[llvm] [IR] Add llvm.vector.[de]interleave{4,6,8} (PR #139893)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Sat May 17 10:27:27 PDT 2025


preames wrote:

> > Another option we could explore is to split deinterleaveN into N calls to an intrinsic for the form 

> I guess a potential problem might happen when we _cannot_ turn this into segmented load/store. For instance, how should we codegen a single, lingering `%s = deinterleave(X, %v)`? We might be able to mitigate it by adding another argument indicating the total number of fields, like `%s0 = deinterleave(0, 3, %v)` for the first field when NF = 3.

Yeah, this was exactly what I had in mind.  We have two constant integer operands which fully describe the shuffle being performed.  (e.g., deinterleave with stride 3 and offset 2, which is analogous to a shufflevector with 2, 5, 8, 11, ... as the mask)

At least on riscv, this is actually a better mapping to the lowering (when we don't turn it into a segment load), than the current intrinsics with their tuple return.  Each of the individual lanes becomes a vcompress or vrgather (or vnsrl if possible).  


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


More information about the llvm-commits mailing list