Skip to content

Commit 8746bd4

Browse files
authored
[CIR][CIRGen][Builtin][Neon] Lower vrnd64z and vrnd64zq (#1401)
Lower vrnd64z and vrnd64zq
1 parent c35a706 commit 8746bd4

File tree

2 files changed

+48
-12
lines changed

2 files changed

+48
-12
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -2582,6 +2582,14 @@ mlir::Value CIRGenFunction::emitCommonNeonBuiltinExpr(
25822582
argTypes.push_back(vTy);
25832583
break;
25842584
}
2585+
case NEON::BI__builtin_neon_vrnd64z_f32:
2586+
case NEON::BI__builtin_neon_vrnd64zq_f32:
2587+
case NEON::BI__builtin_neon_vrnd64z_f64:
2588+
case NEON::BI__builtin_neon_vrnd64zq_f64: {
2589+
intrincsName = "aarch64.neon.frint64z";
2590+
argTypes.push_back(vTy);
2591+
break;
2592+
}
25852593
case NEON::BI__builtin_neon_vshl_v:
25862594
case NEON::BI__builtin_neon_vshlq_v: {
25872595
return builder.create<cir::ShiftOp>(

clang/test/CIR/CodeGen/AArch64/v8.5a-neon-frint3264-intrinsic.c

+40-12
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,30 @@ float32x4_t test_vrnd64xq_f32(float32x4_t a) {
9595
// CHECK-LABEL: test_vrnd64z_f32
9696
// CHECK: [[RND:%.*]] = call <2 x float> @llvm.aarch64.neon.frint64z.v2f32(<2 x float> %a)
9797
// CHECK: ret <2 x float> [[RND]]
98-
// float32x2_t test_vrnd64z_f32(float32x2_t a) {
99-
// return vrnd64z_f32(a);
100-
// }
98+
float32x2_t test_vrnd64z_f32(float32x2_t a) {
99+
return vrnd64z_f32(a);
100+
101+
// CIR-LABEL: vrnd64z_f32
102+
// CIR: [[TMP0:%.*]] = cir.llvm.intrinsic "aarch64.neon.frint64z" {{.*}} : (!cir.vector<!cir.float x 2>) -> !cir.vector<!cir.float x 2>
103+
104+
// LLVM-LABEL: @test_vrnd64z_f32
105+
// LLVM: [[RND:%.*]] = call <2 x float> @llvm.aarch64.neon.frint64z.v2f32(<2 x float> %0)
106+
// LLVM: ret <2 x float> [[RND]]
107+
}
101108

102109
// CHECK-LABEL: test_vrnd64zq_f32
103110
// CHECK: [[RND:%.*]] = call <4 x float> @llvm.aarch64.neon.frint64z.v4f32(<4 x float> %a)
104111
// CHECK: ret <4 x float> [[RND]]
105-
// float32x4_t test_vrnd64zq_f32(float32x4_t a) {
106-
// return vrnd64zq_f32(a);
107-
// }
112+
float32x4_t test_vrnd64zq_f32(float32x4_t a) {
113+
return vrnd64zq_f32(a);
114+
115+
// CIR-LABEL: vrnd64zq_f32
116+
// CIR: [[TMP0:%.*]] = cir.llvm.intrinsic "aarch64.neon.frint64z" {{.*}} : (!cir.vector<!cir.float x 4>) -> !cir.vector<!cir.float x 4>
117+
118+
// LLVM-LABEL: @test_vrnd64zq_f32
119+
// LLVM: [[RND:%.*]] = call <4 x float> @llvm.aarch64.neon.frint64z.v4f32(<4 x float> %0)
120+
// LLVM: ret <4 x float> [[RND]]
121+
}
108122

109123
float64x1_t test_vrnd32x_f64(float64x1_t a) {
110124
return vrnd32x_f64(a);
@@ -182,13 +196,27 @@ float64x2_t test_vrnd64xq_f64(float64x2_t a) {
182196
// CHECK-LABEL: test_vrnd64z_f64
183197
// CHECK: [[RND:%.*]] = call <1 x double> @llvm.aarch64.neon.frint64z.v1f64(<1 x double> %a)
184198
// CHECK: ret <1 x double> [[RND]]
185-
// float64x1_t test_vrnd64z_f64(float64x1_t a) {
186-
// return vrnd64z_f64(a);
187-
// }
199+
float64x1_t test_vrnd64z_f64(float64x1_t a) {
200+
return vrnd64z_f64(a);
201+
202+
// CIR-LABEL: vrnd64z_f64
203+
// CIR: [[TMP0:%.*]] = cir.llvm.intrinsic "aarch64.neon.frint64z" {{.*}} : (!cir.vector<!cir.double x 1>) -> !cir.vector<!cir.double x 1>
204+
205+
// LLVM-LABEL: @test_vrnd64z_f64
206+
// LLVM: [[RND:%.*]] = call <1 x double> @llvm.aarch64.neon.frint64z.v1f64(<1 x double> %0)
207+
// LLVM: ret <1 x double> [[RND]]
208+
}
188209

189210
// CHECK-LABEL: test_vrnd64zq_f64
190211
// CHECK: [[RND:%.*]] = call <2 x double> @llvm.aarch64.neon.frint64z.v2f64(<2 x double> %a)
191212
// CHECK: ret <2 x double> [[RND]]
192-
// float64x2_t test_vrnd64zq_f64(float64x2_t a) {
193-
// return vrnd64zq_f64(a);
194-
// }
213+
float64x2_t test_vrnd64zq_f64(float64x2_t a) {
214+
return vrnd64zq_f64(a);
215+
216+
// CIR-LABEL: vrnd64zq_f64
217+
// CIR: [[TMP0:%.*]] = cir.llvm.intrinsic "aarch64.neon.frint64z" {{.*}} : (!cir.vector<!cir.double x 2>) -> !cir.vector<!cir.double x 2>
218+
219+
// LLVM-LABEL: @test_vrnd64zq_f64
220+
// LLVM: [[RND:%.*]] = call <2 x double> @llvm.aarch64.neon.frint64z.v2f64(<2 x double> %0)
221+
// LLVM: ret <2 x double> [[RND]]
222+
}

0 commit comments

Comments
 (0)