about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64
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/dbl-64
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/dbl-64')
-rw-r--r--sysdeps/ieee754/dbl-64/s_copysign.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_copysign.c b/sysdeps/ieee754/dbl-64/s_copysign.c
index 589b088c95..94025b7854 100644
--- a/sysdeps/ieee754/dbl-64/s_copysign.c
+++ b/sysdeps/ieee754/dbl-64/s_copysign.c
@@ -10,7 +10,7 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
+#if defined (LIBM_SCCS) && ! defined (lint)
 static char rcsid[] = "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $";
 #endif
 
@@ -22,16 +22,11 @@ static char rcsid[] = "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $
 
 #define NO_MATH_REDIRECT
 #include <math.h>
-#include <math_private.h>
 #include <libm-alias-double.h>
 
 double
 __copysign (double x, double y)
 {
-  uint32_t hx, hy;
-  GET_HIGH_WORD (hx, x);
-  GET_HIGH_WORD (hy, y);
-  SET_HIGH_WORD (x, (hx & 0x7fffffff) | (hy & 0x80000000));
-  return x;
+  return __builtin_copysign (x, y);
 }
 libm_alias_double (__copysign, copysign)