This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: new-ra weirdness



On Tuesday, July 15, 2003, at 7:06 PM, <tm_gccmail@mail.kloo.net> wrote:



host: i386-linux target: sh-elf version: CVS head today

new-ra is performing unspeakable acts on some of my SH4 testcases.
It seems to be spilling the FPU registers to integer registers....through
memory. There is no fast way to move the FPU registers to the integer
registers on the SH4, so it shouldn't be doing this at all.


Also, it seems to be generating lots of useless loads and stores.
It loads a DFmode value into two integer pairs, then does nothing
and stores it back.

As I pointed out to Toshi on IRC, memory_move_cost is not defined on SH, and thus, gets the default value of "4".
In contrast, the register move cost on SH ranges from 4 to 20.
The costs are relative, so a memory_move_cost of 4 and a register move cost of 20 means the memory move is 5 times cheaper.


So it thinks it's *cheaper* to move this stuff around in memory, then it would be to move it around in registers.

Given the numbers right now, I think new-ra is doing the absolute right thing here, because it's done the cheapest thing it knows how to do, which is move this stuff through memory.

If the MEMORY_MOVE_COST is corrected to be more expensive than the REGISTER_MOVE_COST and it *still* does this for no apparent reason (IE it moves through memory when it could move through registers), *then* something is borked.


Here's some samples from quatern.i from stress-1.17 compiled with -O2 -m4 -fnew-ra:


_Normal_Calc_z3: ... mov.l r3,@-r15 mov.l r2,@-r15 ... fmov.s @r15+,fr2 fmov.s @r15+,fr3 ... mov.l r3,@-r15 mov.l r2,@-r15 ... fmov.s @r15+,fr6 fmov.s @r15+,fr7 ... mov.l r3,@-r15 mov.l r2,@-r15 fmov.s @r15+,fr14 fmov.s @r15+,fr15 ... fmov.s fr7,@-r15 fmov.s fr6,@-r15 mov.l @r15+,r10 mov.l @r15+,r11 ... fmov.s fr7,@-r15 fmov.s fr6,@-r15 mov.l @r15+,r2 mov.l @r15+,r3 ... fmov.s fr3,@-r15 <- do 16 memory load/stores to execute one fmov.s fr2,@-r15 <- floating-point multiply mov.l @r15+,r10 mov.l @r15+,r11 mov.l r11,@-r15 mov.l r10,@-r15 fmov.s @r15+,fr14 fmov.s @r15+,fr15 mov.l r3,@-r15 mov.l r2,@-r15 fmov.s @r15+,fr2 fmov.s @r15+,fr3 fmul dr2,dr14 fmov.s fr15,@-r15 fmov.s fr14,@-r15 mov.l @r15+,r10 mov.l @r15+,r11 ,,,

        mov.l   @r15+,r2	<- load r2/r3...
        mov.l   @r15+,r3
        fmov.s  @r0,fr3
        mov     #8,r0
        mov.l   r3,@-r15	<- save back r2/r3 unchanged!!!
        mov.l   r2,@-r15
...
        mov.l   @r15+,r2	<- load r2/r3...
        mov.l   @r15+,r3
        fmov.s  @r0,fr7
        mov     #24,r0
        mov.l   r3,@-r15	<- save back r2/r3 unchanged!!!
        mov.l   r2,@-r15
...
        mov.l   @r15+,r2	<- load r2/r3...
        mov.l   @r15+,r3
        mov.l   r3,@-r15	<- save back r2/r3 unchanged!!!
        mov.l   r2,@-r15
...
        mov.l   @r15+,r10
        mov.l   @r15+,r11
        mov.l   r11,@-r15
        mov.l   r10,@-r15
...
        mov.l   @r15+,r2	<- load r2/r3
        mov.l   @r15+,r3
        fmov.s  @r0,fr3
        mov     #48,r0
        mov.l   r3,@-r15	<- save back r2/r3 unchanged!!!
        mov.l   r2,@-r15
...
        mov.l   @r15+,r2
        mov.l   @r15+,r3
        fmov.s  @r0,fr3
        mov     #48,r0
        mov.l   r3,@-r15
        mov.l   r2,@-r15
...
        mov.l   @r15+,r2
        mov.l   @r15+,r3
        fmov.s  @r0,fr7
        mov     #72,r0
        mov.l   r3,@-r15
        mov.l   r2,@-r15
...

Have any idea what's going on?

Toshi




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]