[clang] [X86][ByteCode] Allow PSHUFB intrinsics to be used in constexpr #156612 (PR #163148)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 22 06:12:27 PDT 2025


================
@@ -11619,6 +11619,44 @@ static bool evalPackBuiltin(const CallExpr *E, EvalInfo &Info, APValue &Result,
   return true;
 }
 
+static bool evalPshufbBuiltin(EvalInfo &Info, const CallExpr *Call,
+                              APValue &Out) {
+  APValue SrcVec, ControlVec;
+  if (!EvaluateAsRValue(Info, Call->getArg(0), SrcVec))
+    return false;
+  if (!EvaluateAsRValue(Info, Call->getArg(1), ControlVec))
+    return false;
+
+  const auto *VT = Call->getType()->getAs<VectorType>();
+  if (!VT)
+    return false;
+
+  QualType ElemT = VT->getElementType();
+  unsigned NumElts = VT->getNumElements();
----------------
shashank1545 wrote:

The definition in  BuiltnsX86.td will enforce them, so we can remove them from the InterpBuiltin too.

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


More information about the cfe-commits mailing list