[llvm] [AArch64] Enable fixed-length vector support for partial-reductions (PR #142032)

Nicholas Guy via llvm-commits llvm-commits at lists.llvm.org
Fri May 30 05:23:18 PDT 2025


================
@@ -2225,6 +2233,26 @@ void AArch64TargetLowering::addTypeForFixedLengthSVE(MVT VT) {
   bool PreferNEON = VT.is64BitVector() || VT.is128BitVector();
   bool PreferSVE = !PreferNEON && Subtarget->isSVEAvailable();
 
+  if (EnablePartialReduceNodes) {
+    unsigned NumElts = VT.getVectorNumElements();
+    if (VT.getVectorElementType() == MVT::i64) {
+      setPartialReduceMLAAction(VT, MVT::getVectorVT(MVT::i8, NumElts * 8),
+                                Custom);
+      setPartialReduceMLAAction(VT, MVT::getVectorVT(MVT::i16, NumElts * 4),
+                                Custom);
+      setPartialReduceMLAAction(VT, MVT::getVectorVT(MVT::i32, NumElts * 2),
+                                Custom);
+    } else if (VT.getVectorElementType() == MVT::i32) {
+      setPartialReduceMLAAction(VT, MVT::getVectorVT(MVT::i8, NumElts * 4),
+                                Custom);
+      setPartialReduceMLAAction(VT, MVT::getVectorVT(MVT::i16, NumElts * 2),
+                                Custom);
+    } else if (VT.getVectorElementType() == MVT::i16) {
+      setPartialReduceMLAAction(VT, MVT::getVectorVT(MVT::i8, NumElts * 2),
+                                Custom);
+    }
+  }
----------------
NickGuy-Arm wrote:

Aha, I'd missed that this function is only entered if the VT width is greater than 128.

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


More information about the llvm-commits mailing list