|
|
82289a |
Move __isnanl_pseudo to its own file in sysdeps/x86/isnanl-pseudo.c so
|
|
|
82289a |
that it only links into libc.so. This way it is only available to
|
|
|
82289a |
functions in libc and should not affect libm.
|
|
|
82289a |
|
|
|
82289a |
diff --git a/include/math.h b/include/math.h
|
|
|
82289a |
index 4eddc81be0dccad9..c42c8101dd8ebc88 100644
|
|
|
82289a |
--- a/include/math.h
|
|
|
82289a |
+++ b/include/math.h
|
|
|
82289a |
@@ -7,8 +7,7 @@
|
|
|
82289a |
extern int __matherr (struct exception *__exc);
|
|
|
82289a |
|
|
|
82289a |
# if IS_IN (libc)
|
|
|
82289a |
-extern int __isnanl_pseudo (long double);
|
|
|
82289a |
-hidden_proto (__isnanl_pseudo)
|
|
|
82289a |
+extern int __isnanl_pseudo (long double) attribute_hidden;
|
|
|
82289a |
#endif
|
|
|
82289a |
|
|
|
82289a |
# if IS_IN (libc) || IS_IN (libm)
|
|
|
82289a |
diff --git a/sysdeps/i386/fpu/s_isnanl.c b/sysdeps/i386/fpu/s_isnanl.c
|
|
|
82289a |
index dc83d7a85fb3318b..816396d8fbc79dde 100644
|
|
|
82289a |
--- a/sysdeps/i386/fpu/s_isnanl.c
|
|
|
82289a |
+++ b/sysdeps/i386/fpu/s_isnanl.c
|
|
|
82289a |
@@ -41,23 +41,3 @@ int __isnanl(long double x)
|
|
|
82289a |
}
|
|
|
82289a |
hidden_def (__isnanl)
|
|
|
82289a |
weak_alias (__isnanl, isnanl)
|
|
|
82289a |
-
|
|
|
82289a |
-#if IS_IN (libc)
|
|
|
82289a |
-/* Exact backport from glibc-2.33, used only in printf_fp.c. */
|
|
|
82289a |
-int __isnanl_pseudo (long double x)
|
|
|
82289a |
-{
|
|
|
82289a |
- int32_t se,hx,lx,pn;
|
|
|
82289a |
- GET_LDOUBLE_WORDS(se,hx,lx,x);
|
|
|
82289a |
- se = (se & 0x7fff) << 1;
|
|
|
82289a |
- /* Detect pseudo-normal numbers, i.e. exponent is non-zero and the top
|
|
|
82289a |
- bit of the significand is not set. */
|
|
|
82289a |
- pn = (uint32_t)((~hx & 0x80000000) & (se|(-se)))>>31;
|
|
|
82289a |
- /* Clear the significand bit when computing mantissa. */
|
|
|
82289a |
- lx |= hx & 0x7fffffff;
|
|
|
82289a |
- se |= (uint32_t)(lx|(-lx))>>31;
|
|
|
82289a |
- se = 0xfffe - se;
|
|
|
82289a |
-
|
|
|
82289a |
- return (int)(((uint32_t)(se)) >> 16) | pn;
|
|
|
82289a |
-}
|
|
|
82289a |
-hidden_def (__isnanl_pseudo)
|
|
|
82289a |
-#endif
|
|
|
82289a |
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
|
|
|
82289a |
index f1da941dbbadadb3..d2f7b05db6ff6f72 100644
|
|
|
82289a |
--- a/sysdeps/x86/Makefile
|
|
|
82289a |
+++ b/sysdeps/x86/Makefile
|
|
|
82289a |
@@ -22,3 +22,7 @@ endif
|
|
|
82289a |
ifeq ($(subdir),math)
|
|
|
82289a |
tests += tst-ldbl-nonnormal-printf
|
|
|
82289a |
endif # $(subdir) == math
|
|
|
82289a |
+
|
|
|
82289a |
+ifeq ($(subdir),stdio-common)
|
|
|
82289a |
+sysdep_routines += isnanl-pseudo
|
|
|
82289a |
+endif
|
|
|
82289a |
diff --git a/sysdeps/x86/isnanl-pseudo.c b/sysdeps/x86/isnanl-pseudo.c
|
|
|
82289a |
new file mode 100644
|
|
|
82289a |
index 0000000000000000..95aba4672ba51a16
|
|
|
82289a |
--- /dev/null
|
|
|
82289a |
+++ b/sysdeps/x86/isnanl-pseudo.c
|
|
|
82289a |
@@ -0,0 +1,45 @@
|
|
|
82289a |
+/* s_isnanl.c -- long double version for i387 of s_isnan.c.
|
|
|
82289a |
+ * Conversion to long double by Ulrich Drepper,
|
|
|
82289a |
+ * Cygnus Support, drepper@cygnus.com.
|
|
|
82289a |
+ */
|
|
|
82289a |
+
|
|
|
82289a |
+/*
|
|
|
82289a |
+ * ====================================================
|
|
|
82289a |
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
|
82289a |
+ *
|
|
|
82289a |
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
|
82289a |
+ * Permission to use, copy, modify, and distribute this
|
|
|
82289a |
+ * software is freely granted, provided that this notice
|
|
|
82289a |
+ * is preserved.
|
|
|
82289a |
+ * ====================================================
|
|
|
82289a |
+ */
|
|
|
82289a |
+
|
|
|
82289a |
+#if defined(LIBM_SCCS) && !defined(lint)
|
|
|
82289a |
+static char rcsid[] = "$NetBSD: $";
|
|
|
82289a |
+#endif
|
|
|
82289a |
+
|
|
|
82289a |
+/*
|
|
|
82289a |
+ * isnanl(x) returns 1 is x is nan, else 0;
|
|
|
82289a |
+ * no branching!
|
|
|
82289a |
+ */
|
|
|
82289a |
+
|
|
|
82289a |
+#include <math.h>
|
|
|
82289a |
+#include <math_private.h>
|
|
|
82289a |
+
|
|
|
82289a |
+int
|
|
|
82289a |
+attribute_hidden
|
|
|
82289a |
+__isnanl_pseudo(long double x)
|
|
|
82289a |
+{
|
|
|
82289a |
+ int32_t se,hx,lx,pn;
|
|
|
82289a |
+ GET_LDOUBLE_WORDS(se,hx,lx,x);
|
|
|
82289a |
+ se = (se & 0x7fff) << 1;
|
|
|
82289a |
+ /* Detect pseudo-normal numbers, i.e. exponent is non-zero and the top
|
|
|
82289a |
+ bit of the significand is not set. */
|
|
|
82289a |
+ pn = (uint32_t)((~hx & 0x80000000) & (se|(-se)))>>31;
|
|
|
82289a |
+ /* Clear the significand bit when computing mantissa. */
|
|
|
82289a |
+ lx |= hx & 0x7fffffff;
|
|
|
82289a |
+ se |= (uint32_t)(lx|(-lx))>>31;
|
|
|
82289a |
+ se = 0xfffe - se;
|
|
|
82289a |
+
|
|
|
82289a |
+ return (int)(((uint32_t)(se)) >> 16) | pn;
|
|
|
82289a |
+}
|