Skip to content

Commit 4669855

Browse files
AmrDeveloperlanza
authored andcommitted
[CIR][CIRGen][Builtin][Neon] Lower builtin_neon_vqshlud_n_s64 (#1384)
Lower builtin_neon_vqshlud_n_s64
1 parent f35546e commit 4669855

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3828,7 +3828,15 @@ CIRGenFunction::emitAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
38283828
llvm_unreachable("NEON::BI__builtin_neon_vqdmlslh_s16 NYI");
38293829
}
38303830
case NEON::BI__builtin_neon_vqshlud_n_s64: {
3831-
llvm_unreachable("NEON::BI__builtin_neon_vqshlud_n_s64 NYI");
3831+
const cir::IntType IntType = builder.getSInt64Ty();
3832+
Ops.push_back(emitScalarExpr(E->getArg(1)));
3833+
std::optional<llvm::APSInt> APSInt =
3834+
E->getArg(1)->getIntegerConstantExpr(getContext());
3835+
assert(APSInt && "Expected argument to be a constant");
3836+
Ops[1] = builder.getSInt64(APSInt->getZExtValue(), getLoc(E->getExprLoc()));
3837+
const StringRef Intrinsic = "aarch64.neon.sqshlu";
3838+
return emitNeonCall(builder, {IntType, IntType}, Ops, Intrinsic, IntType,
3839+
getLoc(E->getExprLoc()));
38323840
}
38333841
case NEON::BI__builtin_neon_vqshld_n_u64:
38343842
case NEON::BI__builtin_neon_vqshld_n_s64: {

clang/test/CIR/CodeGen/AArch64/neon.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15680,12 +15680,16 @@ uint64_t test_vqshld_n_u64(uint64_t a) {
1568015680
// return (int32_t)vqshlus_n_s32(a, 31);
1568115681
// }
1568215682

15683-
// NYI-LABEL: @test_vqshlud_n_s64(
15684-
// NYI: [[VQSHLU_N:%.*]] = call i64 @llvm.aarch64.neon.sqshlu.i64(i64 %a, i64 63)
15685-
// NYI: ret i64 [[VQSHLU_N]]
15686-
// int64_t test_vqshlud_n_s64(int64_t a) {
15687-
// return (int64_t)vqshlud_n_s64(a, 63);
15688-
// }
15683+
int64_t test_vqshlud_n_s64(int64_t a) {
15684+
return (int64_t)vqshlud_n_s64(a, 63);
15685+
15686+
// CIR-LABEL: vqshlud_n_s64
15687+
// CIR: [[TMP0:%.*]] = cir.llvm.intrinsic "aarch64.neon.sqshlu" {{.*}}, {{.*}} : (!s64i, !s64i) -> !s64i
15688+
15689+
// LLVM-LABEL: @test_vqshlud_n_s64(
15690+
// LLVM: [[VQSHLU_N:%.*]] = call i64 @llvm.aarch64.neon.sqshlu.i64(i64 %0, i64 63)
15691+
// LLVM: ret i64 [[VQSHLU_N]]
15692+
}
1568915693

1569015694
// NYI-LABEL: @test_vqshlu_n_s64(
1569115695
// NYI: [[TMP0:%.*]] = bitcast <1 x i64> %a to <8 x i8>

0 commit comments

Comments
 (0)