From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8652 invoked by alias); 20 Jun 2005 15:04:26 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 8621 invoked by uid 22791); 20 Jun 2005 15:04:18 -0000 Received: from topconrd.ru (HELO TopconRD.RU) (62.105.138.7) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 20 Jun 2005 15:04:18 +0000 Received: from osv.topcon.com (ttc.topconrd.ru [62.105.138.5]) by TopconRD.RU (8.12.3/8.12.3/Debian-6.6) with ESMTP id j5KF4FL0024270; Mon, 20 Jun 2005 19:04:15 +0400 To: Andrew Pinski Cc: gcc@gcc.gnu.org Subject: Re: How to replace -O1 with corresponding -f's? References: <878y159mhr.fsf@osv.topcon.com> <7a7540ae909461ad920621855369549d@physics.uc.edu> X-attribution: osv From: Sergei Organov Date: Mon, 20 Jun 2005 15:04:00 -0000 In-Reply-To: <7a7540ae909461ad920621855369549d@physics.uc.edu> Message-ID: <87vf4983yt.fsf@osv.topcon.com> User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-06/txt/msg00907.txt.bz2 Andrew Pinski writes: > On Jun 20, 2005, at 9:38 AM, Sergei Organov wrote: > > > 2. The resulting assembly is different from what I get with -O1 and > > doesn't contain the mis-optimization I'm trying to debug though it > > doesn't seem to have anything to do with loops. For reference, the > > code I'm trying to compile is: > > > > extern double const osv; > > double const osv = 314314314; > > double osvf() { return osv; } > > I don't see anything wrong with what it gives for -O0 and -O2. Well, it's on PowerPC with its small constant data sections. With -O1 I get: .globl osv .section .sdata2,"a",@progbits .align 3 .type osv, @object .size osv, 8 osv: .long 1102232590 .long 1241513984 .section .rodata.cst8,"aM",@progbits,8 .align 3 .LC0: .long 1102232590 .long 1241513984 .section ".text" .align 2 .globl osvf .type osvf, @function osvf: lis %r9,.LC0@ha # tmp121, lfd %f1,.LC0@l(%r9) #, blr # With -O0 and a bunch of -f's from -O1 I get: .globl osv .section .sdata2,"a",@progbits .align 3 .type osv, @object .size osv, 8 osv: .long 1102232590 .long 1241513984 .section ".text" .align 2 .globl osvf .type osvf, @function osvf: .LFB2: lfd %f0,osv@sda21(%r0) # osv, D.1144 fmr %f1,%f0 # , blr # While the ideal code would be: ... osvf: .LFB2: lfd %f1,osv@sda21(%r0) # osv, D.1144 blr # -- Sergei.