[llvm] [AArch64] Add costs for LD3/LD4 shuffles. (PR #89268)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 19 05:42:09 PDT 2024
================
@@ -2978,6 +2978,29 @@ bool ShuffleVectorInst::isInterleaveMask(
return true;
}
+/// Check if the mask is a DE-interleave mask of the given factor
+/// \p Factor like:
+/// <Index, Index+Factor, ..., Index+(NumElts-1)*Factor>
+bool ShuffleVectorInst::isDeInterleaveMaskOfFactor(ArrayRef<int> Mask,
+ unsigned Factor,
+ unsigned &Index) {
+ // Check all potential start indices from 0 to (Factor - 1).
+ for (Index = 0; Index < Factor; Index++) {
+ unsigned I = 0;
+
+ // Check that elements are in ascending order by Factor. Ignore undef
+ // elements.
+ for (; I < Mask.size(); I++)
+ if (Mask[I] >= 0 && static_cast<unsigned>(Mask[I]) != Index + I * Factor)
+ break;
+
+ if (I == Mask.size())
+ return true;
----------------
RKSimon wrote:
Maybe only set the output Index on success?
https://github.com/llvm/llvm-project/pull/89268
More information about the llvm-commits
mailing list