Skip to content

[CIR][CIRGen][Builtin][Neon] Lower vqsubd_s64 and vqadds_u32 #1575

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 1 commit into from
Apr 21, 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
6 changes: 4 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2869,7 +2869,8 @@ static mlir::Value emitCommonNeonSISDBuiltinExpr(
case NEON::BI__builtin_neon_vqadds_s32:
return builder.createAdd(ops[0], ops[1], false, false, true);
case NEON::BI__builtin_neon_vqadds_u32:
llvm_unreachable(" neon_vqadds_u32 NYI ");
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.uqadd", resultTy,
loc);
case NEON::BI__builtin_neon_vqdmulhh_s16:
llvm_unreachable(" neon_vqdmulhh_s16 NYI ");
case NEON::BI__builtin_neon_vqdmulhs_s32:
Expand Down Expand Up @@ -3017,7 +3018,8 @@ static mlir::Value emitCommonNeonSISDBuiltinExpr(
case NEON::BI__builtin_neon_vqsubb_u8:
llvm_unreachable(" neon_vqsubb_u8 NYI ");
case NEON::BI__builtin_neon_vqsubd_s64:
llvm_unreachable(" neon_vqsubd_s64 NYI ");
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.sqsub", resultTy,
loc);
case NEON::BI__builtin_neon_vqsubd_u64:
llvm_unreachable(" neon_vqsubd_u64 NYI ");
case NEON::BI__builtin_neon_vqsubh_s16:
Expand Down
34 changes: 22 additions & 12 deletions clang/test/CIR/CodeGen/AArch64/neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -10072,12 +10072,17 @@ int32_t test_vqadds_s32(int32_t a, int32_t b) {
// return vqaddh_u16(a, b);
// }

// NYI-LABEL: @test_vqadds_u32(
// NYI: [[VQADDS_U32_I:%.*]] = call i32 @llvm.aarch64.neon.uqadd.i32(i32 %a, i32 %b)
// NYI: ret i32 [[VQADDS_U32_I]]
// uint32_t test_vqadds_u32(uint32_t a, uint32_t b) {
// return vqadds_u32(a, b);
// }
uint32_t test_vqadds_u32(uint32_t a, uint32_t b) {
return vqadds_u32(a, b);

// CIR: vqadds_u32
// CIR: cir.llvm.intrinsic "aarch64.neon.uqadd" {{%.*}}, {{%.*}} : (!u32i, !u32i) -> !u32i

// LLVM-LABEL: @test_vqadds_u32
// LLVM-SAME: (i32{{.*}}[[a:%.*]], i32{{.*}}[[b:%.*]])
// LLVM: [[VQADDS_U32_I:%.*]] = call i32 @llvm.aarch64.neon.uqadd.i32(i32 [[a]], i32 [[b]])
// LLVM: ret i32 [[VQADDS_U32_I]]
}

// NYI-LABEL: @test_vqaddd_u64(
// NYI: [[VQADDD_U64_I:%.*]] = call i64 @llvm.aarch64.neon.uqadd.i64(i64 %a, i64 %b)
Expand Down Expand Up @@ -10120,12 +10125,17 @@ int32_t test_vqsubs_s32(int32_t a, int32_t b) {
// LLVM: ret i32 [[VQSUBS_S32_I]]
}

// NYI-LABEL: @test_vqsubd_s64(
// NYI: [[VQSUBD_S64_I:%.*]] = call i64 @llvm.aarch64.neon.sqsub.i64(i64 %a, i64 %b)
// NYI: ret i64 [[VQSUBD_S64_I]]
// int64_t test_vqsubd_s64(int64_t a, int64_t b) {
// return vqsubd_s64(a, b);
// }
int64_t test_vqsubd_s64(int64_t a, int64_t b) {
return vqsubd_s64(a, b);

// CIR: vqsubd_s64
// CIR: cir.llvm.intrinsic "aarch64.neon.sqsub" {{%.*}}, {{%.*}} : (!s64i, !s64i) -> !s64i

// LLVM-LABEL: @test_vqsubd_s64
// LLVM-SAME: (i64{{.*}}[[a:%.*]], i64{{.*}}[[b:%.*]])
// LLVM: [[VQSUBD_S64_I:%.*]] = call i64 @llvm.aarch64.neon.sqsub.i64(i64 [[a]], i64 [[b]])
// LLVM: ret i64 [[VQSUBD_S64_I]]
}

// NYI-LABEL: @test_vqsubb_u8(
// NYI: [[TMP0:%.*]] = insertelement <8 x i8> poison, i8 %a, i64 0
Expand Down
Loading