diff mbox series

[08/25] sparc: refactor sparc64 isinf{f} selector to C

Message ID 1509044813-9951-9-git-send-email-adhemerval.zanella@linaro.org
State New
Headers show
Series Refactor IFUNC selection in C | expand

Commit Message

Adhemerval Zanella Netto Oct. 26, 2017, 7:06 p.m. UTC
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_isinf{f}-generic.S).

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

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
	Add isinff-generic and s_isinf-generic objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

---
 ChangeLog                                          |  9 ++++++
 sysdeps/sparc/sparc64/fpu/multiarch/Makefile       |  4 +--
 .../sparc/sparc64/fpu/multiarch/s_isinf-generic.S  |  6 ++++
 sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S      | 15 ---------
 sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c      | 37 ++++++++++++++++++++++
 .../sparc/sparc64/fpu/multiarch/s_isinff-generic.S |  6 ++++
 sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S     | 15 ---------
 sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c     | 33 +++++++++++++++++++
 8 files changed, 93 insertions(+), 32 deletions(-)
 create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S
 delete mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S
 create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c
 create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S
 delete mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S
 create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c

-- 
2.7.4

Comments

Adhemerval Zanella Netto Nov. 29, 2017, 1:40 p.m. UTC | #1
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_isinf{f}-generic.S).

> 

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

> 

> 	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):

> 	Add isinff-generic and s_isinf-generic objects.

> 	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S: New file.

> 	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c: Likewise.

> 	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S: Likewise.

> 	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c: Likewise.

> 	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S: Remove file.

> 	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S: Likewise.

> 

> Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---

>  ChangeLog                                          |  9 ++++++

>  sysdeps/sparc/sparc64/fpu/multiarch/Makefile       |  4 +--

>  .../sparc/sparc64/fpu/multiarch/s_isinf-generic.S  |  6 ++++

>  sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S      | 15 ---------

>  sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c      | 37 ++++++++++++++++++++++

>  .../sparc/sparc64/fpu/multiarch/s_isinff-generic.S |  6 ++++

>  sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S     | 15 ---------

>  sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c     | 33 +++++++++++++++++++

>  8 files changed, 93 insertions(+), 32 deletions(-)

>  create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S

>  delete mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S

>  create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c

>  create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S

>  delete mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S

>  create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c

> 

> diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile

> index a46773b..f0c8fa3 100644

> --- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile

> +++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile

> @@ -3,8 +3,8 @@ ifeq ($(subdir),math)

>  # by printf.  While the libc objects have the prefix s_, the libm ones are

>  # prefixed with  m_.

>  sysdep_calls := s_signbitf-vis3 s_signbit-vis3 s_signbitf-generic \

> -		s_signbit-generic s_finitef-vis3 \

> -		s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \

> +		s_signbit-generic s_finitef-vis3 s_finite-vis3 \

> +		s_isinff-vis3 s_isinf-vis3 s_isinff-generic s_isinf-generic \

>  		s_isnanf-vis3 s_isnan-vis3 s_isnanf-generic s_isnan-generic

>  

>  sysdep_routines += $(sysdep_calls)

> diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S

> new file mode 100644

> index 0000000..ebaf054

> --- /dev/null

> +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S

> @@ -0,0 +1,6 @@

> +#define __isinf __isinf_generic

> +#undef hidden_def

> +#define hidden_def(a)

> +#undef weak_alias

> +#define weak_alias(a,b)

> +#include <./sysdeps/sparc/sparc64/fpu/s_isinf.S>

> diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S

> deleted file mode 100644

> index ed9b626..0000000

> --- a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S

> +++ /dev/null

> @@ -1,15 +0,0 @@

> -#include <sparc-ifunc.h>

> -

> -SPARC_ASM_VIS3_IFUNC(isinf)

> -

> -hidden_def (__isinf)

> -weak_alias (__isinf, isinf)

> -

> -# undef weak_alias

> -# define weak_alias(a, b)

> -# undef hidden_def

> -# define hidden_def(a)

> -

> -#define __isinf __isinf_generic

> -

> -#include "../s_isinf.S"

> diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c

> new file mode 100644

> index 0000000..d7fec22

> --- /dev/null

> +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c

> @@ -0,0 +1,37 @@

