[llvm] [RISCV][TTI] Add shuffle costing for masked slide lowering (PR #128537)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 24 08:56:13 PST 2025
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 529b3d16daf2c7970f6f0b1f97e8ed09891c726a 8b64212562ced109957aec8c4f6f2a974223d3db --extensions h,cpp -- llvm/include/llvm/Analysis/VectorUtils.h llvm/lib/Analysis/VectorUtils.cpp llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 551c814ef6..6b8a4170a8 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -5944,7 +5944,8 @@ bool RISCVTargetLowering::isShuffleMaskLegal(ArrayRef<int> M, EVT VT) const {
std::pair<int, int> SrcInfo[2];
int Dummy1, Dummy2;
return ShuffleVectorInst::isReverseMask(M, NumElts) ||
- (::isMaskedSlidePair(M, SrcInfo) && isElementRotate(SrcInfo, NumElts)) ||
+ (::isMaskedSlidePair(M, SrcInfo) &&
+ isElementRotate(SrcInfo, NumElts)) ||
isInterleaveShuffle(M, SVT, Dummy1, Dummy2, Subtarget);
}
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 1b53db38b1..d08c3593bc 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -474,7 +474,8 @@ costShuffleViaVRegSplitting(RISCVTTIImpl &TTI, MVT LegalVT,
return InstructionCost::getInvalid();
}
-InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp, ArrayRef<int> Mask,
+InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp,
+ ArrayRef<int> Mask,
TTI::TargetCostKind CostKind) {
// Avoid missing masks
if (Mask.size() <= 2)
@@ -495,7 +496,7 @@ InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp, ArrayRef<int> Ma
assert(SlideAmt != 0);
if (SlideAmt < 0)
return SlideAmt > -32 ? RISCV::VSLIDEDOWN_VI : RISCV::VSLIDEDOWN_VX;
- return SlideAmt < 32 ? RISCV::VSLIDEUP_VI : RISCV::VSLIDEUP_VX;
+ return SlideAmt < 32 ? RISCV::VSLIDEUP_VI : RISCV::VSLIDEUP_VX;
};
std::pair<int, int> SrcInfo[2];
@@ -519,11 +520,13 @@ InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp, ArrayRef<int> Ma
unsigned Opcode = getSlideOpcode(SrcInfo[1].second);
SecondSlideCost = getRISCVInstructionCost(Opcode, LT.second, CostKind);
} else {
- SecondSlideCost = getRISCVInstructionCost(RISCV::VMERGE_VVM, LT.second, CostKind);
+ SecondSlideCost =
+ getRISCVInstructionCost(RISCV::VMERGE_VVM, LT.second, CostKind);
}
auto EC = Tp->getElementCount();
- VectorType *MaskTy = VectorType::get(IntegerType::getInt1Ty(Tp->getContext()), EC);
+ VectorType *MaskTy =
+ VectorType::get(IntegerType::getInt1Ty(Tp->getContext()), EC);
InstructionCost MaskCost = getConstantPoolLoadCost(MaskTy, CostKind);
return FirstSlideCost + SecondSlideCost + MaskCost;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/128537
More information about the llvm-commits
mailing list