i386: Better patch to improve avx* vector concatenation [PR93594]
authorJakub Jelinek <jakub@redhat.com>
Fri, 7 Feb 2020 08:28:39 +0000 (09:28 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 7 Feb 2020 08:28:39 +0000 (09:28 +0100)
commitf82617f229b336d856c18313339b14657e05c129
treebb3a69cea4bf2fcec4192a5e5eb36f4040bf452d
parente7bec5d5edeaab404931bf599821c6c2a3023b47
i386: Better patch to improve avx* vector concatenation [PR93594]

After thinking some more on this, we can do better; rather than having to
add a new prereload splitter pattern to catch all other cases where it might
be beneficial to fold first part of an UNSPEC_CAST back to the unspec
operand, this patch reverts the *.md changes I've made yesterday and instead
tweaks the patterns, so that simplify-rtx.c can optimize those on its own.
Instead of the whole SET_SRC being an UNSPEC through which simplify-rtx.c
obviously can't optimize anything, this represents those patterns through a
VEC_CONCAT (or two nested ones for the 128-bit -> 512-bit casts) with the
operand as the low part of it and UNSPEC representing just the high part of
it (the undefined, to be ignored, bits).  While richi suggested using
already in GIMPLE for those using a SSA_NAME default definition (i.e.
clearly uninitialized use), I'd say that uninit pass would warn about those,
but more importantly, in RTL it would probably force zero initialization of
that or use or an uninitialized pseudo, all of which is hard to match in an
pattern, so I think an UNSPEC is better for that.

2020-02-07  Jakub Jelinek  <jakub@redhat.com>

PR target/93594
* config/i386/predicates.md (avx_identity_operand): Remove.
* config/i386/sse.md (*avx_vec_concat<mode>_1): Remove.
(avx_<castmode><avxsizesuffix>_<castmode>,
avx512f_<castmode><avxsizesuffix>_256<castmode>): Change patterns to
a VEC_CONCAT of the operand and UNSPEC_CAST.
(avx512f_<castmode><avxsizesuffix>_<castmode>): Change pattern to
a VEC_CONCAT of VEC_CONCAT of the operand and UNSPEC_CAST with
UNSPEC_CAST.
gcc/ChangeLog
gcc/config/i386/predicates.md
gcc/config/i386/sse.md