[llvm] [AArch64] Reflect cost of integer sub-reductions. (PR #194594)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 07:23:00 PDT 2026


================
@@ -6110,14 +6111,9 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
       return Cost * 2;
   }
 
-  InstructionCost ExpandCost = BaseT::getPartialReductionCost(
-      Opcode, InputTypeA, InputTypeB, AccumType, VF, OpAExtend, OpBExtend,
-      BinOp, CostKind, FMF);
-
-  // Slightly lower the cost of a sub reduction so that it can be considered
-  // as candidate for 'cdot' operations. This is a somewhat arbitrary number,
-  // because we don't yet model these operations directly.
-  return ExpandCost.isValid() && IsSub ? ((8 * ExpandCost) / 10) : ExpandCost;
+  return BaseT::getPartialReductionCost(Opcode, InputTypeA, InputTypeB,
+                                        AccumType, VF, OpAExtend, OpBExtend,
----------------
sdesmalen-arm wrote:

The fall back to BaseT::getPartialReductionCost is covered by existing tests. Regardless, I've added a few new tests (with all various combinations of element types, udot/usdot, add/sub), which exposed a missing condition for `!IsUSDot` for the *mlalb/t instructions.

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


More information about the llvm-commits mailing list