diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp index 01269b92a45d..80a97df52873 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp @@ -2630,6 +2630,7 @@ static mlir::Value emitCommonNeonSISDBuiltinExpr( unsigned builtinID = info.BuiltinID; clang::CIRGen::CIRGenBuilderTy &builder = cgf.getBuilder(); mlir::Type resultTy = cgf.convertType(expr->getType()); + mlir::Type argTy = cgf.convertType(expr->getArg(0)->getType()); mlir::Location loc = cgf.getLoc(expr->getExprLoc()); switch (builtinID) { @@ -2648,11 +2649,9 @@ 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: { - mlir::Type argTy = cgf.convertType(expr->getArg(0)->getType()); + case NEON::BI__builtin_neon_vaddlvq_u32: 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: @@ -2668,9 +2667,9 @@ static mlir::Value emitCommonNeonSISDBuiltinExpr( case NEON::BI__builtin_neon_vaddvq_s64: llvm_unreachable(" neon_vaddvq_s64 NYI "); case NEON::BI__builtin_neon_vaddvq_u32: - llvm_unreachable(" neon_vaddvq_u32 NYI "); case NEON::BI__builtin_neon_vaddvq_u64: - llvm_unreachable(" neon_vaddvq_u64 NYI "); + return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.uaddv", resultTy, + loc); case NEON::BI__builtin_neon_vcaged_f64: llvm_unreachable(" neon_vcaged_f64 NYI "); case NEON::BI__builtin_neon_vcages_f32: diff --git a/clang/test/CIR/CodeGen/AArch64/neon-arith.c b/clang/test/CIR/CodeGen/AArch64/neon-arith.c index f44a4bb9e465..1ad9bb369c5d 100644 --- a/clang/test/CIR/CodeGen/AArch64/neon-arith.c +++ b/clang/test/CIR/CodeGen/AArch64/neon-arith.c @@ -919,3 +919,25 @@ int16_t test_vaddv_s16(int16x4_t a) { // LLVM-NEXT: [[TMP0:%.*]] = trunc i32 [[VADDV_I]] to i16 // LLVM-NEXT: ret i16 [[TMP0]] } + +uint32_t test_vaddvq_u32(uint32x4_t a) { + return vaddvq_u32(a); + + // CIR-LABEL: vaddvq_u32 + // CIR: cir.llvm.intrinsic "aarch64.neon.uaddv" {{%.*}} : (!cir.vector) -> !u32i + + // LLVM-LABEL: test_vaddvq_u32 + // LLVM: [[VADDVQ_U32_I:%.*]] = call i32 @llvm.aarch64.neon.uaddv.i32.v4i32(<4 x i32> {{%.*}}) + // LLVM: ret i32 [[VADDVQ_U32_I]] +} + +uint64_t test_vaddvq_u64(uint64x2_t a) { + return vaddvq_u64(a); + + // CIR-LABEL: vaddvq_u64 + // CIR: cir.llvm.intrinsic "aarch64.neon.uaddv" {{%.*}} : (!cir.vector) -> !u64i + + // LLVM-LABEL: test_vaddvq_u64 + // LLVM: [[VADDVQ_U64_I:%.*]] = call i64 @llvm.aarch64.neon.uaddv.i64.v2i64(<2 x i64> {{%.*}}) + // LLVM: ret i64 [[VADDVQ_U64_I]] +}