[llvm] [TTI][RISCV]Improve costs for whole vector reg extract/insert. (PR #80164)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 16 10:44:21 PST 2024
================
@@ -326,6 +326,18 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
switch (Kind) {
default:
break;
+ case TTI::SK_InsertSubvector:
+ if (auto *FSubTy = dyn_cast<FixedVectorType>(SubTp)) {
+ unsigned TpRegs = getRegUsageForType(Tp);
+ unsigned SubTpRegs = getRegUsageForType(SubTp);
+ unsigned NextSubTpRegs = getRegUsageForType(FixedVectorType::get(
+ Tp->getElementType(), FSubTy->getNumElements() + 1));
+ // Whole vector insert - just the vector itself.
+ if (Index == 0 && SubTpRegs != 0 && SubTpRegs != NextSubTpRegs &&
+ TpRegs / SubTpRegs > 1)
----------------
lukel97 wrote:
Should this be
```suggestion
TpRegs / SubTpRegs >= 1)
```
So inserts with the same vector and subvector type are also free? E.g @llvm.vector.insert.v128i8.v128i8 in the tests is still 8
https://github.com/llvm/llvm-project/pull/80164
More information about the llvm-commits
mailing list