[Fwd: Re: Off topic - G5 question]

Toon Moene toon at moene.indiv.nluug.nl
Sat Jun 28 06:13:03 EDT 2003

I wrote:

> Well, I could make -O2 -ffast-math -funroll-loops the default (but then, 
> I don't think I'll get this past the IEEE754 police @ gcc.gnu.org :-)

and Mark Hahn asked me (offline) whether -ffast-math is important.

Well, as always: it depends.  However, without -ffast-math, gcc and g77 
zealously will follow IEEE 754 restrictions on floating point operations.

Perhaps it's illustrative to see what that means by giving an example 
(culled from a bug report by one of Apple's compiler engineers).

Consider this loop:

       DO IZ = 1, NZ
       DO IY = 1, NY
       DO IX = 1, NX
       END DO
       END DO
       END DO

with I[XYZ], N[XYZ] integers and CMAP a double precision complex rank-3 

DCONJG is expanded inline no matter what, so that's a rather basic 
operation.  However, without -ffast-math, g77 is required to convert the 
double precision real DFLOAT(NX*NY*NZ) - a loop invariant - to double 
complex and than _perform a double complex division_ inside the loop.

With -ffast-math, all that remains is two multiplications with the 
inverse of DFLOAT(NX*NY*NZ) for the real and imaginary parts of 

Toon Moene - mailto:toon at moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc-g95.sourceforge.net/ (under construction)

Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf

More information about the Beowulf mailing list