diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-03-10 06:05:14 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-03-10 06:05:14 +0000 |
commit | f4c024d1f956a7e853eba10ce33ab6851b5d43d1 (patch) | |
tree | 1e1fb47ee60867cc36f948b08e1388786b3ad161 /sysdeps | |
parent | 8b9d605485be779bb03778e780e9875525ec2ca4 (diff) | |
download | glibc-f4c024d1f956a7e853eba10ce33ab6851b5d43d1.zip glibc-f4c024d1f956a7e853eba10ce33ab6851b5d43d1.tar.gz glibc-f4c024d1f956a7e853eba10ce33ab6851b5d43d1.tar.bz2 |
Update.
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.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/alpha/fpu/bits/mathinline.h | 35 | ||||
-rw-r--r-- | sysdeps/i386/fpu/bits/mathinline.h | 15 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/bits/mathinline.h | 16 | ||||
-rw-r--r-- | sysdeps/powerpc/fpu/bits/mathinline.h | 19 | ||||
-rw-r--r-- | sysdeps/sparc/fpu/bits/mathinline.h | 10 | ||||
-rw-r--r-- | sysdeps/x86_64/fpu/bits/mathinline.h | 8 |
6 files changed, 39 insertions, 64 deletions
diff --git a/sysdeps/alpha/fpu/bits/mathinline.h b/sysdeps/alpha/fpu/bits/mathinline.h index 8141485..0ba79f9 100644 --- a/sysdeps/alpha/fpu/bits/mathinline.h +++ b/sysdeps/alpha/fpu/bits/mathinline.h @@ -28,34 +28,19 @@ # define __MATH_INLINE extern __inline #endif -#ifdef __USE_ISOC99 -# define isunordered(x, y) \ +#if defined __USE_ISOC99 && defined __GNUC__ && !__GNUC_PREREQ(3,0) +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered +# define isunordered(u, v) \ (__extension__ \ - ({ double __r; \ + ({ double __r, __u = (u), __v = (v); \ __asm ("cmptun/su %1,%2,%0\n\ttrapb" \ - : "=&f" (__r) : "f" (x), "f"(y)); \ + : "=&f" (__r) : "f" (__u), "f"(__v)); \ __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 */ #if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h index ab3b54d..85d48a5 100644 --- a/sysdeps/i386/fpu/bits/mathinline.h +++ b/sysdeps/i386/fpu/bits/mathinline.h @@ -30,19 +30,18 @@ #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. */ -# 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 +# if !__GNUC_PREREQ (2,97) /* ISO C99 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. */ +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered # ifdef __i686__ /* For the PentiumPro and more recent processors we can provide better code. */ diff --git a/sysdeps/m68k/fpu/bits/mathinline.h b/sysdeps/m68k/fpu/bits/mathinline.h index ec00b4b..1e43e43 100644 --- a/sysdeps/m68k/fpu/bits/mathinline.h +++ b/sysdeps/m68k/fpu/bits/mathinline.h @@ -21,20 +21,18 @@ #ifdef __GNUC__ #ifdef __USE_ISOC99 - -# if __GNUC_PREREQ (3,1) /* GCC 3.1 and up have builtins that actually 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) -# else +# if !__GNUC_PREREQ (3,1) /* ISO C99 defines some macros to perform unordered comparisons. The 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 all floating-point types. */ +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered # define isgreater(x, y) \ __extension__ \ ({ char __result; \ diff --git a/sysdeps/powerpc/fpu/bits/mathinline.h b/sysdeps/powerpc/fpu/bits/mathinline.h index dcd506d..01956d9 100644 --- a/sysdeps/powerpc/fpu/bits/mathinline.h +++ b/sysdeps/powerpc/fpu/bits/mathinline.h @@ -21,17 +21,7 @@ #if defined __GNUC__ && !defined _SOFT_FLOAT #ifdef __USE_ISOC99 -# if __GNUC_PREREQ (2,96) - -# 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 - +# if !__GNUC_PREREQ (2,97) # define __unordered_cmp(x, y) \ (__extension__ \ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ @@ -40,6 +30,13 @@ : "cr7"); \ __r; })) +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered + # define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1) # define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0) # define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1) diff --git a/sysdeps/sparc/fpu/bits/mathinline.h b/sysdeps/sparc/fpu/bits/mathinline.h index 81c2539..734ff05 100644 --- a/sysdeps/sparc/fpu/bits/mathinline.h +++ b/sysdeps/sparc/fpu/bits/mathinline.h @@ -24,9 +24,13 @@ #include <bits/wordsize.h> -#ifdef __GNUC__ - -#ifdef __USE_ISOC99 +#if defined __USE_ISOC99 && defined __GNUC__ && !__GNUC_PREREQ(3,0) +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered # if __WORDSIZE == 32 diff --git a/sysdeps/x86_64/fpu/bits/mathinline.h b/sysdeps/x86_64/fpu/bits/mathinline.h index c77412d..3f61ff5 100644 --- a/sysdeps/x86_64/fpu/bits/mathinline.h +++ b/sysdeps/x86_64/fpu/bits/mathinline.h @@ -30,14 +30,6 @@ #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. */ __MATH_INLINE int |