🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.intel
Article #1781

Moving FPU values around

#1781
From: skibo login
Date: Thu, 25 Aug 1988 21:05
28 lines
1422 bytes
One restriction that is important to bear in mind when using MOVSW to
transfer floating - point values is to make sure that the coprocessor
has finished writing out the values to memory before they are transferred.

Sounds obvious, but under certain optimization controls, Microsoft's 
Xenix C compiler for the 286 will not do this!

Correct:
	FSTP	a
	lea	si, a		; source
	lea	di, b		; destination
	FWAIT			; insures FSTP is complete
	movsw
	movsw
	movsw
	movsw

I'm not sure if SI or DI functions as the destination pointer, but you
get the idea.  Where Microsoft fell down is when they return floating-point
values from a function:  they would issue the FSTP, and then RET (w/o FWAIT).

If the next thing to do was more floating-point, no problem, because
any subsequent floating-point operations would wait until the FSTP was
finished.  If the target of the FSTP was to be manipulated by non-processor
activites: written to disk, copied to another variable, etc, the lack of
the FWAIT instruction would cause lack of coherence.

stan chesnutt/plexus computers inc/ sun!plx!dyrk!skibo
Technical Details
Message-ID: <1174@plx.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!ames!amdahl!dlb!plx!skibo

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!ames!amdahl!dlb!plx!skibo
From: skibo@plx.UUCP (skibo login )
Newsgroups: comp.sys.intel
Subject: Moving FPU values around
Keywords: 80x87
Message-ID: <1174@plx.UUCP>
Date: 25 Aug 88 21:05:25 GMT
Organization: Plexus Computers, San Jose, CA.
Lines: 27