[Bug target/54065] New: [SH] Prefer @(R0,Rn) addressing for floating-point load/store

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jul 22 01:25:00 GMT 2012


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

             Bug #: 54065
           Summary: [SH] Prefer @(R0,Rn) addressing for floating-point
                    load/store
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: olegendo@gcc.gnu.org
            Target: sh*-*-*


The following function

float test00 (float* x)
{
  return x[10] + x[1] + x[20] + x[30];
}

compiled with e.g. '-O2 -m4-single -ml' results in:

        mov     r4,r2
        mov     r4,r1
        add     #40,r2
        add     #4,r1
        fmov.s  @r2,fr0
        fmov.s  @r1,fr1
        add     #76,r1
        add     #120,r4
        fadd    fr1,fr0
        fmov.s  @r1,fr1
        fadd    fr1,fr0
        fmov.s  @r4,fr1
        rts
        fadd    fr1,fr0

which would be better as:

    mov    #40,r0
    fmov.s    @(r0,r2),fr0
    mov    #4,r0
    fmov.s    @(r0,r1),fr1
    mov    #80,r0
    fadd    fr1,fr0
    fmov.s    @(r0,r1),fr1
    mov    #120,r0    
    fadd    fr1,fr0
    fmov.s    @(r0,r4),fr1
    rts
    fadd    fr1,fr0

In sh.md (around line 11724) there are some old peephole patterns that were
supposed to handle this case, I guess.  However, they seem to be defunct.



More information about the Gcc-bugs mailing list