xiongji90 created this revision. xiongji90 added reviewers: rjmccall, sepavloff, aaron.ballman, andrew.w.kaylor. Herald added a project: All. xiongji90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
This patch aims to add necessary description for __builtin_flt_rounds and __builtins_set_flt_rounds in LanguageExtensions.rst Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D146188 Files: clang/docs/LanguageExtensions.rst Index: clang/docs/LanguageExtensions.rst =================================================================== --- clang/docs/LanguageExtensions.rst +++ 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 @@ <https://llvm.org/docs/LangRef.html#llvm-canonicalize-intrinsic>`_ 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 +<https://llvm.org/docs/LangRef.html#llvm-get-rounding-intrinsic>`_ 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 +<https://llvm.org/docs/LangRef.html#llvm-set-rounding-intrinsic>`_ 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 ---------------
Index: clang/docs/LanguageExtensions.rst =================================================================== --- clang/docs/LanguageExtensions.rst +++ 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 @@ <https://llvm.org/docs/LangRef.html#llvm-canonicalize-intrinsic>`_ 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 +<https://llvm.org/docs/LangRef.html#llvm-get-rounding-intrinsic>`_ 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 +<https://llvm.org/docs/LangRef.html#llvm-set-rounding-intrinsic>`_ 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 ---------------
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits