This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/51244] [SH] Inefficient conditional branch and code around T bit
- From: "olegendo at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 23 Sep 2012 21:41:55 +0000
- Subject: [Bug target/51244] [SH] Inefficient conditional branch and code around T bit
- Auto-submitted: auto-generated
- References: <bug-51244-4@http.gcc.gnu.org/bugzilla/>
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