[llvm] [LLVM][CodeGen][SVE] Add isel for bfloat unordered reductions. (PR #143540)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 18:06:08 PDT 2025


================
@@ -11427,9 +11423,18 @@ SDValue TargetLowering::expandVecReduce(SDNode *Node, SelectionDAG &DAG) const {
       std::tie(Lo, Hi) = DAG.SplitVector(Op, dl);
       Op = DAG.getNode(BaseOpcode, dl, HalfVT, Lo, Hi, Node->getFlags());
       VT = HalfVT;
+
+      // Stop if splitting is enough to make the reduction legal.
+      if (isOperationLegalOrCustom(Node->getOpcode(), HalfVT))
+        return DAG.getNode(Node->getOpcode(), dl, Node->getValueType(0), Op,
+                           Node->getFlags());
     }
   }
 
+  if (VT.isScalableVector())
+    report_fatal_error(
+        "Expanding reductions for scalable vectors is undefined.");
----------------
arsenm wrote:

```suggestion
  if (VT.isScalableVector()) {
    reportFatalInternalError(
        "expanding reductions for scalable vectors is undefined.");
  }
```

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


More information about the llvm-commits mailing list