Author Topic: Which method is faster for popping unused entries off the floating point stack?  (Read 7023 times)

Offline ben321

  • Full Member
  • **
  • Posts: 185
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: [Select]
ffree st0
fincstp

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: [Select]
ffreep st0
« Last Edit: March 08, 2023, 11:09:08 AM by ben321 »