This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/10946] New: sibcall optimization does not call directly to sibling


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: sibcall optimization does not call directly to sibling
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pinskia@physics.uc.edu
                CC: gcc-bugs@gcc.gnu.org
 GCC build triplet: powerpc-apple-darwin6.6
  GCC host triplet: powerpc-apple-darwin6.6
GCC target triplet: powerpc-apple-darwin6.6

compile with -O3 -static or -O3 -mdynamic-no-pic:
int f(int i);

int g(int i, int j)
{
        if(i)
                return f(i);
        else
                return j*2*j;
}

Asm:
_g:
        cmpwi cr0,r3,0
        bne- cr0,L5
        mullw r0,r4,r4
        slwi r3,r0,1
        blr
L5:
        b _f

The better way is to do this and not to have an extra branch:
_g:
        cmpwi cr0,r3,0
        bne- cr0,_f
        mullw r0,r4,r4
        slwi r3,r0,1
        blr



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]