[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:21:18 PDT 2026


================
@@ -6076,12 +6077,12 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
       // that now, a regular reduction would be cheaper because the costs of
       // the extends in the IR are still counted. This can be fixed
       // after https://github.com/llvm/llvm-project/pull/147302 has landed.
-      return Cost;
+      return Cost + INegCost;
     // i8 -> i16 is natively supported with SVE2p3
     if (AccumLT.second.getScalarType() == MVT::i16 &&
         InputLT.second.getScalarType() == MVT::i8 &&
-        (ST->hasSVE2p3() || ST->hasSME2p3()))
-      return Cost;
+        (ST->hasSVE2p3() || ST->hasSME2p3()) && !IsSub)
+      return Cost + INegCost;
----------------
sdesmalen-arm wrote:

Oops, removed.

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


More information about the llvm-commits mailing list