diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/i386/fpu/__math.h | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/e_scalb.c | 14 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/e_scalbl.c | 14 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_ctan.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_ctanf.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_ctanh.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_ctanhf.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_ctanhl.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_ctanl.c | 4 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_nearbyintf.c | 9 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_nearbyintl.c | 10 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/__math.h | 76 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/e_pow.c | 49 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_sincos.c | 39 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_sincosf.c | 3 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_sincosl.c | 3 | ||||
-rw-r--r-- | sysdeps/stub/shmat.c | 36 | ||||
-rw-r--r-- | sysdeps/stub/shmdt.c | 32 |
18 files changed, 200 insertions, 101 deletions
diff --git a/sysdeps/i386/fpu/__math.h b/sysdeps/i386/fpu/__math.h index 4e34fa0263..d79fe7dd5c 100644 --- a/sysdeps/i386/fpu/__math.h +++ b/sysdeps/i386/fpu/__math.h @@ -470,7 +470,7 @@ __finite (double __x) /* ISO C 9X defines some macros to perform unordered comparisons. The ix87 FPU supports this with special opcodes and we should use them. - This 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. */ #undef isgreater #define isgreater(x, y) \ diff --git a/sysdeps/libm-ieee754/e_scalb.c b/sysdeps/libm-ieee754/e_scalb.c index 7f66ec7737..86d10bf683 100644 --- a/sysdeps/libm-ieee754/e_scalb.c +++ b/sysdeps/libm-ieee754/e_scalb.c @@ -40,16 +40,16 @@ static char rcsid[] = "$NetBSD: e_scalb.c,v 1.6 1995/05/10 20:46:09 jtc Exp $"; #endif { #ifdef _SCALB_INT - return scalbn(x,fn); + return __scalbn(x,fn); #else - if (isnan(x)||isnan(fn)) return x*fn; - if (!finite(fn)) { + if (__isnan(x)||__isnan(fn)) return x*fn; + if (!__finite(fn)) { if(fn>0.0) return x*fn; else return x/(-fn); } - if (rint(fn)!=fn) return (fn-fn)/(fn-fn); - if ( fn > 65000.0) return scalbn(x, 65000); - if (-fn > 65000.0) return scalbn(x,-65000); - return scalbn(x,(int)fn); + if (__rint(fn)!=fn) return (fn-fn)/(fn-fn); + if ( fn > 65000.0) return __scalbn(x, 65000); + if (-fn > 65000.0) return __scalbn(x,-65000); + return __scalbn(x,(int)fn); #endif } diff --git a/sysdeps/libm-ieee754/e_scalbl.c b/sysdeps/libm-ieee754/e_scalbl.c index 0dd36d422d..823eebda91 100644 --- a/sysdeps/libm-ieee754/e_scalbl.c +++ b/sysdeps/libm-ieee754/e_scalbl.c @@ -44,16 +44,16 @@ static char rcsid[] = "$NetBSD: $"; #endif { #ifdef _SCALB_INT - return scalbnl(x,fn); + return __scalbnl(x,fn); #else - if (isnanl(x)||isnanl(fn)) return x*fn; - if (!finitel(fn)) { + if (__isnanl(x)||__isnanl(fn)) return x*fn; + if (!__finitel(fn)) { if(fn>0.0) return x*fn; else return x/(-fn); } - if (rintl(fn)!=fn) return (fn-fn)/(fn-fn); - if ( fn > 65000.0) return scalbnl(x, 65000); - if (-fn > 65000.0) return scalbnl(x,-65000); - return scalbnl(x,(int)fn); + if (__rintl(fn)!=fn) return (fn-fn)/(fn-fn); + if ( fn > 65000.0) return __scalbnl(x, 65000); + if (-fn > 65000.0) return __scalbnl(x,-65000); + return __scalbnl(x,(int)fn); #endif } diff --git a/sysdeps/libm-ieee754/s_ctan.c b/sysdeps/libm-ieee754/s_ctan.c index 069b96c1d6..c68c3ad3e4 100644 --- a/sysdeps/libm-ieee754/s_ctan.c +++ b/sysdeps/libm-ieee754/s_ctan.c @@ -29,7 +29,7 @@ __ctan (__complex__ double x) { __complex__ double res; - if (!finite (__real__ x) || !finite (__imag__ x)) + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) { if (__isinf (__imag__ x)) { diff --git a/sysdeps/libm-ieee754/s_ctanf.c b/sysdeps/libm-ieee754/s_ctanf.c index 1c6fdca81d..4209587b37 100644 --- a/sysdeps/libm-ieee754/s_ctanf.c +++ b/sysdeps/libm-ieee754/s_ctanf.c @@ -29,7 +29,7 @@ __ctanf (__complex__ float x) { __complex__ float res; - if (!finite (__real__ x) || !finite (__imag__ x)) + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) { if (__isinff (__imag__ x)) { diff --git a/sysdeps/libm-ieee754/s_ctanh.c b/sysdeps/libm-ieee754/s_ctanh.c index a16f9c8d02..eb6ff84817 100644 --- a/sysdeps/libm-ieee754/s_ctanh.c +++ b/sysdeps/libm-ieee754/s_ctanh.c @@ -29,7 +29,7 @@ __ctanh (__complex__ double x) { __complex__ double res; - if (!finite (__real__ x) || !finite (__imag__ x)) + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) { if (__isinf (__real__ x)) { diff --git a/sysdeps/libm-ieee754/s_ctanhf.c b/sysdeps/libm-ieee754/s_ctanhf.c index 45548d518c..aec02fe7c4 100644 --- a/sysdeps/libm-ieee754/s_ctanhf.c +++ b/sysdeps/libm-ieee754/s_ctanhf.c @@ -29,7 +29,7 @@ __ctanhf (__complex__ float x) { __complex__ float res; - if (!finite (__real__ x) || !finite (__imag__ x)) + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) { if (__isinff (__real__ x)) { diff --git a/sysdeps/libm-ieee754/s_ctanhl.c b/sysdeps/libm-ieee754/s_ctanhl.c index 5c466167a6..8ed131e9a6 100644 --- a/sysdeps/libm-ieee754/s_ctanhl.c +++ b/sysdeps/libm-ieee754/s_ctanhl.c @@ -29,7 +29,7 @@ __ctanhl (__complex__ long double x) { __complex__ long double res; - if (!finite (__real__ x) || !finite (__imag__ x)) + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) { if (__isinfl (__real__ x)) { diff --git a/sysdeps/libm-ieee754/s_ctanl.c b/sysdeps/libm-ieee754/s_ctanl.c index b4a2b4a13c..88c02da2ea 100644 --- a/sysdeps/libm-ieee754/s_ctanl.c +++ b/sysdeps/libm-ieee754/s_ctanl.c @@ -27,9 +27,9 @@ __complex__ long double __ctanl (__complex__ long double x) { - __complex__ double res; + __complex__ long double res; - if (!finite (__real__ x) || !finite (__imag__ x)) + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) { if (__isinfl (__imag__ x)) { diff --git a/sysdeps/libm-ieee754/s_nearbyintf.c b/sysdeps/libm-ieee754/s_nearbyintf.c index dc33fa59f9..7d6f262f51 100644 --- a/sysdeps/libm-ieee754/s_nearbyintf.c +++ b/sysdeps/libm-ieee754/s_nearbyintf.c @@ -14,9 +14,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_rintf.c,v 1.4 1995/05/10 20:48:06 jtc Exp $"; -#endif #include <fenv.h> #include "math.h" @@ -33,9 +30,9 @@ TWO23[2]={ }; #ifdef __STDC__ - float __rintf(float x) + float __nearbyintf(float x) #else - float __rintf(x) + float __nearbyintf(x) float x; #endif { @@ -77,4 +74,4 @@ TWO23[2]={ fesetenv (&env); return t; } -weak_alias (__rintf, rintf) +weak_alias (__nearbyintf, nearbyintf) diff --git a/sysdeps/libm-ieee754/s_nearbyintl.c b/sysdeps/libm-ieee754/s_nearbyintl.c index b6a865443a..3b0715e5a5 100644 --- a/sysdeps/libm-ieee754/s_nearbyintl.c +++ b/sysdeps/libm-ieee754/s_nearbyintl.c @@ -15,10 +15,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - /* * rintl(x) * Return x rounded to integral value according to the prevailing @@ -44,9 +40,9 @@ TWO63[2]={ }; #ifdef __STDC__ - long double __rintl(long double x) + long double __nearbyintl(long double x) #else - long double __rintl(x) + long double __nearbyintl(x) long double x; #endif { @@ -101,4 +97,4 @@ TWO63[2]={ fesetenv (&env); return t; } -weak_alias (__rintl, rintl) +weak_alias (__nearbyintl, nearbyintl) diff --git a/sysdeps/m68k/fpu/__math.h b/sysdeps/m68k/fpu/__math.h index 68a6d90e32..92487f9b04 100644 --- a/sysdeps/m68k/fpu/__math.h +++ b/sysdeps/m68k/fpu/__math.h @@ -274,6 +274,14 @@ __m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) \ __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \ : "dmi" (__ctrl_reg)); \ return __result; \ +} \ + \ +__m81_inline void \ +__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \ + float_type *__cosx) \ +{ \ + __asm ("fsincos%.x %2,%1:%0" \ + : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \ } /* This defines the three variants of the inline functions. */ @@ -324,6 +332,10 @@ __inline_forward_c(int,ilogb, (double __value), (__value)) #ifdef __USE_ISOC9X __inline_forward_c(double,nearbyint, (double __value), (__value)) #endif +#ifdef __USE_GNU +__inline_forward(void,sincos, (double __x, double *__sinx, double *__cosx), + (__x, __sinx, __cosx)) +#endif #if defined __USE_MISC || defined __USE_ISOC9X @@ -341,6 +353,10 @@ __inline_forward_c(int,ilogbf, (float __value), (__value)) #ifdef __USE_ISOC9X __inline_forward_c(float,nearbyintf, (float __value), (__value)) #endif +#ifdef __USE_GNU +__inline_forward(void,sincosf, (float __x, float *__sinx, float *__cosx), + (__x, __sinx, __cosx)) +#endif __inline_forward(long double,frexpl, (long double __value, int *__expptr), (__value, __expptr)) @@ -358,12 +374,72 @@ __inline_forward_c(int,ilogbl, (long double __value), (__value)) __inline_forward_c(long double,nearbyintl, (long double __value), (__value)) __inline_forward_c(long int,rinttol, (long double __value), (__value)) #endif +#ifdef __USE_GNU +__inline_forward(void,sincosl, + (long double __x, long double *__sinx, long double *__cosx), + (__x, __sinx, __cosx)) +#endif #endif /* Use misc or ISO C9X */ #undef __inline_forward #undef __inline_forward_c +#ifdef __USE_ISOC9X + +/* ISO C 9X 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 +#define isgreater(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp %2,%1; fsogt %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) + +#undef isgreaterequal +#define isgreaterequal(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp %2,%1; fsoge %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) + +#undef isless +#define isless(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp %2,%1; fsolt %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) + +#undef islessequal +#define islessequal(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp %2,%1; fsole %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) + +#undef islessgreater +#define islessgreater(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp %2,%1; fsogl %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) + +#undef isunordered +#define isunordered(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp %2,%1; fsun %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) +#endif + #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ #endif /* GCC. */ diff --git a/sysdeps/m68k/fpu/e_pow.c b/sysdeps/m68k/fpu/e_pow.c index 284f1bf294..a39b63d342 100644 --- a/sysdeps/m68k/fpu/e_pow.c +++ b/sysdeps/m68k/fpu/e_pow.c @@ -80,51 +80,36 @@ s(__ieee754_pow) (float_type x, float_type y) z = 1 / z; if (m81(__signbit) (x)) { - float_type temp = m81(__rint) (y); - if (y != temp) + if (y != m81(__rint) (y)) { if (x == -1) z = 0.0/0.0; } else - { - if (sizeof (float_type) == sizeof (float)) - { - long i = (long) y; - if (i & 1) - z = -z; - } - else - { - long long i = (long long) y; - if ((float_type) i == y && i & 1) - z = -z; - } - } + goto maybe_negate; } return z; } if (x < 0.0) { - float_type temp = m81(__rint) (y); - if (y == temp) + if (y == m81(__rint) (y)) { - long long i = (long long) y; z = m81(__ieee754_exp) (y * m81(__ieee754_log) (-x)); - if (sizeof (float_type) == sizeof (float)) - { - long i = (long) y; - if (i & 1) - z = -z; - } - else - { - /* If the conversion to long long was inexact assume that y - is an even integer. */ - if ((float_type) i == y && i & 1) - z = -z; - } + maybe_negate: + /* We always use the long double format, since y is already in + this format and rounding won't change the result. */ + { + int32_t exponent; + u_int32_t i0, i1; + GET_LDOUBLE_WORDS (exponent, i0, i1, y); + exponent = (exponent & 0x7fff) - 0x3fff; + if (exponent <= 31 + ? i0 & (1 << (31 - exponent)) + : (exponent <= 63 + && i1 & (1 << (63 - exponent)))) + z = -z; + } } else z = 0.0/0.0; diff --git a/sysdeps/m68k/fpu/s_sincos.c b/sysdeps/m68k/fpu/s_sincos.c new file mode 100644 index 0000000000..ada21d0fb1 --- /dev/null +++ b/sysdeps/m68k/fpu/s_sincos.c @@ -0,0 +1,39 @@ +/* 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define __LIBC_M81_MATH_INLINES +#include <math.h> + +#ifndef FUNC +#define FUNC sincos +#endif +#ifndef float_type +#define float_type double +#endif + +#define CONCATX(a,b) __CONCAT(a,b) + +void +CONCATX(__,FUNC) (x, sinx, cosx) + float_type x, *sinx, *cosx; +{ + __m81_u(CONCATX(__,FUNC))(x, sinx, cosx); +} + +#define weak_aliasx(a,b) weak_alias(a,b) +weak_aliasx (CONCATX(__,FUNC), FUNC) diff --git a/sysdeps/m68k/fpu/s_sincosf.c b/sysdeps/m68k/fpu/s_sincosf.c new file mode 100644 index 0000000000..7ee2ec6600 --- /dev/null +++ b/sysdeps/m68k/fpu/s_sincosf.c @@ -0,0 +1,3 @@ +#define FUNC sincosf +#define float_type float +#include <s_sincos.c> diff --git a/sysdeps/m68k/fpu/s_sincosl.c b/sysdeps/m68k/fpu/s_sincosl.c new file mode 100644 index 0000000000..f998cc0977 --- /dev/null +++ b/sysdeps/m68k/fpu/s_sincosl.c @@ -0,0 +1,3 @@ +#define FUNC sincosl +#define float_type long double +#include <s_sincos.c> diff --git a/sysdeps/stub/shmat.c b/sysdeps/stub/shmat.c index 9d5629b06c..b33cad117b 100644 --- a/sysdeps/stub/shmat.c +++ b/sysdeps/stub/shmat.c @@ -1,21 +1,21 @@ -/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. -Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. + 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 + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <sys/shm.h> #include <errno.h> @@ -24,14 +24,14 @@ Boston, MA 02111-1307, USA. */ segment of the calling process. SHMADDR and SHMFLG determine how and where the segment is attached. */ -char * +void * shmat (shmid, shmaddr, shmflg) int shmid; - char *shmaddr; + const void *shmaddr; int shmflg; { __set_errno (ENOSYS); - return (char *) -1; + return (void *) -1; } stub_warning (shmat) diff --git a/sysdeps/stub/shmdt.c b/sysdeps/stub/shmdt.c index 8cca7743b6..ab9609e55f 100644 --- a/sysdeps/stub/shmdt.c +++ b/sysdeps/stub/shmdt.c @@ -1,21 +1,21 @@ -/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. -Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. + 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 + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <sys/shm.h> #include <errno.h> @@ -25,7 +25,7 @@ Boston, MA 02111-1307, USA. */ int shmdt (shmaddr) - char *shmaddr; + const void *shmaddr; { __set_errno (ENOSYS); return -1; |