diff options
Diffstat (limited to 'sysdeps/m68k/fpu')
-rw-r--r-- | sysdeps/m68k/fpu/__math.h | 21 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/e_pow.c | 32 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_ccos.c | 73 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_ccosf.c | 3 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_ccosh.c | 85 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_ccoshf.c | 1 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_ccoshl.c | 1 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_ccosl.c | 3 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_cexp.c | 119 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_cexpf.c | 1 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_cexpl.c | 1 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_csin.c | 69 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_csinf.c | 3 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_csinh.c | 91 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_csinhf.c | 1 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_csinhl.c | 1 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/s_csinl.c | 3 |
17 files changed, 286 insertions, 222 deletions
diff --git a/sysdeps/m68k/fpu/__math.h b/sysdeps/m68k/fpu/__math.h index 92487f9b04..5dc4d2e066 100644 --- a/sysdeps/m68k/fpu/__math.h +++ b/sysdeps/m68k/fpu/__math.h @@ -153,6 +153,21 @@ __internal_inline_functions (float,f) __internal_inline_functions (long double,l) #undef __internal_inline_functions +/* Get the m68881 condition codes, to quickly check multiple conditions. */ +static __inline__ unsigned long +__m81_test (long double __val) +{ + unsigned long __fpsr; + __asm ("ftst%.x %1; fmove%.l %/fpsr,%0" : "=dm" (__fpsr) : "f" (__val)); + return __fpsr; +} + +/* Bit values returned by __m81_test. */ +#define __M81_COND_NAN (1 << 24) +#define __M81_COND_INF (2 << 24) +#define __M81_COND_ZERO (4 << 24) +#define __M81_COND_NEG (8 << 24) + #endif /* __LIBC_M81_MATH_INLINES */ /* The rest of the functions are available to the user. */ @@ -163,8 +178,12 @@ __m81_u(__CONCAT(__frexp,s))(float_type __value, int *__expptr) \ { \ float_type __mantissa, __exponent; \ int __iexponent; \ - if (__value == 0.0) \ + unsigned long __fpsr; \ + __asm("ftst%.x %1\n" \ + "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \ + if (__fpsr & (7 << 24)) \ { \ + /* Not finite or zero. */ \ *__expptr = 0; \ return __value; \ } \ diff --git a/sysdeps/m68k/fpu/e_pow.c b/sysdeps/m68k/fpu/e_pow.c index a39b63d342..b3d151fadc 100644 --- a/sysdeps/m68k/fpu/e_pow.c +++ b/sysdeps/m68k/fpu/e_pow.c @@ -36,29 +36,33 @@ s(__ieee754_pow) (float_type x, float_type y) { float_type z; float_type ax; + unsigned long x_cond, y_cond; - if (y == 0.0) + y_cond = __m81_test (y); + if (y_cond & __M81_COND_ZERO) return 1.0; - if (x != x || y != y) + + x_cond = __m81_test (x); + if ((x_cond | y_cond) & __M81_COND_NAN) return x + y; - if (m81(__isinf) (y)) + if (y_cond & __M81_COND_INF) { ax = s(fabs) (x); if (ax == 1) - return 0.0/0.0; + return y - y; if (ax > 1) - return y > 0 ? y : 0; + return y_cond & __M81_COND_NEG ? 0 : y; else - return y < 0 ? -y : 0; + return y_cond & __M81_COND_NEG ? -y : 0; } if (s(fabs) (y) == 1) - return y > 0 ? x : 1 / x; + return y_cond & __M81_COND_NEG ? 1 / x : x; if (y == 2) return x * x; - if (y == 0.5 && x >= 0) + if (y == 0.5 && !(x_cond & __M81_COND_NEG)) return m81(__ieee754_sqrt) (x); if (x == 10.0) @@ -73,17 +77,17 @@ s(__ieee754_pow) (float_type x, float_type y) } ax = s(fabs) (x); - if (m81(__isinf) (x) || x == 0 || ax == 1) + if (x_cond & (__M81_COND_INF | __M81_COND_ZERO) || ax == 1) { z = ax; - if (y < 0) + if (y_cond & __M81_COND_NEG) z = 1 / z; - if (m81(__signbit) (x)) + if (x_cond & __M81_COND_NEG) { if (y != m81(__rint) (y)) { if (x == -1) - z = 0.0/0.0; + z = (z - z) / (z - z); } else goto maybe_negate; @@ -91,7 +95,7 @@ s(__ieee754_pow) (float_type x, float_type y) return z; } - if (x < 0.0) + if (x_cond & __M81_COND_NEG) { if (y == m81(__rint) (y)) { @@ -112,7 +116,7 @@ s(__ieee754_pow) (float_type x, float_type y) } } else - z = 0.0/0.0; + z = (y - y) / (y - y); } else z = m81(__ieee754_exp) (y * m81(__ieee754_log) (x)); diff --git a/sysdeps/m68k/fpu/s_ccos.c b/sysdeps/m68k/fpu/s_ccos.c new file mode 100644 index 0000000000..53f8286b14 --- /dev/null +++ b/sysdeps/m68k/fpu/s_ccos.c @@ -0,0 +1,73 @@ +/* Complex cosine function. m68k fpu version + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>. + + 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 <complex.h> +#include <math.h> + +#ifndef SUFF +#define SUFF +#endif +#ifndef float_type +#define float_type double +#endif + +#define CONCATX(a,b) __CONCAT(a,b) +#define s(name) CONCATX(name,SUFF) +#define m81(func) __m81_u(s(func)) + +__complex__ float_type +s(__ccos) (__complex__ float_type x) +{ + __complex__ float_type retval; + unsigned long rx_cond = __m81_test (__real__ x); + + if ((rx_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) + { + /* Real part is finite. */ + float_type sin_rx, cos_rx; + + __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx) + : "f" (__real__ x)); + __real__ retval = cos_rx * m81(__ieee754_cosh) (__imag__ x); + if (rx_cond & __M81_COND_ZERO) + __imag__ retval = (m81(__signbit) (__imag__ x) + ? __real__ x : -__real__ x); + else + __imag__ retval = -sin_rx * m81(__ieee754_sinh) (__imag__ x); + } + else + { + unsigned long ix_cond = __m81_test (__imag__ x); + + if (ix_cond & __M81_COND_INF) + __real__ retval = s(fabs) (__imag__ x); + else + __real__ retval = __real__ x - __real__ x; + if (ix_cond & __M81_COND_ZERO) + __imag__ retval = __imag__ x; + else + __imag__ retval = __real__ x - __real__ x; + } + + return retval; +} +#define weak_aliasx(a,b) weak_alias(a,b) +weak_aliasx (s(__ccos), s(ccos)) diff --git a/sysdeps/m68k/fpu/s_ccosf.c b/sysdeps/m68k/fpu/s_ccosf.c new file mode 100644 index 0000000000..f5e8a41faf --- /dev/null +++ b/sysdeps/m68k/fpu/s_ccosf.c @@ -0,0 +1,3 @@ +#define SUFF f +#define float_type float +#include <s_ccos.c> diff --git a/sysdeps/m68k/fpu/s_ccosh.c b/sysdeps/m68k/fpu/s_ccosh.c index 439eae131c..85e73b87e3 100644 --- a/sysdeps/m68k/fpu/s_ccosh.c +++ b/sysdeps/m68k/fpu/s_ccosh.c @@ -25,9 +25,6 @@ #ifndef SUFF #define SUFF #endif -#ifndef huge_val -#define huge_val HUGE_VAL -#endif #ifndef float_type #define float_type double #endif @@ -40,78 +37,40 @@ __complex__ float_type s(__ccosh) (__complex__ float_type x) { __complex__ float_type retval; + unsigned long ix_cond = __m81_test (__imag__ x); - __real__ x = s(fabs) (__real__ x); - - if (m81(__finite) (__real__ x)) + if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) { - if (m81(__finite) (__imag__ x)) - { - float_type cosh_val; - float_type sin_ix, cos_ix; + /* Imaginary part is finite. */ + float_type sin_ix, cos_ix; - __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) - : "f" (__imag__ x)); - cosh_val = m81(__ieee754_cosh) (__real__ x); - __real__ retval = cos_ix * cosh_val; - __imag__ retval = sin_ix * cosh_val; - } - else if (__real__ x == 0) - { - __imag__ retval = 0.0; - __real__ retval = huge_val - huge_val; - } + __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) + : "f" (__imag__ x)); + __real__ retval = cos_ix * m81(__ieee754_cosh) (__real__ x); + if (ix_cond & __M81_COND_ZERO) + __imag__ retval = (m81(__signbit) (__real__ x) + ? -__imag__ x : __imag__ x); else - __real__ retval = __imag__ retval = huge_val - huge_val; + __imag__ retval = sin_ix * m81(__ieee754_sinh) (__real__ x); } - else if (m81(__isinf) (__real__ x)) + else { - if (__imag__ x == 0) - { - __real__ retval = huge_val; - __imag__ retval = __imag__ x; - } - else if (m81(__finite) (__imag__ x)) - { - float_type remainder, pi_2; - int quadrant; - __real__ retval = __imag__ retval = huge_val; + unsigned long rx_cond = __m81_test (__real__ x); - __asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2)); - __asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1" - : "=f" (remainder), "=dm" (quadrant) - : "f" (pi_2), "0" (__imag__ x)); - quadrant = (quadrant >> 16) & 0x83; - if (quadrant & 0x80) - quadrant ^= 0x83; - switch (quadrant) - { - default: - break; - case 1: - __real__ retval = -__real__ retval; - break; - case 2: - __real__ retval = -__real__ retval; - case 3: - __imag__ retval = -__imag__ retval; - break; - } + if (rx_cond & __M81_COND_ZERO) + { + __real__ retval = __imag__ x - __imag__ x; + __imag__ retval = __real__ x; } else { - /* The subtraction raises the invalid exception. */ - __real__ retval = huge_val; - __imag__ retval = huge_val - huge_val; + if (rx_cond & __M81_COND_INF) + __real__ retval = s(fabs) (__real__ x); + else + __real__ retval = 0.0/0.0; + __imag__ retval = __imag__ x - __imag__ x; } } - else if (__imag__ x == 0) - { - __real__ retval = 0.0/0.0; - __imag__ retval = __imag__ x; - } - else - __real__ retval = __imag__ retval = 0.0/0.0; return retval; } diff --git a/sysdeps/m68k/fpu/s_ccoshf.c b/sysdeps/m68k/fpu/s_ccoshf.c index 7d0766851f..3c8e7c7bb7 100644 --- a/sysdeps/m68k/fpu/s_ccoshf.c +++ b/sysdeps/m68k/fpu/s_ccoshf.c @@ -1,4 +1,3 @@ #define SUFF f #define float_type float -#define huge_val HUGE_VALF #include <s_ccosh.c> diff --git a/sysdeps/m68k/fpu/s_ccoshl.c b/sysdeps/m68k/fpu/s_ccoshl.c index 6f1d1e5f85..772d5786cf 100644 --- a/sysdeps/m68k/fpu/s_ccoshl.c +++ b/sysdeps/m68k/fpu/s_ccoshl.c @@ -1,4 +1,3 @@ #define SUFF l #define float_type long double -#define huge_val HUGE_VALL #include <s_ccosh.c> diff --git a/sysdeps/m68k/fpu/s_ccosl.c b/sysdeps/m68k/fpu/s_ccosl.c new file mode 100644 index 0000000000..aaff365208 --- /dev/null +++ b/sysdeps/m68k/fpu/s_ccosl.c @@ -0,0 +1,3 @@ +#define SUFF l +#define float_type long double +#include <s_ccos.c> diff --git a/sysdeps/m68k/fpu/s_cexp.c b/sysdeps/m68k/fpu/s_cexp.c index 4846ec10f3..86cc894a7e 100644 --- a/sysdeps/m68k/fpu/s_cexp.c +++ b/sysdeps/m68k/fpu/s_cexp.c @@ -25,9 +25,6 @@ #ifndef SUFF #define SUFF #endif -#ifndef huge_val -#define huge_val HUGE_VAL -#endif #ifndef float_type #define float_type double #endif @@ -40,85 +37,79 @@ __complex__ float_type s(__cexp) (__complex__ float_type x) { __complex__ float_type retval; + unsigned long ix_cond; + + ix_cond = __m81_test (__imag__ x); - if (m81(__finite) (__real__ x)) + if ((ix_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0) { - if (m81(__finite) (__imag__ x)) + /* Imaginary part is finite. */ + float_type exp_val = m81(__ieee754_exp) (__real__ x); + + __real__ retval = __imag__ retval = exp_val; + if (m81(__finite) (exp_val)) { - float_type exp_val = m81(__ieee754_exp) (__real__ x); + float_type sin_ix, cos_ix; + __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) + : "f" (__imag__ x)); + __real__ retval *= cos_ix; + if (ix_cond & __M81_COND_ZERO) + __imag__ retval = __imag__ x; + else + __imag__ retval *= sin_ix; + } + else + { + /* Compute the sign of the result. */ + float_type remainder, pi_2; + int quadrant; - __real__ retval = __imag__ retval = exp_val; - if (m81(__finite) (exp_val)) + __asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2)); + __asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1" + : "=f" (remainder), "=dm" (quadrant) + : "f" (pi_2), "0" (__imag__ x)); + quadrant = (quadrant >> 16) & 0x83; + if (quadrant & 0x80) + quadrant ^= 0x83; + switch (quadrant) { - float_type sin_ix, cos_ix; - __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) - : "f" (__imag__ x)); - __real__ retval *= cos_ix; - __imag__ retval *= sin_ix; + default: + break; + case 1: + __real__ retval = -__real__ retval; + break; + case 2: + __real__ retval = -__real__ retval; + case 3: + __imag__ retval = -__imag__ retval; + break; } - else - goto fix_sign; + if (ix_cond & __M81_COND_ZERO && !m81(__isnan) (exp_val)) + __imag__ retval = __imag__ x; } - else - /* If the imaginary part is +-inf or NaN and the real part is - not +-inf the result is NaN + iNaN. */ - __real__ retval = __imag__ retval = 0.0/0.0; } - else if (m81(__isinf) (__real__ x)) + else { - if (m81(__finite) (__imag__ x)) - { - float_type value = m81(__signbit) (__real__ x) ? 0.0 : huge_val; + unsigned long rx_cond = __m81_test (__real__ x); - if (__imag__ x == 0.0) + if (rx_cond & __M81_COND_INF) + { + /* Real part is infinite. */ + if (rx_cond & __M81_COND_NEG) { - __real__ retval = value; - __imag__ retval = __imag__ x; + __real__ retval = __imag__ retval = 0.0; + if (ix_cond & __M81_COND_NEG) + __imag__ retval = -__imag__ retval; } else { - float_type remainder, pi_2; - int quadrant; - __real__ retval = value; - __imag__ retval = value; - - fix_sign: - __asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2)); - __asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1" - : "=f" (remainder), "=dm" (quadrant) - : "f" (pi_2), "0" (__imag__ x)); - quadrant = (quadrant >> 16) & 0x83; - if (quadrant & 0x80) - quadrant ^= 0x83; - switch (quadrant) - { - default: - break; - case 1: - __real__ retval = -__real__ retval; - break; - case 2: - __real__ retval = -__real__ retval; - case 3: - __imag__ retval = -__imag__ retval; - break; - } + __real__ retval = __real__ x; + __imag__ retval = __imag__ x - __imag__ x; } } - else if (m81(__signbit) (__real__ x) == 0) - { - __real__ retval = huge_val; - __imag__ retval = 0.0/0.0; - } else - { - __real__ retval = 0.0; - __imag__ retval = s(__copysign) (0.0, __imag__ x); - } + __real__ retval = __imag__ retval = __imag__ x - __imag__ x; } - else - /* If the real part is NaN the result is NaN + iNaN. */ - __real__ retval = __imag__ retval = 0.0/0.0; return retval; } diff --git a/sysdeps/m68k/fpu/s_cexpf.c b/sysdeps/m68k/fpu/s_cexpf.c index db9f174546..177a360f9b 100644 --- a/sysdeps/m68k/fpu/s_cexpf.c +++ b/sysdeps/m68k/fpu/s_cexpf.c @@ -1,4 +1,3 @@ #define SUFF f -#define huge_val HUGE_VALF #define float_type float #include <s_cexp.c> diff --git a/sysdeps/m68k/fpu/s_cexpl.c b/sysdeps/m68k/fpu/s_cexpl.c index 7367070548..bbda4ba990 100644 --- a/sysdeps/m68k/fpu/s_cexpl.c +++ b/sysdeps/m68k/fpu/s_cexpl.c @@ -1,4 +1,3 @@ #define SUFF l -#define huge_val HUGE_VALL #define float_type long double #include <s_cexp.c> diff --git a/sysdeps/m68k/fpu/s_csin.c b/sysdeps/m68k/fpu/s_csin.c new file mode 100644 index 0000000000..8eecd961a6 --- /dev/null +++ b/sysdeps/m68k/fpu/s_csin.c @@ -0,0 +1,69 @@ +/* Complex sine function. m68k fpu version + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>. + + 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 <complex.h> +#include <math.h> + +#ifndef SUFF +#define SUFF +#endif +#ifndef float_type +#define float_type double +#endif + +#define CONCATX(a,b) __CONCAT(a,b) +#define s(name) CONCATX(name,SUFF) +#define m81(func) __m81_u(s(func)) + +__complex__ float_type +s(__csin) (__complex__ float_type x) +{ + __complex__ float_type retval; + unsigned long rx_cond = __m81_test (__real__ x); + + if ((rx_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) + { + /* Real part is finite. */ + float_type sin_rx, cos_rx; + + __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx) + : "f" (__real__ x)); + if (rx_cond & __M81_COND_ZERO) + __real__ retval = __real__ x; + else + __real__ retval = sin_rx * m81(__ieee754_cosh) (__imag__ x); + __imag__ retval = cos_rx * m81(__ieee754_sinh) (__imag__ x); + } + else + { + unsigned long ix_cond = __m81_test (__imag__ x); + + __real__ retval = __real__ x - __real__ x; + if (ix_cond & (__M81_COND_ZERO|__M81_COND_INF|__M81_COND_NAN)) + __imag__ retval = __imag__ x; + else + __imag__ retval = __real__ retval; + } + + return retval; +} +#define weak_aliasx(a,b) weak_alias(a,b) +weak_aliasx (s(__csin), s(csin)) diff --git a/sysdeps/m68k/fpu/s_csinf.c b/sysdeps/m68k/fpu/s_csinf.c new file mode 100644 index 0000000000..b760e192c3 --- /dev/null +++ b/sysdeps/m68k/fpu/s_csinf.c @@ -0,0 +1,3 @@ +#define SUFF f +#define float_type float +#include <s_csin.c> diff --git a/sysdeps/m68k/fpu/s_csinh.c b/sysdeps/m68k/fpu/s_csinh.c index c409ed0d8f..643a221b57 100644 --- a/sysdeps/m68k/fpu/s_csinh.c +++ b/sysdeps/m68k/fpu/s_csinh.c @@ -25,9 +25,6 @@ #ifndef SUFF #define SUFF #endif -#ifndef huge_val -#define huge_val HUGE_VAL -#endif #ifndef float_type #define float_type double #endif @@ -40,87 +37,33 @@ __complex__ float_type s(__csinh) (__complex__ float_type x) { __complex__ float_type retval; - int negate = m81(__signbit) (__real__ x); + unsigned long ix_cond; - __real__ x = s(fabs) (__real__ x); + ix_cond = __m81_test (__imag__ x); - if (m81(__finite) (__real__ x)) + if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) { - if (m81(__finite) (__imag__ x)) - { - float_type sinh_val; - float_type sin_ix, cos_ix; - - __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) - : "f" (__imag__ x)); - sinh_val = m81(__ieee754_sinh) (__real__ x); - __real__ retval = cos_ix * sinh_val; - __imag__ retval = sin_ix * sinh_val; + /* Imaginary part is finite. */ + float_type sin_ix, cos_ix; - if (negate) - __real__ retval = -__real__ retval; - } - else if (__real__ x == 0) - { - __real__ retval = 0.0; - __imag__ retval = 0.0/0.0; - - if (negate) - __real__ retval = -__real__ retval; - } + __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) + : "f" (__imag__ x)); + __real__ retval = cos_ix * m81(__ieee754_sinh) (__real__ x); + if (ix_cond & __M81_COND_ZERO) + __imag__ retval = __imag__ x; else - __real__ retval = __imag__ retval = 0.0/0.0; + __imag__ retval = sin_ix * m81(__ieee754_cosh) (__real__ x); } - else if (m81(__isinf) (__real__ x)) + else { - if (__imag__ x == 0.0) - { - __real__ retval = negate ? -huge_val : huge_val; - __imag__ retval = __imag__ x; - } - else if (m81(__finite) (__imag__ x)) - { - float_type remainder, pi_2; - int quadrant; - __real__ retval = __imag__ retval = huge_val; + unsigned long rx_cond = __m81_test (__real__ x); - __asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2)); - __asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1" - : "=f" (remainder), "=dm" (quadrant) - : "f" (pi_2), "0" (__imag__ x)); - quadrant = (quadrant >> 16) & 0x83; - if (quadrant & 0x80) - quadrant ^= 0x83; - if (negate) - quadrant ^= 1; - switch (quadrant) - { - default: - break; - case 1: - __real__ retval = -__real__ retval; - break; - case 2: - __real__ retval = -__real__ retval; - case 3: - __imag__ retval = -__imag__ retval; - break; - } - } + __imag__ retval = __imag__ x - __imag__ x; + if (rx_cond & (__M81_COND_ZERO|__M81_COND_INF|__M81_COND_NAN)) + __real__ retval = __real__ x; else - { - /* The subtraction raises the invalid exception. */ - __real__ retval = huge_val; - __imag__ retval = huge_val - huge_val; - } + __real__ retval = __imag__ retval; } - else if (__imag__ x == 0.0) - { - __real__ retval = 0.0/0.0; - __imag__ retval = __imag__ x; - } - else - __real__ retval = __imag__ retval = 0.0/0.0; return retval; } diff --git a/sysdeps/m68k/fpu/s_csinhf.c b/sysdeps/m68k/fpu/s_csinhf.c index 42c114b961..2f7a43e6a8 100644 --- a/sysdeps/m68k/fpu/s_csinhf.c +++ b/sysdeps/m68k/fpu/s_csinhf.c @@ -1,4 +1,3 @@ #define SUFF f #define float_type float -#define huge_val HUGE_VALF #include <s_csinh.c> diff --git a/sysdeps/m68k/fpu/s_csinhl.c b/sysdeps/m68k/fpu/s_csinhl.c index c8aa5c7d27..026a20e7be 100644 --- a/sysdeps/m68k/fpu/s_csinhl.c +++ b/sysdeps/m68k/fpu/s_csinhl.c @@ -1,4 +1,3 @@ #define SUFF l #define float_type long double -#define huge_val HUGE_VALL #include <s_csinh.c> diff --git a/sysdeps/m68k/fpu/s_csinl.c b/sysdeps/m68k/fpu/s_csinl.c new file mode 100644 index 0000000000..ea2dad0556 --- /dev/null +++ b/sysdeps/m68k/fpu/s_csinl.c @@ -0,0 +1,3 @@ +#define SUFF l +#define float_type long double +#include <s_csin.c> |