fix ssse3_pshufbv8qi3 post-reload const pool load
authorAlexandre Oliva <oliva@adacore.com>
Wed, 24 Mar 2021 08:44:35 +0000 (05:44 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Wed, 24 Mar 2021 08:44:35 +0000 (05:44 -0300)
commit4be312862dec5c8e49c76249dd5aed220c72039e
tree8d823f907224e7e094e0b7a5523b15a703ae1b49
parentb179026a5d9fcadadef6ca511933933672557495
fix ssse3_pshufbv8qi3 post-reload const pool load

The split in ssse3_pshufbv8qi3 forces a const vector into the constant
pool, and loads from it.  That runs after reload, so if the load
requires any reloading, we're out of luck.  Indeed, if the load
address is not legitimate, e.g. -mcmodel=large, the insn is no longer
recognized.

This patch turns the constant into an input operand, introduces an
expander to generate the constant unconditionally, and arranges for
this input operand to be retained as an unused immediate in the
alternatives that don't undergo splitting, and for it to be loaded
into the scratch register for those that do.

It is now the register allocator that arranges to load the const
vector into a register, so it deals with whatever legitimizing steps
needed for the target configuration.

for  gcc/ChangeLog

* config/i386/predicates.md (reg_or_const_vec_operand): New.
* config/i386/sse.md (ssse3_pshufbv8qi3): Add an expander for
the now *-prefixed insn_and_split, turn the splitter const vec
into an input for the insn, making it an ignored immediate for
non-split cases, and loaded into the scratch register
otherwise.

for  gcc/testsuite/ChangeLog

* gcc.target/i386/pr94467-3.c: New.
gcc/config/i386/predicates.md
gcc/config/i386/sse.md
gcc/testsuite/gcc.target/i386/pr94467-3.c [new file with mode: 0644]