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

             Bug #: 54602
           Summary: [SH] Register pop insn not put in rts delay slot
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: olege...@gcc.gnu.org
            Target: sh*-*-*


The following case:

int test01 (int a, int b);

int test00 (int a, int b, int c, int d)
{
  return test01 (a, b) + c;
}

Compiled with -O2 -m2:
        mov.l    .L3,r0          ! 9    movsi_i/1    [length = 2]
        mov.l   r8,@-r15        ! 26    movsi_i/7    [length = 2]
        sts.l   pr,@-r15        ! 27    movsi_i/9    [length = 2]
        jsr     @r0             ! 12    call_valuei    [length = 2]
        mov     r6,r8           ! 4    movsi_i/2    [length = 2]
        add     r8,r0           ! 14    *addsi3_compact    [length = 2]
        lds.l   @r15+,pr        ! 33    *movsi_pop/3    [length = 2]
        mov.l   @r15+,r8        ! 34    *movsi_pop/1    [length = 2]
        rts
        nop                     ! 36    *return_i    [length = 4]

Compiled with -O2 -m2a:
        mov.l   .L3,r0          ! 9    movsi_ie/1    [length = 2]
        mov.l   r8,@-r15        ! 30    movsi_ie/9    [length = 4]
        sts.l   pr,@-r15        ! 31    movsi_ie/11    [length = 2]
        jsr     @r0             ! 12    call_valuei    [length = 2]
        mov     r6,r8           ! 4    movsi_ie/2    [length = 2]
        add     r8,r0           ! 14    *addsi3_compact    [length = 2]
        lds.l   @r15+,pr        ! 37    *movsi_pop/3    [length = 2]
        mov.l   @r15+,r8        ! 38    *movsi_pop/1    [length = 2]
        rts/n                   ! 40    *return_i    [length = 4]

The pop insn of r8 is not placed in the delay slot of rts without any obvious
reason.  This happens only for -m1 and -m2*.

Reply via email to