From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11868 invoked by alias); 10 Jun 2011 05:08:03 -0000 Received: (qmail 11858 invoked by uid 22791); 10 Jun 2011 05:08:02 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Jun 2011 05:07:47 +0000 From: "v.haisman at sh dot cvut.cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/49358] New: optimization regression in 4.6.1 from 4.5.4 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: v.haisman at sh dot cvut.cz X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 10 Jun 2011 05:08:00 -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 X-SW-Source: 2011-06/txt/msg00831.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49358 Summary: optimization regression in 4.6.1 from 4.5.4 Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: v.haisman@sh.cvut.cz The code: --------8<---------- double f (double y) { return y*y*y*y; } --------8<---------- This compiles using version 4.5.4 20110602 (prerelease) (FreeBSD Ports Collection) to this: --------8<---------- _Z1fd: .LFB87: .cfi_startproc movapd %xmm0, %xmm1 # y, y mulsd %xmm1, %xmm0 # y, tmp63 mulsd %xmm1, %xmm0 # y, tmp63 mulsd %xmm1, %xmm0 # y, tmp63 ret --------8<---------- But gcc version 4.6.1 20110408 (prerelease) (GCC) produces what seems to be less optimal version: --------8<---------- _Z1fd: .LFB85: .cfi_startproc movapd %xmm0, %xmm1 # y, tmp64 mulsd %xmm0, %xmm1 # y, tmp64 mulsd %xmm0, %xmm1 # y, tmp64 mulsd %xmm0, %xmm1 # y, tmp64 movapd %xmm1, %xmm0 # tmp64, ret --------8<---------- GCC 4.5.4 seems to be smarter in register allocation avoiding the final movapd. In both cases I have used -O3 -fverbose-asm -save-temps parameters to g++.