diff options
author | Shen-Ta Hsieh <ibmibmibm.tw@gmail.com> | 2021-05-24 09:43:12 +0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-06-27 07:56:57 -0700 |
commit | eb9066203f6e07128d42f771def4b7ad37b25dc1 (patch) | |
tree | ae5cce761a496d4d1b9ec2f911ec0bbc5638d007 /sysdeps/ieee754/dbl-64 | |
parent | 1683249d17e14827b6579529742eb895027dfa84 (diff) | |
download | glibc-eb9066203f6e07128d42f771def4b7ad37b25dc1.tar.gz glibc-eb9066203f6e07128d42f771def4b7ad37b25dc1.tar.xz glibc-eb9066203f6e07128d42f771def4b7ad37b25dc1.zip |
Use GCC builtins for roundeven functions if desired.
This patch is using the corresponding GCC builtin for roundevenf, roundeven and roundevenl if the USE_FUNCTION_BUILTIN macros are defined to one in math-use-builtins.h. These builtin functions is supported since GCC 10. The code of the generic implementation is not changed. Signed-off-by: Shen-Ta Hsieh <ibmibmibm.tw@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_roundeven.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_roundeven.c b/sysdeps/ieee754/dbl-64/s_roundeven.c index 5deff3bb8a..88c051e9fe 100644 --- a/sysdeps/ieee754/dbl-64/s_roundeven.c +++ b/sysdeps/ieee754/dbl-64/s_roundeven.c @@ -21,6 +21,7 @@ #include <math_private.h> #include <libm-alias-double.h> #include <stdint.h> +#include <math-use-builtins.h> #define BIAS 0x3ff #define MANT_DIG 53 @@ -29,6 +30,9 @@ double __roundeven (double x) { +#if USE_ROUNDEVEN_BUILTIN + return __builtin_roundeven (x); +#else uint64_t ix, ux; EXTRACT_WORDS64 (ix, x); ux = ix & 0x7fffffffffffffffULL; @@ -66,6 +70,7 @@ __roundeven (double x) ix &= 0x8000000000000000ULL; INSERT_WORDS64 (x, ix); return x; +#endif /* ! USE_ROUNDEVEN_BUILTIN */ } #ifndef __roundeven libm_alias_double (__roundeven, roundeven) |