This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Lower vector_{interleave,deinterleave} for NF > 2

Authored by luke on Mar 7 2023, 5:35 AM.



For NF > we can't use the same tricks we use for the NF == 2 case, so
instead we're just generalizing the vrgather paths.

This also handles the re-concatenation of vectors a bit differently now,
as it's possible to get operands of a valid type but end up with a
result type that's invalid, e.g. nx2vi32 * 3 -> nx6vi32. Now we extend
the vector to the next power of two in the hopes that it's valid, e.g.

Diff Detail

Event Timeline

luke created this revision.Mar 7 2023, 5:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2023, 5:35 AM
luke requested review of this revision.Mar 7 2023, 5:35 AM
luke planned changes to this revision.Mar 8 2023, 9:23 AM

For later consideration...

I think we can avoid falling back to the vrgather case for e.g. interleave 4 on i8. The basic idea is that an interleave 4 on i8 is a pair of two interleave 2 on i8 followed by a single interleave 2 on i16. Each of those three interleaves can be done via the existing lowering. Essentially, we can recursively decompose.

The non-power of two factors are a bit tricker, but I think we can pad with a dummy vector, and then use a single vrgather at the end to compact. I'm not 100% sure this works; we have to be sure the padding fits within the legal element type.

We still have to fall back for edge cases though, so we're going to need the generic logic either way. Probably worth staging commits.

luke abandoned this revision.Jul 5 2023, 9:23 AM
evandro removed a subscriber: evandro.Jul 6 2023, 1:54 PM