summaryrefslogtreecommitdiffstats
path: root/clang/docs/LanguageExtensions.rst
diff options
context:
space:
mode:
authorKang Zhang <shkzhang@cn.ibm.com>2019-03-29 09:11:52 +0000
committerKang Zhang <shkzhang@cn.ibm.com>2019-03-29 09:11:52 +0000
commite5ac385fb1ffa4bd3875ea6a4d24efdbd7814572 (patch)
treed412e43869deac8609ce0a0375ebdbeb9650ea42 /clang/docs/LanguageExtensions.rst
parent05f78b35ae82e371bfa478d02c482c6825c5fd80 (diff)
downloadbcm5719-llvm-e5ac385fb1ffa4bd3875ea6a4d24efdbd7814572.tar.gz
bcm5719-llvm-e5ac385fb1ffa4bd3875ea6a4d24efdbd7814572.zip
[PowerPC] Add the support for __builtin_setrnd() in clang
Summary: PowerPC64/PowerPC64le supports the builtin function __builtin_setrnd to set the floating point rounding mode. This function will use the least significant two bits of integer argument to set the floating point rounding mode. double __builtin_setrnd(int mode); The effective values for mode are: 0 - round to nearest 1 - round to zero 2 - round to +infinity 3 - round to -infinity Note that the mode argument will modulo 4, so if the int argument is greater than 3, it will only use the least significant two bits of the mode. Namely, builtin_setrnd(102)) is equal to builtin_setrnd(2). Reviewed By: jsji Differential Revision: https://reviews.llvm.org/D59403 llvm-svn: 357242
Diffstat (limited to 'clang/docs/LanguageExtensions.rst')
-rw-r--r--clang/docs/LanguageExtensions.rst72
1 files changed, 72 insertions, 0 deletions
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index d4c40b29f80..d79d4122777 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -2376,6 +2376,78 @@ Which compiles to (on X86-32):
movl %gs:(%eax), %eax
ret
+PowerPC Language Extensions
+------------------------------
+
+Set the Floating Point Rounding Mode
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+PowerPC64/PowerPC64le supports the builtin function ``__builtin_setrnd`` to set
+the floating point rounding mode. This function will use the least significant
+two bits of integer argument to set the floating point rounding mode.
+
+.. code-block:: c++
+
+ double __builtin_setrnd(int mode);
+
+The effective values for mode are:
+
+ - 0 - round to nearest
+ - 1 - round to zero
+ - 2 - round to +infinity
+ - 3 - round to -infinity
+
+Note that the mode argument will modulo 4, so if the int argument is greater
+than 3, it will only use the least significant two bits of the mode.
+Namely, ``__builtin_setrnd(102))`` is equal to ``__builtin_setrnd(2)``.
+
+PowerPC Language Extensions
+------------------------------
+
+Set the Floating Point Rounding Mode
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+PowerPC64/PowerPC64le supports the builtin function ``__builtin_setrnd`` to set
+the floating point rounding mode. This function will use the least significant
+two bits of integer argument to set the floating point rounding mode.
+
+.. code-block:: c++
+
+ double __builtin_setrnd(int mode);
+
+The effective values for mode are:
+
+ - 0 - round to nearest
+ - 1 - round to zero
+ - 2 - round to +infinity
+ - 3 - round to -infinity
+
+Note that the mode argument will modulo 4, so if the integer argument is greater
+than 3, it will only use the least significant two bits of the mode.
+Namely, ``__builtin_setrnd(102))`` is equal to ``__builtin_setrnd(2)``.
+
+PowerPC Language Extensions
+------------------------------
+
+Set the Floating Point Rounding Mode
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+PowerPC64/PowerPC64le supports the builtin function ``__builtin_setrnd`` to set
+the floating point rounding mode. This function will use the least significant
+two bits of integer argument to set the floating point rounding mode.
+
+.. code-block:: c++
+
+ double __builtin_setrnd(int mode);
+
+The effective values for mode are:
+
+ - 0 - round to nearest
+ - 1 - round to zero
+ - 2 - round to +infinity
+ - 3 - round to -infinity
+
+Note that the mode argument will modulo 4, so if the integer argument is greater
+than 3, it will only use the least significant two bits of the mode.
+Namely, ``__builtin_setrnd(102))`` is equal to ``__builtin_setrnd(2)``.
+
Extensions for Static Analysis
==============================
OpenPOWER on IntegriCloud