NASM Forum > Programming with NASM

Which method is faster for popping unused entries off the floating point stack?

(1/1)

ben321:
The way with normal instructions is FFREE (invalidate the ST0 floating point entry) followed by FINCSTP (shift the entire floating point stack down so that ST7 goes to ST6, ST6 goes to ST5, all the way to ST1 goes to ST0). So that would be doing this:

--- Code: ---ffree st0
fincstp
--- End code ---

But there's another way I found with an undocumented instruction called FFREEP (yes, this actually does exist, and it does work as expected). It's the equivalent of using BOTH of the above mentioned instructions. However, I don't know if it's faster. Sometimes internally in the CPU it actually takes longer for a few instructions instruction to do the same thing as more instructions, due to how the actual internal circuits of the CPU work. Fewer instructions don't always mean faster processing. When using it, it looks like this:

--- Code: ---ffreep st0
--- End code ---

Navigation

[0] Message Index

Go to full version