[llvm-dev] [RFC] Extending shufflevector for vscale vectors (SVE etc.)
Renato Golin via llvm-dev
llvm-dev at lists.llvm.org
Thu Jan 30 00:56:30 PST 2020
On Thu, 30 Jan 2020 at 08:22, Nicolai Hähnle via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> This fixed list of shuffles makes me uncomfortable, and I wonder if
> there isn't a much simpler solution to the problem. Specifically,
> allow the IR form:
> %result = shufflevector <vscale x n x TY> %v1, <vscale x n x TY> %v2,
> <m x i32> <mask>
> yielding a result of type <vscale x m x TY>. (The <mask> could still
> just be a constant list of integers, i.e. this doesn't require a
> relaxation to arbitrary Value* masks.)
Back when Arm was proposing the SVE extensions, another proposal was
to use SCEV like patterns.
I think they're all valid proposals, but implementation wise, they can
get really complicated.
Masks and expressions will have to be pattern-matched against
target-specific instructions when lowering, and if we're not going to
be generating the most unusual patterns to begin with
(front-end/middle-end creating them), then I think a fixed list to
begin with is quite sensible.
For example, I wouldn't want to let the vectoriser generate any random
pattern in the shuffle if I know that there is no valid instruction in
the back-end that can cope with that, and I'll end up with
A fixed list will also allow us to build the infrastructure first,
with one less problem to handle. After we're sure it works well, we
can extend to different patterns.
For example, we can add to SHUFFLE-NAME things like "mask" and "scev"
and "expr", and then add whatever to the end of it. In those edge
cases, it will be up to the back-end to legalise that in a meaningful,
and hopefully performing, way.
More information about the llvm-dev