Skip to content

Commit 94ab11d

Browse files
AmrDeveloperlanza
authored andcommitted
[CIR][CIRGen][Builtin][Neon] Lower builtin_neon_vqshlud_n_s64 (llvm#1384)
Lower builtin_neon_vqshlud_n_s64
1 parent ae29d1c commit 94ab11d

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
@@ -15681,12 +15681,16 @@ uint64_t test_vqshld_n_u64(uint64_t a) {
1568115681
// return (int32_t)vqshlus_n_s32(a, 31);
1568215682
// }
1568315683

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

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

0 commit comments

Comments
 (0)