[llvm] [AArch64][SVE] Add partial reduction SDNodes (PR #117185)

James Chesterman via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 05:50:29 PST 2024


================
@@ -8126,15 +8126,21 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
     return;
   }
   case Intrinsic::experimental_vector_partial_reduce_add: {
+    SDLoc dl = getCurSDLoc();
+    SDValue Acc = getValue(I.getOperand(0));
+    EVT AccVT = Acc.getValueType();
+    SDValue Input = getValue(I.getOperand(1));
 
     if (!TLI.shouldExpandPartialReductionIntrinsic(cast<IntrinsicInst>(&I))) {
-      visitTargetIntrinsic(I, Intrinsic);
+      if (TLI.isPartialReductionInputSigned(Input))
+        setValue(&I,
+                 DAG.getNode(ISD::PARTIAL_REDUCE_SADD, dl, AccVT, Acc, Input));
+      else
+        setValue(&I,
+                 DAG.getNode(ISD::PARTIAL_REDUCE_UADD, dl, AccVT, Acc, Input));
----------------
JamesChesterman wrote:

Changed this so that only the `shouldExpandPartialReductionIntrinsic` function is called, and the node outputted is always `ISD::PARTIAL_REDUCE_UADD`. Searching for exts and removing them is now done in the DAG combine. I decided to do it here rather than in legalisation so that, if the exts are different, `usdot` instructions can be outputted here. 

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


More information about the llvm-commits mailing list