1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00
2004-03-09  Richard Henderson  <rth@redhat.com>

	* math/math.h (isgreater, isgreaterequal, isless, islessequal,
	islessgreater, isunordered): Use builtins if available.
	* sysdeps/i386/fpu/bits/mathinline.h: Don't define via builtins.
	* sysdeps/m68k/fpu/bits/mathinline.h: Likewise.
	* sysdeps/powerpc/fpu/bits/mathinline.h: Likewise.
	* sysdeps/sparc/fpu/bits/mathinline.h: Likewise.
	* sysdeps/x86_64/fpu/bits/mathinline.h: Likewise.
	* sysdeps/alpha/fpu/bits/mathinline.h (isgreater, isgreaterequal,
	isless, islessequal, islessgreater): Remove; use default.
	(isunordered): Convert inputs to double.
This commit is contained in:
Ulrich Drepper
2004-03-10 06:05:14 +00:00
parent 8b9d605485
commit f4c024d1f9
11 changed files with 86 additions and 72 deletions

View File

@@ -1,3 +1,16 @@
2004-03-09 Richard Henderson <rth@redhat.com>
* math/math.h (isgreater, isgreaterequal, isless, islessequal,
islessgreater, isunordered): Use builtins if available.
* sysdeps/i386/fpu/bits/mathinline.h: Don't define via builtins.
* sysdeps/m68k/fpu/bits/mathinline.h: Likewise.
* sysdeps/powerpc/fpu/bits/mathinline.h: Likewise.
* sysdeps/sparc/fpu/bits/mathinline.h: Likewise.
* sysdeps/x86_64/fpu/bits/mathinline.h: Likewise.
* sysdeps/alpha/fpu/bits/mathinline.h (isgreater, isgreaterequal,
isless, islessequal, islessgreater): Remove; use default.
(isunordered): Convert inputs to double.
2004-02-09 Jakub Jelinek <jakub@redhat.com> 2004-02-09 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add tst-vfork2. * posix/Makefile (tests): Add tst-vfork2.

View File

@@ -357,18 +357,28 @@ extern int matherr (struct exception *__exc);
# define __NO_MATH_INLINES 1 # define __NO_MATH_INLINES 1
#endif #endif
#if __USE_ISOC99 && __GNUC_PREREQ(2,97)
/* ISO C99 defines some macros to compare number while taking care for
unordered numbers. Many FPUs provide special instructions to support
these operations. Generic support in GCC for these as builtins went
in before 3.0.0, but not all cpus added their patterns. We define
versions that use the builtins here, and <bits/mathinline.h> will
undef/redefine as appropriate for the specific GCC version in use. */
# define isgreater(x, y) __builtin_isgreater(x, y)
# define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
# define isless(x, y) __builtin_isless(x, y)
# define islessequal(x, y) __builtin_islessequal(x, y)
# define islessgreater(x, y) __builtin_islessgreater(x, y)
# define isunordered(u, v) __builtin_isunordered(u, v)
#endif
/* Get machine-dependent inline versions (if there are any). */ /* Get machine-dependent inline versions (if there are any). */
#ifdef __USE_EXTERN_INLINES #ifdef __USE_EXTERN_INLINES
# include <bits/mathinline.h> # include <bits/mathinline.h>
#endif #endif
#if __USE_ISOC99 #if __USE_ISOC99
/* ISO C99 defines some macros to compare number while taking care /* If we've still got undefined comparison macros, provide defaults. */
for unordered numbers. Since many FPUs provide special
instructions to support these operations and these tests are
defined in <bits/mathinline.h>, we define the generic macros at
this late point and only if they are not defined yet. */
/* Return nonzero value if X is greater than Y. */ /* Return nonzero value if X is greater than Y. */
# ifndef isgreater # ifndef isgreater

View File

