[Bug target/50749] SH Target: Post-increment addressing used only for first memory access

oleg.endo@t-online.de gcc-bugzilla@gcc.gnu.org
Mon Nov 28 22:54:00 GMT 2011


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

--- Comment #8 from Oleg Endo <oleg.endo@t-online.de> 2011-11-28 22:31:44 UTC ---
(In reply to comment #7)
> The problem is that SH target can't do those simple array accesses
> well at QI/HImode because of the lack of displacement addressing
> for those modes.

In these particular cases, this is true.  Even if there was a working QI/HImode
displacement addressing, it would most likely result in worse code compared to
post-inc / pre-dec addressing opportunities, because of register pressure on
R0.  Apart from that there is no displacement addressing for FPU loads/stores,
which also misses some opportunities:

float test_func_5 (float* p, int c)
{
  float r = 0;
  do
  {
    r += *p++;
    r += *p++;
    r += *p++;
  } while (--c);
  return r;
}

Compiled with -Os -m4-single:

    fldi0    fr0
.L11:
    mov    r4,r1
    fmov.s    @r1+,fr1
    dt    r5
    fadd    fr1,fr0
    fmov.s    @r1,fr1
    mov    r4,r1
    add    #8,r1
    add    #12,r4
    fadd    fr1,fr0
    fmov.s    @r1,fr1
    bf/s    .L11
    fadd    fr1,fr0
    rts    
    nop


..could be:
    fldi0    fr0
.L11:
    fmov.s    @r4+,fr1
    dt    r5
    fadd    fr1,fr0
    fmov.s    @r4+,fr1
    fadd    fr1,fr0
    fmov.s    @r4+,fr1
    bf/s    .L11
    fadd    fr1,fr0
    rts    
    nop


Specifying -fno-tree-forwprop doesn't seem to have any effect on these cases.



More information about the Gcc-bugs mailing list