[llvm] [AArch64] Disallow vscale x 1 partial reductions (PR #125252)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 09:18:30 PST 2025


================
@@ -4687,13 +4687,24 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
   EVT InputEVT = EVT::getEVT(InputTypeA);
   EVT AccumEVT = EVT::getEVT(AccumType);
 
-  if (VF.isScalable() && !ST->isSVEorStreamingSVEAvailable())
-    return Invalid;
+  unsigned VFMinValue = VF.getKnownMinValue();
+
+  if (VF.isScalable()) {
+    if (!ST->isSVEorStreamingSVEAvailable())
+      return Invalid;
+
+    // Don't accept a partial reduction if the scaled accumulator is vscale x 1,
+    // since we can't lower that type.
+    unsigned Scale =
+        AccumEVT.getScalarSizeInBits() / InputEVT.getScalarSizeInBits();
+    if (VFMinValue / Scale == 1)
----------------
sdesmalen-arm wrote:

Is this the same as:
```suggestion
    if (VFMinValue == Scale)
```
?

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


More information about the llvm-commits mailing list