[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
Thu Oct 17 02:03:34 PDT 2024
================
@@ -343,6 +343,28 @@ RISCVTTIImpl::getConstantPoolLoadCost(Type *Ty, TTI::TargetCostKind CostKind) {
/*AddressSpace=*/0, CostKind);
}
+static bool isRepeatedConcatMaskImpl(ArrayRef<int> Mask, int &SubVectorSize) {
+ unsigned Size = Mask.size();
+ if (!isPowerOf2_32(Size))
+ return false;
+ for (unsigned I = 0; I != Size; ++I) {
+ if (static_cast<unsigned>(Mask[I]) == I)
+ continue;
+ if (Mask[I] != 0)
+ return false;
+ if (Size % I != 0)
+ return false;
+ for (unsigned J = 0; J != Size; ++J)
----------------
lukel97 wrote:
Nit, we can skip checking the first I elements
```suggestion
for (unsigned J = I; J != Size; ++J)
```
https://github.com/llvm/llvm-project/pull/111459
More information about the llvm-commits
mailing list