[Bug target/51244] [SH] Inefficient conditional branch and code around T bit
olegendo at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 23 21:42:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51244
--- Comment #53 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-09-23 21:41:55 UTC ---
Another case that seems to go awry:
int test_1 (int a, int b, int c, int* d)
{
bool x = a == 0;
d[2] = !x;
return x ? b : c;
}
-O2 -m4:
tst r4,r4
mov #1,r1
movt r0
xor r0,r1
tst r0,r0
bt/s .L5
mov.l r1,@(8,r7)
mov r5,r6
.L5:
rts
mov r6,r0
This should be something like:
tst r4,r4
movt r0
xor #1,r0
bf/s .L5
mov.l r1,@(8,r7)
mov r5,r6
.L5:
rts
mov r6,r0
-O2 -m2a:
tst r4,r4
movt r0
mov #1,r1
xor r0,r1
mov.l r1,@(8,r7)
tst r0,r0
bf .L6
mov r6,r0
rts/n
.align 1
.L6:
rts
mov r5,r0
This should be:
tst r4,r4
movrt r1
mov.l r1,@(8,r7)
bt .L6
mov r6,r0
rts/n
.align 1
.L6:
rts
mov r5,r0
More information about the Gcc-bugs
mailing list