================
@@ -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();
+
+  for (unsigned ElemNum = 0; ElemNum < VectorLen; ++ElemNum) {
+    INT_TYPE_SWITCH_NO_BOOL(ElemT, {
+      const APSInt &A = LHS.elem<T>(ElemNum).toAPSInt();
+      const APSInt &B = RHS.elem<T>(ElemNum).toAPSInt();
+      bool Result = false;
+      switch (Opcode.getExtValue() & 0x7) {
----------------
tbaederr wrote:

None of the code in the `TYPE_SWITCH` macro expansion depends on `T` except the 
first two lines, so you only need those in the macro.

https://github.com/llvm/llvm-project/pull/164026
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to