about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--linuxthreads/ChangeLog27
-rw-r--r--manual/math.texi8
-rw-r--r--math/Makefile6
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h68
5 files changed, 84 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e47417269..4430e3c554 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2000-05-22  Andreas Jaeger  <aj@suse.de>
+
+	* math/Makefile: Add -D__FAST_MATH__ to CFLAGS-test-ifloat.c,
+	CFLAGS-test-idouble.c, CFLAGS-test-ildoubl.c.
+
+	* manual/math.texi (FP Function Optimizations): Document gcc
+	-ffast-math behaviour with mathinlines.
+
+	* sysdeps/i386/fpu/bits/mathinline.h: Only use save inline
+	functions unless -ffast-math is given to gcc.
+
 2000-05-23  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/i386/fpu/bits/mathinline.h (__sincos, __sincosf,
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index bde417e2de..4bb1a81d17 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,30 @@
+2000-05-24  Ulrich Drepper  <drepper@redhat.com>
+
+	* Makefile (libpthread-routines): Add pspinlock.
+	* cancel.c: Rename __pthread_spin_unlock back to __pthread_unlock.
+	Use struct _pthread_fastlock instead of pthread_spinlock_t.
+	* condvar.c: Likewise.
+	* internals.h: Likewise.
+	* join.c: Likewise.
+	* manager.c: Likewise.
+	* mutex.c: Likewise.
+	* pthread.c: Likewise.
+	* rwlock.c: Likewise.
+	* semaphore.c: Likewise.
+	* signals.c: Likewise.
+	* spinlock.h: Likewise.
+	* spinlock.c: Likewise.  Remove pthread_spin_lock functions.
+	* sysdeps/alpha/pspinlock.c: New file.
+	* sysdeps/arm/pspinlock.c: New file.
+	* sysdeps/i386/pspinlock.c: New file.
+	* sysdeps/m68k/pspinlock.c: New file.
+	* sysdeps/mips/pspinlock.c: New file.
+	* sysdeps/powerpc/pspinlock.c: New file.
+	* sysdeps/sparc/sparc32/pspinlock.c: New file.
+	* sysdeps/sparc/sparc64/pspinlock.c: New file.
+	* sysdeps/pthread/bits/pthreadtypes.h: Remove pthread_spinlock_t
+	back to _pthread_fastlock.  Define new pthread_spinlock_t.
+
 2000-05-24  Andreas Jaeger  <aj@suse.de>
 
 	* sysdeps/i386/i686/pt-machine.h: Only use LDT on newer kernels.
diff --git a/manual/math.texi b/manual/math.texi
index 65ec8dd85e..cc29cd6101 100644
--- a/manual/math.texi
+++ b/manual/math.texi
@@ -1770,9 +1770,11 @@ This means that no calls to the library functions may be necessary, and
 can increase the speed of generated code significantly.  The drawback is
 that code size will increase, and the increase is not always negligible.
 
-The speed increase has one drawback: the inline functions might not set
-@code{errno} and might not have the same precission as the library
-functions.
+There are two kind of inline functions: Those that give the same result
+as the library functions and others that might not set @code{errno} and
+might have a reduced precision and/or argument range in comparison with
+the library functions.  The latter inline functions are only available
+if the flag @code{-ffast-math} is given to GNU CC.
 
 In cases where the inline functions and macros are not wanted the symbol
 @code{__NO_MATH_INLINES} should be defined before any system header is
diff --git a/math/Makefile b/math/Makefile
index 408e6ebcf8..e545031c67 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -116,9 +116,9 @@ endif
 CFLAGS-test-float.c = -fno-inline -ffloat-store
 CFLAGS-test-double.c = -fno-inline -ffloat-store
 CFLAGS-test-ldouble.c = -fno-inline -ffloat-store
-CFLAGS-test-ifloat.c = -U__LIBC_INTERNAL_MATH_INLINES
-CFLAGS-test-idouble.c = -U__LIBC_INTERNAL_MATH_INLINES
-CFLAGS-test-ildoubl.c = -U__LIBC_INTERNAL_MATH_INLINES
+CFLAGS-test-ifloat.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__
+CFLAGS-test-idouble.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__
+CFLAGS-test-ildoubl.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__
 LDLIBS-test-ifloat = math/libm
 LDLIBS-test-idouble = math/libm
 LDLIBS-test-ildoubl = math/libm
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index a1d9532083..9e9db8873d 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -281,6 +281,8 @@ __signbitl (long double __x)
 __inline_mathcode (__sgn, __x, \
   return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0))
 
+/* __FAST_MATH__ is defined by gcc -ffast-math.  */
+#ifdef __FAST_MATH__
 __inline_mathcode (__pow2, __x, \
   register long double __value;						      \
   register long double __exponent;					      \
@@ -305,8 +307,8 @@ __inline_mathcode (__pow2, __x, \
      : "=t" (__value) : "0" (__value), "u" (__exponent));		      \
   return __value)
 
