@@ -2587,7 +2587,7 @@ static bool interp__builtin_ia32_pmadd(
25872587 const Pointer &RHS = S.Stk .pop <Pointer>();
25882588 const Pointer &LHS = S.Stk .pop <Pointer>();
25892589 const Pointer &Dst = S.Stk .peek <Pointer>();
2590-
2590+
25912591 const auto *VT = Call->getArg (0 )->getType ()->castAs <VectorType>();
25922592 PrimType ElemT = *S.getContext ().classify (VT->getElementType ());
25932593 unsigned NumElems = VT->getNumElements ();
@@ -3477,20 +3477,26 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
34773477 case clang::X86::BI__builtin_ia32_pmaddubsw128:
34783478 case clang::X86::BI__builtin_ia32_pmaddubsw256:
34793479 case clang::X86::BI__builtin_ia32_pmaddubsw512:
3480- return interp__builtin_ia32_pmadd (S, OpPC, Call,
3481- [](const APSInt &LoLHS, const APSInt &HiLHS, const APSInt &LoRHS, const APSInt &HiRHS) {
3482- unsigned BitWidth = 2 * LHS.getBitWidth ();
3483- return (LoLHS.zext (BitWidth) * LoRHS.sext (BitWidth)).sadd_sat ((HiLHS.zext (BitWidth) * HiRHS.sext (BitWidth)));
3484- });
3485-
3480+ return interp__builtin_ia32_pmadd (
3481+ S, OpPC, Call,
3482+ [](const APSInt &LoLHS, const APSInt &HiLHS, const APSInt &LoRHS,
3483+ const APSInt &HiRHS) {
3484+ unsigned BitWidth = 2 * LHS.getBitWidth ();
3485+ return (LoLHS.zext (BitWidth) * LoRHS.sext (BitWidth))
3486+ .sadd_sat ((HiLHS.zext (BitWidth) * HiRHS.sext (BitWidth)));
3487+ });
3488+
34863489 case clang::X86::BI__builtin_ia32_pmaddwd128:
34873490 case clang::X86::BI__builtin_ia32_pmaddwd256:
34883491 case clang::X86::BI__builtin_ia32_pmaddwd512:
3489- return interp__builtin_ia32_pmadd (S, OpPC, Call,
3490- [](const APSInt &LoLHS, const APSInt &HiLHS, const APSInt &LoRHS, const APSInt &HiRHS) {
3491- unsigned BitWidth = 2 * LHS.getBitWidth ();
3492- return (LoLHS.sext (BitWidth) * LoRHS.sext (BitWidth)) + (HiLHS.sext (BitWidth) * HiRHS.sext (BitWidth));
3493- });
3492+ return interp__builtin_ia32_pmadd (
3493+ S, OpPC, Call,
3494+ [](const APSInt &LoLHS, const APSInt &HiLHS, const APSInt &LoRHS,
3495+ const APSInt &HiRHS) {
3496+ unsigned BitWidth = 2 * LHS.getBitWidth ();
3497+ return (LoLHS.sext (BitWidth) * LoRHS.sext (BitWidth)) +
3498+ (HiLHS.sext (BitWidth) * HiRHS.sext (BitWidth));
3499+ });
34943500
34953501 case clang::X86::BI__builtin_ia32_pmulhuw128:
34963502 case clang::X86::BI__builtin_ia32_pmulhuw256:
0 commit comments