Fortran 300 times faster than C for computing cosine

steinmetz!dawn!stpeters at uunet.uu.net steinmetz!dawn!stpeters at uunet.uu.net
Sat May 6 10:37:34 AEST 1989


In article <8903221250.AA03853 at trantor.harris-atd.com> you write:
>Does anyone know of an optimizer which will convert calls to the standard
>math routines to their 68881 instruction counterparts?

In effect, yes.  The mechanism Sun uses is to have in-line code (.il)
templates that cause the compiler to generate in-line code in place of the
math library calls.

If you're running SunOS 3.X:

	cc -c -f68881 program.c /usr/lib/f68881.il
	cc -o program -f68881 program.o -lm

If you're running 4.0, it's even easier:

	cc -o program program.c /usr/lib/f68881/libm.il

Substitute soft, switch, or fpa for f68881 as appropriate.

These can make differences of HUGE factors in how fast floating point
programs run.  That floating point manual really is worth reading :-)

Dick St.Peters
GE Corporate R&D, Schenectady, NY
stpeters at dawn.crd.ge.com
uunet!steinmetz!dawn!stpeters



More information about the Comp.sys.sun mailing list