[llvm] [AArch64] Refactor and refine cost-model for partial reductions (PR #158641)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 30 08:05:52 PDT 2025


================
@@ -5632,75 +5632,97 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
     TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
     TTI::TargetCostKind CostKind) const {
   InstructionCost Invalid = InstructionCost::getInvalid();
-  InstructionCost Cost(TTI::TCC_Basic);
 
   if (CostKind != TTI::TCK_RecipThroughput)
     return Invalid;
 
-  // Sub opcodes currently only occur in chained cases.
-  // Independent partial reduction subtractions are still costed as an add
+  if (VF.isScalable() && !ST->isSVEorStreamingSVEAvailable())
----------------
david-arm wrote:

Is this even possible? The only way we could get here with a scalable VF is if the target said it supported scalable vectors, which presumably means we also have SVE or SME and we're in streaming mode. If there is a way to expose this via a test that would be great!

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


More information about the llvm-commits mailing list