Skip to content

Commit

Permalink
[CIR][CIRGen][Builtin][Neon] Lower builtin_neon_vqshlud_n_s64
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrDeveloper committed Feb 22, 2025
1 parent c301b4a commit 6fd5a6e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
10 changes: 9 additions & 1 deletion clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3828,7 +3828,15 @@ CIRGenFunction::emitAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
llvm_unreachable("NEON::BI__builtin_neon_vqdmlslh_s16 NYI");
}
case NEON::BI__builtin_neon_vqshlud_n_s64: {
llvm_unreachable("NEON::BI__builtin_neon_vqshlud_n_s64 NYI");
const cir::IntType IntType = builder.getSInt64Ty();
Ops.push_back(emitScalarExpr(E->getArg(1)));
std::optional<llvm::APSInt> APSInt =
E->getArg(1)->getIntegerConstantExpr(getContext());
assert(APSInt && "Expected argument to be a constant");
Ops[1] = builder.getSInt64(APSInt->getZExtValue(), getLoc(E->getExprLoc()));
const StringRef Intrinsic = "aarch64.neon.sqshlu";
return emitNeonCall(builder, {IntType, IntType}, Ops, Intrinsic, IntType,
getLoc(E->getExprLoc()));
}
case NEON::BI__builtin_neon_vqshld_n_u64:
case NEON::BI__builtin_neon_vqshld_n_s64: {
Expand Down
16 changes: 10 additions & 6 deletions clang/test/CIR/CodeGen/AArch64/neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -15680,12 +15680,16 @@ uint64_t test_vqshld_n_u64(uint64_t a) {
// return (int32_t)vqshlus_n_s32(a, 31);
// }

// NYI-LABEL: @test_vqshlud_n_s64(
// NYI: [[VQSHLU_N:%.*]] = call i64 @llvm.aarch64.neon.sqshlu.i64(i64 %a, i64 63)
// NYI: ret i64 [[VQSHLU_N]]
// int64_t test_vqshlud_n_s64(int64_t a) {
// return (int64_t)vqshlud_n_s64(a, 63);
// }
int64_t test_vqshlud_n_s64(int64_t a) {
return (int64_t)vqshlud_n_s64(a, 63);

// CIR-LABEL: vqshlud_n_s64
// CIR: [[TMP0:%.*]] = cir.llvm.intrinsic "aarch64.neon.sqshlu" {{.*}}, {{.*}} : (!s64i, !s64i) -> !s64i

// LLVM-LABEL: @test_vqshlud_n_s64(
// LLVM: [[VQSHLU_N:%.*]] = call i64 @llvm.aarch64.neon.sqshlu.i64(i64 %0, i64 63)
// LLVM: ret i64 [[VQSHLU_N]]
}

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

0 comments on commit 6fd5a6e

Please sign in to comment.