Newsgroups: | comp.parallel,comp.arch,comp.compilers |
From: | kenneta@hubcap.clemson.edu (Ken Adams) |
Status: | RO |
Followup-To: | comp.parallel,comp.arch,comp.compilers |
Originator: | rmuise@dragon.acadiau.ca |
Organization: | Clemson University |
X-Newsreader: | TIN [version 1.2 PL2] |
References: | <3aqv5k$e27@monalisa.usc.edu> |
Date: | Wed, 23 Nov 1994 22:25:12 GMT |
Zhiwei Xu wrote:
: Can any one explain why a C program using single precision (float) is slower
: that the same code using double precision (double)? Please try the following
: code for computing pi. I have tried it on IBM RS6000/250, IBM SP2, Sun4, and
: Sun SS20, and got the same strange timing.
: On the RS6000 (using PowerPC 601) and AIX, I tried different compiler options,
: such as
: cc -O3 -qarch=ppc
: On the Sun workstations, I tried
: cc -O4 (with or without -fsingle)
: The same thing!
: However, on SP2, reasonable timing is seen after using the -qarch=pwr2 option.
: Many thanks
: Zhiwei Xu, zxu@aloha.usc.edu
: ------------------- C code for computing pi ---------------------
{code deletia}
I don't know about the others but in particular the POWER architecture
is set up specifically to do double precision at a high rate. In effect
it has to dumb itself down to do single precision.
Excertped from p. 58 of Weiss and Smith's "POWER and PowerPC" ...
"...all floating point arithmetic is done in double-precision format.
...programs that use single-precision data are often slower than the
double precision versions because frsp instructions are inserted by the
compiler to convert results to single precision."
I am not familiar with all of the compiler settings you describe...
I assume that the other architectures approach it the same way (maybe?)
Thanks for asking a question that I was studying anyway!!!
BTW if anyone is interested in an OS/2 PM executable for visualizing
instruction flow through the POWER1 pipelines.. I will (hopefully!) have
one done by the end of November (grad arch project).
Ken Adams
Clemson University
Computer Science
adamsk@cs.clemson.edu
Return to the
comp.compilers page.
Search the
comp.compilers archives again.