reload bugfix

Alexandre Oliva aoliva@redhat.com
Tue Aug 22 06:01:00 GMT 2000


On Aug 20, 2000, Bernd Schmidt <bernds@cygnus.co.uk> wrote:

> On 19 Aug 2000, Alexandre Oliva wrote:
>> 
>> Does this make sense for you?

> Not entirely.  Could you provide debug_reload output (for both variants)?

Sure.  The first problem showed up with
gcc.c-torture/compile/930611-1.c -O0 -m4:

/home/guarana/aoliva/cygnus/src/devo-sh/gcc/testsuite/gcc.c-torture/compile/930611-1.c: In function `f':
/home/guarana/aoliva/cygnus/src/devo-sh/gcc/testsuite/gcc.c-torture/compile/930611-1.c:7: Unable to find a register to spill in class `R0_REGS'.
/home/guarana/aoliva/cygnus/src/devo-sh/gcc/testsuite/gcc.c-torture/compile/930611-1.c:7: This is the insn:

(insn 46 45 47 (parallel[ 
            (set (reg:SF 66)
                (const_double:SF (cc0) 0 [0x0] 1072693248 [0x3ff00000] [1]))
            (use (reg/v:PSI 48 fpscr))
            (clobber (scratch:SI))
        ] ) 91 {movsf_ie} (nil)
    (expr_list:REG_DEAD (reg/v:PSI 48 fpscr)
        (expr_list:REG_UNUSED (scratch:SI)
            (nil))))

(gdb) p debug_reload()
Reload 0: reload_in (SI) = (const_int 8 [0x8])
	R0_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 0)
	reload_in_reg: (const_int 8 [0x8])
Reload 1: R0_REGS, RELOAD_FOR_INPUT (opnum = 1), can't combine, secondary_reload_p
Reload 2: reload_in (SF) = (const_double:SF (cc0) 0 [0x0] 1072693248 [0x3ff00000] [1])
	FP_REGS, RELOAD_FOR_INPUT (opnum = 1)
	reload_in_reg: (const_double:SF (cc0) 0 [0x0] 1072693248 [0x3ff00000] [1])
	secondary_in_reload = 1
	secondary_in_icode = reload_insf

Note that both reloads want a register in R0_REGS, but, as you know,
there's only one register in this class.

The patch I posted for sh.md fixes this problem, but then
newlib/libc/stdlib/strtod.c no longer compiles with -O2 -m3e:

/home/guarana/aoliva/cygnus/src/devo-sh/newlib/libc/stdlib/strtod.c: In function `_strtod_r':
/home/guarana/aoliva/cygnus/src/devo-sh/newlib/libc/stdlib/strtod.c:712: Insn does not satisfy its constraints:
(insn 23 2729 24 (parallel[ 
            (set (mem:SF (plus:SI (reg:SI 14 r14)
                        (reg:SI 0 r0)) 59)
                (const_double:SF (cc0) 0 [0x0] 0 [0x0] [0]))
            (use (reg/v:PSI 48 fpscr))
            (clobber (reg:SI 0 r0))
        ] ) 91 {movsf_ie} (nil)
    (nil))

See how it is using r0 in two places, even though in the case of
clobber it is an earlyclobber.

Here's the output of debug_reload() after choose_reload_regs() for
insn 23 returns:

Reload 0: reload_in (SI) = (const_int 32 [0x20])
	R0_REGS, RELOAD_FOR_OPADDR_ADDR (opnum = 0)
	reload_in_reg: (const_int 32 [0x20])
	reload_reg_rtx: (reg:SI 0 r0)
Reload 1: reload_out (SF) = (mem:SF (plus:SI (reg:SI 14 r14)
                                                        (const_int 32 [0x20])) 59)
	NO_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
	reload_out_reg: (subreg:SF (reg/v:DI 87) 0)
Reload 2: reload_out (SI) = (scratch:SI)
	GENERAL_REGS, RELOAD_FOR_INSN (opnum = 3)
	reload_out_reg: (scratch:SI)
	reload_reg_rtx: (reg:SI 0 r0)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc-patches mailing list