Skip to content

[CIR][CIRGen][Builtin][Neon] Lower vminnmv_f32, vminnmvq_f64 and vminnmvq_f32 #1546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2800,11 +2800,10 @@ static mlir::Value emitCommonNeonSISDBuiltinExpr(
case NEON::BI__builtin_neon_vmaxvq_u32:
llvm_unreachable(" neon_vmaxvq_u32 NYI ");
case NEON::BI__builtin_neon_vminnmv_f32:
llvm_unreachable(" neon_vminnmv_f32 NYI ");
case NEON::BI__builtin_neon_vminnmvq_f32:
llvm_unreachable(" neon_vminnmvq_f32 NYI ");
case NEON::BI__builtin_neon_vminnmvq_f64:
llvm_unreachable(" neon_vminnmvq_f64 NYI ");
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.fminnmv", resultTy,
loc);
case NEON::BI__builtin_neon_vminv_f32:
llvm_unreachable(" neon_vminv_f32 NYI ");
case NEON::BI__builtin_neon_vminv_s32:
Expand Down
46 changes: 34 additions & 12 deletions clang/test/CIR/CodeGen/AArch64/neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -18832,19 +18832,41 @@ float32_t test_vmaxnmv_f32(float32x2_t a) {
// LLVM: ret float [[VMAXNMV_F32_I]]
}

// NYI-LABEL: @test_vminnmvq_f64(
// NYI: [[VMINNMVQ_F64_I:%.*]] = call double @llvm.aarch64.neon.fminnmv.f64.v2f64(<2 x double> %a)
// NYI: ret double [[VMINNMVQ_F64_I]]
// float64_t test_vminnmvq_f64(float64x2_t a) {
// return vminnmvq_f64(a);
// }
float64_t test_vminnmvq_f64(float64x2_t a) {
return vminnmvq_f64(a);

// NYI-LABEL: @test_vminnmv_f32(
// NYI: [[VMINNMV_F32_I:%.*]] = call float @llvm.aarch64.neon.fminnmv.f32.v2f32(<2 x float> %a)
// NYI: ret float [[VMINNMV_F32_I]]
// float32_t test_vminnmv_f32(float32x2_t a) {
// return vminnmv_f32(a);
// }
// CIR-LABEL: vminnmvq_f64
// CIR: cir.llvm.intrinsic "aarch64.neon.fminnmv" {{%.*}} : (!cir.vector<!cir.double x 2>) -> !cir.double

// LLVM-LABEL: @test_vminnmvq_f64
// LLVM-SAME: (<2 x double> [[a:%.*]])
// LLVM: [[VMINNMVQ_F64_I:%.*]] = call double @llvm.aarch64.neon.fminnmv.f64.v2f64(<2 x double> [[a]])
// LLVM: ret double [[VMINNMVQ_F64_I]]
}

float32_t test_vminnmvq_f32(float32x4_t a) {
return vminnmvq_f32(a);

// CIR-LABEL: vminnmvq_f32
// CIR: cir.llvm.intrinsic "aarch64.neon.fminnmv" {{%.*}} : (!cir.vector<!cir.float x 4>) -> !cir.float

// LLVM-LABEL: @test_vminnmvq_f32
// LLVM-SAME: (<4 x float> [[a:%.*]])
// LLVM: [[VMINNMVQ_F32_I:%.*]] = call float @llvm.aarch64.neon.fminnmv.f32.v4f32(<4 x float> [[a]])
// LLVM: ret float [[VMINNMVQ_F32_I]]
}

float32_t test_vminnmv_f32(float32x2_t a) {
return vminnmv_f32(a);

// CIR-LABEL: vminnmv_f32
// CIR: cir.llvm.intrinsic "aarch64.neon.fminnmv" {{%.*}} : (!cir.vector<!cir.float x 2>) -> !cir.float

// LLVM-LABEL: @test_vminnmv_f32
// LLVM-SAME: (<2 x float> [[a:%.*]])
// LLVM: [[VMINNMV_F32_I:%.*]] = call float @llvm.aarch64.neon.fminnmv.f32.v2f32(<2 x float> [[a]])
// LLVM: ret float [[VMINNMV_F32_I]]
}

// NYI-LABEL: @test_vpaddq_s64(
// NYI: [[VPADDQ_V2_I:%.*]] = call <2 x i64> @llvm.aarch64.neon.addp.v2i64(<2 x i64> %a, <2 x i64> %b)
Expand Down
Loading