diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -3246,7 +3246,7 @@ double __builtin_canonicalize(double); float __builtin_canonicalizef(float); - long double__builtin_canonicalizel(long double); + long double __builtin_canonicalizel(long double); Returns the platform specific canonical encoding of a floating point number. This canonicalization is useful for implementing certain @@ -3254,6 +3254,25 @@ `_ for more information on the semantics. +``__builtin_flt_rounds`` and ``__builtin_set_flt_rounds`` +--------------------------------------------------------- + +.. code-block:: c + + int __builtin_flt_rounds(); + void __builtin_set_flt_rounds(int); + +Returns and sets current rounding mode. Encoding of the returned values and +input parameter is same as the result of FLT_ROUNDS, specified by C standard: +0 - toward zero +1 - to nearest, ties to even +2 - toward positive infinity +3 - toward negative infinity +4 - to nearest, ties away from zero +The effect of passing some other value to ``__builtin_flt_rounds`` is +implementation-defined. ``__builtin_set_flt_rounds`` is restricted to work on +X86 and Arm targets currently. + String builtins --------------- diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -272,6 +272,7 @@ - Add ``__builtin_elementwise_log2`` builtin for floating point types only. - Add ``__builtin_elementwise_exp`` builtin for floating point types only. - Add ``__builtin_elementwise_exp2`` builtin for floating point types only. +- Add ``__builtin_set_flt_rounds`` builtin for X86, x86_64, Arm and AArch64 only. AST Matchers ------------