From 2e2485ce05bce85bf092ba0752854afa14b92dad Mon Sep 17 00:00:00 2001 From: Xiaolin Tang Date: Wed, 23 Nov 2022 11:45:00 +0800 Subject: 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 --- sysdeps/ieee754/dbl-64/s_logb.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sysdeps/ieee754/dbl-64') 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 #include #include +#include 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) -- cgit 1.4.1