[llvm] [IA][RISCV] Support VP intrinsics in InterleavedAccessPass (PR #120490)

Hassnaa Hamdi via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 16:43:36 PST 2025


================
@@ -248,6 +249,196 @@ static bool isReInterleaveMask(ShuffleVectorInst *SVI, unsigned &Factor,
   return false;
 }
 
+// For an (de)interleave tree like this:
+//
+//   A   C B   D
+//   |___| |___|
+//     |_____|
+//        |
+//     A B C D
+//
+//  We will get ABCD at the end while the leaf operands/results
+//  are ACBD, which are also what we initially collected in
+//  getVectorInterleaveFactor / getVectorDeinterleaveFactor. But TLI
+//  hooks (e.g. lowerInterleavedScalableLoad) expect ABCD, so we need
+//  to reorder them by interleaving these values.
+static void interleaveLeafValues(SmallVectorImpl<Value *> &Leaves) {
+  unsigned Factor = Leaves.size();
+  assert(isPowerOf2_32(Factor) && Factor <= 8 && Factor > 1);
----------------
hassnaaHamdi wrote:

Hi @mshockwave 
I have done a simpler approach to support interleaving of factor 4 by using pattern match.
In my opinion, I think it will be better to do either the simple approach to support factor 8, or your current approach but with support to all power_of_2 factors.
I think the BFS approach is better for all power_of_2 factors, while the simple approach (pattern match) is better for only limited factors like 4 or 8.
And I see that you already did the heavy work, so making it generic for all power_of_2 factors would be better.
That is my opinion :'D 

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


More information about the llvm-commits mailing list