http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49263
--- Comment #14 from Oleg Endo <oleg.e...@t-online.de> 2011-11-20 13:04:39 UTC --- With trunk rev 181517 I have observed the following problem, which happens when compiling for -m2*, -m3*, -m4* and -Os: The function compiled with -m2 -Os int test_int64_lowword (long long* x) { return *x & 0xFFFFFFFF ? -20 : -40; } results in the following code: mov #0,r2 ! 42 movsi_i/3 [length = 2] tst r2,r2 ! 44 cmpeqsi_t/1 [length = 2] bf.s .L4 ! 45 branch_false [length = 2] mov.l @(4,r4),r3 ! 12 movsi_i/5 [length = 2] tst r3,r3 ! 46 cmpeqsi_t/1 [length = 2] .L4: bt .L3 ! 14 branch_true [length = 2] mov #-20,r0 ! 4 movsi_i/3 [length = 2] rts nop ! 52 *return_i [length = 4] .L3: rts ! 54 *return_i [length = 2] mov #-40,r0 ! 5 movsi_i/3 [length = 2] When compiled with -O1 or -O2 the high word test is completely eliminated correctly: mov.l @(4,r4),r1 ! 10 movsi_i/5 [length = 2] tst r1,r1 ! 17 cmpeqsi_t/1 [length = 2] bt .L4 ! 18 branch_true [length = 2] mov #-20,r0 ! 4 movsi_i/3 [length = 2] rts nop ! 50 *return_i [length = 4] .L4: rts ! 52 *return_i [length = 2] mov #-40,r0 ! 5 movsi_i/3 [length = 2] I'm not sure whether this is actually related to this PR, but have noticed it with the test cases of this PR. It seems only to happen for comparison-like insns. If I remember correctly, this problem did not exist when I started working on this PR.