Skip to content

Commit 091448e

Browse files
authored
Revert "[CostModel][X86] getShuffleCost - use processShuffleMasks to split SK_PermuteTwoSrc shuffles to legal types" (#120707)
Reverts #120599 - some recent tests are currently failing
1 parent b03a09e commit 091448e

22 files changed

+934
-1073
lines changed

llvm/lib/Target/X86/X86TargetTransformInfo.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,8 +1698,7 @@ InstructionCost X86TTIImpl::getShuffleCost(
16981698
// We are going to permute multiple sources and the result will be in multiple
16991699
// destinations. Providing an accurate cost only for splits where the element
17001700
// type remains the same.
1701-
if ((Kind == TTI::SK_PermuteSingleSrc || Kind == TTI::SK_PermuteTwoSrc) &&
1702-
LT.first != 1) {
1701+
if (Kind == TTI::SK_PermuteSingleSrc && LT.first != 1) {
17031702
MVT LegalVT = LT.second;
17041703
if (LegalVT.isVector() &&
17051704
LegalVT.getVectorElementType().getSizeInBits() ==
@@ -1785,6 +1784,14 @@ InstructionCost X86TTIImpl::getShuffleCost(
17851784
return BaseT::getShuffleCost(Kind, BaseTp, Mask, CostKind, Index, SubTp);
17861785
}
17871786

1787+
// For 2-input shuffles, we must account for splitting the 2 inputs into many.
1788+
if (Kind == TTI::SK_PermuteTwoSrc && !IsInLaneShuffle && LT.first != 1) {
1789+
// We assume that source and destination have the same vector type.
1790+
InstructionCost NumOfDests = LT.first;
1791+
InstructionCost NumOfShufflesPerDest = LT.first * 2 - 1;
1792+
LT.first = NumOfDests * NumOfShufflesPerDest;
1793+
}
1794+
17881795
static const CostTblEntry AVX512VBMIShuffleTbl[] = {
17891796
{TTI::SK_Reverse, MVT::v64i8, 1}, // vpermb
17901797
{TTI::SK_Reverse, MVT::v32i8, 1}, // vpermb

llvm/test/Analysis/CostModel/X86/shuffle-concat_subvector-codesize.ll

Lines changed: 61 additions & 47 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/X86/shuffle-concat_subvector-latency.ll

Lines changed: 61 additions & 47 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/X86/shuffle-concat_subvector-sizelatency.ll

Lines changed: 61 additions & 47 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/X86/shuffle-concat_subvector.ll

Lines changed: 61 additions & 47 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/X86/shuffle-insert_subvector-codesize.ll

Lines changed: 76 additions & 76 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/X86/shuffle-insert_subvector-latency.ll

Lines changed: 76 additions & 76 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/X86/shuffle-insert_subvector-sizelatency.ll

Lines changed: 76 additions & 76 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/X86/shuffle-insert_subvector.ll

Lines changed: 76 additions & 76 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/X86/shuffle-two-src-codesize.ll

Lines changed: 82 additions & 128 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)