[Bug target/39423] [4.7/4.8/4.9 Regression] [SH] performance regression: lost mov @(disp,Rn)

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jun 23 14:55:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39423

--- Comment #36 from Oleg Endo <olegendo at gcc dot gnu.org> ---
This is annoying:

int
foo (int tab[], int index)
{
  return tab[index+1] + tab[index+2];
}

-O2 -m4 -mb:

        add     #1,r5
        mov     r4,r1
        shll2   r5
        add     r5,r1
        mov     r5,r0
        mov.l   @(4,r1),r1
        mov.l   @(r0,r4),r2
        add     r1,r2
        rts
        mov     r2,r0

should be:

        shll2   r5
        add     r4,r5
        mov.l   @(4,r5),r0
        mov.l   @(8,r5),r1
        rts
        add     r1,r0

Somehow this is a typical problem for combine based 'fixes' -- it works for a
single case, but falls apart when there are multiple uses of the same pattern.



More information about the Gcc-bugs mailing list