-#ifdef __USE_GNU
-# define __sincos_code \
+# ifdef __USE_GNU
+#  define __sincos_code \
   register long double __cosr;						      \
   register long double __sinr;						      \
   __asm __volatile__							      \
@@ -345,13 +347,13 @@ __sincosl (long double __x, long double *__sinx, long double *__cosx)
 {
   __sincos_code;
 }
-#endif
+# endif
 
 
 /* Optimized inline implementation, sometimes with reduced precision
    and/or argument range.  */
 
-#define __expm1_code \
+# define __expm1_code \
   register long double __value;						      \
   register long double __exponent;					      \
   register long double __temp;						      \
@@ -373,7 +375,7 @@ __sincosl (long double __x, long double *__sinx, long double *__cosx)
 __inline_mathcodeNP_ (long double, __expm1l, __x, __expm1_code)
 
 
-#define __exp_code \
+# define __exp_code \
   register long double __value;						      \
   register long double __exponent;					      \
   __asm __volatile__							      \
@@ -403,27 +405,6 @@ __inline_mathcodeNP (tan, __x, \
   return __value)
 
 
-#define __atan2_code \
-  register long double __value;						      \
-  __asm __volatile__							      \
-    ("fpatan"								      \
-     : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)");		      \
-  return __value
-__inline_mathcodeNP2 (atan2, __y, __x, __atan2_code)
-__inline_mathcodeNP2_ (long double, __atan2l, __y, __x, __atan2_code)
-
-
-__inline_mathcodeNP2 (fmod, __x, __y, \
-  register long double __value;						      \
-  __asm __volatile__							      \
-    ("1:	fprem\n\t"						      \
-     "fnstsw	%%ax\n\t"						      \
-     "sahf\n\t"								      \
-     "jp	1b"							      \
-     : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc");		      \
-  return __value)
-
-
 __inline_mathcodeNP2 (pow, __x, __y, \
   register long double __value;						      \
   register long double __exponent;					      \
@@ -472,6 +453,28 @@ __inline_mathcodeNP2 (pow, __x, __y, \
     ("fscale"								      \
      : "=t" (__value) : "0" (__value), "u" (__exponent));		      \
   return __value)
+#endif /* __FAST_MATH__ */
+
+
+#define __atan2_code \
+  register long double __value;						      \
+  __asm __volatile__							      \
+    ("fpatan"								      \
+     : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)");		      \
+  return __value
+__inline_mathcodeNP2 (atan2, __y, __x, __atan2_code)
+__inline_mathcodeNP2_ (long double, __atan2l, __y, __x, __atan2_code)
+
+
+__inline_mathcodeNP2 (fmod, __x, __y, \
+  register long double __value;						      \
+  __asm __volatile__							      \
+    ("1:	fprem\n\t"						      \
+     "fnstsw	%%ax\n\t"						      \
+     "sahf\n\t"								      \
+     "jp	1b"							      \
+     : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc");		      \
+  return __value)
 
 
 __inline_mathopNP (sqrt, "fsqrt")
@@ -487,17 +490,20 @@ __inline_mathop (fabs, "fabs")
 __inline_mathop_ (long double, __fabsl, "fabs")
 #endif
 
+#ifdef __FAST_MATH__
 /* The argument range of this inline version is reduced.  */
 __inline_mathopNP (sin, "fsin")
 /* The argument range of this inline version is reduced.  */
 __inline_mathopNP (cos, "fcos")
 
-__inline_mathop_declNP (atan, "fld1; fpatan", "0" (__x) : "st(1)")
 __inline_mathop_declNP (log, "fldln2; fxch; fyl2x", "0" (__x) : "st(1)")
 __inline_mathop_declNP (log10, "fldlg2; fxch; fyl2x", "0" (__x) : "st(1)")
 
 __inline_mathcodeNP (asin, __x, return __atan2l (__x, __sqrtl (1.0 - __x * __x)))
 __inline_mathcodeNP (acos, __x, return __atan2l (__sqrtl (1.0 - __x * __x), __x))
+#endif /* __FAST_MATH__ */
+
+__inline_mathop_declNP (atan, "fld1; fpatan", "0" (__x) : "st(1)")
 
 __inline_mathcode_ (long double, __sgn1l, __x, \
   union { long double __xld; unsigned int __xi[3]; } __n = { __xld: __x };  \
@@ -713,10 +719,12 @@ __inline_mathcode (__acosh1p, __x, \
 #endif /* __USE_MISC  */
 
 /* Undefine some of the large macros which are not used anymore.  */
-#undef __expm1_code
-#undef __exp_code
 #undef __atan2_code
-#undef __sincos_code
+#ifdef __FAST_MATH__
+# undef __expm1_code
+# undef __exp_code
+# undef __sincos_code
+#endif /* __FAST_MATH__ */
 
 #endif /* __NO_MATH_INLINES  */