http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54019
Bug #: 54019
Summary: [SH] Tail calls with -fPIC use bsrf instead of braf
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: target
AssignedTo: [email protected]
ReportedBy: [email protected]
Target: sh*-*-*
The following function:
int a, b;
int bleh (int x, int y);
int foo (void)
{
return bleh (a + b, a - b);
}
compiled with -m4 -O2 -ml -fPIC:
mov.l r12,@-r15 ! 42 movsi_ie/11 [length = 2]
mova .L3,r0 ! 44 mova [length = 2]
mov.l .L3,r12 ! 45 movsi_ie/1 [length = 2]
sts.l pr,@-r15 ! 43 movsi_ie/13 [length = 2]
add r0,r12 ! 46 *addsi3_compact [length = 2]
mov.l .L4,r0 ! 5 movsi_ie/1 [length = 2]
mov.l @(r0,r12),r2 ! 7 movsi_ie/7 [length = 2]
mov.l .L5,r0 ! 34 movsi_ie/1 [length = 2]
mov.l @r2,r5 ! 8 movsi_ie/7 [length = 2]
mov.l @(r0,r12),r1 ! 11 movsi_ie/7 [length = 2]
mov r5,r4 ! 37 movsi_ie/2 [length = 2]
mov.l @r1,r1 ! 12 movsi_ie/7 [length = 2]
add r1,r4 ! 15 *addsi3_compact [length = 2]
sub r1,r5 ! 16 *subsi3_internal [length = 2]
mov.l .L6,r1 ! 39 movsi_ie/1 [length = 2]
bsrf r1 ! 41 call_valuei_pcrel [length = 4]
.LPCS0:
nop
lds.l @r15+,pr ! 55 movsi_ie/17 [length = 2]
rts ! 58 *return_i [length = 2]
mov.l @r15+,r12 ! 56 movsi_ie/7 [length = 2]
.L7:
.align 2
.L3:
.long _GLOBAL_OFFSET_TABLE_
.L4:
.long _a@GOT
.L5:
.long _b@GOT
.L6:
.long __Z4blehii@PLT-(.LPCS0+2-.)
.cfi_endproc
Instead of 'bsrf' the 'braf' instruction could be used.
Maybe this is a side effect of PR 12306.