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 optimization/12305] New: processor return register saved/restore unnecessarily in leaf function


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

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

           Summary: processor return register saved/restore unnecessarily in
                    leaf function
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tm at kloo dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-linux
  GCC host triplet: i386-linux
GCC target triplet: sh-elf

When this function is compiled:

int a, b; int foo(void) { return a + b; }

using -O2 -m4 -fPIC -S, the following code is created:

_foo:
        mov.l   r12,@-r15
        mova    .L3,r0
        mov.l   .L3,r12
        mov.l   r14,@-r15
        add     r0,r12
        mov.l   .L4,r0
        sts.l   pr,@-r15		<- PR saved unnecessarily
        mov.l   @(r0,r12),r1
        mov     r12,r0
        mov     r15,r14
        mov.l   @r1,r2
        mov.l   .L5,r1
        mov.l   @(r0,r1),r1
        mov.l   @r1,r1
        add     r1,r2
        mov     r2,r0
        mov     r14,r15
        lds.l   @r15+,pr		<- PR restored unnecessarily
        mov.l   @r15+,r14
        rts
        mov.l   @r15+,r12


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