about summary refs log tree commit diff
path: root/sysdeps/sparc/fpu
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /sysdeps/sparc/fpu
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.xz
glibc-a334319f6530564d22e775935d9c91663623a1b4.zip
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'sysdeps/sparc/fpu')
-rw-r--r--sysdeps/sparc/fpu/bits/mathdef.h68
-rw-r--r--sysdeps/sparc/fpu/bits/mathinline.h81
-rw-r--r--sysdeps/sparc/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/sparc/fpu/fesetround.c3
-rw-r--r--sysdeps/sparc/fpu/fraiseexcpt.c34
5 files changed, 91 insertions, 98 deletions
diff --git a/sysdeps/sparc/fpu/bits/mathdef.h b/sysdeps/sparc/fpu/bits/mathdef.h
new file mode 100644
index 0000000000..e76735b55b
--- /dev/null
+++ b/sysdeps/sparc/fpu/bits/mathdef.h
@@ -0,0 +1,68 @@
+/* Copyright (C) 1997, 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#if !defined _MATH_H && !defined _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* FIXME! This file describes properties of the compiler, not the machine;
+   it should not be part of libc!  */
+
+#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
+# define _MATH_H_MATHDEF	1
+
+# ifdef __GNUC__
+#  if __STDC__ == 1
+
+/* In GNU or ANSI mode, gcc leaves `float' expressions as-is.  */
+typedef float float_t;
+typedef double double_t;
+
+#  else
+
+/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
+typedef double float_t;
+typedef double double_t;
+
+#  endif
+# else
+
+/* Wild guess at types for float_t and double_t. */
+typedef double float_t;
+typedef double double_t;
+
+# endif
+
+/* The values returned by `ilogb' for 0 and NaN respectively.  */
+# define FP_ILOGB0       (-2147483647)
+# define FP_ILOGBNAN     (2147483647)
+
+#endif	/* ISO C99 */
+
+#ifndef __NO_LONG_DOUBLE_MATH
+
+# if __WORDSIZE == 32
+/* Signal that in 32bit ABI we do not really have a `long double'.
+   The disables the declaration of all the `long double' function
+   variants.  */
+#  define __NO_LONG_DOUBLE_MATH	1
+# endif
+
+#endif
diff --git a/sysdeps/sparc/fpu/bits/mathinline.h b/sysdeps/sparc/fpu/bits/mathinline.h
index 9dd784d122..7add493660 100644
--- a/sysdeps/sparc/fpu/bits/mathinline.h
+++ b/sysdeps/sparc/fpu/bits/mathinline.h
@@ -1,6 +1,5 @@
 /* Inline math functions for SPARC.
-   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006
-   Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
 
@@ -37,52 +36,23 @@
 
 # if __WORDSIZE == 32
 
-#  ifndef __NO_LONG_DOUBLE_MATH
-
-#   define __unordered_cmp(x, y) \
+#  define __unordered_cmp(x, y) \
   (__extension__							      \
    ({ unsigned __r;							      \
-      if (sizeof (x) == 4 && sizeof (y) == 4)				      \
+      if (sizeof(x) == 4 && sizeof(y) == 4)				      \
 	{								      \
 	  float __x = (x); float __y = (y);				      \
-	  __asm__ ("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x),      \
-		   "f" (__y) : "cc");					      \
-	}								      \
-      else if (sizeof (x) <= 8 && sizeof (y) <= 8)			      \
-	{								      \
-	  double __x = (x); double __y = (y);				      \
-	  __asm__ ("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x),   \
-		   "f" (__y) : "cc");					      \
-	}								      \
-      else								      \
-	{								      \
-	  long double __x = (x); long double __y = (y);			      \
-	  extern int _Q_cmp (const long double a, const long double b);	      \
-	  __r = _Q_cmp (__x, __y) << 10;				      \
-	}								      \
-      __r; }))
-
-#  else
-
-#   define __unordered_cmp(x, y) \
-  (__extension__							      \
-   ({ unsigned __r;							      \
-      if (sizeof (x) == 4 && sizeof (y) == 4)				      \
-	{								      \
-	  float __x = (x); float __y = (y);				      \
-	  __asm__ ("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x),      \
-		   "f" (__y) : "cc");					      \
+	  __asm__("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x),	      \
+		  "f" (__y) : "cc");					      \
 	}								      \
       else								      \
 	{								      \
 	  double __x = (x); double __y = (y);				      \
-	  __asm__ ("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x),   \
-		   "f" (__y) : "cc");					      \
+	  __asm__("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x),    \
+		  "f" (__y) : "cc");					      \
 	}								      \
       __r; }))
 
-#  endif
-
 #  define isgreater(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (2 << 10))
 #  define isgreaterequal(x, y) ((__unordered_cmp (x, y) & (1 << 10)) == 0)
 #  define isless(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (1 << 10))
@@ -95,22 +65,22 @@
 #  define __unordered_v9cmp(x, y, op, qop) \
   (__extension__							      \
    ({ unsigned __r;						      	      \
-      if (sizeof (x) == 4 && sizeof (y) == 4)				      \
+      if (sizeof(x) == 4 && sizeof(y) == 4)				      \
 	{								      \
 	  float __x = (x); float __y = (y);				      \
-	  __asm__ ("fcmps\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0"	      \
-		   : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc");      \
+	  __asm__("fcmps\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0"	      \
+		  : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc");	      \
 	}								      \
-      else if (sizeof (x) <= 8 && sizeof (y) <= 8)			      \
+      else if (sizeof(x) <= 8 && sizeof(y) <= 8)			      \
 	{								      \
 	  double __x = (x); double __y = (y);				      \
-	  __asm__ ("fcmpd\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0"	      \
-		   : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc");      \
+	  __asm__("fcmpd\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0"	      \
+		  : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc");	      \
 	}								      \
       else								      \
 	{								      \
 	  long double __x = (x); long double __y = (y);			      \
-	  extern int _Qp_cmp (const long double *a, const long double *b);    \
+	  extern int _Qp_cmp(const long double *a, const long double *b);     \
 	  __r = qop;						      	      \
 	}								      \
       __r; }))
@@ -157,20 +127,11 @@ __NTH (__signbit (double __x))
   return __u.__i[0] < 0;
 }
 
-#    ifndef __NO_LONG_DOUBLE_MATH
-__MATH_INLINE int
-__NTH (__signbitl (long double __x))
-{
-  __extension__ union { long double __l; int __i[4]; } __u = { __l: __x };
-  return __u.__i[0] < 0;
-}
-#    else
 __MATH_INLINE int
 __NTH (__signbitl (long double __x))
 {
   return __signbit ((double)__x);
 }
-#    endif
 
 #   else /* sparc64 */
 
