This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/11708] New: Non-Optimal jump code generation.
- From: "naveens at noida dot hcltech dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jul 2003 13:42:33 -0000
- Subject: [Bug optimization/11708] New: Non-Optimal jump code generation.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11708
Summary: Non-Optimal jump code generation.
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: naveens at noida dot hcltech dot com
CC: gcc-bugs at gcc dot gnu dot org,joern dot rennecke at
superh dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: sh-unknown-elf
I am seeing some redundant jumps in code generated by GCC3.3 and
the mainline. e.g. I see this assembly generated for
one of my benchmark (sh-elf target, options: -ml -m4 -O2)
! basic block 1
cmp/pl r3
mov.w .L147,r1
bt .L3 <--- conditional branch C1
mov #0,r1
bra .L208 <--- Branch B1
mov r1,r3 <--- delay slot
.L3:
! basic block 2
mov r1,r3
.L208:
mov.w .L149,r2
mov.w .L150,r1
cmp/gt r1,r3
bt .L7
It seems it should be better generated as:
! basic block 1
cmp/pl r3
mov.w .L147,r1
bt .L208 <--- conditional branch C1
mov #0,r1
.L208:
! basic block 2
mov r1,r3
mov.w .L149,r2
mov.w .L150,r1
cmp/gt r1,r3
bt .L7
So, a jump(bra) instruction could be eliminated.