@@ -1,3 +1,16 @@
2004-03-09 Richard Henderson <rth@redhat.com>
* math/math.h (isgreater, isgreaterequal, isless, islessequal,
islessgreater, isunordered): Use builtins if available.
* sysdeps/i386/fpu/bits/mathinline.h: Don't define via builtins.
* sysdeps/m68k/fpu/bits/mathinline.h: Likewise.
* sysdeps/powerpc/fpu/bits/mathinline.h: Likewise.
* sysdeps/sparc/fpu/bits/mathinline.h: Likewise.
* sysdeps/x86_64/fpu/bits/mathinline.h: Likewise.
* sysdeps/alpha/fpu/bits/mathinline.h (isgreater, isgreaterequal,
isless, islessequal, islessgreater): Remove; use default.
(isunordered): Convert inputs to double.
2004-02-09 Jakub Jelinek <jakub@redhat.com> 2004-02-09 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/i386/vfork.S (SAVE_PID): Negate PID * sysdeps/unix/sysv/linux/i386/vfork.S (SAVE_PID): Negate PID

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2003 Free Software Foundation, Inc. /* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -105,6 +105,7 @@ tf (void *arg)
static int static int
do_one_test (void) do_one_test (void)
{ {
in_sh_body = 0;
cleanups = 0; cleanups = 0;
if (pipe (fd) != 0 || pipe (fd + 2) != 0) if (pipe (fd) != 0 || pipe (fd + 2) != 0)
{ {

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2003 Free Software Foundation, Inc. /* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -162,6 +162,8 @@ tf (void *arg)
static int static int
do_one_test (void) do_one_test (void)
{ {
in_sh_body = 0;
pid_t pid = fork (); pid_t pid = fork ();
if (pid == -1) if (pid == -1)

View File

@@ -28,34 +28,19 @@
# define __MATH_INLINE extern __inline # define __MATH_INLINE extern __inline
#endif #endif
#ifdef __USE_ISOC99 #if defined __USE_ISOC99 && defined __GNUC__ && !__GNUC_PREREQ(3,0)
# define isunordered(x, y) \ # undef isgreater
# undef isgreaterequal
# undef isless
# undef islessequal
# undef islessgreater
# undef isunordered
# define isunordered(u, v) \
(__extension__ \ (__extension__ \
({ double __r; \ ({ double __r, __u = (u), __v = (v); \
__asm ("cmptun/su %1,%2,%0\n\ttrapb" \ __asm ("cmptun/su %1,%2,%0\n\ttrapb" \
: "=&f" (__r) : "f" (x), "f"(y)); \ : "=&f" (__r) : "f" (__u), "f"(__v)); \
__r != 0; })) __r != 0; }))
# define isgreater(x, y) \
(__extension__ \
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
!isunordered(__x, __y) && __x > __y; }))
# define isgreaterequal(x, y) \
(__extension__ \
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
!isunordered(__x, __y) && __x >= __y; }))
# define isless(x, y) \
(__extension__ \
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
!isunordered(__x, __y) && __x < __y; }))
# define islessequal(x, y) \
(__extension__ \
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
!isunordered(__x, __y) && __x <= __y; }))
# define islessgreater(x, y) \
(__extension__ \
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
!isunordered(__x, __y) && __x != __y; }))
#endif /* ISO C99 */ #endif /* ISO C99 */
#if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ #if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \

View File

@@ -30,19 +30,18 @@
#if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2 #if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2
# if __GNUC_PREREQ (2,97)
/* GCC 2.97 and up have builtins that actually can be used. */ /* GCC 2.97 and up have builtins that actually can be used. */
# define isgreater(x, y) __builtin_isgreater (x, y) # if !__GNUC_PREREQ (2,97)
# define isgreaterequal(x, y) __builtin_isgreaterequal (x, y)
# define isless(x, y) __builtin_isless (x, y)
# define islessequal(x, y) __builtin_islessequal (x, y)
# define islessgreater(x, y) __builtin_islessgreater (x, y)
# define isunordered(x, y) __builtin_isunordered (x, y)
# else
/* ISO C99 defines some macros to perform unordered comparisons. The /* ISO C99 defines some macros to perform unordered comparisons. The
ix87 FPU supports this with special opcodes and we should use them. 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 These must not be inline functions since we have to be able to handle
all floating-point types. */ all floating-point types. */
# undef isgreater
# undef isgreaterequal
# undef isless
# undef islessequal
# undef islessgreater
# undef isunordered
# ifdef __i686__ # ifdef __i686__
/* For the PentiumPro and more recent processors we can provide /* For the PentiumPro and more recent processors we can provide
better code. */ better code. */

