www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1999/05/10/18:37:21

X-Authentication-Warning: sal.physics.ucsb.edu: dwhysong owned process doing -bs
Date: Mon, 10 May 1999 15:34:44 -0700 (PDT)
From: David Whysong <dwhysong AT physics DOT ucsb DOT edu>
To: Marc Lehmann <pcg AT goof DOT com>
cc: pgcc AT delorie DOT com
Subject: Re: Optimization question
In-Reply-To: <19990510201927.E10032@cerebro.laendle>
Message-ID: <Pine.LNX.4.04.9905101436230.15547-100000@sal.physics.ucsb.edu>
MIME-Version: 1.0
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, 10 May 1999, Marc Lehmann wrote:

>On Mon, May 10, 1999 at 12:50:56AM -0700, David Whysong wrote:
>> 
>> My question is, how well does the compiler optimize code that looks like
>> this:
>
>How about if you benchmark it? ;)

I've been trying to do that all morning.

>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...

Theory doesn't seem to fit the data very well then. :-) I have gained
nearly a factor of two in speed after doing some CSE by hand. Even on the
simple code fragment I posted, a little "hand optimizing" significantly
reduced the number of fmul ops. As far as I can see, very little or no CSE
was being done at all.

>> 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).

I'll try it.

>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).

Thanks,

Dave

David Whysong                                       dwhysong AT physics DOT ucsb DOT edu
Astrophysics graduate student         University of California, Santa Barbara
My public PGP keys are on my web page - http://www.physics.ucsb.edu/~dwhysong
DSS PGP Key 0x903F5BD6  :  FE78 91FE 4508 106F 7C88  1706 B792 6995 903F 5BD6
D-H PGP key 0x5DAB0F91  :  BC33 0F36 FCCD E72C 441F  663A 72ED 7FB7 5DAB 0F91


- Raw text -


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