------- Comment #2 from chrbr at gcc dot gnu dot org  2009-03-11 08:46 -------
I observed some large performance regressions in 4.3 and upwards for many
benchmarks for the superh targets, There are many causes but the main one is
reduced to the indirect+offset access :

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

compiles (-O2 -fomit-frame-pointer) into 
        mov     r5,r0
        add     #1,r0
        shll2   r0
        rts     
        mov.l   @(r0,r4),r0

instead of
        shll2   r5
        add     r4,r5
        rts     
        mov.l   @(4,r5),r0

Note that in more complex code the problem is emphasized because only r0
register class can be used as indirect register index, putting extra pressure
on reload.

It seems to be that the problem is in the way that the constant index is now
hidden by gimple, so we now have

 return *(tab + ((unsigned int) index + 1) * 4)

instead of 

 return *(tab + 4B + (int *) ((unsigned int) index * 4))

It seems more easy to change gimple, but this is a target dependant
transformation. On the other hand the RTL code gen should be able to
redistribute the factorization, but that seems extra work to undo what was done
previously.


-- 

chrbr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |
            Summary|[                           |[SH]  performance
                   |                            |regression: lost mov
                   |                            |@(disp,Rn)


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

Reply via email to