[clang] [clang][x86][bytecode] Replace interp__builtin_rotate with static bool interp__builtin_elementwise_int_binop callback #160289 (PR #161924)
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 5 02:41:09 PDT 2025
================
@@ -3162,7 +3143,10 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
case Builtin::BI_rotl:
case Builtin::BI_lrotl:
case Builtin::BI_rotl64:
- return interp__builtin_rotate(S, OpPC, Frame, Call, /*Right=*/false);
+ return interp__builtin_elementwise_int_binop(
+ S, OpPC, Call, [](const APSInt &A, const APSInt &B) -> APInt {
+ return A.rotl(B.urem(A.getBitWidth()));
----------------
RKSimon wrote:
The urem is unnecessary - APInt::rotl//r will handle this for us - see BI__builtin_ia32_vprotbi etc. cases - they do something similar.
https://github.com/llvm/llvm-project/pull/161924
More information about the cfe-commits
mailing list