@@ -3577,6 +3577,12 @@ seq\_cst total orderings of other operations that are not marked
35773577Floating-Point Environment
35783578--------------------------
35793579
3580+ Unless noted otherwise, LLVM works with IEEE-754 floating-point semantics: LLVM
3581+ backends assume that the CPU is configured to provide IEEE-compatible behavior,
3582+ and LLVM frontends can assume that LLVM IR floating-point operations behave
3583+ according to the IEEE specification (with an :ref:`exception around NaN values
3584+ <floatnan>`).
3585+
35803586The default LLVM floating-point environment assumes that traps are disabled and
35813587status flags are not observable. Therefore, floating-point math operations do
35823588not have side effects and may be speculated freely. Results assume the
@@ -3608,10 +3614,11 @@ are not "floating-point math operations": ``fneg``, ``llvm.fabs``, and
36083614``llvm.copysign``. These operations act directly on the underlying bit
36093615representation and never change anything except possibly for the sign bit.
36103616
3611- For floating-point math operations, unless specified otherwise, the following
3612- rules apply when a NaN value is returned: the result has a non-deterministic
3613- sign; the quiet bit and payload are non-deterministically chosen from the
3614- following set of options:
3617+ Floating-point math operations that return a NaN are an exception from the
3618+ general principle that LLVM implements IEEE-754 semantics. Unless specified
3619+ otherwise, the following rules apply when a NaN value is returned: the result
3620+ has a non-deterministic sign; the quiet bit and payload are
3621+ non-deterministically chosen from the following set of options:
36153622
36163623- The quiet bit is set and the payload is all-zero. ("Preferred NaN" case)
36173624- The quiet bit is set and the payload is copied from any input operand that is
0 commit comments