[llvm] [AArch64][NEON] Lower fixed-width add partial reductions to dot product (PR #107078)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 06:12:22 PDT 2024


================
@@ -21781,7 +21782,12 @@ SDValue tryLowerPartialReductionToDot(SDNode *N,
              Intrinsic::experimental_vector_partial_reduce_add &&
          "Expected a partial reduction node");
 
-  if (!Subtarget->isSVEorStreamingSVEAvailable())
+  if (!Subtarget->isSVEorStreamingSVEAvailable() &&
+      !Subtarget->isNeonAvailable())
+    return SDValue();
+
+  // Fixed-width requires the dotprod feature, both for Neon and SVE
+  if (!N->getValueType(0).isScalableVT() && !Subtarget->hasDotProd())
----------------
paulwalker-arm wrote:

I'd rather have the association between type and feature explicit. Something more akin to:
```
if (vt.isScalableVector() && !SVE)
  bail;

if (vt.isFixedLnegth() && (!NEON || !DOT)
  bail;
```

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


More information about the llvm-commits mailing list