From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28119 invoked by alias); 8 Jan 2015 15:04:30 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 28078 invoked by uid 48); 8 Jan 2015 15:04:27 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/64410] gcc 25% slower than clang 3.5 for adding complex numbers Date: Thu, 08 Jan 2015 15:04:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-01/txt/msg00479.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64410 --- Comment #9 from Richard Biener --- Created attachment 34402 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34402&action=edit patch to pattern-detect the load/store This pattern matches real/imagpart uses and single-use complex stores and transforms them to component-wise accesses in forwprop. Together we vectorize the loop now and produce: .L28: movupd (%rbx,%rax), %xmm1 movupd (%r15,%rax), %xmm0 addpd %xmm1, %xmm0 movups %xmm0, 0(%r13,%rax) addq $16, %rax cmpq %rax, %rdx jne .L28 note that we need a runtime alias check to disambiguate things (because std::vector memory cannot be disambiguated statically) and similarly we cannot prove sufficent alignment to use aligned loads/stores.