From fe276cf7437662b5f633ba9a3fd8e71d1431e92a Mon Sep 17 00:00:00 2001 From: Guojin He Date: Wed, 4 Dec 2024 13:58:57 -0500 Subject: [PATCH] [CIR][CIRGen][Builtin][Neon] Lower neon_vaddlvq_u32 --- clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp | 7 +++++-- clang/test/CIR/CodeGen/AArch64/neon-misc.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp index 4d80a6163aa7..9e5295e8163f 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp @@ -2635,8 +2635,11 @@ static mlir::Value emitCommonNeonSISDBuiltinExpr( llvm_unreachable(" neon_vaddlv_u32 NYI "); case NEON::BI__builtin_neon_vaddlvq_s32: llvm_unreachable(" neon_vaddlvq_s32 NYI "); - case NEON::BI__builtin_neon_vaddlvq_u32: - llvm_unreachable(" neon_vaddlvq_u32 NYI "); + case NEON::BI__builtin_neon_vaddlvq_u32: { + mlir::Type argTy = cgf.convertType(expr->getArg(0)->getType()); + return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.uaddlv", resultTy, + loc); + } case NEON::BI__builtin_neon_vaddv_f32: llvm_unreachable(" neon_vaddv_f32 NYI "); case NEON::BI__builtin_neon_vaddv_s32: diff --git a/clang/test/CIR/CodeGen/AArch64/neon-misc.c b/clang/test/CIR/CodeGen/AArch64/neon-misc.c index a2d5fdcb8383..c0935a81b835 100644 --- a/clang/test/CIR/CodeGen/AArch64/neon-misc.c +++ b/clang/test/CIR/CodeGen/AArch64/neon-misc.c @@ -1716,3 +1716,14 @@ uint64x2_t test_vpadalq_u32(uint64x2_t a, uint32x4_t b) { // LLVM: [[TMP2:%.*]] = add <2 x i64> [[VPADAL1_I]], [[a]] // LLVM: ret <2 x i64> [[TMP2]] } + +uint64_t test_vaddlvq_u32(uint32x4_t a) { + return vaddlvq_u32(a); + + // CIR-LABEL: vaddlvq_u32 + // CIR: = cir.llvm.intrinsic "aarch64.neon.uaddlv" {{%.*}} : (!cir.vector) -> !u64i + + // LLVM: {{.*}}@test_vaddlvq_u32(<4 x i32>{{.*}}[[A:%.*]]) + // LLVM-NEXT: [[VADDLVQ_U32_I:%.*]] = call i64 @llvm.aarch64.neon.uaddlv.i64.v4i32(<4 x i32> [[A]]) + // LLVM-NEXT: ret i64 [[VADDLVQ_U32_I]] +}