[llvm] [CostModel][X86] SK_InsertSubvector - if the legalized base/subvector types match then the insert is now just a copy (PR #84048)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 5 10:14:13 PST 2024
================
@@ -1550,6 +1550,12 @@ InstructionCost X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
if (Kind == TTI::SK_InsertSubvector && LT.second.isVector()) {
int NumElts = LT.second.getVectorNumElements();
std::pair<InstructionCost, MVT> SubLT = getTypeLegalizationCost(SubTp);
+
+ // If we're inserting into the same legalized type then its not an
+ // insert anymore, its a copy.
+ if (LT.second == SubLT.second)
+ return TTI::TCC_Free;
----------------
alexey-bataev wrote:
This is probably not quite correct. shufflevector <4 x i32>, <4 xi32> , <0,1,2,4> is a subvector insert of 2 vectors with the same types, but it is not free.
https://github.com/llvm/llvm-project/pull/84048
More information about the llvm-commits
mailing list