Is it really necessary to use EMM instruction before any fpu operation even if i reload fpu data registers after using mmx?
Does windows 'emm' everytime it changes context from the process which uses mmx to the one which uses fpu?
Posted on 2002-12-06 10:09:58 by Vaxon
Intel says so. Because EMMS clears the top of the stack pointer and do some other things (which I don't remember right now.) The point is, loading FP data is not enough unless you do what EMMS does. Then, it is much cheaper to say EMMS than writing down all the code required. That will include at least one FRSTOR, which is not cheap at all.
Posted on 2002-12-07 01:22:46 by Starless
In a little more detail:

> Is it really necessary to use EMM instruction before any fpu operation even if i reload fpu data registers after using mmx? <
Yes. MMX ops mark all registers 'used' (FPU tag word = 0); subsequently fld-ing something without an EMMS causes a stack overflow and incorrect results.

> Does windows 'emm' everytime it changes context from the process which uses mmx to the one which uses fpu? <
It saves+restores the complete FPU state (via FXRSTOR).
Posted on 2002-12-08 19:43:13 by Jan Wassenberg
Thanks, guys:alright:
Posted on 2002-12-09 01:57:35 by Vaxon