Skip to content

Commit 9fce13c

Browse files
AmrDeveloperxlauko
authored andcommitted
[CIR][CIRGen][Builtin][Neon] Lower vrnd64x and vrnd64xq (llvm#1400)
Lower vrnd64x and vrnd64xq
1 parent 89370b7 commit 9fce13c

File tree

2 files changed

+48
-18
lines changed

2 files changed

+48
-18
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,6 +2566,14 @@ mlir::Value CIRGenFunction::emitCommonNeonBuiltinExpr(
25662566
argTypes.push_back(vTy);
25672567
break;
25682568
}
2569+
case NEON::BI__builtin_neon_vrnd64x_f32:
2570+
case NEON::BI__builtin_neon_vrnd64xq_f32:
2571+
case NEON::BI__builtin_neon_vrnd64x_f64:
2572+
case NEON::BI__builtin_neon_vrnd64xq_f64: {
2573+
intrincsName = "aarch64.neon.frint64x";
2574+
argTypes.push_back(vTy);
2575+
break;
2576+
}
25692577
case NEON::BI__builtin_neon_vrnd32z_f32:
25702578
case NEON::BI__builtin_neon_vrnd32zq_f32:
25712579
case NEON::BI__builtin_neon_vrnd32z_f64:
@@ -4141,12 +4149,6 @@ CIRGenFunction::emitAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
41414149
case NEON::BI__builtin_neon_vrndh_f16: {
41424150
llvm_unreachable("NEON::BI__builtin_neon_vrndh_f16 NYI");
41434151
}
4144-
case NEON::BI__builtin_neon_vrnd64x_f32:
4145-
case NEON::BI__builtin_neon_vrnd64xq_f32:
4146-
case NEON::BI__builtin_neon_vrnd64x_f64:
4147-
case NEON::BI__builtin_neon_vrnd64xq_f64: {
4148-
llvm_unreachable("NEON::BI__builtin_neon_vrnd64xq_f64 NYI");
4149-
}
41504152
case NEON::BI__builtin_neon_vrnd64z_f32:
41514153
case NEON::BI__builtin_neon_vrnd64zq_f32:
41524154
case NEON::BI__builtin_neon_vrnd64z_f64:

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

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,30 @@ float32x4_t test_vrnd32zq_f32(float32x4_t a) {
6767
// CHECK-LABEL: test_vrnd64x_f32
6868
// CHECK: [[RND:%.*]] = call <2 x float> @llvm.aarch64.neon.frint64x.v2f32(<2 x float> %a)
6969
// CHECK: ret <2 x float> [[RND]]
70-
// float32x2_t test_vrnd64x_f32(float32x2_t a) {
71-
// return vrnd64x_f32(a);
72-
// }
70+
float32x2_t test_vrnd64x_f32(float32x2_t a) {
71+
return vrnd64x_f32(a);
72+
73+
// CIR-LABEL: vrnd64x_f32
74+
// CIR: [[TMP0:%.*]] = cir.llvm.intrinsic "aarch64.neon.frint64x" {{.*}} : (!cir.vector<!cir.float x 2>) -> !cir.vector<!cir.float x 2>
75+
76+
// LLVM-LABEL: @test_vrnd64x_f32
77+
// LLVM: [[RND:%.*]] = call <2 x float> @llvm.aarch64.neon.frint64x.v2f32(<2 x float> %0)
78+
// LLVM: ret <2 x float> [[RND]]
79+
}
7380

7481
// CHECK-LABEL: test_vrnd64xq_f32
7582
// CHECK: [[RND:%.*]] = call <4 x float> @llvm.aarch64.neon.frint64x.v4f32(<4 x float> %a)
7683
// CHECK: ret <4 x float> [[RND]]
77-
// float32x4_t test_vrnd64xq_f32(float32x4_t a) {
78-
// return vrnd64xq_f32(a);
79-
// }
84+
float32x4_t test_vrnd64xq_f32(float32x4_t a) {
85+
return vrnd64xq_f32(a);
86+
87+
// CIR-LABEL: vrnd64xq_f32
88+
// CIR: [[TMP0:%.*]] = cir.llvm.intrinsic "aarch64.neon.frint64x" {{.*}} : (!cir.vector<!cir.float x 4>) -> !cir.vector<!cir.float x 4>
89+
90+
// LLVM-LABEL: @test_vrnd64xq_f32
91+
// LLVM: [[RND:%.*]] = call <4 x float> @llvm.aarch64.neon.frint64x.v4f32(<4 x float> %0)
92+
// LLVM: ret <4 x float> [[RND]]
93+
}
8094

8195
// CHECK-LABEL: test_vrnd64z_f32
8296
// CHECK: [[RND:%.*]] = call <2 x float> @llvm.aarch64.neon.frint64z.v2f32(<2 x float> %a)
@@ -140,16 +154,30 @@ float64x2_t test_vrnd32zq_f64(float64x2_t a) {
140154
// CHECK-LABEL: test_vrnd64x_f64
141155
// CHECK: [[RND:%.*]] = call <1 x double> @llvm.aarch64.neon.frint64x.v1f64(<1 x double> %a)
142156
// CHECK: ret <1 x double> [[RND]]
143-
// float64x1_t test_vrnd64x_f64(float64x1_t a) {
144-
// return vrnd64x_f64(a);
145-
// }
157+
float64x1_t test_vrnd64x_f64(float64x1_t a) {
158+
return vrnd64x_f64(a);
159+
160+
// CIR-LABEL: vrnd64x_f64
161+
// CIR: [[TMP0:%.*]] = cir.llvm.intrinsic "aarch64.neon.frint64x" {{.*}} : (!cir.vector<!cir.double x 1>) -> !cir.vector<!cir.double x 1>
162+
163+
// LLVM-LABEL: @test_vrnd64x_f64
164+
// LLVM: [[RND:%.*]] = call <1 x double> @llvm.aarch64.neon.frint64x.v1f64(<1 x double> %0)
165+
// LLVM: ret <1 x double> [[RND]]
166+
}
146167

147168
// CHECK-LABEL: test_vrnd64xq_f64
148169
// CHECK: [[RND:%.*]] = call <2 x double> @llvm.aarch64.neon.frint64x.v2f64(<2 x double> %a)
149170
// CHECK: ret <2 x double> [[RND]]
150-
// float64x2_t test_vrnd64xq_f64(float64x2_t a) {
151-
// return vrnd64xq_f64(a);
152-
// }
171+
float64x2_t test_vrnd64xq_f64(float64x2_t a) {
172+
return vrnd64xq_f64(a);
173+
174+
// CIR-LABEL: vrnd64xq_f64
175+
// CIR: [[TMP0:%.*]] = cir.llvm.intrinsic "aarch64.neon.frint64x" {{.*}} : (!cir.vector<!cir.double x 2>) -> !cir.vector<!cir.double x 2>
176+
177+
// LLVM-LABEL: @test_vrnd64xq_f64
178+
// LLVM: [[RND:%.*]] = call <2 x double> @llvm.aarch64.neon.frint64x.v2f64(<2 x double> %0)
179+
// LLVM: ret <2 x double> [[RND]]
180+
}
153181

154182
// CHECK-LABEL: test_vrnd64z_f64
155183
// CHECK: [[RND:%.*]] = call <1 x double> @llvm.aarch64.neon.frint64z.v1f64(<1 x double> %a)

0 commit comments

Comments
 (0)