TITLE: x87 Floating Point Store/Restore for Rounding ISSUE_NAME: X87_ROUNDING DESCRIPTION: x87 floating point calculations store/restore from stack to round to 32-bit (single precision) or 64-bit (double precision) RELEVANCE: Negatively impacts most architectures on all OSs but costsAtom's Bonnell, Silverthorne and Saltwell (10-12 cycles) since they cannot store cannot be forwarded to loads in the FP domain. EXAMPLE: Here is an example of how x87 math is done with rounding done by storing/restoring from memory in between calculations: fadd fstp [address] fld [address] //The above store is not forwarded fsub SOLUTION: If extra precision is not required, utilize SSE where rounding to/from memory is not required. GCC Flag = mfpmath=sse On Linux make sure that the-ffloat-store flag is not thrown. If ISV will not take SSE2 the compiler flag /fp:fast can be used on compilers for Windows. RELATED_SOURCES: NOTES: Here is what the resulting code should look like with /fp:fast fadd fsub //No store and load between calculations so you avoid the cost of waiting on theload.
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione