Index: docs/LangRef.rst =================================================================== --- docs/LangRef.rst +++ docs/LangRef.rst @@ -2284,6 +2284,32 @@ seq\_cst total orderings of other operations that are not marked ``syncscope("singlethread")`` or ``syncscope("")``. +.. _floatenv: + +Floating-Point Environment +-------------------------- + +The default LLVM floating-point environment assumes that floating-point +instructions do not have side effects. No floating-point exception state is +maintained in this environment. Results assume the round-to-nearest rounding +mode. Therefore, there is no attempt to create or preserve invalid operation +(SNaN) or division-by-zero exceptions in these examples: + +.. code-block:: llvm + + %A = fdiv undef, %X + %B = fdiv %X, 0.0 + Safe: + %A = NaN + %B = NaN + +The benefit of this exception-free assumption is that floating-point +operations may be speculated freely without any other fast-math relaxations +to the floating-point model. + +Code that requires different behavior than this should use the +:ref:`Constrained Floating-Point Intrinsics <_constrainedfp>`. + .. _fastmath: Fast-Math Flags @@ -12895,6 +12921,8 @@ Returns another pointer that aliases its argument but which is considered different for the purposes of ``load``/``store`` ``invariant.group`` metadata. +.. _constrainedfp: + Constrained Floating Point Intrinsics -------------------------------------