Skip to content

Commit 7d4deb8

Browse files
committed
move floatsem section after the more generally applicable floatenv and floatnan section; clarify which operations it applies to
1 parent cd80e84 commit 7d4deb8

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

llvm/docs/LangRef.rst

+33-33
Original file line numberDiff line numberDiff line change
@@ -3572,39 +3572,6 @@ or ``syncscope("<target-scope>")`` *synchronizes with* and participates in the
35723572
seq\_cst total orderings of other operations that are not marked
35733573
``syncscope("singlethread")`` or ``syncscope("<target-scope>")``.
35743574

3575-
.. _floatsem:
3576-
3577-
Floating-Point Semantics
3578-
------------------------
3579-
3580-
LLVM floating-point types fall into two categories:
3581-
3582-
- half, float, double, and fp128, which correspond to the binary16, binary32,
3583-
binary64, and binary128 formats described in the IEEE-754 specification.
3584-
- The remaining types, which do not directly correspond to a standard IEEE
3585-
format.
3586-
3587-
For floating-point operations acting on types with a corresponding IEEE format,
3588-
unless otherwise specified the value returned by that operation matches that of
3589-
the corresponding IEEE-754 operation executed in the :ref:`default
3590-
floating-point environment <floatenv>`, except that the behavior of NaN results
3591-
is instead :ref:`as specified here <floatnan>`. (This statement concerns only
3592-
the returned *value*; we make no statement about status flags or
3593-
traps/exceptions.) In particular, a floating-point instruction returning a
3594-
non-NaN value is guaranteed to always return the same bit-identical result on
3595-
all machines and optimization levels.
3596-
3597-
This means that optimizations and backends may not change the observed bitwise
3598-
result of these operations in any way (unless NaNs are returned), and frontends
3599-
can rely on these operations providing perfectly rounded results as described in
3600-
the standard.
3601-
3602-
Various flags and attributes can alter the behavior of these operations and thus
3603-
make them not bit-identical across machines and optimization levels any more:
3604-
most notably, the :ref:`fast-math flags <fastmath>` as well as the ``strictfp``
3605-
and ``denormal-fp-math`` attributes. See their corresponding documentation for
3606-
details.
3607-
36083575
.. _floatenv:
36093576

36103577
Floating-Point Environment
@@ -3692,6 +3659,39 @@ specification on some architectures:
36923659
LLVM does not correctly represent this. See `issue #60796
36933660
<https://github.com/llvm/llvm-project/issues/60796>`_.
36943661

3662+
.. _floatsem:
3663+
3664+
Floating-Point Semantics
3665+
------------------------
3666+
3667+
This section defines the semantics for core floating-point operations on types
3668+
that use a format specified by IEEE-745. These types are: ``half``, ``float``,
3669+
``double``, and ``fp128``, which correspond to the binary16, binary32, binary64,
3670+
and binary128 formats, respectively. The "core" operations are those defined in
3671+
section 5 of IEEE-745, which all have corresponding LLVM operations.
3672+
3673+
The value returned by those operations matches that of the corresponding
3674+
IEEE-754 operation executed in the :ref:`default LLVM floating-point environment
3675+
<floatenv>`, except that the behavior of NaN results is instead :ref:`as
3676+
specified here <floatnan>`. In particular, such a floating-point instruction
3677+
returning a non-NaN value is guaranteed to always return the same bit-identical
3678+
result on all machines and optimization levels.
3679+
3680+
This means that optimizations and backends may not change the observed bitwise
3681+
result of these operations in any way (unless NaNs are returned), and frontends
3682+
can rely on these operations providing perfectly rounded results as described in
3683+
the standard.
3684+
3685+
(Note that this is only about the value returned by these operations; see the
3686+
:ref:`floating-point environment section <floatenv>` regarding flags and
3687+
exceptions.)
3688+
3689+
Various flags and attributes can alter the behavior of these operations and thus
3690+
make them not bit-identical across machines and optimization levels any more:
3691+
most notably, the :ref:`fast-math flags <fastmath>` as well as the ``strictfp``
3692+
and ``denormal-fp-math`` attributes. See their corresponding documentation for
3693+
details.
3694+
36953695
.. _fastmath:
36963696

36973697
Fast-Math Flags

0 commit comments

Comments
 (0)