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

--- Comment #5 from Lee Duhem <lee.duhem at gmail dot com> ---
(In reply to Andrew Pinski from comment #4)
> (In reply to Andrew Pinski from comment #3)
> > Looks like sibcalls are incorrectly done.
> 
> Or maybe not since it is no longer a call but rather a sibcall which means
> it can never be using call16 here since it is not a real call. 
> 
> Smallest testcase:
> int shouldbecall16(void);
> int g(void) { return shouldbecall16(); }

I think the following testcase is closer to my case:
int shouldbecall16(void);
int g(void) { shouldbecall16(); return 0; }

And in this case, I got (with or without -O2):
    daddiu    $sp,$sp,-16
    sd    $28,0($sp)
    lui    $28,%hi(%neg(%gp_rel(g)))
    daddu    $28,$28,$25
    daddiu    $28,$28,%lo(%neg(%gp_rel(g)))
    ld    $25,%call16(shouldbecall16)($28)
    sd    $31,8($sp)
    .reloc    1f,R_MIPS_JALR,shouldbecall16
1:    jalr    $25
    nop


Thank you for your time.

Reply via email to