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



--- Comment #1 from Tilman Sauerbeck <til...@code-monkey.de> 2013-02-16 
16:49:34 UTC ---

Changing the literal in the test function so that it fits in 8 bits makes gcc

go with the TST instruction instead of AND+CMP:



unsigned f2 (unsigned x, unsigned m)

{

    if (m & 0x80)

        x >>= 8;



    return x;

}



=>

    tst    r1, #128

    movne    r0, r0, lsr #8

    bx    lr



So I guess I shouldn't ask why gcc generates AND+CMP instead of ANDS, but why

it chooses not to use TST.

Reply via email to