[clang] [Headers][X86] Allow SLLDQ/SRLDQ byte shift intrinsics to be used in constexpr (PR #164166)

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 22 03:54:46 PDT 2025


================
@@ -3128,6 +3128,38 @@ static bool interp__builtin_ia32_vpconflict(InterpState &S, CodePtr OpPC,
   return true;
 }
 
+static bool interp__builtin_x86_byteshift(
+    InterpState &S, CodePtr OpPC, const CallExpr *Call, unsigned ID,
+    llvm::function_ref<APInt(const Pointer &, PrimType ElemT, unsigned Lane,
+                             unsigned I, unsigned Shift)>
+        Fn) {
+  assert(Call->getNumArgs() == 2);
+
+  APSInt ImmAPS = popToAPSInt(S, Call->getArg(1));
+  uint64_t Shift = ImmAPS.getZExtValue();
----------------
RKSimon wrote:

Consult EmitX86BuiltinExpr - we only the bottom imm8
```suggestion
  uint64_t Shift = ImmAPS.getZExtValue() & 0xff;
```

https://github.com/llvm/llvm-project/pull/164166


More information about the cfe-commits mailing list