diff mbox series

[18/25] sparc: refactor sparc32 copysign selector to C

Message ID 1509044813-9951-19-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 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/sparcv9/fpu/multiarch/s_copysign-generic.S: New
	file.
	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Likewise.
	* sysdeps/sparc/sparcv9/fpu/multiarch/s_copysignf-generic.S:
	Likewise.
	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysignf.c: Likewise.
	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysign.S: Remove file.
	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: Likewise.

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

---
 ChangeLog                                          | 14 ++++++++
 .../sparc/sparc32/sparcv9/fpu/multiarch/Makefile   | 15 ++++++---
 .../sparcv9/fpu/multiarch/s_copysign-generic.S     |  8 +++++
 .../sparc32/sparcv9/fpu/multiarch/s_copysign.S     | 21 ------------
 .../sparc32/sparcv9/fpu/multiarch/s_copysign.c     | 38 ++++++++++++++++++++++
 .../sparcv9/fpu/multiarch/s_copysignf-generic.S    |  4 +++
 .../sparc32/sparcv9/fpu/multiarch/s_copysignf.S    | 12 -------
 .../sparc32/sparcv9/fpu/multiarch/s_copysignf.c    | 11 +++++++
 8 files changed, 86 insertions(+), 37 deletions(-)
 create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S
 delete mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S
 create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c
 create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S
 delete mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S
 create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c

-- 
2.7.4

Comments

Adhemerval Zanella Netto Nov. 30, 2017, 8:33 p.m. UTC | #1
If no one opposes it, I will commit it shortly.  I had to adjust to use
Joseph recent changes to use libc_alias_{float,double}.

On 26/10/2017 17:06, Adhemerval Zanella wrote:
> 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/sparcv9/fpu/multiarch/s_copysign-generic.S: New

> 	file.

> 	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Likewise.

> 	* sysdeps/sparc/sparcv9/fpu/multiarch/s_copysignf-generic.S:

> 	Likewise.

> 	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysignf.c: Likewise.

> 	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysign.S: Remove file.

> 	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: Likewise.

> 

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

> ---

>  ChangeLog                                          | 14 ++++++++

>  .../sparc/sparc32/sparcv9/fpu/multiarch/Makefile   | 15 ++++++---

>  .../sparcv9/fpu/multiarch/s_copysign-generic.S     |  8 +++++

>  .../sparc32/sparcv9/fpu/multiarch/s_copysign.S     | 21 ------------

>  .../sparc32/sparcv9/fpu/multiarch/s_copysign.c     | 38 ++++++++++++++++++++++

>  .../sparcv9/fpu/multiarch/s_copysignf-generic.S    |  4 +++

>  .../sparc32/sparcv9/fpu/multiarch/s_copysignf.S    | 12 -------

>  .../sparc32/sparcv9/fpu/multiarch/s_copysignf.c    | 11 +++++++

>  8 files changed, 86 insertions(+), 37 deletions(-)

>  create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S

>  delete mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S

>  create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c

>  create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S

>  delete mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S

>  create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c

> 

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

> index 62bf6f1..b8d1126 100644

> --- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile

> +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile

> @@ -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

> diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S

> new file mode 100644

> index 0000000..55fb0ed

> --- /dev/null

> +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S

> @@ -0,0 +1,8 @@

> +#include <math_ldbl_opt.h>

> +

> +#define __copysign __copysign_generic

> +#undef weak_alias

> +#define weak_alias(a, b)

> +#undef compat_symbol

> +#define compat_symbol(a, b, c, d)

> +#include <sysdeps/sparc/sparc32/fpu/s_copysign.S>

> diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S

> deleted file mode 100644

> index 5d26430..0000000

> --- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S

> +++ /dev/null

> @@ -1,21 +0,0 @@

> -#include <sparc-ifunc.h>

> -#include <math_ldbl_opt.h>

> -

> -SPARC_ASM_VIS3_IFUNC(copysign)

> -

> -weak_alias (__copysign, copysign)

> -#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)

> -compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);

> -#endif

> -#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"

> diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c

> new file mode 100644

> index 0000000..f11181b

> --- /dev/null

> +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c

> @@ -0,0 +1,38 @@

