[llvm] [RISCV][TTI] Cost a subvector insert at a register boundary with exact vlen (PR #85240)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 18 01:39:11 PDT 2024
================
@@ -469,6 +469,22 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
return LT.first *
getRISCVInstructionCost(RISCV::VSLIDEDOWN_VI, LT.second, CostKind);
case TTI::SK_InsertSubvector:
+ // If we're inserting a subvector of *exactly* m1 size at a sub-register
+ // boundary this is a subregister insert at worst and won't require the
+ // slideup. We require the subvec to to be exactly VLEN as otherwise
+ // we'd have to account for tail elements in the m1 container if any.
+ // TODO: Extend for aligned m2, m4 inserts
+ // TODO: Extend for scalable subvector types
+ if (std::pair<InstructionCost, MVT> SubLT = getTypeLegalizationCost(SubTp);
+ SubLT.second.isValid() && SubLT.second.isFixedLengthVector()) {
+ const unsigned MinVLen = ST->getRealMinVLen();
+ const unsigned MaxVLen = ST->getRealMaxVLen();
----------------
lukel97 wrote:
We could also use `ST->getRealVLen()`
https://github.com/llvm/llvm-project/pull/85240
More information about the llvm-commits
mailing list