@@ -219,13 +180,6 @@ __NTH (sqrtl (long double __x))
   _Qp_sqrt (&__r, &__x);
   return __r;
 }
-#   elif !defined __NO_LONG_DOUBLE_MATH
-__MATH_INLINE long double
-sqrtl (long double __x) __THROW
-{
-  extern long double _Q_sqrt (__const__ long double);
-  return _Q_sqrt (__x);
-}
 #   endif /* sparc64 */
 
 #  endif /* !__NO_MATH_INLINES && !GCC 3.2+ */
@@ -257,13 +211,6 @@ __ieee754_sqrtl (long double __x)
   _Qp_sqrt(&__r, &__x);
   return __r;
 }
-#   elif !defined __NO_LONG_DOUBLE_MATH
-__MATH_INLINE long double
-__ieee754_sqrtl (long double __x)
-{
-  extern long double _Q_sqrt (__const__ long double);
-  return _Q_sqrt (__x);
-}
 #   endif /* sparc64 */
 #  endif /* __LIBC_INTERNAL_MATH_INLINES */
 # endif /* gcc 2.8+ */
diff --git a/sysdeps/sparc/fpu/feholdexcpt.c b/sysdeps/sparc/fpu/feholdexcpt.c
index 729637ad1b..3bd2b16cf1 100644
--- a/sysdeps/sparc/fpu/feholdexcpt.c
+++ b/sysdeps/sparc/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,4 +33,3 @@ feholdexcept (fenv_t *envp)
 
   return 0;
 }
-libm_hidden_def (feholdexcept)
diff --git a/sysdeps/sparc/fpu/fesetround.c b/sysdeps/sparc/fpu/fesetround.c
index e3b441cd53..b18b344516 100644
--- a/sysdeps/sparc/fpu/fesetround.c
+++ b/sysdeps/sparc/fpu/fesetround.c
@@ -1,5 +1,5 @@
 /* Set current rounding direction.
-   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -35,4 +35,3 @@ fesetround (int round)
 
   return 0;
 }
-libm_hidden_def (fesetround)
diff --git a/sysdeps/sparc/fpu/fraiseexcpt.c b/sysdeps/sparc/fpu/fraiseexcpt.c
index cbb8be80ec..0d45ec82d2 100644
--- a/sysdeps/sparc/fpu/fraiseexcpt.c
+++ b/sysdeps/sparc/fpu/fraiseexcpt.c
@@ -25,12 +25,12 @@
 int
 __feraiseexcept (int excepts)
 {
+  static volatile double sink;
   static const struct {
     double zero, one, max, min, sixteen, pi;
   } c = {
     0.0, 1.0, DBL_MAX, DBL_MIN, 16.0, M_PI
   };
-  double d;
 
   /* Raise exceptions represented by EXPECTS.  But we must raise only
      one signal at a time.  It is important the if the overflow/underflow
@@ -39,44 +39,24 @@ __feraiseexcept (int excepts)
 
   /* First: invalid exception.  */
   if ((FE_INVALID & excepts) != 0)
-    {
-      /* One example of a invalid operation is 0/0.  */
-      __asm ("" : "=e" (d) : "0" (c.zero));
-      d /= c.zero;
-      __asm __volatile ("" : : "e" (d));
-    }
+    /* One example of a invalid operation is 0/0.  */
+    sink = c.zero / c.zero;
 
   /* Next: division by zero.  */
   if ((FE_DIVBYZERO & excepts) != 0)
-    {
-      __asm ("" : "=e" (d) : "0" (c.one));
-      d /= c.zero;
-      __asm __volatile ("" : : "e" (d));
-    }
+    sink = c.one / c.zero;
 
   /* Next: overflow.  */
   if ((FE_OVERFLOW & excepts) != 0)
-    {
-      __asm ("" : "=e" (d) : "0" (c.max));
-      d *= d;
-      __asm __volatile ("" : : "e" (d));
-    }
+    sink = c.max * c.max;
 
   /* Next: underflow.  */
   if ((FE_UNDERFLOW & excepts) != 0)
-    {
-      __asm ("" : "=e" (d) : "0" (c.min));
-      d /= c.sixteen;
-      __asm __volatile ("" : : "e" (d));
-    }
+    sink = c.min / c.sixteen;
 
   /* Last: inexact.  */
   if ((FE_INEXACT & excepts) != 0)
-    {
-      __asm ("" : "=e" (d) : "0" (c.one));
-      d /= c.pi;
-      __asm __volatile ("" : : "e" (d));
-    }
+    sink = c.one / c.pi;
 
   /* Success.  */
   return 0;