This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/53976] [SH] Unnecessary clrt after bt
- 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 20:50:23 +0000
- Subject: [Bug target/53976] [SH] Unnecessary clrt after bt
- Auto-submitted: auto-generated
- References: <bug-53976-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53976
--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-09-23 20:50:23 UTC ---
The clrt insn gets placed into another basic block, thus using a peephole will
not work in this case. In order to be able to eliminate the clrt (or any sett)
the value of the T bit must be tracked not only inside a basic block but also
across basic blocks.
Another case, which shows that the T bit value is lost and has to be
recalculated:
int test_2 (volatile int* a, int b, int c)
{
a[1] = b != 0;
if (b == 0)
a[10] = c;
return b == 0;
}
compiled with -O2 -m4:
tst r5,r5
mov #-1,r1
negc r1,r1
mov.l r1,@(4,r4)
tst r5,r5 !! OK, negc above clobbers T bit
bf .L2
mov.l r6,@(40,r4)
.L2:
tst r5,r5 !! T bit lost in new BB
rts
movt r0
compiled with -O2 -m2a:
tst r5,r5
movrt r1
mov.l r1,@(4,r4)
bf.s .L4
tst r5,r5 !! T bit lost in new BB
mov.l r6,@(40,r4)
tst r5,r5 !! T bit lost in new BB
.L4:
rts
movt r0