aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-04-12 18:03:48 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-04-14 15:37:53 -0500
commit50a23bc73af32aa6d0e10e0041c6cf57c0c81830 (patch)
treec500a815a9f794fa834d068ca149450a6fcd3b66
parentba1b2dec98f825c28c68747f66c020b9352e1480 (diff)
downloadglibc-50a23bc73af32aa6d0e10e0041c6cf57c0c81830.zip
glibc-50a23bc73af32aa6d0e10e0041c6cf57c0c81830.tar.gz
glibc-50a23bc73af32aa6d0e10e0041c6cf57c0c81830.tar.bz2
PowerPC: copysign/copysignf multilib for PowerPC
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile6
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-power6.S (renamed from sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S)28
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-ppc32.S12
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign.c55
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysignf.c1
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_copysign.S2
-rw-r--r--sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S1
7 files changed, 76 insertions, 29 deletions
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
index c9003e3..9fb2528 100644
--- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
@@ -2,7 +2,8 @@ ifeq ($(subdir),math)
sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 \
s_isnan-ppc32 \
s_isnanf-power7 s_isnanf-power6 s_isnanf-power5 \
- s_isnanf-ppc32
+ s_isnanf-ppc32 \
+ s_copysign-power6 s_copysign-ppc32
libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-c \
s_llrint-power6 s_llrint-power4 s_llrint-c \
@@ -13,7 +14,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-c \
s_isnan-power7 s_isnan-power6 s_isnan-power5 \
s_isnan-ppc32 \
s_isnanf-power7 s_isnanf-power6 s_isnanf-power5 \
- s_isnanf-ppc32
+ s_isnanf-ppc32 \
+ s_copysign-power6 s_copysign-ppc32
CFLAGS-s_llround.c = -fno-builtin-llroundf
endif
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-power6.S
index 1b8d73a..7aa28e1 100644
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-power6.S
@@ -27,32 +27,8 @@
.section ".text"
.type __copysign, @function
.machine power6
-EALIGN (__copysign, 4, 0)
+EALIGN (__copysign_power6, 4, 0)
CALL_MCOUNT
fcpsgn fp1,fp2,fp1
blr
-END (__copysign)
-
-hidden_def (__copysign)
-weak_alias (__copysign, copysign)
-
-/* It turns out that the 'double' version will also always work for
- single-precision. */
-strong_alias (__copysign, __copysignf)
-hidden_def (__copysignf)
-weak_alias (__copysignf, copysignf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__copysign, __copysignl)
-weak_alias (__copysign, copysignl)
-#endif
-
-#ifdef IS_IN_libm
-# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
-compat_symbol (libm, copysign, copysignl, GLIBC_2_0)
-# endif
-#else
-# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, copysign, copysignl, GLIBC_2_0);
-# endif
-#endif
+END (__copysign_power6)
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-ppc32.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-ppc32.S
new file mode 100644
index 0000000..c0b9f45
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign-ppc32.S
@@ -0,0 +1,12 @@
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+#undef compat_symbol
+#define compat_symbol(a, b, c, d)
+
+#define __copysign __copysign_ppc32
+#undef hidden_def
+#define hidden_def(name)
+ strong_alias (__copysign_ppc32, __GI___copysign)
+
+#include <sysdeps/powerpc/powerpc32/fpu/s_copysign.S>
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign.c
new file mode 100644
index 0000000..67a38e9
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysign.c
@@ -0,0 +1,55 @@
+/* Multiple versions of s_copysign.
+ Copyright (C) 2013 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 <math_ldbl_opt.h>
+#include <shlib-compat.h>
+#include "init-arch.h"
+
+extern __typeof (__copysign) __copysign_ppc32 attribute_hidden;
+extern __typeof (__copysign) __copysign_power6 attribute_hidden;
+
+libc_ifunc (__copysign,
+ (hwcap & PPC_FEATURE_ARCH_2_05)
+ ? __copysign_power6
+ : __copysign_ppc32);
+
+weak_alias (__copysign, copysign)
+
+/* It's safe to use double-precision implementation for single-precision.
+ The following assembly directives are basically doing:
+ weak_alias (__copysign,copysignf)
+ strong_alias(__copysign,__copysignf)
+ But the compiler will not let us do it in C because both __copysignf and
+ copysignf are already defined. */
+asm (".weak copysignf\n"
+ ".set copysignf, __copysign");
+asm (".globl __copysign\n"
+ "__copysign = __copysignf");
+
+#ifdef NO_LONG_DOUBLE
+weak_alias (__copysign,copysignl)
+strong_alias(__copysign,__copysignl)
+#endif
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysignf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysignf.c
new file mode 100644
index 0000000..2838458
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_copysignf.c
@@ -0,0 +1 @@
+/* copysignf() is in s_copysign.c */
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
index 840891f..9753cb6 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
@@ -43,8 +43,10 @@ L(0): fnabs fp1,fp1
weak_alias (__copysign,copysign)
/* It turns out that it's safe to use this code even for single-precision. */
+#ifndef __isnan
weak_alias (__copysign,copysignf)
strong_alias(__copysign,__copysignf)
+#endif
#ifdef NO_LONG_DOUBLE
weak_alias (__copysign,copysignl)
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S
deleted file mode 100644
index d4aa702..0000000
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_copysign.S. */