[llvm] [TTI][RISCV]Improve costs for whole vector reg extract/insert. (PR #80164)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 16 11:25:59 PST 2024
================
@@ -432,12 +444,19 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
// must be implemented here.
break;
case TTI::SK_ExtractSubvector:
+ // Extract at zero is always a subregister extract
+ if (Index == 0)
+ return TTI::TCC_Free;
+
// Example sequence:
// vsetivli zero, 4, e8, mf2, tu, ma (ignored)
// vslidedown.vi v8, v9, 2
return LT.first *
getRISCVInstructionCost(RISCV::VSLIDEDOWN_VI, LT.second, CostKind);
case TTI::SK_InsertSubvector:
+ if (Index == 0 && any_of(Args, UndefValue::classof))
----------------
alexey-bataev wrote:
If we know that it is a subvector insert and at least one argument is undef vector, does it really matter, which one is undef? Iа the subvector is undef - we can use the original vector, in other case - just resize the subvector to the type of the vector.
https://github.com/llvm/llvm-project/pull/80164
More information about the llvm-commits
mailing list