[clang] [X86][Clang] Add AVX512 Integer Comparison Intrinsics for constexpr Evaluation (PR #164026)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 17 21:09:46 PDT 2025


================
@@ -3101,6 +3101,62 @@ static bool interp__builtin_vec_set(InterpState &S, CodePtr OpPC,
   return true;
 }
 
+static bool interp__builtin_cmp_mask(InterpState &S, CodePtr OpPC,
+                                     const CallExpr *Call, unsigned ID,
+                                     bool IsUnsigned) {
+  assert(Call->getNumArgs() == 4);
+
+  APSInt Mask = popToAPSInt(S, Call->getArg(3));
+  APSInt Opcode = popToAPSInt(S, Call->getArg(2));
+  const Pointer &RHS = S.Stk.pop<Pointer>();
+  const Pointer &LHS = S.Stk.pop<Pointer>();
+
+  assert(LHS.getNumElems() == RHS.getNumElems());
+
+  APInt RetMask = APInt::getZero(LHS.getNumElems());
+  unsigned VectorLen = LHS.getNumElems();
+  PrimType ElemT = LHS.getFieldDesc()->getPrimType();
+
+  INT_TYPE_SWITCH_NO_BOOL(ElemT, {
+    for (unsigned ElemNum = 0; ElemNum < VectorLen; ++ElemNum) {
+      APSInt A = LHS.elem<T>(ElemNum).toAPSInt();
+      APSInt B = RHS.elem<T>(ElemNum).toAPSInt();
+      bool result = false;
----------------
tbaederr wrote:

Capitalization

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


More information about the cfe-commits mailing list