> +/* isinf 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 __isinf __redirect___isinf

> +#define __isinff __redirect___isinff

> +#define __isinfl __redirect___isinfl

> +#include <math.h>

> +#undef __isinf

> +#undef __isinff

> +#undef __isinfl

> +#include <sparc-ifunc.h>

> +

> +extern __typeof (isinf) __isinf_vis3 attribute_hidden;

> +extern __typeof (isinf) __isinf_generic attribute_hidden;

> +

> +sparc_libm_ifunc_redirected (__redirect___isinf, __isinf,

> +			     hwcap & HWCAP_SPARC_VIS3

> +			     ? __isinf_vis3

> +			     : __isinf_generic)

> +

> +sparc_ifunc_redirected_hidden_def (__redirect___isinf, __isinf)

> +weak_alias (__isinf, isinf)

> diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S

> new file mode 100644

> index 0000000..d37243f

> --- /dev/null

> +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S

> @@ -0,0 +1,6 @@

> +#define __isinff __isinff_generic

> +#undef hidden_def

> +#define hidden_def(a)

> +#undef weak_alias

> +#define weak_alias(a,b)

> +#include <sysdeps/sparc/sparc64/fpu/s_isinff.S>

> diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S

> deleted file mode 100644

> index 0451739..0000000

> --- a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S

> +++ /dev/null

> @@ -1,15 +0,0 @@

> -#include <sparc-ifunc.h>

> -

> -SPARC_ASM_VIS3_IFUNC(isinff)

> -

> -hidden_def (__isinff)

> -weak_alias (__isinff, isinff)

> -

> -# undef weak_alias

> -# define weak_alias(a, b)

> -# undef hidden_def

> -# define hidden_def(a)

> -

> -#define __isinff __isinff_generic

> -

> -#include "../s_isinff.S"

> diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c

> new file mode 100644

> index 0000000..31c67f3

> --- /dev/null

> +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c

> @@ -0,0 +1,33 @@

> +/* isinff 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 __isinff __redirect___isinff

> +#include <math.h>

> +#undef __isinff

> +#include <sparc-ifunc.h>

> +

> +extern __typeof (isinff) __isinff_vis3 attribute_hidden;

> +extern __typeof (isinff) __isinff_generic attribute_hidden;

> +

> +sparc_libm_ifunc_redirected (__redirect___isinff, __isinff,

> +			     hwcap & HWCAP_SPARC_VIS3

> +			     ? __isinff_vis3

> +			     : __isinff_generic);

> +

> +sparc_ifunc_redirected_hidden_def (__redirect___isinff, __isinff)

> +weak_alias (__isinff, isinff)

>
diff mbox series

Patch

diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index a46773b..f0c8fa3 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -3,8 +3,8 @@  ifeq ($(subdir),math)
 # by printf.  While the libc objects have the prefix s_, the libm ones are
 # prefixed with  m_.
 sysdep_calls := s_signbitf-vis3 s_signbit-vis3 s_signbitf-generic \
-		s_signbit-generic s_finitef-vis3 \
-		s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \
+		s_signbit-generic s_finitef-vis3 s_finite-vis3 \
+		s_isinff-vis3 s_isinf-vis3 s_isinff-generic s_isinf-generic \
 		s_isnanf-vis3 s_isnan-vis3 s_isnanf-generic s_isnan-generic
 
 sysdep_routines += $(sysdep_calls)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S
new file mode 100644
index 0000000..ebaf054
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S
@@ -0,0 +1,6 @@ 
+#define __isinf __isinf_generic
+#undef hidden_def
+#define hidden_def(a)
+#undef weak_alias
+#define weak_alias(a,b)
+#include <./sysdeps/sparc/sparc64/fpu/s_isinf.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S
deleted file mode 100644
index ed9b626..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S
+++ /dev/null
@@ -1,15 +0,0 @@ 
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(isinf)
-
-hidden_def (__isinf)
-weak_alias (__isinf, isinf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef hidden_def
-# define hidden_def(a)
-
-#define __isinf __isinf_generic
-
-#include "../s_isinf.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c
new file mode 100644
index 0000000..d7fec22
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c
@@ -0,0 +1,37 @@ 
+/* isinf 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 __isinf __redirect___isinf
+#define __isinff __redirect___isinff
+#define __isinfl __redirect___isinfl
+#include <math.h>
+#undef __isinf
+#undef __isinff
+#undef __isinfl
+#include <sparc-ifunc.h>
+
+extern __typeof (isinf) __isinf_vis3 attribute_hidden;
+extern __typeof (isinf) __isinf_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect___isinf, __isinf,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __isinf_vis3
+			     : __isinf_generic)
+
+sparc_ifunc_redirected_hidden_def (__redirect___isinf, __isinf)
+weak_alias (__isinf, isinf)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S
new file mode 100644
index 0000000..d37243f
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S
@@ -0,0 +1,6 @@ 
+#define __isinff __isinff_generic
+#undef hidden_def
+#define hidden_def(a)
+#undef weak_alias
+#define weak_alias(a,b)
+#include <sysdeps/sparc/sparc64/fpu/s_isinff.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S
deleted file mode 100644
index 0451739..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S
+++ /dev/null
@@ -1,15 +0,0 @@ 
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(isinff)
-
-hidden_def (__isinff)
-weak_alias (__isinff, isinff)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef hidden_def
-# define hidden_def(a)
-
-#define __isinff __isinff_generic
-
-#include "../s_isinff.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c
new file mode 100644
index 0000000..31c67f3
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c
@@ -0,0 +1,33 @@ 
+/* isinff 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 __isinff __redirect___isinff
+#include <math.h>
+#undef __isinff
+#include <sparc-ifunc.h>
+
+extern __typeof (isinff) __isinff_vis3 attribute_hidden;
+extern __typeof (isinff) __isinff_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect___isinff, __isinff,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __isinff_vis3
+			     : __isinff_generic);
+
+sparc_ifunc_redirected_hidden_def (__redirect___isinff, __isinff)
+weak_alias (__isinff, isinff)