Skip to content
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

[CIR][CIRGen][Builtin][Neon] Lower neon_vaddvq_u32 and neon_vaddvq_u64 #1225

Merged
merged 1 commit into from
Dec 12, 2024
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
9 changes: 4 additions & 5 deletions clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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:
Expand All @@ -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:
Expand Down
22 changes: 22 additions & 0 deletions clang/test/CIR/CodeGen/AArch64/neon-arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 x 4>) -> !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 x 2>) -> !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]]
}
Loading