public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sergei Organov <osv@topconrd.ru>
To: Andrew Pinski <pinskia@physics.uc.edu>
Cc: gcc@gcc.gnu.org
Subject: Re: How to replace -O1 with corresponding -f's?
Date: Mon, 20 Jun 2005 15:04:00 -0000	[thread overview]
Message-ID: <87vf4983yt.fsf@osv.topcon.com> (raw)
In-Reply-To: <7a7540ae909461ad920621855369549d@physics.uc.edu>

Andrew Pinski <pinskia@physics.uc.edu> 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)      #, <result>
        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      # <result>, <result>
        blr      #

While the ideal code would be:

        ...
osvf:
.LFB2:
        lfd %f1,osv@sda21(%r0)   # osv, D.1144
        blr      #

-- 
Sergei.

      reply	other threads:[~2005-06-20 15:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-20 13:40 Sergei Organov
2005-06-20 14:04 ` Andrew Haley
2005-06-20 14:26   ` Andrew Pinski
2005-06-20 14:55     ` Sergei Organov
2005-06-20 15:01       ` Andrew Pinski
2005-06-20 15:29         ` Sergei Organov
2005-06-20 15:36           ` Andrew Pinski
2005-06-20 15:58             ` Sergei Organov
2005-06-21  9:55               ` Michael Meissner
2005-06-21 12:49                 ` Sergei Organov
2005-06-20 17:18             ` Sergei Organov
2005-06-24 16:09             ` Sergei Organov
2005-06-20 14:28   ` Sergei Organov
2005-06-22 19:29     ` Zack Weinberg
2005-06-20 14:25 ` Scott Robert Ladd
2005-06-20 14:35 ` Andrew Pinski
2005-06-20 15:04   ` Sergei Organov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vf4983yt.fsf@osv.topcon.com \
    --to=osv@topconrd.ru \
    --cc=gcc@gcc.gnu.org \
    --cc=pinskia@physics.uc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).