------- Comment #8 from rearnsha at arm dot com  2010-02-08 16:30 -------
Subject: Re:  [arm] Combine cannot do its job because
        immediate operand is used instead of register


On Mon, 2010-02-08 at 16:11 +0000, steven at gcc dot gnu dot org wrote:
> Can someone please explain what the expected code is?

Something like

        stmfd   sp!, {r3, r4, r5, lr}
        mov     r4, r0
        mov     r5, #255
        mov     r1, r4, lsr #24
        mov     r0, #8
        bl      func
        and     r1, r5, r4, lsr #16
        mov     r0, #8
        bl      func
        mov     r1, r5, r4, lsr #8
        mov     r0, #8
        ldmfd   sp!, {r3, r4, r5, lr}
        b       func

By putting 255 into a register we add one instruction, but remove 2; so
save one overall.  This is one of the rare cases where an immediate is
actually more expensive on ARM than using a register.


-- 


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

Reply via email to