[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 20 01:17:03 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:

Thanks for trying @JamesChesterman. Moving the `mul` into the `partial_reduce_mla` should only be done if the extends come for free (because there is an instruction that does this), or if this doesn't lose the nsw/nuw flags on the mul (otherwise we lose the information to decide that the `mul` can be performed on the smaller type, i.e.  do the extend on the result of the mul, rather than extending the operands to the accumulator/result type). With that in mind, I agree it is probably easier to do this in one function.

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


More information about the llvm-commits mailing list