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

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |sh*-*-* arm*-*-* cris*-*-*
                 CC|                            |olegendo at gcc dot gnu.org

--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> ---
On SH there's a similar issue.  E.g. compiling

void exit (int __status) __attribute__ ((noreturn));

int test (int a, int b, int c)
{
  if (a == b)
    return 5;

  if (a)
    exit (0);

  return 0;
}

with -O2 -m4 results in:

_test:
        cmp/eq  r5,r4
        bt/s    .L3
        tst     r4,r4
        bf/s    .L10
        mov     #0,r0
        rts
        nop
.L3:
        rts
        mov     #5,r0
.L10:
        mov.l   .L11,r1
        sts.l   pr,@-r15     // push return address register
        jsr     @r1          // jump to subroutine
        mov     #0,r4
.L12:
        .align 2
.L11:
        .long   _exit

The jsr should be a simple jmp and the pr push is not required (as with leaf
function calls).

Reply via email to