about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.ibm.com>2019-12-11 15:09:24 +0100
committerStefan Liebler <stli@linux.ibm.com>2019-12-11 15:12:19 +0100
commitf818afdd3b29d7eef2010448457c9f5c16e684cd (patch)
tree642a01b96f19ec7f6668f867ff82eb045688c949 /sysdeps/ieee754/ldbl-128
parentf82996f8159981619ac7ed8a4c1838c2ad72ab61 (diff)
downloadglibc-f818afdd3b29d7eef2010448457c9f5c16e684cd.tar.gz
glibc-f818afdd3b29d7eef2010448457c9f5c16e684cd.tar.xz
glibc-f818afdd3b29d7eef2010448457c9f5c16e684cd.zip
Use GCC builtins for copysign functions if desired.
This patch is always using the corresponding GCC builtin for copysignf, copysign,
and is using the builtin for copysignl, copysignf128 if the USE_FUNCTION_BUILTIN
macros are defined to one in math-use-builtins.h.

Altough the long double version is enabled by default we still need
the macro and the alternative implementation as the _Float128 version
of the builtin is not available with all supported GCC versions.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/ieee754/ldbl-128')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_copysignl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_copysignl.c b/sysdeps/ieee754/ldbl-128/s_copysignl.c
index a501139f71..848a184524 100644
--- a/sysdeps/ieee754/ldbl-128/s_copysignl.c
+++ b/sysdeps/ieee754/ldbl-128/s_copysignl.c
@@ -27,14 +27,20 @@ static char rcsid[] = "$NetBSD: $";
 #include <math.h>
 #include <math_private.h>
 #include <libm-alias-ldouble.h>
+#include <math-use-builtins.h>
 
 _Float128 __copysignl(_Float128 x, _Float128 y)
 {
+#if USE_COPYSIGNL_BUILTIN
+  return __builtin_copysignl (x, y);
+#else
+  /* Use generic implementation.  */
 	uint64_t hx,hy;
 	GET_LDOUBLE_MSW64(hx,x);
 	GET_LDOUBLE_MSW64(hy,y);
 	SET_LDOUBLE_MSW64(x,(hx&0x7fffffffffffffffULL)
 			    |(hy&0x8000000000000000ULL));
         return x;
+#endif /* ! USE_COPYSIGNL_BUILTIN  */
 }
 libm_alias_ldouble (__copysign, copysign)