about summary refs log tree commit diff
path: root/sysdeps/m68k/m680x0/fpu/s_sincos.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-11-30 22:39:07 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-11-30 22:39:07 +0000
commite53df1dee841a206bf376373eb4250ce4f277e4b (patch)
tree474412d9424304fd87148f53ebbd300e7e2184d8 /sysdeps/m68k/m680x0/fpu/s_sincos.c
parentc0535adfeb5aad46f622f040925889602a482f29 (diff)
downloadglibc-e53df1dee841a206bf376373eb4250ce4f277e4b.tar.gz
glibc-e53df1dee841a206bf376373eb4250ce4f277e4b.tar.xz
glibc-e53df1dee841a206bf376373eb4250ce4f277e4b.zip
Rework m68k libm functions to use declare_mgen_alias.
Many m68k libm functions use their own system to share code between
different types and functions, involving defining macros before
including code for another function (for example, s_atan.c also acts
as a template that can define other functions).

Thes files serving as templates generate function aliases directly
with e.g. "weak_alias (__CONCATX(__,FUNC), FUNC)" in s_atan.c.  To be
prepared to generate _Float32, _Float64 and _Float32x function
aliases, this needs changing so that the libm_alias_* macros get used
instead.  As the macro to use varies depending on the type, that would
mean additional macros to define in several different places to get
the appropriate alias-generation macro used in each case.

Rather than adding to the m68k-specific mechanisms, this patch
converts the functions in question to use something closer to the
math/ type-generic template mechanism.  After this patch, these
functions have m68k-specific templates such as s_atan_template.c, but
those templates use all the same macros as in the math/ templates,
such as FLOAT, M_DECL_FUNC, M_SUF and declare_mgen_alias.  There is no
automatic generation of the files such as s_atan.c that include the
appropriate math-type-macros-*.h header and the template file (the
existing automatic generation logic is only applicable for the fixed
set of templates listed in math/ - and sysdeps sources always override
files generated that way), so those files are still checked in, but
they are all the obvious two-line files (with one additional
definition in the case of the expm1 implementations), rather than
making e.g. s_atan.c special.

Functions are only converted where they should have aliases for
_FloatN / _FloatNx types.  Those m68k functions that do not generate
public names (those that only generate __ieee754_*, with wrappers
generating the public names, and classification functions that only
exist once per format not once per type so don't get aliases) are
unchanged.  However, log1p (public names generated by wrapper) and
significand (not provided for new types so no new aliases needed)
needed changing because they previously included the atan
implementations.  Now, s_significand.c is the main implementation for
functions with that prototype and using the old implementation
approach, while log1p includes it in place of atan.

Any further cleanups in this area (which preserve the proper set of
functions getting aliases defined by libm_alias_float and
libm_alias_double) are of course welcome, just not needed for the
goals of this patch.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by the patch.

	* sysdeps/m68k/m680x0/fpu/s_atan_template.c: New file.
	* sysdeps/m68k/m680x0/fpu/s_ceil_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_cos_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_expm1_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_fabs_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_floor_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_frexp_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_lrint_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_modf_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nearbyint_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_remquo_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_rint_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sin_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sincos_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tan_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanh_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_trunc_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_atan.c: Reimplement to use
	s_atan_template.c.
	* sysdeps/m68k/m680x0/fpu/s_atanf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_atanl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_ceil.c: Reimplement to use
	s_ceil_template.c.
	* sysdeps/m68k/m680x0/fpu/s_ceilf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_ceill.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_cos.c: Reimplement to use
	s_cos_template.c.
	* sysdeps/m68k/m680x0/fpu/s_cosf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_cosl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_expm1.c: Reimplement to use
	s_expm1_template.c.
	* sysdeps/m68k/m680x0/fpu/s_expm1f.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_expm1l.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_fabs.c: Reimplement to use
	s_fabs_template.c.
	* sysdeps/m68k/m680x0/fpu/s_fabsf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_fabsl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_floor.c: Reimplement to use
	s_floor_template.c.
	* sysdeps/m68k/m680x0/fpu/s_floorf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_floorl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_frexp.c: Reimplement to use
	s_frexp_template.c.
	* sysdeps/m68k/m680x0/fpu/s_frexpf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_lrint.c: Reimplement to use
	s_lrint_template.c.
	* sysdeps/m68k/m680x0/fpu/s_lrintf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_lrintl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_modf.c: Reimplement to use
	s_modf_template.c.
	* sysdeps/m68k/m680x0/fpu/s_modff.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_modfl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nearbyint.c: Reimplement to use
	s_nearbyint_template.c.
	* sysdeps/m68k/m680x0/fpu/s_nearbyintf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nearbyintl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_remquo.c: Reimplement to use
	s_remquo_template.c.
	* sysdeps/m68k/m680x0/fpu/s_remquof.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_remquol.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_rint.c: Reimplement to use
	s_rint_template.c.
	* sysdeps/m68k/m680x0/fpu/s_rintf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_rintl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sin.c: Reimplement to use
	s_sin_template.c.
	* sysdeps/m68k/m680x0/fpu/s_sinf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sinl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sincos.c: Reimplement to use
	s_sincos_template.c.
	* sysdeps/m68k/m680x0/fpu/s_sincosf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sincosl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tan.c: Reimplement to use
	s_tan_template.c.
	* sysdeps/m68k/m680x0/fpu/s_tanf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanh.c: Reimplement to use
	s_tanh_template.c.
	* sysdeps/m68k/m680x0/fpu/s_tanhf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanhl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_trunc.c: Reimplement to use
	s_trunc_template.c.
	* sysdeps/m68k/m680x0/fpu/s_truncf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_truncl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_significand.c: Reimplement based on
	s_atan.c instead of including s_atan.c.
	* sysdeps/m68k/m680x0/fpu/s_significandf.c: Reimplement based on
	s_atanf.c instead of including s_atanf.c.
	* sysdeps/m68k/m680x0/fpu/s_significandl.c: Reimplement based on
	s_atanl.c instead of including s_atanl.c.
	* sysdeps/m68k/m680x0/fpu/s_log1p.c: Include s_significand.c
	instead of s_atan.c.
	* sysdeps/m68k/m680x0/fpu/s_log1pf.c: Include s_significandf.c
	instead of s_atanf.c.
	* sysdeps/m68k/m680x0/fpu/s_log1pl.c: Include s_significandl.c
	instead of s_atanl.c.
Diffstat (limited to 'sysdeps/m68k/m680x0/fpu/s_sincos.c')
-rw-r--r--sysdeps/m68k/m680x0/fpu/s_sincos.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/sysdeps/m68k/m680x0/fpu/s_sincos.c b/sysdeps/m68k/m680x0/fpu/s_sincos.c
index ca93d93333..9226798fd7 100644
--- a/sysdeps/m68k/m680x0/fpu/s_sincos.c
+++ b/sysdeps/m68k/m680x0/fpu/s_sincos.c
@@ -1,34 +1,2 @@
-/* Copyright (C) 1997-2017 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 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
-   <http://www.gnu.org/licenses/>.  */
-
-#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) (float_type x, float_type *sinx, float_type *cosx)
-{
-  __m81_u(CONCATX(__,FUNC))(x, sinx, cosx);
-}
-weak_alias (CONCATX(__,FUNC), FUNC)
+#include <math-type-macros-double.h>
+#include <s_sincos_template.c>