Page 1 of 1
Fast FXSR
Posted: Sun Apr 26, 2009 12:55 am
by JohnnyTheDon
While looking into supporting 3DNow! instructions, I found a Fast FXSR bit. This apparently allow the processor to skip saving the XMM registers when doing a FXSAVE/FXRSTORE. My question is: why? Is it substansiably faster to save these registers manually on task switches?
Re: Fast FXSR
Posted: Mon Apr 27, 2009 3:53 am
by jal
JohnnyTheDon wrote:While looking into supporting 3DNow! instructions, I found a Fast FXSR bit. This apparently allow the processor to skip saving the XMM registers when doing a FXSAVE/FXRSTORE. My question is: why? Is it substansiably faster to save these registers manually on task switches?
Presumably, when many applications are using the FPU but not that many are using XMM, it will safe time (you'd manually safe/restore only when a task is using them).
JAL
Re: Fast FXSR
Posted: Mon Apr 27, 2009 11:07 pm
by 01000101
If you save/restore the FPU/MMX state every interrupt routine or if you do it frequently, it will probably save you some time. But if you ever want/plan to use SSE (XMM regs) then it's probably best to do a full save/restore via FXSAVE/FXRSTR as some things are worth taking the cycle hit. I haven't really looked into the Fast FXSR bit but does it require less memory space? The FXSAVE/FXRSTR (normal) requires a full 512 bytes of memory that is aligned on a 16 byte boundary (iirc).
Re: Fast FXSR
Posted: Tue Apr 28, 2009 9:05 am
by JohnnyTheDon
I would probably have to allocated the space anyway, just in case the application started using SSE at some point. It would also be annoying set TS until the thread did SSE (it would interrupt on every FPU/MMX instruction as well as SSE). I think I'm just going to forget it, it doesn't seem like that good of an idea unless I know that the program won't use SSE.