[llvm] [PowerPC] Add PPC cost model support for partial reductions (PR #214760)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 07:49:40 PDT 2026
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 origin/main HEAD --extensions h,cpp -- llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
index ea4539e08..9bf05e679 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
@@ -1162,11 +1162,10 @@ PPCTTIImpl::getMemIntrinsicInstrCost(const MemIntrinsicCostAttributes &MICA,
}
InstructionCost PPCTTIImpl::getPartialReductionCost(
- unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
- ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
- TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
- TTI::TargetCostKind CostKind,
- std::optional<FastMathFlags> FMF) const {
+ unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
+ ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
+ TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
+ TTI::TargetCostKind CostKind, std::optional<FastMathFlags> FMF) const {
InstructionCost Invalid = InstructionCost::getInvalid();
if (Opcode != Instruction::Add)
@@ -1174,14 +1173,14 @@ InstructionCost PPCTTIImpl::getPartialReductionCost(
if (BinOp && BinOp.value() != Instruction::Mul)
return Invalid;
- EVT AccVT = TLI->getValueType(DL, AccumType, true);
+ EVT AccVT = TLI->getValueType(DL, AccumType, true);
if (AccVT != MVT::i32)
return Invalid;
if (InputTypeA != InputTypeB)
return Invalid;
Type *ATy = VectorType::get(InputTypeA, VF);
- EVT AVT = TLI->getValueType(DL, ATy, true);
+ EVT AVT = TLI->getValueType(DL, ATy, true);
if (AVT != MVT::v16i8 && AVT != MVT::v8i16)
return Invalid;
@@ -1193,7 +1192,7 @@ InstructionCost PPCTTIImpl::getPartialReductionCost(
if (AVT != MVT::v16i8 || OpBExtend != TTI::PR_ZeroExtend)
return Invalid;
} else if (AVT == MVT::v16i8 && OpAExtend == TTI::PR_SignExtend) {
- return Invalid;
+ return Invalid;
}
return vectorCostAdjustmentFactor(Instruction::Add, ATy, nullptr);
``````````
</details>
https://github.com/llvm/llvm-project/pull/214760
More information about the llvm-commits
mailing list