diff options
author | Xiaolin Tang <tangxiaolin@loongson.cn> | 2022-11-23 11:45:00 +0800 |
---|---|---|
committer | caiyinyu <caiyinyu@loongson.cn> | 2022-11-29 16:00:28 +0800 |
commit | 2e2485ce05bce85bf092ba0752854afa14b92dad (patch) | |
tree | 4138377bc399d8368b1e838941f12889ff4c8495 /sysdeps/ieee754/dbl-64/s_logb.c | |
parent | f711e4ef53990b6c76f2dfdbcb9f791c541cdac3 (diff) | |
download | glibc-2e2485ce05bce85bf092ba0752854afa14b92dad.tar.gz glibc-2e2485ce05bce85bf092ba0752854afa14b92dad.tar.xz glibc-2e2485ce05bce85bf092ba0752854afa14b92dad.zip |
Use GCC builtins for logb functions if desired.
This patch is using the corresponding GCC builtin for logbf, logb, logbl and logbf128 if the USE_FUNCTION_BUILTIN macros are defined to one in math-use-builtins-function.h. Co-Authored-By: Xi Ruoyao <xry111@xry111.site>
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_logb.c')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_logb.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_logb.c b/sysdeps/ieee754/dbl-64/s_logb.c index 82cabd206a..dd74d5f08c 100644 --- a/sysdeps/ieee754/dbl-64/s_logb.c +++ b/sysdeps/ieee754/dbl-64/s_logb.c @@ -21,10 +21,14 @@ #include <math_private.h> #include <libm-alias-double.h> #include <fix-int-fp-convert-zero.h> +#include <math-use-builtins.h> double __logb (double x) { +#if USE_LOGB_BUILTIN + return __builtin_logb (x); +#else int64_t ix, ex; EXTRACT_WORDS64 (ix, x); @@ -42,6 +46,7 @@ __logb (double x) if (FIX_INT_FP_CONVERT_ZERO && ex == 1023) return 0.0; return (double) (ex - 1023); +#endif /* !USE_LOGB_BUILTIN */ } #ifndef __logb libm_alias_double (__logb, logb) |