x87 Floating Point Store/Restore for Rounding

x87 Floating Point Store/Restore for Rounding

TITLE: x87 Floating Point Store/Restore for RoundingISSUE_NAME: X87_ROUNDINGDESCRIPTION: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:faddfstp [address]fld [address] //The above store is not forwardedfsubSOLUTION:If extra precision is not required, utilize SSE where rounding to/from memory is not required.GCC Flag = mfpmath=sseOn 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:fastfaddfsub //No store and load between calculations so you avoid the cost of waiting on theload.

1 envío / 0 nuevos
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.