================
@@ -2087,6 +2087,32 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC,
IntrinsicInst &II) const {
}
return std::nullopt;
}
+ case Intrinsic::amdgcn_sudot4:
+ case Intrinsic::amdgcn_sudot8: {
+ // Reassociating across a saturating accumulate is not valid.
+ if (!II.hasOneUse() || !match(II.getArgOperand(5), m_Zero()))
+ break;
+
+ const APInt *Acc;
+ if (!match(II.getArgOperand(4), m_APInt(Acc)))
+ break;
+
+ auto *AccumUser = dyn_cast<BinaryOperator>(II.user_back());
+ if (!AccumUser)
+ break;
+
+ const APInt *AccumDelta;
+ Constant *NewAcc;
+ if (match(AccumUser, m_c_Add(m_Specific(&II), m_APInt(AccumDelta))))
+ NewAcc = ConstantInt::get(II.getType(), *Acc + *AccumDelta);
+ else
+ break;
----------------
tgymnich wrote:
```suggestion
if (!match(AccumUser, m_c_Add(m_Specific(&II), m_APInt(AccumDelta))))
break;
NewAcc = ConstantInt::get(II.getType(), *Acc + *AccumDelta);
```
https://github.com/llvm/llvm-project/pull/225322
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits