[clang] [Headers][X86] Allow MMX/SSE/AVX MOVMSK intrinsics to be used in constexpr (PR #161914)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 6 14:26:41 PDT 2025


================
@@ -2817,6 +2817,46 @@ static bool interp__builtin_ia32_pshuf(InterpState &S, CodePtr OpPC,
   return true;
 }
 
+static bool interp__builtin_ia32_movmsk_op(InterpState &S, CodePtr OpPC,
+                                           const CallExpr *Call) {
+  assert(Call->getNumArgs() == 1);
+
+  const Pointer &Source = S.Stk.pop<Pointer>();
+
+  unsigned SourceLen = Source.getNumElems();
+  const QualType ElemQT = getElemType(Source);
+  const OptPrimType ElemPT = S.getContext().classify(ElemQT);
+  unsigned LaneWidth = S.getASTContext().getTypeSize(ElemQT);
+
+  if (ElemQT->isIntegerType()) {
+    unsigned Byte = 8;
----------------
shafik wrote:

`8` is a magic number and the use of `Byte` is ambiguous, it was not obvious to me and I had to look at more code to make sure I understood the use. I was going to suggest an alternative name but they realized we have a way of getting this number.

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


More information about the cfe-commits mailing list