This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/37734] Missing optimization: gcc fails to reuse flags from already calculated expression for condition check with zero
- From: "siarhei dot siamashka at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Oct 2008 02:48:32 -0000
- Subject: [Bug target/37734] Missing optimization: gcc fails to reuse flags from already calculated expression for condition check with zero
- References: <bug-37734-14457@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from siarhei dot siamashka at gmail dot com 2008-10-04 02:48 -------
For -Os optimization, the generated code is much better:
00000000 <unrolled_loop_fn>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 83 ec 04 sub $0x4,%esp
7: 8b 5d 08 mov 0x8(%ebp),%ebx
a: eb 0a jmp 16 <unrolled_loop_fn+0x16>
c: e8 fc ff ff ff call d <unrolled_loop_fn+0xd>
11: e8 fc ff ff ff call 12 <unrolled_loop_fn+0x12>
16: 83 eb 02 sub $0x2,%ebx
19: 79 f1 jns c <unrolled_loop_fn+0xc>
1b: 80 e3 01 and $0x1,%bl
1e: 74 05 je 25 <unrolled_loop_fn+0x25>
20: e8 fc ff ff ff call 21 <unrolled_loop_fn+0x21>
25: 5a pop %edx
26: 5b pop %ebx
27: 5d pop %ebp
28: c3 ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37734