www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1999/05/10/15:43:08

Date: Mon, 10 May 1999 20:19:27 +0200
To: pgcc AT delorie DOT com
Cc: David Whysong <dwhysong AT physics DOT ucsb DOT edu>
Subject: Re: Optimization question
Message-ID: <19990510201927.E10032@cerebro.laendle>
Mail-Followup-To: pgcc AT delorie DOT com,
David Whysong <dwhysong AT physics DOT ucsb DOT edu>
References: <Pine DOT LNX DOT 4 DOT 04 DOT 9905100038010 DOT 12328-100000 AT sal DOT physics DOT ucsb DOT edu>
Mime-Version: 1.0
In-Reply-To: <Pine.LNX.4.04.9905100038010.12328-100000@sal.physics.ucsb.edu>; from David Whysong on Mon, May 10, 1999 at 12:50:56AM -0700
X-Operating-System: Linux version 2.2.7 (root AT cerebro) (gcc driver version pgcc-2.93.09 19990221 (gcc2 ss-980929 experimental) executing gcc version 2.7.2.3)
From: Marc Lehmann <pcg AT goof DOT com>
Reply-To: pgcc AT delorie DOT com
X-Mailing-List: pgcc AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, May 10, 1999 at 12:50:56AM -0700, David Whysong wrote:
> 
> /usr/local/bin/gcc dynamics_exact.c -c -O6 -mcpu=pentiumpro -Wall
> -ffast-math -mstack-align-double -mpentiumpro -mieee-fp -fstrength-reduce
> -malign-double -funroll-loops -funroll-all-loops -fomit-frame-pointer
> -DNDEBUG -DARCRANDOM -DDOUBLEPREC -I../..//include
> 
> My question is, how well does the compiler optimize code that looks like
> this:

How about if you benchmark it? ;)

In theory, it should get rid of most if not all common subexpressions
automatically, however, the x86 does not have much fp registers to store the
intermediate values...

> Can I do anything so that the compiler produces a faster binary?

You could try out -fschedule-insns, which improves floating point
scheduling unless you have high register pressure. You should benchmark
it. In general you should play around with the switches a bit (-mno-ieee
often helps while improving the accuracy as well).

The only other option is to try some algebraic simplifications that the
compiler doesn't do (Ibecause its too dumb) or that the compiler is not
allowed to do in C (use fortran instead).

--  
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg AT goof DOT com      |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019