================
@@ -2820,6 +2820,65 @@ static bool interp__builtin_ia32_pmul(
   return true;
 }
 
+static bool interp__builtin_ia32_dbpsadbw(InterpState &S, CodePtr OpPC,
+                                          const CallExpr *Call) {
+  assert(Call->getNumArgs() == 3);
+  QualType Arg2Type = Call->getArg(2)->getType();
+  APSInt ImmVal = popToAPSInt(S, Arg2Type);
+  unsigned Imm = ImmVal.getZExtValue();
+
+  const Pointer &Src2 = S.Stk.pop<Pointer>();
+  const Pointer &Src1 = S.Stk.pop<Pointer>();
+  const Pointer &Dst = S.Stk.peek<Pointer>();
+
+  const auto *SrcVT = Call->getArg(0)->getType()->castAs<VectorType>();
+  PrimType SrcElemT = *S.getContext().classify(SrcVT->getElementType());
+  unsigned SourceLen = SrcVT->getNumElements();
+
+  const auto *DestVT = Call->getType()->castAs<VectorType>();
+  PrimType DestElemT = *S.getContext().classify(DestVT->getElementType());
+  bool DestUnsigned = Call->getType()->isUnsignedIntegerOrEnumerationType();
+
+  unsigned LaneSize = 16; // 128-bit lane = 16 bytes
+  unsigned NumLanes = SourceLen / LaneSize;
+  unsigned BlockOffsetA = (Imm & 0x3) * 4;
+  unsigned BlockOffsetB = ((Imm >> 2) & 0x3) * 4;
+
+  unsigned DstIdx = 0;
+  for (unsigned Lane = 0; Lane < NumLanes; ++Lane) {
----------------
tbaederr wrote:

```suggestion
  for (unsigned Lane = 0; Lane != NumLanes; ++Lane) {
```

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

Reply via email to