about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-04-11 17:20:44 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-04-12 07:23:33 -0500
commit6f1341ed0356611b936b34e65f660e2d8ff8843b (patch)
tree94b66821f222efe246ba092b7831a1f5d5618f7b
parent852da90a7c8d3d2333aff246ea52c58e8af58469 (diff)
downloadglibc-6f1341ed0356611b936b34e65f660e2d8ff8843b.tar.gz
glibc-6f1341ed0356611b936b34e65f660e2d8ff8843b.tar.xz
glibc-6f1341ed0356611b936b34e65f660e2d8ff8843b.zip
PowerPC: isnan/isnanf multilib for PowerPC32
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile11
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power5.S (renamed from sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S)20
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power6.S (renamed from sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S)20
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power7.S (renamed from sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S)25
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-ppc32.S9
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan.c46
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power5.S (renamed from sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S)8
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power6.S (renamed from sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S)7
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power7.S1
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-ppc32.S14
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf.c37
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_isnan.S2
-rw-r--r--sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S1
13 files changed, 132 insertions, 69 deletions
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
index 1eae5b31c9..c9003e36a6 100644
--- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
@@ -1,10 +1,19 @@
 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
+
 libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-c \
 			s_llrint-power6 s_llrint-power4 s_llrint-c \
 			s_llround-power6 s_llround-power5+ s_llround-power4 \
 			s_llround-c \
 			w_sqrt-power5 w_sqrt-power4 w_sqrt-c \
-			w_sqrtf-power5 w_sqrtf-power4 w_sqrtf-c
+			w_sqrtf-power5 w_sqrtf-power4 w_sqrtf-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
 
 CFLAGS-s_llround.c = -fno-builtin-llroundf
 endif
diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power5.S
index f2417fdf41..a42eaf216d 100644
--- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power5.S
@@ -21,7 +21,7 @@
 
 /* int __isnan(x)  */
 	.machine power5
-EALIGN (__isnan, 4, 0)
+EALIGN (__isnan_power5, 4, 0)
 	stwu	r1,-32(r1)
 	cfi_adjust_cfa_offset (32)
 	ori	r1,r1,0
@@ -42,20 +42,4 @@ EALIGN (__isnan, 4, 0)
 L(NaN):
 	li	r3,1		/* else return 1 */
 	blr
-	END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#ifndef IS_IN_libm
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
-
+END (__isnan_power5)
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power6.S
index 2c095db1d4..62f9c4b2a7 100644
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power6.S
@@ -21,7 +21,7 @@
 
 /* int __isnan(x)  */
 	.machine power6
-EALIGN (__isnan, 4, 0)
+EALIGN (__isnan_power6, 4, 0)
 	stwu	r1,-32(r1)
 	cfi_adjust_cfa_offset (32)
 	ori	r1,r1,0
@@ -42,20 +42,4 @@ EALIGN (__isnan, 4, 0)
 L(NaN):
 	li	r3,1		/* else return 1 */
 	blr
-	END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#ifndef IS_IN_libm
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
-
+END (__isnan_power6)
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power7.S
index 99ff126961..54cc998d6c 100644
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-power7.S
@@ -29,7 +29,7 @@
 	.section    ".text"
 	.type	    __isnan, @function
 	.machine    power7
-ENTRY (__isnan)
+ENTRY (__isnan_power7)
 #ifdef SHARED
 	mflr	r11
 	cfi_register(lr,r11)
@@ -66,25 +66,10 @@ ENTRY (__isnan)
 L(NaN):
 	li      r3,1	      /* x == NaN?  */
 	blr
-	END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
+END (__isnan_power7)
 
 /* It turns out that the 'double' version will also always work for
    single-precision.  */
-strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#ifndef IS_IN_libm
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
+strong_alias (__isnan_power7, __isnanf_power7)
+hidden_def (__isnanf_power7)
+weak_alias (__isnanf_power7, isnanf_power7)
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-ppc32.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-ppc32.S
new file mode 100644
index 0000000000..f844d10df6
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan-ppc32.S
@@ -0,0 +1,9 @@
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+#define __isnan __isnan_ppc32
+#undef hidden_def
+#define hidden_def(name)
+  strong_alias (__isnan_ppc32, __GI___isnan)
+
+#include <sysdeps/powerpc/powerpc32/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan.c
new file mode 100644
index 0000000000..aea00318ba
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnan.c
@@ -0,0 +1,46 @@
+/* Multiple versions of s_isnan.
+   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 (__isnan) __isnan_ppc32 attribute_hidden;
+extern __typeof (__isnan) __isnan_power5 attribute_hidden;
+extern __typeof (__isnan) __isnan_power6 attribute_hidden;
+extern __typeof (__isnan) __isnan_power7 attribute_hidden;
+
+libc_ifunc (__isnan,
+	    (hwcap & PPC_FEATURE_ARCH_2_06)
+	    ? __isnan_power7 :
+	      (hwcap & PPC_FEATURE_ARCH_2_05)
+	      ? __isnan_power6 :
+		(hwcap & PPC_FEATURE_POWER5)
+		? __isnan_power5
+            : __isnan_ppc32);
+
+weak_alias (__isnan, isnan)
+
+#ifdef NO_LONG_DOUBLE
+strong_alias (__isnan, __isnanl)
+weak_alias (__isnan, isnanl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __isnan, isnanl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power5.S
index 0373f0156c..cfdae7d4d1 100644
--- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power5.S
@@ -21,7 +21,7 @@
 
 /* int __isnanf(x)  */
 	.machine power5
-EALIGN (__isnanf, 4, 0)
+EALIGN (__isnanf_power5, 4, 0)
 	stwu	r1,-32(r1)
 	cfi_adjust_cfa_offset (32)
 	stfs	fp1,28(r1)	/* copy FPR to GPR */
@@ -38,8 +38,4 @@ EALIGN (__isnanf, 4, 0)
 L(NaN):
 	li	r3,1		/* else return 1 */
 	blr
-	END (__isnanf)
-
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
+END (__isnanf_power5)
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power6.S
index 483f0f9c0f..0890b350b0 100644
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power6.S
@@ -21,7 +21,7 @@
 
 /* int __isnanf(x)  */
 	.machine power6
-EALIGN (__isnanf, 4, 0)
+EALIGN (__isnanf_power6, 4, 0)
 	stwu	r1,-32(r1)
 	cfi_adjust_cfa_offset (32)
 	ori	r1,r1,0
@@ -38,7 +38,4 @@ EALIGN (__isnanf, 4, 0)
 L(NaN):
 	li	r3,1		/* else return 1 */
 	blr
-	END (__isnanf)
-
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
+END (__isnanf_power6)
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power7.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power7.S
new file mode 100644
index 0000000000..3fa2145b19
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-power7.S
@@ -0,0 +1 @@
+/* This function uses the same code as s_isnan-power7.S.  */
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-ppc32.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-ppc32.S
new file mode 100644
index 0000000000..d0db5ccfc1
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf-ppc32.S
@@ -0,0 +1,14 @@
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+#undef weak_alias
+#define weak_alias(a, b)
+#undef compat_symbol
+#define compat_symbol(a, b, c, d)
+
+#define __isnan __isnanf_ppc32
+#undef hidden_def
+#define hidden_def(name) \
+  strong_alias (__isnanf_ppc32, __GI___isnanf)
+
+#include <sysdeps/powerpc/powerpc32/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf.c
new file mode 100644
index 0000000000..21bca8d05d
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isnanf.c
@@ -0,0 +1,37 @@
+/* Multiple versions of s_isnanf.
+   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 <shlib-compat.h>
+#include "init-arch.h"
+
+extern __typeof (__isnanf) __isnanf_ppc32 attribute_hidden;
+extern __typeof (__isnanf) __isnanf_power5 attribute_hidden;
+extern __typeof (__isnanf) __isnanf_power6 attribute_hidden;
+extern __typeof (__isnanf) __isnanf_power7 attribute_hidden;
+
+libc_ifunc (__isnanf,
+	    (hwcap & PPC_FEATURE_ARCH_2_06)
+	    ? __isnanf_power7 :
+	      (hwcap & PPC_FEATURE_ARCH_2_05)
+	      ? __isnanf_power6 :
+		(hwcap & PPC_FEATURE_POWER5)
+		? __isnanf_power5
+            : __isnanf_ppc32);
+
+weak_alias (__isnanf, isnanf)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/s_isnan.S
index ac8b08856f..5a78b51acd 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_isnan.S
@@ -37,9 +37,11 @@ weak_alias (__isnan, isnan)
 
 /* It turns out that the 'double' version will also always work for
    single-precision.  */
+#ifndef __isnan
 strong_alias (__isnan, __isnanf)
 hidden_def (__isnanf)
 weak_alias (__isnanf, isnanf)
+#endif
 
 #ifdef NO_LONG_DOUBLE
 strong_alias (__isnan, __isnanl)
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S
deleted file mode 100644
index b48c85e0d3..0000000000
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_isnan.S.  */