|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
The register state also includes the x87 FPU control word. The calling convention dictates this register to be nonvolatile.
The x87 FPU control word register is set to the following standard values at the start of program execution:
FPCSR[0:6]: Exception masks all 1's (all exceptions masked) FPCSR: Reserved – 0 FPCSR[8:9]: Precision Control – 10B (double precision) FPCSR[10:11]: Rounding control - 0 (round to nearest) FPCSR: Infinity control – 0 (not used)
A callee that modifies any of the fields within FPCSR must restore them before returning to its caller. Furthermore, a caller that has modified any of these fields must restore them to their standard values before invoking a callee unless by agreement the callee expects the modified values.
There are two exceptions to the rules regarding the non-volatility of the control flags:
In functions where the documented purpose of the given function is to modify the nonvolatile FpCsr flags.
When it is provably correct that the violation of these rules results in a programs that behaves/means the same as a program where these rules are not violated, for example, through whole-program analysis.