new-ra thrashing on target sh-elf

tm_gccmail@mail.kloo.net tm_gccmail@mail.kloo.net
Thu Apr 10 01:31:00 GMT 2003


I've been testing new-ra lately, and have noticed some oddities.
It's still doing weird stuff like transferring DFmode values to
integer registers and back again.

Here's a sample:

This is g_misc.i/barrel_explode() from stress-1.17 compiled with -O2 -m4
-fnew-ra. The SH4 can't do DFmode stores to memory, so it hst post-reload
splits into two consecutive SFmode stores of the two SFmode halves of the
DFmode register.

...
        mov.l   r3,@-r15	<- store r2/r3 to the stack...
        mov.l   r2,@-r15
        fsub    dr14,dr4
        flds    fr1,fpul
        fcnvsd  fpul,dr2
        fadd    dr4,dr4
        fmul    dr2,dr4
        fmov.s  @r15+,fr2	<- load it into dr2 (fr2/fr3)
        fmov.s  @r15+,fr3
        fadd    dr4,dr2
        fmov.s  fr3,@-r15	<- store dr2...
        fmov.s  fr2,@-r15
        mov.l   @r15+,r2	<- load into integer registers...
        mov.l   @r15+,r3
        mov.l   r3,@-r15	<- save from integer registers...
        mov.l   r2,@-r15
        fmov.s  @r15+,fr2	<- back into dr2...
        fmov.s  @r15+,fr3
        mov.l   r3,@-r15	<- store integer values again...
        mov.l   r2,@-r15
        fmov.s  @r15+,fr2	<- load it back into dr2...
        mov.l   @(32,r14),r1
        fmov.s  @r15+,fr3
        fcnvds  dr2,fpul
        fsts    fpul,fr1
        fmov.s  fr1,@r14
        fmov.s  @r1,fr1
        flds    fr1,fpul
        fcnvsd  fpul,dr2
        fmov.s  fr3,@-r15
        fmov.s  fr2,@-r15
...
        fmov.s  fr3,@-r15	<- same type of silliness here
        fmov.s  fr2,@-r15
        mov.l   @r15+,r2	<- here
        mov.l   @r15+,r3
        mov.l   r3,@-r15	<- here
        mov.l   r2,@-r15
        fmov.s  @r15+,fr2	<- here
        fmov.s  @r15+,fr3
        mov.l   r3,@-r15	<- here
        mov.l   r2,@-r15
        fmov.s  @r15+,fr2	<- here
        fmov.s  @r15+,fr3
        fcnvds  dr2,fpul
        fsts    fpul,fr1
        fmov.s  fr1,@r1
        mov.l   @(36,r14),r1
        fmov.s  @r1,fr1
        flds    fr1,fpul
        fcnvsd  fpul,dr2
        fmov.s  fr3,@-r15	<- here
        fmov.s  fr2,@-r15	<- here
        mov.l   @r15+,r2
        mov.l   @r15+,r3
...
        mov.l   r3,@-r15	<- here
        mov.l   r2,@-r15
        fsub    dr14,dr4
        flds    fr1,fpul
        fcnvsd  fpul,dr2
        fadd    dr4,dr4
        fmul    dr2,dr4
        fmov.s  @r15+,fr2	<- here
        fmov.s  @r15+,fr3
        fadd    dr4,dr2
        fmov.s  fr3,@-r15	<- here
        fmov.s  fr2,@-r15
        mov.l   @r15+,r2	<- here
        mov.l   @r15+,r3
        mov.l   r3,@-r15	<- here
        mov.l   r2,@-r15
        fmov.s  @r15+,fr2	<- here
        fmov.s  @r15+,fr3
        mov.l   r3,@-r15	<- here
        mov.l   r2,@-r15
        fmov.s  @r15+,fr2
        mov.l   @(32,r14),r1
        fmov.s  @r15+,fr3
        fcnvds  dr2,fpul
        fsts    fpul,fr1
        fmov.s  fr1,@r14
        fmov.s  @r1,fr1
        flds    fr1,fpul
        fcnvsd  fpul,dr2
        fmov.s  fr3,@-r15
        fmov.s  fr2,@-r15
...
        fmov.s  @r15+,fr2	<- here
        fmov.s  @r15+,fr3
        fadd    dr4,dr2
        fmov.s  fr3,@-r15	<- here
        fmov.s  fr2,@-r15
        mov.l   @r15+,r2	<- here
        mov.l   @r15+,r3
        mov.l   r3,@-r15	<- here
        mov.l   r2,@-r15
        fmov.s  @r15+,fr2	<- here
        fmov.s  @r15+,fr3
        mov.l   r3,@-r15	<- here
        mov.l   r2,@-r15
        fmov.s  @r15+,fr2	<- here
        fmov.s  @r15+,fr3
...etc.

I checked without -fnew-ra, and the output code seems reasonable.
Here's a quick sanity check:

			without -fnew-ra	with -fnew-ra
----------------------------------------------------------------
barrel_explode:		1407 lines		2232 lines

So, there seems to be a problem with new-regalloc on this testcase.

Toshi



More information about the Gcc-bugs mailing list