diff options
Diffstat (limited to 'docs/LanguageExtensions.rst')
-rw-r--r-- | docs/LanguageExtensions.rst | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/docs/LanguageExtensions.rst b/docs/LanguageExtensions.rst index 885ad579ba72..a8fb4623b637 100644 --- a/docs/LanguageExtensions.rst +++ b/docs/LanguageExtensions.rst @@ -356,7 +356,7 @@ is: Query for this feature with ``__has_extension(attribute_ext_vector_type)``. -Giving ``-faltivec`` option to clang enables support for AltiVec vector syntax +Giving ``-maltivec`` option to clang enables support for AltiVec vector syntax and functions. For example: .. code-block:: c++ @@ -993,6 +993,7 @@ The following type trait primitives are supported by Clang: * ``__has_trivial_destructor`` (GNU, Microsoft) * ``__has_virtual_destructor`` (GNU, Microsoft) * ``__is_abstract`` (GNU, Microsoft) +* ``__is_aggregate`` (GNU, Microsoft) * ``__is_base_of`` (GNU, Microsoft) * ``__is_class`` (GNU, Microsoft) * ``__is_convertible_to`` (Microsoft) @@ -1780,7 +1781,7 @@ String builtins --------------- Clang provides constant expression evaluation support for builtins forms of -the following functions from the C standard library ``<strings.h>`` header: +the following functions from the C standard library ``<string.h>`` header: * ``memchr`` * ``memcmp`` @@ -2312,3 +2313,36 @@ For example, the hint ``vectorize_width(4)`` is ignored if the loop is not proven safe to vectorize. To identify and diagnose optimization issues use `-Rpass`, `-Rpass-missed`, and `-Rpass-analysis` command line options. See the user guide for details. + +Extensions to specify floating-point flags +==================================================== + +The ``#pragma clang fp`` pragma allows floating-point options to be specified +for a section of the source code. This pragma can only appear at file scope or +at the start of a compound statement (excluding comments). When using within a +compound statement, the pragma is active within the scope of the compound +statement. + +Currently, only FP contraction can be controlled with the pragma. ``#pragma +clang fp contract`` specifies whether the compiler should contract a multiply +and an addition (or subtraction) into a fused FMA operation when supported by +the target. + +The pragma can take three values: ``on``, ``fast`` and ``off``. The ``on`` +option is identical to using ``#pragma STDC FP_CONTRACT(ON)`` and it allows +fusion as specified the language standard. The ``fast`` option allows fusiong +in cases when the language standard does not make this possible (e.g. across +statements in C) + +.. code-block:: c++ + + for(...) { + #pragma clang fp contract(fast) + a = b[i] * c[i]; + d[i] += a; + } + + +The pragma can also be used with ``off`` which turns FP contraction off for a +section of the code. This can be useful when fast contraction is otherwise +enabled for the translation unit with the ``-ffp-contract=fast`` flag. |