[llvm] [DAGCombiner] Add generic DAG combine for ISD::PARTIAL_REDUCE_MLA (PR #127083)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 08:07:22 PST 2025


================
@@ -12497,6 +12501,50 @@ SDValue DAGCombiner::visitMHISTOGRAM(SDNode *N) {
   return SDValue();
 }
 
+SDValue DAGCombiner::visitPARTIAL_REDUCE_MLA(SDNode *N) {
+  // Makes PARTIAL_REDUCE_MLA(Acc, MUL(EXT(MulOpLHS), EXT(MulOpRHS)), Splat(1))
+  // into PARTIAL_REDUCE_MLA(Acc, MulOpLHS, MulOpRHS)
----------------
sdesmalen-arm wrote:

Could you split this into two separate transformations:
(1) (fold the mul operands into the lhs/rhs)
```
partial_reduce_umla(acc, mul(lhs, rhs), splat(1))
-> partial_reduce_umla(acc, lhs, rhs)
```
and (2) (remove the extends)
```
partial_reduce_umla(acc, sext(lhs), sext(rhs))
-> partial_reduce_smla(acc, lhs, rhs)
```
and
```
partial_reduce_umla(acc, zext(lhs), zext(rhs))
-> partial_reduce_umla(acc, lhs, rhs)
```

https://github.com/llvm/llvm-project/pull/127083


More information about the llvm-commits mailing list