sparc: refactor sparc64 lrint{f} selector to C

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

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

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_lrint-generic and s_lrint-generic
	objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
Adhemerval Zanella 2017-10-13 13:20:00 -03:00
parent 2a6f4fab24
commit 522228ddea
8 changed files with 102 additions and 35 deletions

View File

@ -1,5 +1,15 @@
2017-11-29 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
(libm-sysdep_routines): Add s_lrint-generic and s_lrintf-generic
objects.
* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S: New file.
* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S: Remove file.
* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
(libm-sysdep_routines): Add s_nearbyint-generic and
s_nearbyintf-generic objects.

View File

@ -9,7 +9,8 @@ sysdep_calls := s_signbitf-vis3 s_signbit-vis3 s_signbitf-generic \
s_isnanf-vis3 s_isnan-vis3 s_isnanf-generic s_isnan-generic
sysdep_routines += $(sysdep_calls)
libm-sysdep_routines += s_lrintf-vis3 s_lrint-vis3 s_rintf-vis3 s_rint-vis3 \
libm-sysdep_routines += s_lrintf-vis3 s_lrint-vis3 s_lrintf-generic \
s_lrint-generic s_rintf-vis3 s_rint-vis3 \
s_fmaf-vis3 s_fma-vis3 s_fmaf-generic s_fma-generic \
s_nearbyint-vis3 s_nearbyintf-vis3 \
s_nearbyint-generic s_nearbyintf-generic \

View File

@ -0,0 +1,6 @@
#define __lrint __lrint_generic
#undef weak_alias
#define weak_alias(a,b)
#undef strong_alias
#define strong_alias(a,b)
#include <sysdeps/sparc/sparc64/fpu/s_lrint.S>

View File

@ -1,17 +0,0 @@
#include <sparc-ifunc.h>
SPARC_ASM_VIS3_IFUNC(lrint)
weak_alias (__lrint, lrint)
strong_alias (__lrint, __llrint)
weak_alias (__llrint, llrint)
# undef weak_alias
# define weak_alias(a, b)
# undef strong_alias
# define strong_alias(a, b)
#define __lrint __lrint_generic
#include "../s_lrint.S"

View File

@ -0,0 +1,39 @@
/* lrint/llrint ifunc resolver, Linux/sparc64 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 lrint __redirect_lrint
#define llrint __redirect_llrint
#define __lrint __redirect___lrint
#define __llrint __redirect___llrint
#include <math.h>
#undef lrint
#undef llrint
#undef __lrint
#undef __llrint
#include <sparc-ifunc.h>
extern __typeof (__redirect_lrint) __lrint_vis3 attribute_hidden;
extern __typeof (__redirect_lrint) __lrint_generic attribute_hidden;
sparc_libm_ifunc_redirected (__redirect_lrint, __lrint,
hwcap & HWCAP_SPARC_VIS3
? __lrint_vis3
: __lrint_generic);
weak_alias (__lrint, lrint)
strong_alias (__lrint, __llrint)
weak_alias (__llrint, llrint)

View File

@ -0,0 +1,6 @@
#define __lrintf __lrintf_generic
#undef weak_alias
#define weak_alias(a,b)
#undef strong_alias
#define strong_alias(a,b)
#include <sysdeps/sparc/sparc64/fpu/s_lrintf.S>

View File

@ -1,17 +0,0 @@
#include <sparc-ifunc.h>
SPARC_ASM_VIS3_IFUNC(lrintf)
weak_alias (__lrintf, lrintf)
strong_alias (__lrintf, __llrintf)
weak_alias (__llrintf, llrintf)
# undef weak_alias
# define weak_alias(a, b)
# undef strong_alias
# define strong_alias(a, b)
#define __lrintf __lrintf_generic
#include "../s_lrintf.S"

View File

@ -0,0 +1,39 @@
/* lrintf/llrintf ifunc resolver, Linux/sparc64 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 lrintf __redirect_lrintf
#define llrintf __redirect_llrintf
#define __lrintf __redirect_lrintf
#define __llrintf __redirect_llrintf
#include <math.h>
#undef lrintf
#undef llrintf
#undef __lrintf
#undef __llrintf
#include <sparc-ifunc.h>
extern __typeof (__redirect_lrintf) __lrintf_vis3 attribute_hidden;
extern __typeof (__redirect_lrintf) __lrintf_generic attribute_hidden;
sparc_libm_ifunc_redirected (__redirect_lrintf, __lrintf,
hwcap & HWCAP_SPARC_VIS3
? __lrintf_vis3
: __lrintf_generic);
weak_alias (__lrintf, lrintf)
strong_alias (__lrintf, __llrintf)
weak_alias (__llrintf, llrintf)