mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-22 15:00:55 +08:00
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.
This commit is contained in:
parent
54cbdb528d
commit
cc32e81cdb
@ -3640,6 +3640,11 @@ zero_all_vector_registers (HARD_REG_SET need_zeroed_hardregs)
|
||||
static bool
|
||||
zero_all_st_registers (HARD_REG_SET need_zeroed_hardregs)
|
||||
{
|
||||
|
||||
/* If the FPU is disabled, no need to zero all st registers. */
|
||||
if (! (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387))
|
||||
return false;
|
||||
|
||||
unsigned int num_of_st = 0;
|
||||
for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
|
||||
if ((STACK_REGNO_P (regno) || MMX_REGNO_P (regno))
|
||||
|
11
gcc/testsuite/gcc.target/i386/zero-scratch-regs-32.c
Normal file
11
gcc/testsuite/gcc.target/i386/zero-scratch-regs-32.c
Normal file
@ -0,0 +1,11 @@
|
||||
/* { dg-do compile { target *-*-linux* } } */
|
||||
/* { dg-options "-O2 -fzero-call-used-regs=all -mno-80387" } */
|
||||
|
||||
int
|
||||
foo (int x)
|
||||
{
|
||||
return (x + 1);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-not "fldz" } } */
|
||||
|
Loading…
x
Reference in New Issue
Block a user