Skip to content

Commit fe8e5c9

Browse files
AmrDeveloperlanza
authored andcommitted
[CIR][CIRGen][Builtin][Neon] Lower vminvq_f32 and vminvq_f64 (llvm#1555)
Lower vminvq_f32 and vminvq_f64
1 parent 9125ffa commit fe8e5c9

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
@@ -18789,12 +18789,17 @@ float64_t test_vmaxvq_f64(float64x2_t a) {
1878918789
// return vminv_f32(a);
1879018790
// }
1879118791

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

1879918804

1880018805
float32_t test_vmaxnmvq_f32(float32x4_t a) {
@@ -19282,6 +19287,18 @@ uint32_t test_vminv_u32(uint32x2_t a) {
1928219287
// LLVM: ret i32 [[VMINV_U32_I]]
1928319288
}
1928419289

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

0 commit comments

Comments
 (0)