This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/42779] New: [C++0x] Variadic templates + lambdas = extremely poor code quality
- From: "piotr dot wyderski at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jan 2010 20:13:40 -0000
- Subject: [Bug tree-optimization/42779] New: [C++0x] Variadic templates + lambdas = extremely poor code quality
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The attached code compiled with
g++ -std=gnu++0x -O2 -m32 -march=native -msse -msse2 -msse3 -Wall
-Werror -Wno-unused -Wno-strict-aliasing -march=native
-fomit-frame-pointer -Wno-pmf-conversions -g main.cpp
emits code which is, to put it mildly,
far from optimal. For instance, the code of
bit_vector::op_not_or:
combine([](__m128i x, __m128i y) { return _mm_xor_si128(_mm_or_si128(x, y),
g_Mask[128]); }, true, v1, v2);
emits:
00401800 <__ZN10bit_vector9op_not_orERKS_S1_>:
401800: 55 push %ebp
401801: 57 push %edi
401802: 56 push %esi
401803: 53 push %ebx
401804: 83 ec 1c sub $0x1c,%esp
401807: 8b 74 24 30 mov 0x30(%esp),%esi
40180b: 8b 7c 24 34 mov 0x34(%esp),%edi
40180f: 8b 6c 24 38 mov 0x38(%esp),%ebp
401813: 8b 5f 04 mov 0x4(%edi),%ebx
401816: 39 ee cmp %ebp,%esi
401818: 74 46 je 401860
<__ZN10bit_vector9op_not_orERKS_S1_+0x60>
40181a: 83 c3 7f add $0x7f,%ebx
40181d: c1 eb 07 shr $0x7,%ebx
401820: 85 db test %ebx,%ebx
401822: 74 30 je 401854
<__ZN10bit_vector9op_not_orERKS_S1_+0x54>
401824: 31 c0 xor %eax,%eax
401826: 66 0f 76 c9 pcmpeqd %xmm1,%xmm1
40182a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
401830: 8b 0f mov (%edi),%ecx
401832: 89 c2 mov %eax,%edx
401834: 40 inc %eax
401835: c1 e2 04 shl $0x4,%edx
401838: 39 c3 cmp %eax,%ebx
40183a: 66 0f 6f 04 11 movdqa (%ecx,%edx,1),%xmm0
40183f: 8b 4d 00 mov 0x0(%ebp),%ecx
401842: 66 0f eb 04 11 por (%ecx,%edx,1),%xmm0
401847: 8b 0e mov (%esi),%ecx
401849: 66 0f ef c1 pxor %xmm1,%xmm0
40184d: 66 0f 7f 04 11 movdqa %xmm0,(%ecx,%edx,1)
401852: 75 dc jne 401830
<__ZN10bit_vector9op_not_orERKS_S1_+0x30>
401854: 83 c4 1c add $0x1c,%esp
401857: 5b pop %ebx
401858: 5e pop %esi
401859: 5f pop %edi
40185a: 5d pop %ebp
40185b: c3 ret
--
Summary: [C++0x] Variadic templates + lambdas = extremely poor
code quality
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: piotr dot wyderski at gmail dot com
GCC host triplet: GCC-trunk(20100107)/Cygwin/WinXP32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42779