Skip to content

Commit e5c6935

Browse files
authored
[CIR][CIRGen][Builtin][Neon] Lower vminvq_f32 and vminvq_f64 (#1555)
Lower vminvq_f32 and vminvq_f64
1 parent 24ab10f commit e5c6935

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,9 +2813,9 @@ static mlir::Value emitCommonNeonSISDBuiltinExpr(
28132813
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.uminv", resultTy,
28142814
loc);
28152815
case NEON::BI__builtin_neon_vminvq_f32:
2816-
llvm_unreachable(" neon_vminvq_f32 NYI ");
28172816
case NEON::BI__builtin_neon_vminvq_f64:
2818-
llvm_unreachable(" neon_vminvq_f64 NYI ");
2817+
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.fminv", resultTy,
2818+
loc);
28192819
case NEON::BI__builtin_neon_vminvq_s32:
28202820
llvm_unreachable(" neon_vminvq_s32 NYI ");
28212821
case NEON::BI__builtin_neon_vminvq_u32:

clang/test/CIR/CodeGen/AArch64/neon.c

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18788,12 +18788,17 @@ float64_t test_vmaxvq_f64(float64x2_t a) {
1878818788
// return vminv_f32(a);
1878918789
// }
1879018790

18791-
// NYI-LABEL: @test_vminvq_f64(
18792-
// NYI: [[VMINVQ_F64_I:%.*]] = call double @llvm.aarch64.neon.fminv.f64.v2f64(<2 x double> %a)
18793-
// NYI: ret double [[VMINVQ_F64_I]]
18794-
// float64_t test_vminvq_f64(float64x2_t a) {
18795-
// return vminvq_f64(a);
18796-
// }
18791+
float64_t test_vminvq_f64(float64x2_t a) {
18792+
return vminvq_f64(a);
18793+
18794+
// CIR-LABEL: vminvq_f64
18795+
// CIR: cir.llvm.intrinsic "aarch64.neon.fminv" {{%.*}} : (!cir.vector<!cir.double x 2>) -> !cir.double
18796+
18797+
// LLVM-LABEL: @test_vminvq_f64
18798+
// LLVM-SAME: (<2 x double> [[a:%.*]])
18799+
// LLVM: [[VMINVQ_F64_I:%.*]] = call double @llvm.aarch64.neon.fminv.f64.v2f64(<2 x double> [[a]])
18800+
// LLVM: ret double [[VMINVQ_F64_I]]
18801+
}
1879718802

1879818803

1879918804
float32_t test_vmaxnmvq_f32(float32x4_t a) {
@@ -19281,6 +19286,18 @@ uint32_t test_vminv_u32(uint32x2_t a) {
1928119286
// LLVM: ret i32 [[VMINV_U32_I]]
1928219287
}
1928319288

19289+
float32_t test_vminvq_f32(float32x4_t a) {
19290+
return vminvq_f32(a);
19291+
19292+
// CIR-LABEL: vminvq_f32
19293+
// CIR: cir.llvm.intrinsic "aarch64.neon.fminv" {{%.*}} : (!cir.vector<!cir.float x 4>) -> !cir.float
19294+
19295+
// LLVM-LABEL: @test_vminvq_f32
19296+
// LLVM-SAME: (<4 x float> [[a:%.*]])
19297+
// LLVM: [[VMINVQ_F32_I:%.*]] = call float @llvm.aarch64.neon.fminv.f32.v4f32(<4 x float> [[a]])
19298+
// LLVM: ret float [[VMINVQ_F32_I]]
19299+
}
19300+
1928419301
int32_t test_vmaxv_s32(int32x2_t a) {
1928519302
return vmaxv_s32(a);
1928619303

0 commit comments

Comments
 (0)