I have a program which performs MMX calculations 24/7 doing some serious processing on a Windows XP machine. It never uses FP. As I understand it, Windows saves and restores the FP state between processes (I can't remember with what FP instructions), so that when it interrupts my program to perform perhaps an FPU task in another program, it returns to mine exactly with the MMX data it left, and vice versa. When my program closes, it does not execute EMMS.

Does it need to?

And why?
Posted on 2005-10-03 11:03:35 by V Coder
You've already answered yourself :)

As I understand it, Windows saves and restores the FP state between processes (I can't remember with what FP instructions), so that when it interrupts my program to perform perhaps an FPU task in another program, it returns to mine exactly with the MMX data it left, and vice versa.
Posted on 2005-10-03 13:26:53 by ti_mo_n
EMMS is used when mixing MMX and FPU code. Other than that it's useless.

Cleaning up is needed because the MMX and FPU registers are actually aliases to the same memory space within the processor. So if you've been storing data in the MMX registers you may not want the FPU to use it, since that may trigger exceptions.
Posted on 2005-10-03 14:28:33 by QvasiModo