================
@@ -2745,6 +2745,73 @@ static bool interp__builtin_ia32_addsub(InterpState &S, 
CodePtr OpPC,
   return true;
 }
 
+static bool interp__builtin_ia32_pclmulqdq(InterpState &S, CodePtr OpPC,
+                                           const CallExpr *Call) {
+  // PCLMULQDQ: carry-less multiplication of selected 64-bit halves
+  // imm8 bit 0: selects lower (0) or upper (1) 64 bits of first operand
+  // imm8 bit 4: selects lower (0) or upper (1) 64 bits of second operand
+  assert(Call->getArg(0)->getType()->isVectorType() &&
+         Call->getArg(1)->getType()->isVectorType());
+
+  // Extract imm8 argument
+  APSInt Imm8 = popToAPSInt(S, Call->getArg(2));
+  unsigned Imm8Val = static_cast<unsigned>(Imm8.getZExtValue());
+  bool SelectUpperA = (Imm8Val & 0x01) != 0;
+  bool SelectUpperB = (Imm8Val & 0x10) != 0;
----------------
RKSimon wrote:

Do we need Imm8Val? Doesn't `(Imm8 & 0x01) != 0` work?

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

Reply via email to