From 522228ddeae7b5cfb76332f80d2c0dfdb7055d4c Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 13 Oct 2017 13:20:00 -0300 Subject: [PATCH] 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 --- ChangeLog | 10 +++++ sysdeps/sparc/sparc64/fpu/multiarch/Makefile | 3 +- .../sparc64/fpu/multiarch/s_lrint-generic.S | 6 +++ sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S | 17 -------- sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c | 39 +++++++++++++++++++ .../sparc64/fpu/multiarch/s_lrintf-generic.S | 6 +++ .../sparc/sparc64/fpu/multiarch/s_lrintf.S | 17 -------- .../sparc/sparc64/fpu/multiarch/s_lrintf.c | 39 +++++++++++++++++++ 8 files changed, 102 insertions(+), 35 deletions(-) create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S delete mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S delete mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c diff --git a/ChangeLog b/ChangeLog index 9a4b5c8377..d0e393a15d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2017-11-29 Adhemerval Zanella + * 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. diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile index 6062af0f43..d0a87d18f0 100644 --- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile +++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile @@ -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 \ diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S new file mode 100644 index 0000000000..e6ab999a66 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S @@ -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 diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S deleted file mode 100644 index 94af8f028c..0000000000 --- a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S +++ /dev/null @@ -1,17 +0,0 @@ -#include - -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" diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c new file mode 100644 index 0000000000..557f0d66cd --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c @@ -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 + . */ + +#define lrint __redirect_lrint +#define llrint __redirect_llrint +#define __lrint __redirect___lrint +#define __llrint __redirect___llrint +#include +#undef lrint +#undef llrint +#undef __lrint +#undef __llrint +#include + +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) diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S new file mode 100644 index 0000000000..4cfbf4ae72 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S @@ -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 diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S deleted file mode 100644 index e6ea4061c3..0000000000 --- a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S +++ /dev/null @@ -1,17 +0,0 @@ -#include - -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" diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c new file mode 100644 index 0000000000..9b1a569d01 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c @@ -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 + . */ + +#define lrintf __redirect_lrintf +#define llrintf __redirect_llrintf +#define __lrintf __redirect_lrintf +#define __llrintf __redirect_llrintf +#include +#undef lrintf +#undef llrintf +#undef __lrintf +#undef __llrintf +#include + +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)