[clang] [clang][x86][bytecode] Replace interp__builtin_rotate with static bool interp__builtin_elementwise_int_binop callback #160289 (PR #161924)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 3 22:17:36 PDT 2025
================
@@ -56,6 +56,20 @@ static APSInt popToAPSInt(InterpState &S, QualType T) {
return popToAPSInt(S.Stk, *S.getContext().classify(T));
}
+static APInt ROTL_fn(const APSInt &A, const APSInt &B) {
+ const APInt &X = static_cast<const APInt &>(A);
+ const unsigned BW = X.getBitWidth();
+ const uint64_t Amt = B.getZExtValue();
+ return X.rotl(static_cast<unsigned>(Amt % BW));
+}
+
+static APInt ROTR_fn(const APSInt &A, const APSInt &B) {
+ const APInt &X = static_cast<const APInt &>(A);
+ const unsigned BW = X.getBitWidth();
+ const uint64_t Amt = B.getZExtValue();
+ return X.rotr(static_cast<unsigned>(Amt % BW));
+}
+
----------------
tbaederr wrote:
Why these separate functions? Everything else uses lambdas in `InterpretBuiltin`.
https://github.com/llvm/llvm-project/pull/161924
More information about the cfe-commits
mailing list