Page 1 of 1

fpu question

Posted: Fri Jun 28, 2002 11:00 pm
by Stefan
on a 486 or better cpu (Pentium ...) after an fpu instruction do I have to put a WAIT instruction? I'm asking because I have never programmed an fpu unit!

Thanks!

RE:fpu question

Posted: Sun Jun 30, 2002 11:00 pm
by Stefan
Can anybody answer?

RE:fpu question

Posted: Sun Jun 30, 2002 11:00 pm
by carbonBased
According to output from gcc, no.

There might be select circumstances where you do.  Unfortunately, I can't be of much more help.  My knowledge of floating point at the assembly level is pretty limited.

I'd try writting the code in C first, though, and see what gcc -S produces for assembly output... might help.

Jeff

RE:fpu question

Posted: Sun Jun 30, 2002 11:00 pm
by carbonBased
From:
http://www.nexus-systems.com/qlib/tutor-fpu.html

WAITing
Because the FPU runs totally independant of the CPU you may at times need to WAIT (or FWAIT which is the same) until the FPU is complete before continuing. For example if you used a store instruction and try to used the stored data immediately, the FPU may not have completed the store instruction before you read the data. But each time you start an FPU instrution the CPU will WAIT automatically till the FPU is done. Therefore usually the only time you will ever need to WAIT is after using a store instruction.
Just a note : with the 8087 a WAIT was required after each FPU instrution, but after the 80287+ it was no longer that way.

RE:fpu question

Posted: Tue Jul 02, 2002 11:00 pm
by Stefan
That article describes the 8087 and 80387 coprocessor, witch are not integrated in the CPU. From 486 the FPU is integrated in the CPU, that's why I am asking if I must put WAIT instructions!

RE:fpu question

Posted: Tue Jul 02, 2002 11:00 pm
by Schol-R-LEA
According to

http://www.asdf.org/~fatphil/x86/pentopt/26.html#26_6

the only case you will need WAIT instructions in processors later than the 48sx is when checking for certain exceptions, and even then it is not usually needed.

RE:fpu question

Posted: Wed Jul 03, 2002 11:00 pm
by Stefan
10x