sparc: refactor sparc32 copysign selector to C

This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_copysign{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(sysdep_calls): New rule.
	(sysdep_routines): Use sysdep_calls as base.
	(libm-sysdep_routines): Add generic rule for symbols shared with
	libc.  Add s_copysign-generic and s_copysign-generic objects.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S:
	New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
Adhemerval Zanella 2017-10-13 15:34:33 -03:00
parent d985adae22
commit 5b4e5e7869
8 changed files with 107 additions and 36 deletions

View File

@ -1,3 +1,19 @@
2017-12-01 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
(sysdep_calls): New rule.
(sysdep_routines): Use sysdep_calls as base.
(libm-sysdep_routines): Add generic rule for symbols shared with
libc. Add s_copysign-generic and s_copysign-generic objects.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S:
New file.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S:
Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S: Remove file.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: Likewise.
2017-12-01 Mike FABIAN <mfabian@redhat.com>
[BZ #22519]

View File

@ -1,12 +1,19 @@
ifeq ($(subdir),math)
libm-sysdep_routines += m_copysignf-vis3 m_copysign-vis3 s_fabs-vis3 \
s_fabsf-vis3 s_llrintf-vis3 s_llrint-vis3 \
# These functions are built both for libc and libm because they're required
# by printf. While the libc objects have the prefix s_, the libm ones are
# prefixed with m_.
sysdep_calls := s_copysignf-vis3 s_copysign-vis3 s_copysignf-generic \
s_copysign-generic
sysdep_routines += $(sysdep_calls)
libm-sysdep_routines += s_fabs-vis3 s_fabsf-vis3 s_llrintf-vis3 s_llrint-vis3 \
s_rintf-vis3 s_rint-vis3 \
s_fmaf-vis3 s_fma-vis3 s_fma-generic s_fmaf-generic \
s_nearbyint-vis3 s_nearbyintf-vis3 \
s_fdimf-vis3 s_fdim-vis3 s_fdim-generic \
s_fdimf-generic
sysdep_routines += s_copysignf-vis3 s_copysign-vis3
s_fdimf-generic \
$(sysdep_calls:s_%=m_%)
CFLAGS-s_fdimf-vis3.c += -Wa,-Av9d -mvis3
CFLAGS-s_fdim-vis3.c += -Wa,-Av9d -mvis3

View File

@ -0,0 +1,8 @@
#include <math_ldbl_opt.h>
#include <libm-alias-double.h>
#define __copysign __copysign_generic
#undef libm_alias_double
#define libm_alias_double(a, b)
#undef compat_symbol
#define compat_symbol(a, b, c, d)
#include <sysdeps/sparc/sparc32/fpu/s_copysign.S>

View File

@ -1,19 +0,0 @@
#include <sparc-ifunc.h>
#include <math_ldbl_opt.h>
#include <libm-alias-double.h>
SPARC_ASM_VIS3_IFUNC(copysign)
libm_alias_double (__copysign, copysign)
#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
#endif
# undef weak_alias
# define weak_alias(a, b)
# undef compat_symbol
# define compat_symbol(a, b, c, d)
#define __copysign __copysign_generic
#include "../../../fpu/s_copysign.S"

View File

@ -0,0 +1,37 @@
/* copysign ifunc resolver, Linux/sparc32 version.
Copyright (C) 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/>. */
#define __copysign __redirect_copysign
#include <math.h>
#undef __copysign
#include <math_ldbl_opt.h>
#include <libm-alias-double.h>
#include <sparc-ifunc.h>
extern __typeof (__redirect_copysign) __copysign_vis3 attribute_hidden;
extern __typeof (__redirect_copysign) __copysign_generic attribute_hidden;
sparc_libm_ifunc_redirected (__redirect_copysign, __copysign,
hwcap & HWCAP_SPARC_VIS3
? __copysign_vis3
: __copysign_generic);
libm_alias_double (__copysign, copysign)
#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
#endif

View File

@ -0,0 +1,5 @@
#include <libm-alias-float.h>
#define __copysignf __copysignf_generic
#undef libm_alias_float
#define libm_alias_float(a, b)
#include <sysdeps/sparc/sparc32/fpu/s_copysignf.S>

View File

@ -1,13 +0,0 @@
#include <sparc-ifunc.h>
#include <libm-alias-float.h>
SPARC_ASM_VIS3_IFUNC(copysignf)
libm_alias_float (__copysign, copysign)
# undef weak_alias
# define weak_alias(a, b)
#define __copysignf __copysignf_generic
#include "../../../fpu/s_copysignf.S"

View File

@ -0,0 +1,30 @@
/* copysign ifunc resolver, Linux/sparc32 version.
Copyright (C) 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>
#include <sparc-ifunc.h>
#include <libm-alias-float.h>
extern __typeof (copysignf) __copysignf_vis3 attribute_hidden;
extern __typeof (copysignf) __copysignf_generic attribute_hidden;
sparc_libm_ifunc (__copysignf,
hwcap & HWCAP_SPARC_VIS3
? __copysignf_vis3
: __copysignf_generic);
libm_alias_float (__copysign, copysign)