[llvm] [IR][LangRef] Add partial reduction add intrinsic (PR #94499)
Graham Hunter via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 08:25:05 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++) {
----------------
huntergr-arm wrote:
I think the previous design may have been better, since it was clearly just performing the reduction of a single vector value into another (and possibly to a scalar, as @arsenm suggests). Making it a binop as well seems to make it less flexible vs. just having a separate binop afterwards. Maybe I'm missing something though...
https://github.com/llvm/llvm-project/pull/94499
More information about the llvm-commits
mailing list