]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
sparc: refactor sparc32 copysign selector to C
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 13 Oct 2017 18:34:33 +0000 (15:34 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 1 Dec 2017 13:48:39 +0000 (11:48 -0200)
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/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S:
New file.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S:
Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S: Remove file.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
ChangeLog
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S [new file with mode: 0644]
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S [deleted file]
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c [new file with mode: 0644]
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S [new file with mode: 0644]
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S [deleted file]
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c [new file with mode: 0644]

index 7764ab20d7222269f71ecba7344a1ac8aeee1d3e..39e8bcb5813c176a5ea8234d4b5f69305d409ed7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2017-12-01  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       * 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/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S:
+       New file.
+       * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Likewise.
+       * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S:
+       Likewise.
+       * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c: Likewise.
+       * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S: Remove file.
+       * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: Likewise.
+
 2017-12-01  Mike FABIAN  <mfabian@redhat.com>
 
        [BZ #22519]
index 62bf6f1431c427311874da0d3c63c0cb9d745fa5..b8d112610423033f78ecfd4590ac6f775729e35a 100644 (file)
@@ -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 (file)
index 0000000..9aa3486
--- /dev/null
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+#include <libm-alias-double.h>
+#define __copysign __copysign_generic
+#undef libm_alias_double
+#define libm_alias_double(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 (file)
index affe541..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <sparc-ifunc.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
-SPARC_ASM_VIS3_IFUNC(copysign)
-
-libm_alias_double (__copysign, copysign)
-#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 (file)
index 0000000..947ecc5
--- /dev/null
@@ -0,0 +1,37 @@
+/* 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>
+#undef __copysign
+#include <math_ldbl_opt.h>
+#include <libm-alias-double.h>
+#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);
+libm_alias_double (__copysign, copysign)
+
+#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 (file)
index 0000000..6850275
--- /dev/null
@@ -0,0 +1,5 @@
+#include <libm-alias-float.h>
+#define __copysignf __copysignf_generic
+#undef libm_alias_float
+#define libm_alias_float(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 (file)
index ebb32c7..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sparc-ifunc.h>
-#include <libm-alias-float.h>
-
-SPARC_ASM_VIS3_IFUNC(copysignf)
-
-libm_alias_float (__copysign, copysign)
-
-# 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 (file)
index 0000000..26cad31
--- /dev/null
@@ -0,0 +1,30 @@
+/* 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/>.  */
+
+#include <math.h>
+#include <sparc-ifunc.h>
+#include <libm-alias-float.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);
+libm_alias_float (__copysign, copysign)