This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/16611] Terrible code generated for vector<bool>
- From: "pcarlini at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Dec 2005 20:12:54 -0000
- Subject: [Bug libstdc++/16611] Terrible code generated for vector<bool>
- References: <bug-16611-2744@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #9 from pcarlini at suse dot de 2005-12-23 20:12 -------
FWIW, on x86-linux at least, we are making progress on the compiler side.
With 4.0.2 I get (-O2):
00000000 <_Z1fRKSt6vectorIbSaIbEEj>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 8b 5d 08 mov 0x8(%ebp),%ebx
7: 8b 55 0c mov 0xc(%ebp),%edx
a: 8b 43 04 mov 0x4(%ebx),%eax
d: 01 d0 add %edx,%eax
f: 89 c1 mov %eax,%ecx
11: c1 f9 1f sar $0x1f,%ecx
14: c1 e9 1b shr $0x1b,%ecx
17: 8d 04 01 lea (%ecx,%eax,1),%eax
1a: 89 c2 mov %eax,%edx
1c: 83 e0 1f and $0x1f,%eax
1f: c1 fa 05 sar $0x5,%edx
22: c1 e2 02 shl $0x2,%edx
25: 03 13 add (%ebx),%edx
27: 29 c8 sub %ecx,%eax
29: 89 c1 mov %eax,%ecx
2b: 78 13 js 40 <_Z1fRKSt6vectorIbSaIbEEj+0x40>
2d: b8 01 00 00 00 mov $0x1,%eax
32: d3 e0 shl %cl,%eax
34: 85 02 test %eax,(%edx)
36: 5b pop %ebx
37: 5d pop %ebp
38: 0f 95 c0 setne %al
3b: 83 e0 01 and $0x1,%eax
3e: c3 ret
3f: 90 nop
40: 83 c1 20 add $0x20,%ecx
43: b8 01 00 00 00 mov $0x1,%eax
48: d3 e0 shl %cl,%eax
4a: 83 ea 04 sub $0x4,%edx
4d: 85 02 test %eax,(%edx)
4f: 5b pop %ebx
50: 5d pop %ebp
51: 0f 95 c0 setne %al
54: 83 e0 01 and $0x1,%eax
57: c3 ret
With current 4_1-branch:
00000000 <_Z1fRKSt6vectorIbSaIbEEj>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 8b 5d 08 mov 0x8(%ebp),%ebx
7: 8b 45 0c mov 0xc(%ebp),%eax
a: 8b 53 04 mov 0x4(%ebx),%edx
d: 01 d0 add %edx,%eax
f: 89 c1 mov %eax,%ecx
11: c1 f9 1f sar $0x1f,%ecx
14: c1 e9 1b shr $0x1b,%ecx
17: 8d 04 01 lea (%ecx,%eax,1),%eax
1a: 89 c2 mov %eax,%edx
1c: 83 e0 1f and $0x1f,%eax
1f: c1 fa 05 sar $0x5,%edx
22: c1 e2 02 shl $0x2,%edx
25: 03 13 add (%ebx),%edx
27: 29 c8 sub %ecx,%eax
29: 89 c1 mov %eax,%ecx
2b: 78 13 js 40 <_Z1fRKSt6vectorIbSaIbEEj+0x40>
2d: b8 01 00 00 00 mov $0x1,%eax
32: d3 e0 shl %cl,%eax
34: 85 02 test %eax,(%edx)
36: 5b pop %ebx
37: 5d pop %ebp
38: 0f 95 c0 setne %al
3b: 83 e0 01 and $0x1,%eax
3e: c3 ret
3f: 90 nop
40: 83 c1 20 add $0x20,%ecx
43: 83 ea 04 sub $0x4,%edx
46: eb e5 jmp 2d <_Z1fRKSt6vectorIbSaIbEEj+0x2d>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16611