about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.ibm.com>2019-12-11 15:09:24 +0100
committerStefan Liebler <stli@linux.ibm.com>2019-12-11 15:12:18 +0100
commitf82996f8159981619ac7ed8a4c1838c2ad72ab61 (patch)
tree684c4c0fad4471c925d49b8772d60e35e9ca5de6 /sysdeps/ieee754/dbl-64
parent1ac9c1cf87216bf9f8ac4f7c9754d025d9f2c4ae (diff)
downloadglibc-f82996f8159981619ac7ed8a4c1838c2ad72ab61.tar.gz
glibc-f82996f8159981619ac7ed8a4c1838c2ad72ab61.tar.xz
glibc-f82996f8159981619ac7ed8a4c1838c2ad72ab61.zip
Use GCC builtins for round functions if desired.
This patch is using the corresponding GCC builtin for roundf, round,
roundl and roundf128 if the USE_FUNCTION_BUILTIN macros are defined to one
in math-use-builtins.h.

This is the case for s390 if build with at least --march=z196 --mzarch.
Otherwise the generic implementation is used.  The code of the generic
implementation is not changed.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r--sysdeps/ieee754/dbl-64/s_round.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_round.c b/sysdeps/ieee754/dbl-64/s_round.c
index 8f4b7cff86..7eb1ecb482 100644
--- a/sysdeps/ieee754/dbl-64/s_round.c
+++ b/sysdeps/ieee754/dbl-64/s_round.c
@@ -23,11 +23,16 @@
 #include <math_private.h>
 #include <libm-alias-double.h>
 #include <stdint.h>
+#include <math-use-builtins.h>
 
 
 double
 __round (double x)
 {
+#if USE_ROUND_BUILTIN
+  return __builtin_round (x);
+#else
+  /* Use generic implementation.  */
   int64_t i0, j0;
 
   EXTRACT_WORDS64 (i0, x);
@@ -62,5 +67,6 @@ __round (double x)
 
   INSERT_WORDS64 (x, i0);
   return x;
+#endif /* ! USE_ROUND_BUILTIN  */
 }
 libm_alias_double (__round, round)