[i386] Make the vzeroupper pattern describe its effects (PR91994)
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 7 Oct 2019 08:36:06 +0000 (08:36 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 7 Oct 2019 08:36:06 +0000 (08:36 +0000)
commit698114484e668abf28c70d989bc93fa399dda9ac
treefd1f0dfc8c900a11da102a8bbfba388877795b9c
parent806bdf4e40d31cf55744c876eb9f17654de36b99
[i386] Make the vzeroupper pattern describe its effects (PR91994)

The problem in this PR was that vzeroupper has an effect on register
contents, but those effects weren't modelled in the rtl pattern,
which was just an unspec_volatile.

This patch fixes that by running a subpass after vzeroupper insertion
to add SETs and CLOBBERs as appropriate.  See the comments in the patch
for more details.

2019-10-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR target/91994
* config/i386/sse.md (avx_vzeroupper): Turn into a define_expand
and wrap the unspec_volatile in a parallel.
(*avx_vzeroupper): New define_insn.  Use a match_parallel around
the unspec_volatile.
* config/i386/predicates.md (vzeroupper_pattern): Expect the
unspec_volatile to be wrapped in a parallel.
* config/i386/i386-features.c (ix86_add_reg_usage_to_vzeroupper)
(ix86_add_reg_usage_to_vzerouppers): New functions.
(rest_of_handle_insert_vzeroupper): Use them to add register
usage information to the vzeroupper instructions.

gcc/testsuite/
PR target/91994
* gcc.target/i386/pr91994.c: New test.

From-SVN: r276648
gcc/ChangeLog
gcc/config/i386/i386-features.c
gcc/config/i386/predicates.md
gcc/config/i386/sse.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr91994.c [new file with mode: 0644]