Moving floating point values around

William E. Davidsen Jr davidsen at steinmetz.ge.com
Fri Aug 26 04:14:09 AEST 1988


Please excuse the long quote, I couldn't take out much more and have
anyone understand what the topic was.

In article <1121 at scolex> seanf at sco.COM (Sean Fagan) writes:
| In article <4256 at lynx.UUCP> m5 at lynx.UUCP (Mike McNally) writes:
| > [ could you use integer load and store to move float on 80*86? ]
| 
| If I remember correctly, both our '286 and '386 compilers will generate MOVS
| instructions to push FP-values on the stack;  they might (I haven't checked)
| even generate them for non-stack-pushes.  Yep, just dropped into a subshell
| and checked:  neither compiler will uses FLD and FSTP if possible (what if
| you don't have an FPU?!  Horror!).

I just logged onto a machine running SCO 2.2.2 for 386, and tried this
for both 286 and 386 compilers. While the code:
	a = b;
generates the more efficient code with integer moves or movs,
initializing auto variables is still done with floating operations.
Perhaps that could be mentioned to the people who try to look better on
benchmarks. Example:
	float flt1, flt2 = 1.23;	/* done with FLD, FSTP	*/
	flt1 = flt2;			/* mov eax		*/

The compiler generates the good code for assign other than
initialization even without the -O switch. Half a congratulation for
half a job well done (or is that a job well half done?).

-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list