From ce6698ea0aea863bbfb4e932494406789e4e36c1 Mon Sep 17 00:00:00 2001 From: "Paul E. Murphy" Date: Tue, 14 Jun 2016 11:44:14 -0500 Subject: Support for type-generic libm function implementations libm This defines a new classes of libm objects. The _template.c file which is used in conjunction with the new makefile hooks to derive variants for each type supported by the target machine. The headers math-type-macros-TYPE.h are used to supply macros to a common implementation of a function in a file named FUNC_template.c and glued togethor via a generated file matching existing naming in the build directory. This has the properties of preserving the existing override mechanism and not requiring any arcane build system twiddling. Likewise, it enables machines to override these files without any additional work. I have verified the built objects for ppc64, x86_64, alpha, arm, and m68k do not change in any meaningful way with these changes using the Fedora cross toolchains. I have verified the x86_64 and ppc64 changes still run. --- math/Makefile | 31 +++++++++++++++++++++++++++++-- math/cabs.c | 32 -------------------------------- math/cabs_template.c | 33 +++++++++++++++++++++++++++++++++ math/cabsf.c | 28 ---------------------------- math/cabsl.c | 28 ---------------------------- math/carg.c | 32 -------------------------------- math/carg_template.c | 33 +++++++++++++++++++++++++++++++++ math/cargf.c | 28 ---------------------------- math/cargl.c | 28 ---------------------------- math/cimag.c | 31 ------------------------------- math/cimag_template.c | 32 ++++++++++++++++++++++++++++++++ math/cimagf.c | 27 --------------------------- math/cimagl.c | 27 --------------------------- math/conj.c | 31 ------------------------------- math/conj_template.c | 32 ++++++++++++++++++++++++++++++++ math/conjf.c | 27 --------------------------- math/conjl.c | 27 --------------------------- math/creal.c | 31 ------------------------------- math/creal_template.c | 32 ++++++++++++++++++++++++++++++++ math/crealf.c | 27 --------------------------- math/creall.c | 27 --------------------------- 21 files changed, 191 insertions(+), 433 deletions(-) delete mode 100644 math/cabs.c create mode 100644 math/cabs_template.c delete mode 100644 math/cabsf.c delete mode 100644 math/cabsl.c delete mode 100644 math/carg.c create mode 100644 math/carg_template.c delete mode 100644 math/cargf.c delete mode 100644 math/cargl.c delete mode 100644 math/cimag.c create mode 100644 math/cimag_template.c delete mode 100644 math/cimagf.c delete mode 100644 math/cimagl.c delete mode 100644 math/conj.c create mode 100644 math/conj_template.c delete mode 100644 math/conjf.c delete mode 100644 math/conjl.c delete mode 100644 math/creal.c create mode 100644 math/creal_template.c delete mode 100644 math/crealf.c delete mode 100644 math/creall.c (limited to 'math') diff --git a/math/Makefile b/math/Makefile index 38a4709..2ff1405 100644 --- a/math/Makefile +++ b/math/Makefile @@ -43,6 +43,10 @@ libm-support = s_lib_version s_matherr s_signgam \ fesetenv feupdateenv t_exp fedisblxcpt feenablxcpt \ fegetexcept fesetexcept +# Wrappers for these functions generated per type using a file named +# _template.c and the appropriate math-type-macros-.h. +gen-libm-calls = cargF conjF cimagF crealF cabsF + libm-calls = \ e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \ e_hypotF e_j0F e_j1F e_jnF e_lgammaF_r e_logF e_log10F e_powF \ @@ -59,13 +63,13 @@ libm-calls = \ w_ilogbF \ s_fpclassifyF s_fmaxF s_fminF s_fdimF s_nanF s_truncF \ s_remquoF e_log2F e_exp2F s_roundF s_nearbyintF s_sincosF \ - conjF cimagF crealF cabsF cargF s_cexpF s_csinhF s_ccoshF s_clogF \ + s_cexpF s_csinhF s_ccoshF s_clogF \ s_catanF s_casinF s_ccosF s_csinF s_ctanF s_ctanhF s_cacosF \ s_casinhF s_cacoshF s_catanhF s_csqrtF s_cpowF s_cprojF s_clog10F \ s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F \ s_issignalingF $(calls:s_%=m_%) x2y2m1F k_casinhF \ gamma_productF lgamma_negF lgamma_productF \ - s_nextupF s_nextdownF + s_nextupF s_nextdownF $(gen-libm-calls) libm-compat-calls-ldouble-yes = w_lgamma_compatl k_standardl libm-compat-calls = w_lgamma_compatf w_lgamma_compat k_standard k_standardf \ @@ -265,6 +269,29 @@ extra-objs += libieee.a ieee-math.o include ../Rules +generated += $(addsuffix .c,$(call type-foreach,$(gen-libm-calls))) \ + gen-libm-templates.stmp + +# Create wrappers in the math build directory. +$(objpfx)gen-libm-templates.stmp: + for gcall in $(gen-libm-calls); do \ + func=$${gcall%F*}$${gcall#*F}; \ + for type in $(foreach t,$(types),$(t)__$(type-$(t)-suffix)); do \ + suff=$${type#*__}; \ + type=$${type%__*}; \ + file=$(objpfx)$${gcall%F*}$${suff}$${gcall#*F}.c; \ + ( \ + echo "#include "; \ + echo "#include <$${func}_template.c>"; \ + ) > $${file}; \ + done; \ + done; \ + echo > $(@) + +# Add dependency to ensure the generator runs prior. +$(foreach t, $(call type-foreach, $(gen-libm-calls)), \ + $(objpfx)$(t).c): $(objpfx)gen-libm-templates.stmp + ifneq (no,$(PERL)) # This must come after the inclusion of sysdeps Makefiles via Rules. $(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test.stmp diff --git a/math/cabs.c b/math/cabs.c deleted file mode 100644 index d7e0665..0000000 --- a/math/cabs.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Return the complex absolute value of double complex value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -double -__cabs (double _Complex z) -{ - return __hypot (__real__ z, __imag__ z); -} -weak_alias (__cabs, cabs) -#ifdef NO_LONG_DOUBLE -strong_alias (__cabs, __cabsl) -weak_alias (__cabs, cabsl) -#endif diff --git a/math/cabs_template.c b/math/cabs_template.c new file mode 100644 index 0000000..5eff1b2 --- /dev/null +++ b/math/cabs_template.c @@ -0,0 +1,33 @@ +/* Return the complex absolute value of complex float type. + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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 + +FLOAT +M_DECL_FUNC (__cabs) (CFLOAT z) +{ + return M_SUF (__hypot) (__real__ z, __imag__ z); +} + +declare_mgen_alias (__cabs, cabs) + +#if M_LIBM_NEED_COMPAT (cabs) +declare_mgen_libm_compat (__cabs, cabs) +#endif diff --git a/math/cabsf.c b/math/cabsf.c deleted file mode 100644 index 431a244..0000000 --- a/math/cabsf.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Return the complex absolute value of float complex value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -float -__cabsf (float _Complex z) -{ - return __hypotf (__real__ z, __imag__ z); -} -weak_alias (__cabsf, cabsf) diff --git a/math/cabsl.c b/math/cabsl.c deleted file mode 100644 index d87e3a2..0000000 --- a/math/cabsl.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Return the complex absolute value of long double complex value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -long double -__cabsl (long double _Complex z) -{ - return __hypotl (__real__ z, __imag__ z); -} -weak_alias (__cabsl, cabsl) diff --git a/math/carg.c b/math/carg.c deleted file mode 100644 index 61f1e0d..0000000 --- a/math/carg.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Compute argument of complex double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -double -__carg (__complex__ double x) -{ - return __atan2 (__imag__ x, __real__ x); -} -weak_alias (__carg, carg) -#ifdef NO_LONG_DOUBLE -strong_alias (__carg, __cargl) -weak_alias (__carg, cargl) -#endif diff --git a/math/carg_template.c b/math/carg_template.c new file mode 100644 index 0000000..6205be8 --- /dev/null +++ b/math/carg_template.c @@ -0,0 +1,33 @@ +/* Compute argument of complex float type. + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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 + +FLOAT +M_DECL_FUNC (__carg) (CFLOAT x) +{ + return M_SUF (__atan2) (__imag__ x, __real__ x); +} + +declare_mgen_alias (__carg, carg) + +#if M_LIBM_NEED_COMPAT (carg) +declare_mgen_libm_compat (__carg, carg) +#endif diff --git a/math/cargf.c b/math/cargf.c deleted file mode 100644 index 620db3e..0000000 --- a/math/cargf.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Compute argument of complex float value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -float -__cargf (__complex__ float x) -{ - return __atan2f (__imag__ x, __real__ x); -} -weak_alias (__cargf, cargf) diff --git a/math/cargl.c b/math/cargl.c deleted file mode 100644 index 31b7292..0000000 --- a/math/cargl.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Compute argument of complex long double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -long double -__cargl (__complex__ long double x) -{ - return __atan2l (__imag__ x, __real__ x); -} -weak_alias (__cargl, cargl) diff --git a/math/cimag.c b/math/cimag.c deleted file mode 100644 index 1807ac2..0000000 --- a/math/cimag.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Return imaginary part of complex double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -double -__cimag (double _Complex z) -{ - return __imag__ z; -} -weak_alias (__cimag, cimag) -#ifdef NO_LONG_DOUBLE -strong_alias (__cimag, __cimagl) -weak_alias (__cimag, cimagl) -#endif diff --git a/math/cimag_template.c b/math/cimag_template.c new file mode 100644 index 0000000..582147d --- /dev/null +++ b/math/cimag_template.c @@ -0,0 +1,32 @@ +/* Return imaginary part of complex float type. + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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 + +FLOAT +M_DECL_FUNC (__cimag) (CFLOAT z) +{ + return __imag__ z; +} + +declare_mgen_alias (__cimag, cimag) + +#if M_LIBM_NEED_COMPAT (cimag) +declare_mgen_libm_compat (__cimag, cimag) +#endif diff --git a/math/cimagf.c b/math/cimagf.c deleted file mode 100644 index 67c37f4..0000000 --- a/math/cimagf.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Return imaginary part of complex float value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -float -__cimagf (float _Complex z) -{ - return __imag__ z; -} -weak_alias (__cimagf, cimagf) diff --git a/math/cimagl.c b/math/cimagl.c deleted file mode 100644 index c1d0910..0000000 --- a/math/cimagl.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Return imaginary part of complex long double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -long double -__cimagl (long double _Complex z) -{ - return __imag__ z; -} -weak_alias (__cimagl, cimagl) diff --git a/math/conj.c b/math/conj.c deleted file mode 100644 index d282985..0000000 --- a/math/conj.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Return complex conjugate of complex double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -double _Complex -__conj (double _Complex z) -{ - return ~z; -} -weak_alias (__conj, conj) -#ifdef NO_LONG_DOUBLE -strong_alias (__conj, __conjl) -weak_alias (__conj, conjl) -#endif diff --git a/math/conj_template.c b/math/conj_template.c new file mode 100644 index 0000000..72d1236 --- /dev/null +++ b/math/conj_template.c @@ -0,0 +1,32 @@ +/* Return complex conjugate of complex float type. + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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 + +CFLOAT +M_DECL_FUNC (__conj) (CFLOAT z) +{ + return ~z; +} + +declare_mgen_alias (__conj, conj) + +#if M_LIBM_NEED_COMPAT (conj) +declare_mgen_libm_compat (__conj, conj) +#endif diff --git a/math/conjf.c b/math/conjf.c deleted file mode 100644 index 3587c94..0000000 --- a/math/conjf.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Return complex conjugate of complex float value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -float _Complex -__conjf (float _Complex z) -{ - return ~z; -} -weak_alias (__conjf, conjf) diff --git a/math/conjl.c b/math/conjl.c deleted file mode 100644 index 55bb393..0000000 --- a/math/conjl.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Return complex conjugate of complex long double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -long double _Complex -__conjl (long double _Complex z) -{ - return ~z; -} -weak_alias (__conjl, conjl) diff --git a/math/creal.c b/math/creal.c deleted file mode 100644 index 231d3b0..0000000 --- a/math/creal.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Return real part of complex double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -double -__creal (double _Complex z) -{ - return __real__ z; -} -weak_alias (__creal, creal) -#ifdef NO_LONG_DOUBLE -strong_alias (__creal, __creall) -weak_alias (__creal, creall) -#endif diff --git a/math/creal_template.c b/math/creal_template.c new file mode 100644 index 0000000..f840f43 --- /dev/null +++ b/math/creal_template.c @@ -0,0 +1,32 @@ +/* Return real part of complex float type. + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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 + +FLOAT +M_DECL_FUNC (__creal) (CFLOAT z) +{ + return __real__ z; +} + +declare_mgen_alias (__creal, creal) + +#if M_LIBM_NEED_COMPAT (creal) +declare_mgen_libm_compat (__creal, creal) +#endif diff --git a/math/crealf.c b/math/crealf.c deleted file mode 100644 index 5883849..0000000 --- a/math/crealf.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Return real part of complex float value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -float -__crealf (float _Complex z) -{ - return __real__ z; -} -weak_alias (__crealf, crealf) diff --git a/math/creall.c b/math/creall.c deleted file mode 100644 index 4a31557..0000000 --- a/math/creall.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Return real part of complex long double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - -long double -__creall (long double _Complex z) -{ - return __real__ z; -} -weak_alias (__creall, creall) -- cgit v1.1