[llvm] [RISCV][TTI] Recognize CONCAT_VECTORS if a shufflevector mask is multiple insert subvector. (PR #111459)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 08:23:49 PDT 2024


================
@@ -343,6 +343,52 @@ RISCVTTIImpl::getConstantPoolLoadCost(Type *Ty,  TTI::TargetCostKind CostKind) {
                              /*AddressSpace=*/0, CostKind);
 }
 
+InstructionCost
+RISCVTTIImpl::isMultipleInsertSubvector(VectorType *Tp, ArrayRef<int> Mask,
+                                        TTI::TargetCostKind CostKind) {
----------------
lukel97 wrote:

Can we split this function into something similar to `ShuffleVectorInst::isReplicationMask` and the other mask functions, e.g. `static bool isRepeatedConcatMask(ArrayRef<int> Mask, int &SubvectorSize)`.

Then call that check in getShuffleCost and compute the cost there if it's true. That way it's a bit more similar to how we check other mask patterns.

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


More information about the llvm-commits mailing list