[PATCH] D69513: [GlobalISel] Widen one type at the time for insert/extract vector elt
Petar Avramovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 12 04:16:36 PST 2019
Petar.Avramovic added a comment.
I don't fully understand G_BUILD_VECTOR_TRUNC. Such opcode does not exist in llvm-ir and as such can only be created in legalizer or later (at the moment at least). The problem here is the context sensitive legality (we still avoid this) along side with type legality. e.g. types might be fine but we still can't select an instructions because vector is built from different virtual registers (so splat is not an option) and we should perform lower. At the current state of legalizer I don't think it is possible to have it legal for type and as such I planned to handle it with custom legalization by either context sensitive select or lower.
Reasoning similarly to G_BUILD_VECTOR_TRUNC it is probably good thing to have verbose corner case opcodes for vector operations which implicitly convert.
If I understood correctly, we need 4 new generic opcodes: G_INSERT_VECTOR_ELT_TRUNC
G_SEXT_EXTRACT_VECTOR_ELT
G_ZEXT_EXTRACT_VECTOR_ELT
G_ANYEXT_EXTRACT_VECTOR_ELT.
For MIPS, I would create them in preLegalizerCombiner.
Only difference between G_INSERT_VECTOR_ELT_TRUNC, G_ANYEXT_EXTRACT_VECTOR_ELT and G_INSERT_VECTOR_ELT, G_EXTRACT_VECTOR_ELT I see is widen scalar for scalar type.
Do scalar and vector scalar type have to be always different for them,
i.e. is `%Dest:_(<2 x s8>) = G_INSERT_VECTOR_ELT_TRUNC %Src:_(<2 x s8>), %Elt:_(s8), %Index:_(s32)` allowed or it must be G_INSERT_VECTOR_ELT instead.
If later, how do we widen scalar for G_INSERT_VECTOR_ELT (it should change opcode to G_INSERT_VECTOR_ELT_TRUNC). Something like WidenEltScalar that would be used only for G_INSERT_VECTOR_ELT and G_EXTRACT_VECTOR_ELT?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69513/new/
https://reviews.llvm.org/D69513
More information about the llvm-commits
mailing list