================ @@ -2903,6 +2903,55 @@ static bool interp__builtin_elementwise_triop( return true; } +static bool interp__builtin_pternlog(InterpState &S, CodePtr OpPC, + const CallExpr *Call, bool MaskZ) { + assert(Call->getNumArgs() == 5); + + const VectorType *VecT = Call->getArg(0)->getType()->castAs<VectorType>(); + unsigned DstLen = VecT->getNumElements(); + PrimType DstElemT = *S.getContext().classify(VecT->getElementType()); + + APSInt U = popToAPSInt(S.Stk, *S.getContext().classify(Call->getArg(4))); + APSInt Imm = popToAPSInt(S.Stk, *S.getContext().classify(Call->getArg(3))); + const Pointer &C = S.Stk.pop<Pointer>(); + const Pointer &B = S.Stk.pop<Pointer>(); + const Pointer &A = S.Stk.pop<Pointer>(); + + const Pointer &Dst = S.Stk.peek<Pointer>(); + + for (unsigned I = 0; I < DstLen; ++I) { + APSInt a, b, c; + INT_TYPE_SWITCH(DstElemT, { + a = A.elem<T>(I).toAPSInt(); + b = B.elem<T>(I).toAPSInt(); + c = C.elem<T>(I).toAPSInt(); + }); + + unsigned BitWidth = a.getBitWidth(); + APInt R(BitWidth, 0); + bool DstUnsigned = a.isUnsigned(); + + if (U[I]) { + for (unsigned Bit = 0; Bit < BitWidth; ++Bit) { ---------------- tbaederr wrote:
```suggestion for (unsigned Bit = 0; Bit != BitWidth; ++Bit) { ``` https://github.com/llvm/llvm-project/pull/158703 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits