[Bug target/63321] [SH] Unused T bit result of shll / shlr insns

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 2 09:43:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63321

--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> ---
A more advanced example:

void test4 (unsigned int x, unsigned int* y)
{
  y[0] = (x >> 0) & 1;
  y[1] = (x >> 1) & 1;
  y[2] = x >> 2;
}

currently compiles to:
        mov     r4,r0
        and     #1,r0
        mov.l   r0,@r5
        mov     r4,r0
        shlr    r0
        and     #1,r0
        shlr2   r4
        mov.l   r0,@(4,r5)
        rts
        mov.l   r4,@(8,r5)

better:
        shlr     r4
        movt     r0
        shlr     r4
        mov.l    r0,@r5
        movt     r1
        mov.l    r4,@(8,r5)
        rts
        mov.l    r1,@(4,r5)



More information about the Gcc-bugs mailing list