> +/* 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>

> +#include <math_ldbl_opt.h>

> +#undef __copysign

> +#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);

> +weak_alias (__copysign, copysign)

> +#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)

> +compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);

> +#endif

> +#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)

> +compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);

> +#endif

> diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S

> new file mode 100644

> index 0000000..ebe0759

> --- /dev/null

> +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S

> @@ -0,0 +1,4 @@

> +#define __copysignf __copysignf_generic

> +#undef weak_alias

> +#define weak_alias(a, b)

> +#include <sysdeps/sparc/sparc32/fpu/s_copysignf.S>

> diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S

> deleted file mode 100644

> index cd40955..0000000

> --- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S

> +++ /dev/null

> @@ -1,12 +0,0 @@

> -#include <sparc-ifunc.h>

> -

> -SPARC_ASM_VIS3_IFUNC(copysignf)

> -

> -weak_alias (__copysignf, copysignf)

> -

> -# undef weak_alias

> -# define weak_alias(a, b)

> -

> -#define __copysignf __copysignf_generic

> -

> -#include "../../../fpu/s_copysignf.S"

> diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c

> new file mode 100644

> index 0000000..573c14d

> --- /dev/null

> +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c

> @@ -0,0 +1,11 @@

> +#include <math.h>

> +#include <sparc-ifunc.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);

> +weak_alias (__copysignf, copysignf)

>
Joseph Myers Dec. 1, 2017, 5:13 p.m. UTC | #2
I'm seeing a build failure for sparcv9-linux-gnu.

https://sourceware.org/ml/libc-testresults/2017-q4/msg00399.html

../sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c:33:32: error: 'copysign' aliased to external symbol '__copysign'
 libm_alias_double (__copysign, copysign)
                                ^
./../include/libc-symbols.h:146:26: note: in definition of macro '_weak_alias'
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
                          ^~~~~~~~~
../sysdeps/ieee754/ldbl-opt/libm-alias-double.h:44:3: note: in expansion of macro 'weak_alias'
   weak_alias (from ## r, to ## r);    \
   ^~~~~~~~~~
../sysdeps/ieee754/ldbl-opt/libm-alias-double.h:53:37: note: in expansion of macro 'libm_alias_double_r'
 #define libm_alias_double(from, to) libm_alias_double_r (from, to, )
                                     ^~~~~~~~~~~~~~~~~~~
../sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c:33:1: note: in expansion of macro 'libm_alias_double'
 libm_alias_double (__copysign, copysign)
 ^~~~~~~~~~~~~~~~~
/scratch/jmyers/glibc-bot/build/glibcs/sparcv9-linux-gnu/glibc/sysd-rules:67: recipe for target '/scratch/jmyers/glibc-bot/build/glibcs/sparcv9-linux-gnu/glibc/math/s_copysign.os' failed
make[3]: *** [/scratch/jmyers/glibc-bot/build/glibcs/sparcv9-linux-gnu/glibc/math/s_copysign.os] Error 1

-- 
Joseph S. Myers
joseph@codesourcery.com
Adhemerval Zanella Netto Dec. 1, 2017, 5:47 p.m. UTC | #3
On 01/12/2017 15:13, Joseph Myers wrote:
> I'm seeing a build failure for sparcv9-linux-gnu.

> 

> https://sourceware.org/ml/libc-testresults/2017-q4/msg00399.html

> 

> ../sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c:33:32: error: 'copysign' aliased to external symbol '__copysign'

>  libm_alias_double (__copysign, copysign)

>                                 ^

> ./../include/libc-symbols.h:146:26: note: in definition of macro '_weak_alias'

>    extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));

>                           ^~~~~~~~~

> ../sysdeps/ieee754/ldbl-opt/libm-alias-double.h:44:3: note: in expansion of macro 'weak_alias'

>    weak_alias (from ## r, to ## r);    \

>    ^~~~~~~~~~

> ../sysdeps/ieee754/ldbl-opt/libm-alias-double.h:53:37: note: in expansion of macro 'libm_alias_double_r'

>  #define libm_alias_double(from, to) libm_alias_double_r (from, to, )

>                                      ^~~~~~~~~~~~~~~~~~~

> ../sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c:33:1: note: in expansion of macro 'libm_alias_double'

>  libm_alias_double (__copysign, copysign)

>  ^~~~~~~~~~~~~~~~~

> /scratch/jmyers/glibc-bot/build/glibcs/sparcv9-linux-gnu/glibc/sysd-rules:67: recipe for target '/scratch/jmyers/glibc-bot/build/glibcs/sparcv9-linux-gnu/glibc/math/s_copysign.os' failed

> make[3]: *** [/scratch/jmyers/glibc-bot/build/glibcs/sparcv9-linux-gnu/glibc/math/s_copysign.os] Error 1

> 


It should be fixed now, sorry for the trouble.
diff mbox series

Patch

diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
index 62bf6f1..b8d1126 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -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
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S
new file mode 100644
index 0000000..55fb0ed
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S
@@ -0,0 +1,8 @@ 
+#include <math_ldbl_opt.h>
+
+#define __copysign __copysign_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#undef compat_symbol
+#define compat_symbol(a, b, c, d)
+#include <sysdeps/sparc/sparc32/fpu/s_copysign.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S
deleted file mode 100644
index 5d26430..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S
+++ /dev/null
@@ -1,21 +0,0 @@ 
-#include <sparc-ifunc.h>
-#include <math_ldbl_opt.h>
-
-SPARC_ASM_VIS3_IFUNC(copysign)
-
-weak_alias (__copysign, copysign)
-#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
-compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);
-#endif
-#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"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c
new file mode 100644
index 0000000..f11181b
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c
@@ -0,0 +1,38 @@ 
+/* 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>
+#include <math_ldbl_opt.h>
+#undef __copysign
+#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);
+weak_alias (__copysign, copysign)
+#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);
+#endif
+#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S
new file mode 100644
index 0000000..ebe0759
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S
@@ -0,0 +1,4 @@ 
+#define __copysignf __copysignf_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#include <sysdeps/sparc/sparc32/fpu/s_copysignf.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S
deleted file mode 100644
index cd40955..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S
+++ /dev/null
@@ -1,12 +0,0 @@ 
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(copysignf)
-
-weak_alias (__copysignf, copysignf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __copysignf __copysignf_generic
-
-#include "../../../fpu/s_copysignf.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c
new file mode 100644
index 0000000..573c14d
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c
@@ -0,0 +1,11 @@ 
+#include <math.h>
+#include <sparc-ifunc.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);
+weak_alias (__copysignf, copysignf)