Where's the SPARK in my SPARC????

Dik T. Winter dik at cwi.nl
Fri Feb 22 09:29:02 AEST 1991


In article <1991Feb21.120049.5626 at jarvis.csri.toronto.edu> corkum at csri.toronto.edu (Brent Thomas Corkum) writes:
 >                            Anyways, I ported my code, had to thange it
 > to K&R from Ansi because the default compiler that comes with the SUN
 > doesn't support Ansi (yet!!).
This is part of the problem.
 >                               So I compiled the program and ran it, and
 > did I get a surprise, it ran 6.5 times slower than the 4D/25. I thought the
 > SPARC2 was suppose to be 2-3 times faster in FLOPS.
...
 > cc -float *.c -lm -o compute          -> SGI
 > cc -fsingle *.c -lm -o compute        -> SUN

The major problem is that the -fsingle flag is nearly useless for original
K&R C.  Suppose you have a routine whose declaration reads:
	void rout(s) float s; { ... }
this is effectively the same as declaring:
	void rout(s) double s; { ... }
and within the routine all calculations involving s are effectively done
in double rather than float *regardless to whether the -fsingle flag was
used or not*.  There is an undocumented feature of the C compiler: the
flag -fsingle2.  When you use that parameters are passed as floats
and not as doubles (so this is not really K&R C).  You might try to use
that and see what happens.  One warning though.  Use of this flag also
implies that all floats to standard library routines are not expanded
to double (which they should), so you have to take care of that problem
also (e.g. explicit casts to double).

Hope this helps.
--
dik t. winter, cwi, amsterdam, nederland
dik at cwi.nl



More information about the Comp.sys.sgi mailing list