[clang] [Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - Allow AVX512 VPMULTISHIFTQB intrinsics to be used in constexpr (PR #168995)

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 26 07:16:05 PST 2025


================
@@ -3531,6 +3531,65 @@ static bool interp__builtin_ia32_shufbitqmb_mask(InterpState &S, CodePtr OpPC,
   return true;
 }
 
+static bool interp__builtin_ia32_multishiftqb(InterpState &S, CodePtr OpPC,
+                                              const CallExpr *Call) {
+  assert(Call->getNumArgs() == 2);
+
+  QualType ATy = Call->getArg(0)->getType();
+  QualType BTy = Call->getArg(1)->getType();
+  if (!ATy->isVectorType() || !BTy->isVectorType()) {
+    return false;
+  }
+
+  const Pointer &BPtr = S.Stk.pop<Pointer>();
+  const Pointer &APtr = S.Stk.pop<Pointer>();
+  const auto *AVecT = ATy->castAs<VectorType>();
+  const auto *BVecT = BTy->castAs<VectorType>();
+  assert(AVecT->getNumElements() == BVecT->getNumElements());
----------------
RKSimon wrote:

Stop unused variable warnings on non-assert builds:
```suggestion
  assert(AVecT->getNumElements() == BTy->castAs<VectorType>()->getNumElements());
```

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


More information about the cfe-commits mailing list