[PATCH] D53594: [GlobalISel] Introduce G_BUILD_VECTOR and G_CONCAT_VECTOR opcodes
Quentin Colombet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 31 15:48:03 PDT 2018
qcolombet added a comment.
> I'm not sure how this is any better. If we had an opcode G_BUILD_VECTOR_TRUNC, it would have a superset of the functionality of the G_BUILD_VECTOR. You'd still have this powerful opcode, except now you have potential code duplication in handling the two, as well as a hindered G_BUILD_VECTOR.
>
> Unless you're say that G_BUILD_VECTOR _TRUNC can *only* deal with oversize scalars, in which case it's an odd opcode for a corner case (and I would suggest here that we just deal with the inconvenient types, but I'm not married to the idea).
I was suggesting the later.
Generally speaking, I am not a fan of implicit stuff, thus the proposal (and that's easy to have a isBuildVectorLike or something). That said, I'd like to go back as why we need to do that.
So the problem was that we wanted to represent:
a(<4 x s32>) = G_BUILD_VECTOR p(s32), q, r, s
b(<4 x s8>) = G_TRUNC a
into
b(< 4 x s8>) = G_BUILD_VECTOR p(s32), q, r, s
Why can't we keep the "verbose" representation?
I would expect it would be easy to handle that in ISel.
Also, just throwing that here, I haven't really thought about it: should we rethink our legality model to check patterns instead of one instruction at a time?
I.e., maybe
a(s8) = ...
is not legal but
a(s8) = ...
b(<4 x s8>) = build_vector a(s8)
is.
This actually ties back to one question that I don't think we answered. Do we legalize on the type (i.e., s8 to s32) or the size and type can be different (i.e., s8(8b) to s8(32b))?
It seems to me we are trying to write <4 x s8> = s8(32b), ...., but maybe we want <4 x s8> = s32, ....
Anyhow, to be concrete, I am fine with the implicit truncate, we know this is not too bad based on SDISel experience, I want to make sure we consider all our options here.
Cheers,
-Quentin
Repository:
rL LLVM
https://reviews.llvm.org/D53594
More information about the llvm-commits
mailing list