[llvm] [AArch64] Fold four and eight way partial reductions with [SU]ADDLP (PR #214636)

Adam Scott via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 22:28:02 PDT 2026


================
@@ -13984,6 +13984,46 @@ SDValue TargetLowering::expandPartialReduceMLA(SDNode *N,
     break;
   }
 
+  // A wide partial reduction is built from a ladder of narrower ones, a rung
+  // at a time, each halving the element count and doubling the width.
+  unsigned Opc = N->getOpcode();
+  if (Opc != ISD::PARTIAL_REDUCE_FMLA &&
+      MulOpVT.getVectorMinNumElements() > 2 * AccVT.getVectorMinNumElements() &&
+      getPartialReduceMLAAction(Opc, AccVT, MulOpVT) == Custom) {
----------------
as4230 wrote:

getPartialReduceMLAAction is in there because taking it out broke some RISCV tests and I read that as the target wanting a say. I think it is just picking out the well formed shapes by accident. The width check with how it is implemented now would be 2 * WidthRatio >= CountRatio. It has to scale with the count ratio since each rung spends one doubling. So I should be able to remove getPartialReduceMLAAction with that check instead and it should match the budget check you suggested.

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


More information about the llvm-commits mailing list