[llvm] LangRef: state explicitly that floats generally behave according to IEEE-754 (PR #102140)

Ralf Jung via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 08:31:32 PDT 2024


================
@@ -3572,6 +3572,39 @@ or ``syncscope("<target-scope>")`` *synchronizes with* and participates in the
 seq\_cst total orderings of other operations that are not marked
 ``syncscope("singlethread")`` or ``syncscope("<target-scope>")``.
 
+.. _floatsem:
+
+Floating-Point Semantics
+------------------------
+
+LLVM floating-point types fall into two categories:
+
+- half, float, double, and fp128, which correspond to the binary16, binary32,
+  binary64, and binary128 formats described in the IEEE-754 specification.
+- The remaining types, which do not directly correspond to a standard IEEE
+  format.
+
+For floating-point operations acting on types with a corresponding IEEE format,
+unless otherwise specified the value returned by that operation matches that of
+the corresponding IEEE-754 operation executed in the :ref:`default
+floating-point environment <floatenv>`, except that the behavior of NaN results
+is instead :ref:`as specified here <floatnan>`. (This statement concerns only
+the returned *value*; we make no statement about status flags or
+traps/exceptions.) In particular, a floating-point instruction returning a
+non-NaN value is guaranteed to always return the same bit-identical result on
----------------
RalfJung wrote:

minimum/maximum don't do any rounding, making this clarification much less relevant. So maybe we should just say that this is about the core operations listed in section 5?

https://github.com/llvm/llvm-project/pull/102140


More information about the llvm-commits mailing list