From 01ee387015a2075c45a4e1ad45d39e50b5a6d40b Mon Sep 17 00:00:00 2001 From: "Paul E. Murphy" Date: Mon, 27 Jun 2016 17:11:46 -0500 Subject: Convert _Complex cosine functions to generated code This is fairly straight fowards. m68k overrides are updated to use the framework, and thus are simplified a bit. --- sysdeps/alpha/fpu/s_cacosf.c | 11 ++++- sysdeps/alpha/fpu/s_cacoshf.c | 10 +++- sysdeps/alpha/fpu/s_ccosf.c | 12 +++-- sysdeps/alpha/fpu/s_ccoshf.c | 12 +++-- sysdeps/ieee754/ldbl-opt/s_cacos.c | 6 --- sysdeps/ieee754/ldbl-opt/s_cacosh.c | 6 --- sysdeps/ieee754/ldbl-opt/s_cacoshl.c | 6 --- sysdeps/ieee754/ldbl-opt/s_cacosl.c | 6 --- sysdeps/ieee754/ldbl-opt/s_ccos.c | 6 --- sysdeps/ieee754/ldbl-opt/s_ccosh.c | 6 --- sysdeps/ieee754/ldbl-opt/s_ccoshl.c | 6 --- sysdeps/ieee754/ldbl-opt/s_ccosl.c | 6 --- sysdeps/m68k/m680x0/fpu/s_ccosh.c | 76 ------------------------------ sysdeps/m68k/m680x0/fpu/s_ccosh_template.c | 68 ++++++++++++++++++++++++++ sysdeps/m68k/m680x0/fpu/s_ccoshf.c | 3 -- sysdeps/m68k/m680x0/fpu/s_ccoshl.c | 3 -- 16 files changed, 101 insertions(+), 142 deletions(-) delete mode 100644 sysdeps/ieee754/ldbl-opt/s_cacos.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_cacosh.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_cacoshl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_cacosl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_ccos.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_ccosh.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_ccoshl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_ccosl.c delete mode 100644 sysdeps/m68k/m680x0/fpu/s_ccosh.c create mode 100644 sysdeps/m68k/m680x0/fpu/s_ccosh_template.c delete mode 100644 sysdeps/m68k/m680x0/fpu/s_ccoshf.c delete mode 100644 sysdeps/m68k/m680x0/fpu/s_ccoshl.c (limited to 'sysdeps') diff --git a/sysdeps/alpha/fpu/s_cacosf.c b/sysdeps/alpha/fpu/s_cacosf.c index 25e21bb..d98ff9c 100644 --- a/sysdeps/alpha/fpu/s_cacosf.c +++ b/sysdeps/alpha/fpu/s_cacosf.c @@ -24,11 +24,18 @@ #undef __cacosf #undef cacosf -#define __cacosf internal_cacosf static _Complex float internal_cacosf (_Complex float x); -#include +#define M_DECL_FUNC(f) internal_cacosf +#include + +/* Disable any aliasing from base template. */ +#undef declare_mgen_alias +#define declare_mgen_alias(__to, __from) + +#include + #include "cfloat-compat.h" #undef __cacosf diff --git a/sysdeps/alpha/fpu/s_cacoshf.c b/sysdeps/alpha/fpu/s_cacoshf.c index 43b6542..06b422f 100644 --- a/sysdeps/alpha/fpu/s_cacoshf.c +++ b/sysdeps/alpha/fpu/s_cacoshf.c @@ -24,11 +24,17 @@ #undef __cacoshf #undef cacoshf -#define __cacoshf internal_cacoshf static _Complex float internal_cacoshf (_Complex float x); -#include +#define M_DECL_FUNC(f) internal_cacoshf +#include + +/* Disable any aliasing from base template. */ +#undef declare_mgen_alias +#define declare_mgen_alias(__to, __from) + +#include #include "cfloat-compat.h" #undef __cacoshf diff --git a/sysdeps/alpha/fpu/s_ccosf.c b/sysdeps/alpha/fpu/s_ccosf.c index 886be62..2e7d4a2 100644 --- a/sysdeps/alpha/fpu/s_ccosf.c +++ b/sysdeps/alpha/fpu/s_ccosf.c @@ -24,14 +24,18 @@ #undef __ccosf #undef ccosf -#define __ccosf internal_ccosf static _Complex float internal_ccosf (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_ccosf +#include -#undef __ccosf +/* Disable any aliasing from base template. */ +#undef declare_mgen_alias +#define declare_mgen_alias(__to, __from) + +#include +#include "cfloat-compat.h" c1_cfloat_rettype __c1_ccosf (c1_cfloat_decl (x)) diff --git a/sysdeps/alpha/fpu/s_ccoshf.c b/sysdeps/alpha/fpu/s_ccoshf.c index 16f49de..e5de040 100644 --- a/sysdeps/alpha/fpu/s_ccoshf.c +++ b/sysdeps/alpha/fpu/s_ccoshf.c @@ -24,14 +24,18 @@ #undef __ccoshf #undef ccoshf -#define __ccoshf internal_ccoshf static _Complex float internal_ccoshf (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_ccoshf +#include -#undef __ccoshf +/* Disable any aliasing from base template. */ +#undef declare_mgen_alias +#define declare_mgen_alias(__to, __from) + +#include +#include "cfloat-compat.h" c1_cfloat_rettype __c1_ccoshf (c1_cfloat_decl (x)) diff --git a/sysdeps/ieee754/ldbl-opt/s_cacos.c b/sysdeps/ieee754/ldbl-opt/s_cacos.c deleted file mode 100644 index db90a9e..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_cacos.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __cacos, cacosl, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_cacosh.c b/sysdeps/ieee754/ldbl-opt/s_cacosh.c deleted file mode 100644 index e68049d..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_cacosh.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __cacosh, cacoshl, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_cacoshl.c b/sysdeps/ieee754/ldbl-opt/s_cacoshl.c deleted file mode 100644 index ed4a299..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_cacoshl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __cacoshl, cacoshl); diff --git a/sysdeps/ieee754/ldbl-opt/s_cacosl.c b/sysdeps/ieee754/ldbl-opt/s_cacosl.c deleted file mode 100644 index 9b84005..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_cacosl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __cacosl, cacosl); diff --git a/sysdeps/ieee754/ldbl-opt/s_ccos.c b/sysdeps/ieee754/ldbl-opt/s_ccos.c deleted file mode 100644 index 2c43c7f..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_ccos.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __ccos, ccosl, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_ccosh.c b/sysdeps/ieee754/ldbl-opt/s_ccosh.c deleted file mode 100644 index 3753cd5..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_ccosh.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __ccosh, ccoshl, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_ccoshl.c b/sysdeps/ieee754/ldbl-opt/s_ccoshl.c deleted file mode 100644 index 9f0c1e1..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_ccoshl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __ccoshl, ccoshl); diff --git a/sysdeps/ieee754/ldbl-opt/s_ccosl.c b/sysdeps/ieee754/ldbl-opt/s_ccosl.c deleted file mode 100644 index e93e805..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_ccosl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __ccosl, ccosl); diff --git a/sysdeps/m68k/m680x0/fpu/s_ccosh.c b/sysdeps/m68k/m680x0/fpu/s_ccosh.c deleted file mode 100644 index 47a4fb0..0000000 --- a/sysdeps/m68k/m680x0/fpu/s_ccosh.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Complex cosine hyperbole function. m68k fpu version - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Schwab . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include -#include -#include "mathimpl.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(__ccosh) (__complex__ float_type x) -{ - __complex__ float_type retval; - unsigned long ix_cond = __m81_test (__imag__ x); - - if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) - { - /* 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)); - __real__ retval = cos_ix * m81(__ieee754_cosh) (__real__ x); - if (ix_cond & __M81_COND_ZERO) - __imag__ retval = (signbit (__real__ x) - ? -__imag__ x : __imag__ x); - else - __imag__ retval = sin_ix * m81(__ieee754_sinh) (__real__ x); - } - else - { - unsigned long rx_cond = __m81_test (__real__ x); - - if (rx_cond & __M81_COND_ZERO) - { - __real__ retval = __imag__ x - __imag__ x; - __imag__ retval = __real__ x; - } - else - { - if (rx_cond & __M81_COND_INF) - __real__ retval = s(fabs) (__real__ x); - else - __real__ retval = s(__nan) (""); - __imag__ retval = __imag__ x - __imag__ x; - } - } - - return retval; -} -weak_alias (s(__ccosh), s(ccosh)) diff --git a/sysdeps/m68k/m680x0/fpu/s_ccosh_template.c b/sysdeps/m68k/m680x0/fpu/s_ccosh_template.c new file mode 100644 index 0000000..83b449e --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_ccosh_template.c @@ -0,0 +1,68 @@ +/* Complex cosine hyperbole function. m68k fpu version + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Schwab . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include "mathimpl.h" + +#define s(name) M_SUF (name) +#define m81(func) __m81_u(s(func)) + +CFLOAT +s(__ccosh) (CFLOAT x) +{ + CFLOAT retval; + unsigned long ix_cond = __m81_test (__imag__ x); + + if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) + { + /* Imaginary part is finite. */ + FLOAT sin_ix, cos_ix; + + __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 = (signbit (__real__ x) + ? -__imag__ x : __imag__ x); + else + __imag__ retval = sin_ix * m81(__ieee754_sinh) (__real__ x); + } + else + { + unsigned long rx_cond = __m81_test (__real__ x); + + if (rx_cond & __M81_COND_ZERO) + { + __real__ retval = __imag__ x - __imag__ x; + __imag__ retval = __real__ x; + } + else + { + if (rx_cond & __M81_COND_INF) + __real__ retval = s(fabs) (__real__ x); + else + __real__ retval = s(__nan) (""); + __imag__ retval = __imag__ x - __imag__ x; + } + } + + return retval; +} +weak_alias (s(__ccosh), s(ccosh)) diff --git a/sysdeps/m68k/m680x0/fpu/s_ccoshf.c b/sysdeps/m68k/m680x0/fpu/s_ccoshf.c deleted file mode 100644 index 3c8e7c7..0000000 --- a/sysdeps/m68k/m680x0/fpu/s_ccoshf.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF f -#define float_type float -#include diff --git a/sysdeps/m68k/m680x0/fpu/s_ccoshl.c b/sysdeps/m68k/m680x0/fpu/s_ccoshl.c deleted file mode 100644 index 772d578..0000000 --- a/sysdeps/m68k/m680x0/fpu/s_ccoshl.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF l -#define float_type long double -#include -- cgit v1.1