diff options
author | Stefan Liebler <stli@linux.ibm.com> | 2019-12-11 15:09:20 +0100 |
---|---|---|
committer | Stefan Liebler <stli@linux.ibm.com> | 2019-12-11 15:12:16 +0100 |
commit | a2a9b004297b777758420c952cb6eea5985d37fe (patch) | |
tree | 247d1784ddc3b3940b6e5439e19373d1c94fd930 /sysdeps/ieee754/ldbl-128/s_rintl.c | |
parent | ae3577f607b50bf3ce9b0877e43ad2508c9da61b (diff) | |
download | glibc-a2a9b004297b777758420c952cb6eea5985d37fe.tar.gz glibc-a2a9b004297b777758420c952cb6eea5985d37fe.tar.xz glibc-a2a9b004297b777758420c952cb6eea5985d37fe.zip |
Use GCC builtins for rint functions if desired.
This patch is using the corresponding GCC builtin for rintf, rint, rintl and rintf128 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/ldbl-128/s_rintl.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_rintl.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_rintl.c b/sysdeps/ieee754/ldbl-128/s_rintl.c index b6337e1d8a..3340c35ee1 100644 --- a/sysdeps/ieee754/ldbl-128/s_rintl.c +++ b/sysdeps/ieee754/ldbl-128/s_rintl.c @@ -31,15 +31,19 @@ static char rcsid[] = "$NetBSD: $"; #include <math.h> #include <math_private.h> #include <libm-alias-ldouble.h> - -static const _Float128 -TWO112[2]={ - 5.19229685853482762853049632922009600E+33L, /* 0x406F000000000000, 0 */ - -5.19229685853482762853049632922009600E+33L /* 0xC06F000000000000, 0 */ -}; +#include <math-use-builtins.h> _Float128 __rintl(_Float128 x) { +#if USE_RINTL_BUILTIN + return __builtin_rintl (x); +#else + /* Use generic implementation. */ + static const _Float128 + TWO112[2] = { + 5.19229685853482762853049632922009600E+33L, /* 0x406F000000000000, 0 */ + -5.19229685853482762853049632922009600E+33L /* 0xC06F000000000000, 0 */ + }; int64_t i0,j0,sx; uint64_t i1 __attribute__ ((unused)); _Float128 w,t; @@ -60,5 +64,6 @@ _Float128 __rintl(_Float128 x) } w = TWO112[sx]+x; return w-TWO112[sx]; +#endif /* ! USE_RINTL_BUILTIN */ } libm_alias_ldouble (__rint, rint) |