about summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-11-22 18:49:27 +0000
committerUlrich Drepper <drepper@redhat.com>1997-11-22 18:49:27 +0000
commitf43ce637b5f35b350b4dff6810dd6a7421fbb952 (patch)
tree9059744db9ed114b2e140a094505bea14316c667 /sysdeps/i386
parent6973fc01278d6c8a5f309738d641a68228efe5ed (diff)
downloadglibc-f43ce637b5f35b350b4dff6810dd6a7421fbb952.tar.gz
glibc-f43ce637b5f35b350b4dff6810dd6a7421fbb952.tar.xz
glibc-f43ce637b5f35b350b4dff6810dd6a7421fbb952.zip
1997-11-22 19:28  Ulrich Drepper  <drepper@cygnus.com>

	* iconv/gconv_simple.c: Fix lots of bugs.
	* iconv/iconv_open.c: Normalize names before passing them to
	__gconv_open.

	* libio/iolibio.h: Add prototypes for _IO_{new,old}_fclose.

	* libio/iopopen.c: Check for correct mode argument and punt otherwise.
	* stdio-common/test-popen.c: Add test for above change.

	* math/libm-test.c: Print test results also using %a format,
	specified in PRINTF_XEXPR macro.
	* math/test-double.c: Define PRINTF_XEXPR.
	* math/test-float.c: Likewise.
	* math/test-ldouble.c: Likewise.
	* math/test-idouble.c: Likewise.
	* math/test-ifloat.c: Likewise.
	* math/test-ildoubl.c: Likewise.

	* stdio-common/vfscanf.c: Recognize a in format specifier only as
	modifier if used before s, S, or [.  Otherwise it's the hexadecimal
	FP number format.

	* stdlib/strtod.c: Little code cleanup.

	* sysdeps/i386/Makefile: Define __LIBC_INTERNAL_MATH_INLINES for
	compiling in math subdir.

	* sysdeps/m68k/fpu/e_acos.c: Define __LIBC_INTERNAL_MATH_INLINES
	instead of __LIBC_M81_MATH_INLINES.
	* sysdeps/m68k/fpu/e_atan2.c: Likewise.
	* sysdeps/m68k/fpu/e_fmod.c: Likewise.
	* sysdeps/m68k/fpu/e_pow.c: Likewise.
	* sysdeps/m68k/fpu/e_scalb.c: Likewise.
	* sysdeps/m68k/fpu/k_cos.c: Likewise.
	* sysdeps/m68k/fpu/k_sin.c: Likewise.
	* sysdeps/m68k/fpu/k_tan.c: Likewise.
	* sysdeps/m68k/fpu/s_atan.c: Likewise.
	* sysdeps/m68k/fpu/s_ccos.c: Likewise.
	* sysdeps/m68k/fpu/s_ccosh.c: Likewise.
	* sysdeps/m68k/fpu/s_cexp.c: Likewise.
	* sysdeps/m68k/fpu/s_csin.c: Likewise.
	* sysdeps/m68k/fpu/s_csinh.c: Likewise.
	* sysdeps/m68k/fpu/s_frexp.c: Likewise.
	* sysdeps/m68k/fpu/s_ilogb.c: Likewise.
	* sysdeps/m68k/fpu/s_isinf.c: Likewise.
	* sysdeps/m68k/fpu/s_llrint.c: Likewise.
	* sysdeps/m68k/fpu/s_llrintf.c: Likewise.
	* sysdeps/m68k/fpu/s_llrintl.c: Likewise.
	* sysdeps/m68k/fpu/s_lrint.c: Likewise.
	* sysdeps/m68k/fpu/s_modf.c: Likewise.
	* sysdeps/m68k/fpu/s_remquo.c: Likewise.
	* sysdeps/m68k/fpu/s_scalbn.c: Likewise.
	* sysdeps/m68k/fpu/s_sincos.c: Likewise.
	* sysdeps/m68k/fpu/bits/mathinline.h: Define optimizations if
	__LIBC_INTERNAL_MATH_INLINES is defined.

	* sysdeps/i386/fpu/bits/mathinline.h: Define special i686 versions
	of compare macros from ISO C 9X.  Optimize generic versions a bit.
	Define __signbit inline functions and __ieee754_sqrt which can be
	used if the ompiler is fixed.

	* sysdeps/posix/sysv_signal.c: Define sysv_signal as weak alias.

1997-11-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makerules ($(common-objpfx)stub-$(subdir)): Look for
	sysdeps/generic in the whole dep file, not only in the first line.

1997-11-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/ieee754/bits/nan.h (__nan) [!__GNUC__]: Fix type.

1997-11-19  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* manual/arith.texi (Imaginary Unit): Move @end deftypevr to right
	place.

1997-11-19  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* elf/dl-error.c (_dl_signal_error): Only print colon if OBJNAME
	is non-empty.

1997-11-20 16:51  Ulrich Drepper  <drepper@cygnus.com>

	* malloc/malloc.c (malloc_update_mallinfo): Initialize struct for
	return value.

1997-11-19 21:36  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/getcwd.c: Free allocated buffer if
	readlink succeeds but the return value is too long.

	* stdio-common/printf_fphex.c: Determine sign of number correctly.

1997-11-19 02:45  Ulrich Drepper  <drepper@cygnus.com>

	* libc.map: Export __divl, __reml, __divq, __remq, __divqu and
	__remqu for Alpha.

1997-11-18 23:08  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/sys/ucontext.h: Stub context file.

	* libio/iofprintf.c: Removed.  We use the stdio-common version.

	* manual/Makefile (distribute): Add stdio-fp.c.

	* sysdeps/powerpc/Dist: Add ppc-mcount.S.

	* db2/Makefile (distribute): Add include/os_func.h, README and
	mutex/tsl_parisc.s.

	* hesiod/Makefile (distribute): Add README.hesiod.

1997-11-18 22:14  Ulrich Drepper  <drepper@cygnus.com>

	* iconv/gconv.c: Correctly call transformation function.

	* manual/maint.texi: Document need of binutils 2.8.1.0.17.

1997-11-13  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* sysdeps/libm-ieee754/s_remquo.c (__remquo): Fix function (gave
	wrong results for e.g. remquo (3,2, &x)).
	* sysdeps/libm-ieee754/s_remquof.c (__remquof): Likewise.
	* sysdeps/libm-ieee754/s_remquol.c (__remquol): Likewise.

1997-11-18  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* configure.in (ld --version-script): Test if the same symbol
	maybe defined in all versions (needed by recent changes to
	libc.map and supported with binutils 2.8.1.0.17) and issue warning
	if versioning is not supported/enabled.
	(bash test): Correct test case.

	* math/libm-test.c: Added counting/reporting of number of test cases.

	* elf/Makefile ($(objpfx)rtldtbl.h): gawk is not longer required,
	use awk instead.

	* sysdeps/unix/sysv/linux/net/if.h: Add __BEGIN_DECLS/__END_DECLS.

1997-11-18  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* elf/dl-load.c (_dl_init_paths): Correct __mempcpy logic.

1997-11-18 18:04  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/pty.c: Define REVOKE to use revoke function.
	Replace revoke call by use of REVOKE.
	* sysdeps/unix/sysv/linux/pty.c: New file.  Define REVOKE as
	empty and #include generic version.
	Suggested by Zack Weinberg <zack@rabi.phys.columbia.edu>.

1997-11-18 16:02  Ulrich Drepper  <drepper@cygnus.com>

	* libc.map: Add socket functions with __libc_* names.
	Reported by Andreas Jaeger.

1997-11-18  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* libc.map: Tidy up (remove duplicates, sort entries).

1997-11-18  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* iconv/gconv.h: Add __BEGIN_DECLS/__END_DECLS.

1997-11-18 06:45  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/pty.c: Make thread safe.  Fix bug when calling
	again after successful call.
	Patch by Marc Lehmann <pcg@goof.com>.

1997-11-17  Paul Eggert  <eggert@twinsun.com>

	* time/mktime.c, time/strftime.c (_REENTRANT): #define,
	as some hosts need this to declare localtime_r properly.

1997-11-18 06:08  Ulrich Drepper  <drepper@cygnus.com>

	* libc.map: Add iconv_open, iconv, and iconv_close.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/Makefile6
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h117
2 files changed, 99 insertions, 24 deletions
diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile
index bb2d8f7b41..b97f95f6a8 100644
--- a/sysdeps/i386/Makefile
+++ b/sysdeps/i386/Makefile
@@ -1,6 +1,6 @@
 # The mpn functions need a #define for asm syntax flavor.
 # Every i386 port in use uses gas syntax (I think).
-asm-CPPFLAGS := $(asm-CPPFLAGS) -DGAS_SYNTAX
+asm-CPPFLAGS += -DGAS_SYNTAX
 
 # The i386 `long double' is a distinct type we support.
 long-double-fcts = yes
@@ -18,3 +18,7 @@ CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused
 CFLAGS-dl-load.c += -Wno-unused
 CFLAGS-dl-reloc.c += -Wno-unused
 endif
+
+ifeq ($(subdir),math)
+CPPFLAGS += -D__LIBC_INTERNAL_MATH_INLINES
+endif
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index 482b47e3b3..5823055c30 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -22,64 +22,123 @@
 # error "Never use <bits/mathinline.h> directly; include <math.h> instead."
 #endif
 
+#ifdef __cplusplus
+# define __MATH_INLINE __inline
+#else
+# define __MATH_INLINE extern __inline
+#endif
+
 
 #if defined __USE_ISOC9X && defined __GNUC__ && __GNUC__ >= 2
 /* ISO C 9X defines some macros to perform unordered comparisons.  The
    ix87 FPU supports this with special opcodes and we should use them.
    These must not be inline functions since we have to be able to handle
    all floating-point types.  */
-# define isgreater(x, y) \
+# ifdef __i686__
+/* For the PentiumPro and more recent processors we can provide
+   better code.  */
+#  define isgreater(x, y) \
+     ({ register char __result;						      \
+	__asm__ ("fucomip; seta %%al"					      \
+		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st");	      \
+	__result; })
+#  define isgreaterequal(x, y) \
+     ({ register char __result;						      \
+	__asm__ ("fucomip; setae %%al"					      \
+		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st");	      \
+	__result; })
+
+#  define isless(x, y) \
+     ({ register char __result;						      \
+	__asm__ ("fucomip; setb %%al"					      \
+		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st");	      \
+	__result; })
+
+#  define islessequal(x, y) \
+     ({ register char __result;						      \
+	__asm__ ("fucomip; setbe %%al"					      \
+		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st");	      \
+	__result; })
+
+#  define islessgreater(x, y) \
+     ({ register char __result;						      \
+	__asm__ ("fucomip; setne %%al"					      \
+		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st");	      \
+	__result; })
+
+#  define isunordered(x, y) \
+     ({ register char __result;						      \
+	__asm__ ("fucomip; setp %%al"					      \
+		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st");	      \
+	__result; })
+# else
+/* This is the dumb, portable code for i386 and above.  */
+#  define isgreater(x, y) \
      ({ register char __result;						      \
-	__asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al;"	      \
+	__asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al"	      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 
-# define isgreaterequal(x, y) \
+#  define isgreaterequal(x, y) \
      ({ register char __result;						      \
-	__asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al;"	      \
+	__asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al"	      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 
-# define isless(x, y) \
+#  define isless(x, y) \
      ({ register char __result;						      \
-	__asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x45, %%ah;"      \
-		 "setz %%al"						      \
+	__asm__ ("fucompp; fnstsw; sahf; setb %%al"			      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 
-# define islessequal(x, y) \
+#  define islessequal(x, y) \
      ({ register char __result;						      \
-	__asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x05, %%ah;"      \
-		 "setz %%al"						      \
+	__asm__ ("fucompp; fnstsw; sahf; setbe %%al"			      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 
-# define islessgreater(x, y) \
+#  define islessgreater(x, y) \
      ({ register char __result;						      \
-	__asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al;"	      \
+	__asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al"	      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 
-# define isunordered(x, y) \
+#  define isunordered(x, y) \
      ({ register char __result;						      \
 	__asm__ ("fucompp; fnstsw; sahf; setp %%al"			      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
-#endif
+# endif	/* __i686__ */
 
+/* XXX Argh!!!  More compiler errors.  */
+#if 0
+/* Test for negative number.  Used in the signbit() macro.  */
+__MATH_INLINE int
+__signbitf (float __x)
+{
+  union { float __f; int __i; } __u = { __f: __x }; return __u.__i < 0;
+}
+__MATH_INLINE int
+__signbit (double __x)
+{
+  union { double __d; int __i[2]; } __u = { __d: __x }; return __u.__i[1] < 0;
+}
+__MATH_INLINE int
+__signbitl (long double __x)
+{
+  union { long double __l; int __i[3]; } __u = { __l: __x };
+  return (__u.__i[2] & 0x8000) != 0;
+}
+#endif
+#endif
 
-#ifdef	__GNUC__
-#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
 
 /* The gcc, version 2.7 or below, has problems with all this inlining
    code.  So disable it for this version of the compiler.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7)
+#if defined __GNUC__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
 
-#ifdef __cplusplus
-# define __MATH_INLINE __inline
-#else
-# define __MATH_INLINE extern __inline
-#endif
+#if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
+     && defined __OPTIMIZE__)
 
 /* A macro to define float, double, and long double versions of various
    math functions for the ix87 FPU.  FUNC is the function name (which will
@@ -163,8 +222,10 @@
   {									      \
     code;								      \
   }
+#endif
 
 
+#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
 /* Miscellaneous functions */
 
 __inline_mathcode (__sgn, __x, \
@@ -550,6 +611,16 @@ __inline_mathcode (__acosh1p, __x, \
 #undef __atan2_code
 #undef __sincos_code
 
-#endif /* Not gcc <= 2.7.  */
 #endif /* __NO_MATH_INLINES  */
+
+
+/* This code is used internally in the GNU libc.  */
+#if 0
+/* XXX I hate compiler bugs.  The current version produces wrong code
+   if this optimization is used.  */
+#ifdef __LIBC_INTERNAL_MATH_INLINES
+__inline_mathop (__ieee754_sqrt, "fsqrt")
+#endif
+#endif
+
 #endif /* __GNUC__  */