[PATCH] D44318: [LangRef] describe the default FP environment
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 9 10:31:08 PST 2018
spatel created this revision.
spatel added reviewers: lattner, majnemer, efriedma, andrew.w.kaylor, arsenm, scanon, reames, nhaehnle.
Herald added subscribers: wdng, mcrosier.
Follow-up for @lattner's suggestion in https://reviews.llvm.org/D44216: add a section and examples to describe the FP env.
I thought about mentioning IEEE-754 here, but I don't know how far we can or want to go in that direction.
https://reviews.llvm.org/D44318
Files:
docs/LangRef.rst
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("<target-scope>")``.
+.. _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
-------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44318.137789.patch
Type: text/x-patch
Size: 1480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180309/c27fc5ba/attachment.bin>
More information about the llvm-commits
mailing list