[Bug target/55666] New: Use scratch register to avoid save/restore of callee saved register

carrot at google dot com gcc-bugzilla@gcc.gnu.org
Wed Dec 12 19:47:00 GMT 2012


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

             Bug #: 55666
           Summary: Use scratch register to avoid save/restore of callee
                    saved register
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: carrot@google.com


Compile the attached source code with options:  -march=armv7-a -mthumb -O2

I get the following instructions


YUY2ToUVRow_NEON:
    @ args = 4, pretend = 0, frame = 0
    @ frame_needed = 0, uses_anonymous_args = 0
    @ link register save eliminated.
    push    {r4}
    ldr    r4, [sp, #4]
#APP
@ 5 "tx.i" 1
    adds       r1, r0, r1                     
.p2align  2                               
1:                                          
vld4.8     {d0, d1, d2, d3}, [r0]!        
vld4.8     {d4, d5, d6, d7}, [r1]!        
vrhadd.u8  d1, d1, d5                     
vrhadd.u8  d3, d3, d7                     
vst1.u8    {d1}, [r2]!                    
vst1.u8    {d3}, [r3]!                    
subs       r4, r4, #16                    
bgt        1b                             

@ 0 "" 2
    .thumb
    ldr    r4, [sp], #4
    bx    lr


If we replace all usage of r4 with a scratch register r12, then we can avoid
the save/restore of r4.



More information about the Gcc-bugs mailing list