Message ID | 1509044813-9951-12-git-send-email-adhemerval.zanella@linaro.org |
---|---|
State | New |
Headers | show |
Series | Refactor IFUNC selection in C | expand |
If no one opposes it, I will commit it shortly. On 26/10/2017 17:06, Adhemerval Zanella wrote: > 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> > --- > ChangeLog | 10 ++++++ > sysdeps/sparc/sparc64/fpu/multiarch/Makefile | 3 +- > .../sparc/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 ++++++++++++++++++++++ > .../sparc/sparc64/fpu/multiarch/s_lrintf-generic.S | 6 ++++ > sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S | 17 ---------- > sysdeps/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/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile > index 6062af0..d0a87d1 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 0000000..e6ab999 > --- /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 <sysdeps/sparc/sparc64/fpu/s_lrint.S> > 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 94af8f0..0000000 > --- a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S > +++ /dev/null > @@ -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" > 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 0000000..557f0d6 > --- /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 > + <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) > 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 0000000..4cfbf4a > --- /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 <sysdeps/sparc/sparc64/fpu/s_lrintf.S> > 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 e6ea406..0000000 > --- a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S > +++ /dev/null > @@ -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" > 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 0000000..9b1a569 > --- /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 > + <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) >
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile index 6062af0..d0a87d1 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 0000000..e6ab999 --- /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 <sysdeps/sparc/sparc64/fpu/s_lrint.S> 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 94af8f0..0000000 --- a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S +++ /dev/null @@ -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" 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 0000000..557f0d6 --- /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 + <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) 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 0000000..4cfbf4a --- /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 <sysdeps/sparc/sparc64/fpu/s_lrintf.S> 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 e6ea406..0000000 --- a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S +++ /dev/null @@ -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" 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 0000000..9b1a569 --- /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 + <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)
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> --- ChangeLog | 10 ++++++ sysdeps/sparc/sparc64/fpu/multiarch/Makefile | 3 +- .../sparc/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 ++++++++++++++++++++++ .../sparc/sparc64/fpu/multiarch/s_lrintf-generic.S | 6 ++++ sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S | 17 ---------- sysdeps/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 -- 2.7.4