Skip to content

Commit 8715197

Browse files
AmrDeveloperlanza
authored andcommitted
[CIR][CIRGen][Builtin][Neon] Lower vmaxv_s32 (llvm#1533)
Lower vmaxv_s32
1 parent 5dad579 commit 8715197

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2786,7 +2786,8 @@ static mlir::Value emitCommonNeonSISDBuiltinExpr(
27862786
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.fmaxv", resultTy,
27872787
loc);
27882788
case NEON::BI__builtin_neon_vmaxv_s32:
2789-
llvm_unreachable(" neon_vmaxv_s32 NYI ");
2789+
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.smaxv", resultTy,
2790+
loc);
27902791
case NEON::BI__builtin_neon_vmaxv_u32:
27912792
llvm_unreachable(" neon_vmaxv_u32 NYI ");
27922793
case NEON::BI__builtin_neon_vmaxvq_f32:

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19222,12 +19222,17 @@ float64x1_t test_vmax_f64(float64x1_t a, float64x1_t b) {
1922219222
// return vminv_u32(a);
1922319223
// }
1922419224

19225-
// NYI-LABEL: @test_vmaxv_s32(
19226-
// NYI: [[VMAXV_S32_I:%.*]] = call i32 @llvm.aarch64.neon.smaxv.i32.v2i32(<2 x i32> %a)
19227-
// NYI: ret i32 [[VMAXV_S32_I]]
19228-
// int32_t test_vmaxv_s32(int32x2_t a) {
19229-
// return vmaxv_s32(a);
19230-
// }
19225+
int32_t test_vmaxv_s32(int32x2_t a) {
19226+
return vmaxv_s32(a);
19227+
19228+
// CIR-LABEL: vmaxv_s32
19229+
// CIR: cir.llvm.intrinsic "aarch64.neon.smaxv" {{%.*}} : (!cir.vector<!s32i x 2>) -> !s32i
19230+
19231+
// LLVM-LABEL: @test_vmaxv_s32
19232+
// LLVM-SAME: (<2 x i32> [[a:%.*]])
19233+
// LLVM: [[VMAXV_S32_I:%.*]] = call i32 @llvm.aarch64.neon.smaxv.i32.v2i32(<2 x i32> [[a]])
19234+
// LLVM: ret i32 [[VMAXV_S32_I]]
19235+
}
1923119236

1923219237
// NYI-LABEL: @test_vmaxv_u32(
1923319238
// NYI: [[VMAXV_U32_I:%.*]] = call i32 @llvm.aarch64.neon.umaxv.i32.v2i32(<2 x i32> %a)

0 commit comments

Comments
 (0)