Skip to content

Commit fd2cb4b

Browse files
committed
[Clang][doc] -ffp-contract options and standard compliance
We had an internal discussion about -ffp-contract, how it compared to GCC which defaults to fast, and standard compliance. Looking at our docs, I think most information is there, but also thought it could be a little bit more explicit about when it is and isn't standard compliant. Let me know if you think this is an improvement or not; happy to abandon this if you think it is not helping much.
1 parent 059f044 commit fd2cb4b

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

clang/docs/UsersManual.rst

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,19 +1681,25 @@ for more details.
16811681
permitted to produce more precise results than performing the same
16821682
operations separately.
16831683

1684-
The C standard permits intermediate floating-point results within an
1684+
The C/C++ standard permits intermediate floating-point results within an
16851685
expression to be computed with more precision than their type would
16861686
normally allow. This permits operation fusing, and Clang takes advantage
1687-
of this by default. This behavior can be controlled with the ``FP_CONTRACT``
1688-
and ``clang fp contract`` pragmas. Please refer to the pragma documentation
1689-
for a description of how the pragmas interact with this option.
1687+
of this by default (``on``). Fusion across statements is non-C/C++ standard
1688+
compliant behavior and can be enabled (``fast``).
1689+
1690+
Fusion can be controlled with the ``FP_CONTRACT`` and ``clang fp contract``
1691+
pragmas. Please refer to the pragma documentation for a description of how
1692+
the pragmas interact with this option.
16901693

16911694
Valid values are:
16921695

1693-
* ``fast`` (fuse across statements disregarding pragmas, default for CUDA)
1694-
* ``on`` (fuse in the same statement unless dictated by pragmas, default for languages other than CUDA/HIP)
1695-
* ``off`` (never fuse)
1696-
* ``fast-honor-pragmas`` (fuse across statements unless dictated by pragmas, default for HIP)
1696+
* ``fast``: enable non-C/C++ standard compliant behavior and fusion across
1697+
statements disregarding pragmas (default for CUDA)
1698+
* ``on``: enable C/C++ standard complaint fusion in the same statement unless
1699+
dictated by pragmas (default for languages other than CUDA/HIP)
1700+
* ``off``: disable fusion
1701+
* ``fast-honor-pragmas``: fuse across statements unless dictated by pragmas
1702+
(default for HIP)
16971703

16981704
.. option:: -f[no-]honor-infinities
16991705

0 commit comments

Comments
 (0)