[llvm] [SLP]Add cost estimation for gather node reshuffling (PR #115201)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 15 03:03:36 PST 2024
================
@@ -4846,8 +4846,21 @@ getShuffleCost(const TargetTransformInfo &TTI, TTI::ShuffleKind Kind,
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput,
int Index = 0, VectorType *SubTp = nullptr,
ArrayRef<const Value *> Args = {}) {
- if (Kind != TTI::SK_PermuteTwoSrc)
+ if (Kind != TTI::SK_PermuteTwoSrc) {
+ int SplatIdx = PoisonMaskElem;
+ if (!Mask.empty() && all_of(Mask, [&](int Idx) {
+ if (Idx == PoisonMaskElem)
+ return true;
+ if (SplatIdx == PoisonMaskElem) {
+ SplatIdx = Idx;
+ return true;
+ }
+ return SplatIdx == Idx;
+ }))
+ return TTI.getShuffleCost(TTI::SK_Broadcast, Tp, Mask, CostKind, Index,
+ SubTp, Args);
return TTI.getShuffleCost(Kind, Tp, Mask, CostKind, Index, SubTp, Args);
+ }
----------------
RKSimon wrote:
Can we not just improve improveShuffleKindFromMask to handle this?
https://github.com/llvm/llvm-project/pull/115201
More information about the llvm-commits
mailing list