public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/42779]  New: [C++0x] Variadic templates + lambdas = extremely poor code quality
@ 2010-01-17 20:13 piotr dot wyderski at gmail dot com
  2010-01-17 20:15 ` [Bug tree-optimization/42779] " piotr dot wyderski at gmail dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: piotr dot wyderski at gmail dot com @ 2010-01-17 20:13 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-03-13  3:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-17 20:13 [Bug tree-optimization/42779] New: [C++0x] Variadic templates + lambdas = extremely poor code quality piotr dot wyderski at gmail dot com
2010-01-17 20:15 ` [Bug tree-optimization/42779] " piotr dot wyderski at gmail dot com
2010-01-17 20:22 ` paolo dot carlini at oracle dot com
2010-01-17 20:46 ` piotr dot wyderski at gmail dot com
2010-01-17 20:50 ` paolo dot carlini at oracle dot com
2010-01-17 21:06 ` [Bug target/42779] [C++0x] Variadic templates + lambdas = extremely poor code quality, __m128i and aliasing sucks rguenth at gcc dot gnu dot org
2010-01-17 21:09 ` rguenth at gcc dot gnu dot org
2010-01-17 21:19 ` rguenth at gcc dot gnu dot org
2010-01-17 21:29 ` piotr dot wyderski at gmail dot com
2010-01-17 21:35 ` rguenther at suse dot de
2010-01-17 22:11 ` hjl dot tools at gmail dot com
2010-01-18 10:46 ` [Bug target/42779] extremely poor code quality, aliasing issues with __m128i paolo dot carlini at oracle dot com
2010-03-13  3:20 ` pinskia at gcc dot gnu dot org
2010-03-13  3:22 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).