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!
fpu question
RE:fpu question
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
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
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.
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
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
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.
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.