[clang] [Headers][X86] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow PALIGNR byte shift intrinsics to be used in constexpr (PR #162005)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 5 10:36:34 PDT 2025


================
@@ -2975,6 +2975,75 @@ static bool interp__builtin_vec_set(InterpState &S, CodePtr OpPC,
   return true;
 }
 
+static bool interp__builtin_x86_psrldq_byteshift(InterpState &S, CodePtr OpPC,
+                                                 const CallExpr *Call,
+                                                 unsigned ID) {
+  assert(Call->getNumArgs() == 2);
+
+  APSInt ImmAPS = popToAPSInt(S, Call->getArg(1));
+  uint64_t Shift = ImmAPS.getZExtValue();
+
+  const Pointer &Concat = S.Stk.pop<Pointer>();
+  if (!Concat.getFieldDesc()->isPrimitiveArray())
+    return false;
+
+  unsigned NumElems = Concat.getNumElems();
+  const Pointer &Dst = S.Stk.peek<Pointer>();
+  PrimType ElemPT = Concat.getFieldDesc()->getPrimType();
----------------
tbaederr wrote:

```suggestion
  PrimType ElemT = Concat.getFieldDesc()->getPrimType();
```

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


More information about the cfe-commits mailing list