From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26144 invoked by alias); 4 Apr 2010 06:29:00 -0000 Received: (qmail 25413 invoked by alias); 4 Apr 2010 06:28:43 -0000 Date: Sun, 04 Apr 2010 06:29:00 -0000 Message-ID: <20100404062843.25410.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/43639] Missed optimization with complex long double In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia at gmail dot com" 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: 2010-04/txt/msg00319.txt.bz2 ------- Comment #1 from pinskia at gmail dot com 2010-04-04 06:28 ------- Subject: Re: New: Missed optimization with complex long double Sent from my iPhone On Apr 3, 2010, at 11:21 PM, "svfuerst at gmail dot com" wrote: > gcc 4.4 compiles the following: > > _Complex long double foo(long double p1, long double p2) > { > return p1 + (__extension__ 1.0iF) * p2; > } > > gcc-4.4 -O3 tgcc.c -c -o tgcc.o > > into > > 0x0000000000000000 <+0>: fldt 0x8(%rsp) > 0x0000000000000004 <+4>: fldt 0x18(%rsp) > 0x0000000000000008 <+8>: fxch %st(1) > 0x000000000000000a <+10>: retq > > This is ok, except for the useless fxch instruction. However, gcc > 4.5 compiles > the same code into: > gcc-4.5 -O3 tgcc.c -c -o tgcc.o > > 0x0000000000000000 <+0>: fldt 0x18(%rsp) > 0x0000000000000004 <+4>: fld %st(0) > 0x0000000000000006 <+6>: fmuls 0x0(%rip) # 0xc > 0x000000000000000c <+12>: fldt 0x8(%rsp) > 0x0000000000000010 <+16>: faddp %st,%st(1) > 0x0000000000000012 <+18>: retq > > which is quite a bit worse. Except it is needed for handling -0.0 correctly. > > > -- > Summary: Missed optimization with complex long double > Product: gcc > Version: unknown > Status: UNCONFIRMED > Severity: normal > Priority: P3 > Component: c > AssignedTo: unassigned at gcc dot gnu dot org > ReportedBy: svfuerst at gmail dot com > GCC build triplet: x86_64-linux > GCC host triplet: x86_64-linux > GCC target triplet: x86_64-linux > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43639 > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43639