i386: Fix PR97715
authorqing zhao <qinzhao@gcc.gnu.org>
Thu, 5 Nov 2020 14:57:46 +0000 (15:57 +0100)
committerqing zhao <qinzhao@gcc.gnu.org>
Thu, 5 Nov 2020 14:57:46 +0000 (15:57 +0100)
commitcc32e81cdbb7696cd571bdb5ffe52f228f125df5
treedd80526f8e3f10c246b2eda160fb18daae2a46a4
parent54cbdb528df16686290ad26e2130a1896915639d
i386: Fix PR97715

This change fixes a bug in the i386 backend when adding
-fzero-call-used-regs=all on a target that has no x87
registers.

When there is no x87 registers available, we should not
zero stack registers.

gcc/ChangeLog:

PR target/97715
* config/i386/i386.c (zero_all_st_registers): Return
earlier when the FPU is disabled.

gcc/testsuite/ChangeLog:

PR target/97715
* gcc.target/i386/zero-scratch-regs-32.c: New test.
gcc/config/i386/i386.c
gcc/testsuite/gcc.target/i386/zero-scratch-regs-32.c [new file with mode: 0644]