[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:10 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
----------------
lukel97 wrote:

Another case we handle in #84107 is mf{2,4,8} subvector inserts, where the bottom element being inserted is aligned to a vector register **and** the vector being inserted into is undef.

https://github.com/llvm/llvm-project/pull/85240


More information about the llvm-commits mailing list