------- Comment #1 from ramana at gcc dot gnu dot org  2009-12-30 00:08 -------
What architecture options are you using  ? With         .ident  "GCC: (GNU)
4.5.0 20091229 (experimental)" and -O2 I get the redundant move into r4 of sp . 

But for -Os I get the following very different code.  I don't see the call to
memset ever. 

        .text
        .align  2
        .global foo
        .type   foo, %function
foo:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        stmfd   sp!, {r0, r1, r2, lr}   @,
        mov     r3, r0  @ a, a
        ldr     r2, [r0, #12]   @ tmp142,
        str     r2, [sp, #0]    @ tmp142,
        ldr     r0, .L2 @,
        ldmia   r3, {r1, r2, r3}        @ phole ldm
        bl      printf  @
        ldmfd   sp!, {r1, r2, r3, pc}
.L3:
        .align  2
.L2:
        .word   .LC0
        .size   foo, .-foo
        .section        .rodata.str1.1,"aMS",%progbits,1
.LC0:
        .ascii  "%d %d %d %d \012\000"
        .ident  "GCC: (GNU) 4.5.0 20091229 (experimental)"
        .section        .note.GNU-stack,"",%progbits


-- 

ramana at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|unnecessary register move   |unnecessary register move


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

Reply via email to