This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/11708] 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 14:10:10 -0000
- Subject: [Bug optimization/11708] Non-Optimal jump code generation.
- References: <20030729134233.11708.naveens@noida.hcltech.com>
- 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
------- Additional Comments From naveens at noida dot hcltech dot com 2003-07-29 14:10 -------
It seems, delay slot scheduling has the responsibility of generating
optimal code here.
In fact, it is able to do the required transformation in some cases. e.g.
Consider this part of the assembler
with -fno-delayed-branch -O2 -ml -m4 -S -dA
! basic block 25
cmp/pl r3
mov.w .L147,r1
bt .L203
bra .L93
nop
.L203:
.L36:
! basic block 26
..... snipped ...
.L93:
! basic block 69
mov #0,r1
bra .L36
nop
.align 5
With -fdelayed-branch, this is optimized to:
! basic block 25
cmp/pl r3
mov.w .L147,r1
bt .L36
mov #0,r1
.L36:
! basic block 26
mov.w .L136,r3
mov.w .L149,r2
add r1,r3
mov.w .L150,r1
cmp/gt r1,r3
So, it seems that delayed branch scheduling is able to
optimize some cases, but misses some. I will try to
confirm the reason.