[llvm] [IR][LangRef] Add partial reduction add intrinsic (PR #94499)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 10:37:57 PDT 2024


================
@@ -7914,6 +7914,28 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
     setValue(&I, Trunc);
     return;
   }
+  case Intrinsic::experimental_vector_partial_reduce_add: {
+    auto DL = getCurSDLoc();
+    auto ReducedTy = EVT::getEVT(I.getType());
+    auto OpNode = getValue(I.getOperand(1));
+    auto FullTy = OpNode.getValueType();
+
+    auto Accumulator = getValue(I.getOperand(0));
+    unsigned ScaleFactor = FullTy.getVectorMinNumElements() / ReducedTy.getVectorMinNumElements();
+
+    for(unsigned i = 0; i < ScaleFactor; i++) {
----------------
paulwalker-arm wrote:

@huntergr-arm - Yes, the intent for "same size operands" is to emit a stock binop.  This will effectively match what LoopVectorize does today and thus allow the intrinsic to be used regardless of the target rather than having to implement target specific/controlled paths within the vectorizer.

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


More information about the llvm-commits mailing list