about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128/s_logbl.c
diff options
context:
space:
mode:
authorXiaolin Tang <tangxiaolin@loongson.cn>2022-11-23 11:45:00 +0800
committercaiyinyu <caiyinyu@loongson.cn>2022-11-29 16:00:28 +0800
commit2e2485ce05bce85bf092ba0752854afa14b92dad (patch)
tree4138377bc399d8368b1e838941f12889ff4c8495 /sysdeps/ieee754/ldbl-128/s_logbl.c
parentf711e4ef53990b6c76f2dfdbcb9f791c541cdac3 (diff)
downloadglibc-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/ldbl-128/s_logbl.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_logbl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_logbl.c b/sysdeps/ieee754/ldbl-128/s_logbl.c
index 1c56eda499..59b08aa295 100644
--- a/sysdeps/ieee754/ldbl-128/s_logbl.c
+++ b/sysdeps/ieee754/ldbl-128/s_logbl.c
@@ -25,10 +25,15 @@ static char rcsid[] = "$NetBSD: $";
 #include <math.h>
 #include <math_private.h>
 #include <libm-alias-ldouble.h>
+#include <math-use-builtins.h>
 
 _Float128
 __logbl (_Float128 x)
 {
+#if USE_LOGBL_BUILTIN
+  return __builtin_logbl (x);
+#else
+  /* Use generic implementation.  */
   int64_t lx, hx, ex;
 
   GET_LDOUBLE_WORDS64 (hx, lx, x);
@@ -49,6 +54,7 @@ __logbl (_Float128 x)
       ex -= ma - 16;
     }
   return (_Float128) (ex - 16383);
+#endif /* ! USE_LOGBL_BUILTIN  */
 }
 
 libm_alias_ldouble (__logb, logb)