This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
decrement and branch optimization broken?
- To: gcc <gcc at gcc dot gnu dot org>
- Subject: decrement and branch optimization broken?
- From: Roman Zippel <zippel at linux-m68k dot org>
- Date: Fri, 27 Jul 2001 17:00:07 +0200
Hi,
I can't get 3.x to produce dbra instructions on m68k anymore.
For e.g.:
int f(void);
void f1(void)
{
short i = 32;
do {
f();
} while (--i >= 0);
}
2.95 produces this:
lea f,%a2
.L6:
jbsr (%a2)
dbra %d2,.L6
The problem is that the combine pass doesn't optimize this:
(insn 21 18 23 (set (reg/v:HI 29)
(plus:HI (reg/v:HI 29)
(const_int -1 [0xffffffff]))) 101 {addhi3} (nil)
(nil))
(insn 23 21 24 (set (cc0)
(reg/v:HI 29)) 4 {*m68k.md:384} (insn_list 21 (nil))
(nil))
(jump_insn 24 23 28 (set (pc)
(if_then_else (ge (cc0)
(const_int 0 [0x0]))
(label_ref 11)
(pc))) 322 {bge} (nil)
(expr_list:REG_BR_PROB (const_int 9697 [0x25e1])
(expr_list:REG_NONNEG (reg/v:HI 29)
(nil))))
into this anymore:
(jump_insn 32 31 36 (parallel[
(set (pc)
(if_then_else (ge (plus:HI (reg/v:HI 29)
(const_int -1 [0xffffffff]))
(const_int 0 [0x0]))
(label_ref 35)
(pc)))
(set (reg/v:HI 29)
(plus:HI (reg/v:HI 29)
(const_int -1 [0xffffffff])))
] ) 409 {decrement_and_branch_until_zero-1} (nil)
(expr_list:REG_NONNEG (nil)
(expr_list:REG_NONNEG (nil)
(nil))))
Does anyone has an idea, what goes wrong or how to fix this?
bye, Roman