[llvm] [AArch64] Add a subvector extract cost. (PR #121472)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 6 08:44:51 PST 2025
================
@@ -4706,10 +4706,21 @@ InstructionCost AArch64TTIImpl::getShuffleCost(
}
Kind = improveShuffleKindFromMask(Kind, Mask, Tp, Index, SubTp);
- // Treat extractsubvector as single op permutation.
bool IsExtractSubvector = Kind == TTI::SK_ExtractSubvector;
- if (IsExtractSubvector && LT.second.isFixedLengthVector())
+ // A sebvector extract can be implemented with a ext (or trivial extract, if
+ // from lane 0). This currently only handles low or high extracts to prevent
+ // SLP vectorizer regressions.
+ if (IsExtractSubvector && LT.second.isFixedLengthVector()) {
+ if (LT.second.is128BitVector() &&
+ cast<FixedVectorType>(SubTp)->getNumElements() ==
+ LT.second.getVectorNumElements() / 2) {
+ if (Index == 0)
+ return 0;
+ else if (Index == LT.second.getVectorNumElements() / 2)
----------------
alexey-bataev wrote:
Drop `else`
https://github.com/llvm/llvm-project/pull/121472
More information about the llvm-commits
mailing list