Date: Mon, 10 May 1999 20:19:27 +0200 To: pgcc AT delorie DOT com Cc: David Whysong Subject: Re: Optimization question Message-ID: <19990510201927.E10032@cerebro.laendle> Mail-Followup-To: pgcc AT delorie DOT com, David Whysong References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: ; 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 Reply-To: pgcc AT delorie DOT com X-Mailing-List: pgcc AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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 | |