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,46 @@ `_ for more information on the semantics. +``__builtin_flt_rounds`` +-------------------------- + +.. code-block:: c + + int __builtin_flt_rounds(); + +Returns the current rounding mode. Encoding of the returned values 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 +See `llvm.get.rounding +`_ for +more information on the semantics. + +``__builtin_set_flt_rounds`` +-------------------------- + +.. code-block:: c + + void __builtin_set_flt_rounds(int); + +Sets the current rounding mode. Encoding of the returned values 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 +See `llvm.set.rounding +`_ for +more information on the semantics. +This builtin is converted to llvm.set.rounding intrinsic in LLVM IR level +and not all targets support this intrinsic, so only x86 and arm targets +support this builtin. Since this builtin changes default floating-point +environment, ``#pragma STDC FENV_ACCESS ON`` is required. + String builtins ---------------