------- Comment #7 from ramana at gcc dot gnu dot org  2009-06-16 10:01 -------
(In reply to comment #5)
> See the attached pqp.c file.
> 
> With gcc 4.3.3, on such simplistic examples, peephole ldm and stm works:
> 
> sum:
>         ldr     r2, .L3
>         ldmia   r2, {r1, r3}    @ phole ldm
>         add     r3, r0, r3
>         add     r0, r0, r1
>         stmia   r2, {r0, r3}    @ phole stm
>         bx      lr
> 
> 
> With gcc 4.4.0 branch, built on 20090413, it fails:
> 
> sum:
>         @ args = 0, pretend = 0, frame = 0
>         @ frame_needed = 0, uses_anonymous_args = 0
>         @ link register save eliminated.
>         ldr     r3, .L3
>         ldr     r2, [r3, #0]
>         ldr     r1, [r3, #4]
>         add     r2, r0, r2
>         add     r1, r0, r1
>         str     r1, [r3, #4]
>         str     r2, [r3, #0]
>         bx      lr
> 


We can't use stm or ldm on the second case because ldm's and stm's depend on
the lowest numbered register going to the lowest memory address. It's a relic
of the register allocator choosing a different order for the registers for such
cases.

ldm's and stm's are not easily describable in the RTL backend and are
semi-bolted on on top of the existing infrastructure using peepholes.


-- 


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

Reply via email to