public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: kenner@vlsi1.ultra.nyu.edu (Richard Kenner)
To: dalej@apple.com
Cc: gcc@gcc.gnu.org
Subject: Re:  how to fix anti-optimization?
Date: Fri, 14 Sep 2001 15:27:00 -0000	[thread overview]
Message-ID: <10109142233.AA00201@vlsi1.ultra.nyu.edu> (raw)

    const double Prescale[] = { 3.0, 5.0 };
    extern void bar(double, double);
    void foo () { bar(Prescale[0], Prescale[1]); }

    With -O1 or higher, gcc substitutes constants 3.0 and 5.0 for the array 
    references.  This isn't a win on targets where the extra copies of these 
    constants have to go in memory; you get an extra copy of the constants in 
    data space.

Only if it's no more complex an expression.  Consider Prescale[0]*Prescale[1].
It's *much* faster to do the folding in that case.

             reply	other threads:[~2001-09-14 15:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-14 15:27 Richard Kenner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-09-12 11:34 dalej
2001-09-12 15:14 ` Richard Henderson
2001-09-14 12:50   ` Dale Johannesen
2001-09-14 13:02     ` David Edelsohn
2001-09-14 13:36     ` Richard Henderson
2001-09-13 10:50 ` David Edelsohn
2001-09-13 11:03   ` Dale Johannesen

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=10109142233.AA00201@vlsi1.ultra.nyu.edu \
    --to=kenner@vlsi1.ultra.nyu.edu \
    --cc=dalej@apple.com \
    --cc=gcc@gcc.gnu.org \
    /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).