[llvm] [IR][LangRef] Add partial reduction add intrinsic (PR #94499)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 5 09:49:38 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 6150e84cfc87d118f8cd2794e40dd021c8779e9d f365ac737c27d3c9e5978d3c64787749d89355a7 -- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index f24723a452..e9c1a109c7 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -7921,15 +7921,19 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
auto Index = DAG.getVectorIdxConstant(0, DL);
auto FullTy = OpNode.getValueType();
- auto ResultVector = DAG.getSplat(ReducedTy, DL, DAG.getConstant(0, DL, ReducedTy.getScalarType()));
- unsigned ScaleFactor = FullTy.getVectorMinNumElements() / ReducedTy.getVectorMinNumElements();
+ auto ResultVector = DAG.getSplat(
+ ReducedTy, DL, DAG.getConstant(0, DL, ReducedTy.getScalarType()));
+ unsigned ScaleFactor =
+ FullTy.getVectorMinNumElements() / ReducedTy.getVectorMinNumElements();
- for(unsigned i = 0; i < ScaleFactor; i++) {
+ for (unsigned i = 0; i < ScaleFactor; i++) {
auto SourceIndex = DAG.getVectorIdxConstant(i * ScaleFactor, DL);
auto TargetIndex = DAG.getVectorIdxConstant(i, DL);
- auto N = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ReducedTy, {OpNode, SourceIndex});
+ auto N = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ReducedTy,
+ {OpNode, SourceIndex});
N = DAG.getNode(ISD::VECREDUCE_ADD, DL, ReducedTy.getScalarType(), N);
- ResultVector = DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, ReducedTy, {ResultVector, N, TargetIndex});
+ ResultVector = DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, ReducedTy,
+ {ResultVector, N, TargetIndex});
}
setValue(&I, ResultVector);
``````````
</details>
https://github.com/llvm/llvm-project/pull/94499
More information about the llvm-commits
mailing list