View File

@@ -21,20 +21,18 @@
#ifdef __GNUC__ #ifdef __GNUC__
#ifdef __USE_ISOC99 #ifdef __USE_ISOC99
# if __GNUC_PREREQ (3,1)
/* GCC 3.1 and up have builtins that actually can be used. */ /* GCC 3.1 and up have builtins that actually can be used. */
# define isgreater(x, y) __builtin_isgreater (x, y) # if !__GNUC_PREREQ (3,1)
# define isgreaterequal(x, y) __builtin_isgreaterequal (x, y)
# define isless(x, y) __builtin_isless (x, y)
# define islessequal(x, y) __builtin_islessequal (x, y)
# define islessgreater(x, y) __builtin_islessgreater (x, y)
# define isunordered(x, y) __builtin_isunordered (x, y)
# else
/* ISO C99 defines some macros to perform unordered comparisons. The /* ISO C99 defines some macros to perform unordered comparisons. The
m68k FPU supports this with special opcodes and we should use them. m68k 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 These must not be inline functions since we have to be able to handle
all floating-point types. */ all floating-point types. */
# undef isgreater
# undef isgreaterequal
# undef isless
# undef islessequal
# undef islessgreater
# undef isunordered
# define isgreater(x, y) \ # define isgreater(x, y) \
__extension__ \ __extension__ \
({ char __result; \ ({ char __result; \

View File

@@ -21,17 +21,7 @@
#if defined __GNUC__ && !defined _SOFT_FLOAT #if defined __GNUC__ && !defined _SOFT_FLOAT
#ifdef __USE_ISOC99 #ifdef __USE_ISOC99
# if __GNUC_PREREQ (2,96) # if !__GNUC_PREREQ (2,97)
# define isgreater(x, y) __builtin_isgreater (x, y)
# define isgreaterequal(x, y) __builtin_isgreaterequal (x, y)
# define isless(x, y) __builtin_isless (x, y)
# define islessequal(x, y) __builtin_islessequal (x, y)
# define islessgreater(x, y) __builtin_islessgreater (x, y)
# define isunordered(x, y) __builtin_isunordered (x, y)
# else
# define __unordered_cmp(x, y) \ # define __unordered_cmp(x, y) \
(__extension__ \ (__extension__ \
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
@@ -40,6 +30,13 @@
: "cr7"); \ : "cr7"); \
__r; })) __r; }))
# undef isgreater
# undef isgreaterequal
# undef isless
# undef islessequal
# undef islessgreater
# undef isunordered
# define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1) # define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1)
# define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0) # define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0)
# define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1) # define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1)

View File

@@ -24,9 +24,13 @@
#include <bits/wordsize.h> #include <bits/wordsize.h>
#ifdef __GNUC__ #if defined __USE_ISOC99 && defined __GNUC__ && !__GNUC_PREREQ(3,0)
# undef isgreater
#ifdef __USE_ISOC99 # undef isgreaterequal
# undef isless
# undef islessequal
# undef islessgreater
# undef isunordered
# if __WORDSIZE == 32 # if __WORDSIZE == 32

View File

@@ -30,14 +30,6 @@
#if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2 #if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2
/* GCC has builtins that can be used. */
# define isgreater(x, y) __builtin_isgreater (x, y)
# define isgreaterequal(x, y) __builtin_isgreaterequal (x, y)
# define isless(x, y) __builtin_isless (x, y)
# define islessequal(x, y) __builtin_islessequal (x, y)
# define islessgreater(x, y) __builtin_islessgreater (x, y)
# define isunordered(x, y) __builtin_isunordered (x, y)
/* Test for negative number. Used in the signbit() macro. */ /* Test for negative number. Used in the signbit() macro. */
__MATH_INLINE int __MATH_INLINE int