问题
I cannot understand this things: what is the use of such commands (FFREE, FDECSTP)? Can it ve used to pop value out of the fpu stack, or this is for some another purpose? I dont get it :/ Could someone explain that, tnx
回答1:
Yes, using FFREE
, FINCSTP
and FDECSTP
you can manage the FPU stack manually. Note that FPU stack grows down similar to the CPU stack, so to remove (pop) something you mark the register as free and increment the stack pointer.
You won't see these instructions in typical code, especially since they can only operate one register at a time. In case of CPU stack using ADD ESP, x
you can discard multiple items in one go, you can't do that with the FPU stack. As such, typically you use FSTP st(0)
to discard one item, instead of the equivalent FFREE
+ FINCSTP
pair. When allocating an item, you normally want to initialize too, so use some FLD
variant.
来源:https://stackoverflow.com/questions/13335395/use-of-ffree-and-fdecstp