[llvm] [BasicTTI] Prefer SK_InsertSubvector over SK_Select when both are legal (PR #85302)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 12:54:21 PDT 2024
================
@@ -996,7 +996,17 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
return TTI::SK_Splice;
break;
}
- case TTI::SK_Select:
+ case TTI::SK_Select: {
+ int NumSubElts;
+ if (Mask.size() > 2 && ShuffleVectorInst::isInsertSubvectorMask(
+ Mask, NumSrcElts, NumSubElts, Index)) {
+ if (Index + NumSubElts > NumSrcElts)
+ return Kind;
+ SubTy = FixedVectorType::get(Ty->getElementType(), NumSubElts);
+ return TTI::SK_InsertSubvector;
+ }
+ break;
+ }
----------------
alexey-bataev wrote:
I think better to fix the order in TargetTransformInfoImpl.h::getInstructionCost
https://github.com/llvm/llvm-project/pull/85302
More information about the llvm-commits
mailing list