about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-04-09 13:36:56 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-04-12 07:21:34 -0500
commit4fc34c6e2f2abb08d56ebb7ce4860e1d337e0e84 (patch)
treec9cc15fc36279adece58aca0f79b27ca52a21aab
parentc5284ce8beced3b02c420fc467da6bd62de7988e (diff)
downloadglibc-4fc34c6e2f2abb08d56ebb7ce4860e1d337e0e84.tar.gz
glibc-4fc34c6e2f2abb08d56ebb7ce4860e1d337e0e84.tar.xz
glibc-4fc34c6e2f2abb08d56ebb7ce4860e1d337e0e84.zip
PowerPC: llrint/llrintf multilib for PowerPC32
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile4
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-c.c13
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S (renamed from sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S)17
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S (renamed from sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S)17
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c43
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-c.c3
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S (renamed from sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S)10
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S (renamed from sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S)10
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c34
9 files changed, 113 insertions, 38 deletions
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
new file mode 100644
index 0000000000..4c63e5d810
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
@@ -0,0 +1,4 @@
+ifeq ($(subdir),math)
+libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-c \
+			s_llrint-power6 s_llrint-power4 s_llrint-c
+endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-c.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-c.c
new file mode 100644
index 0000000000..a83db3f1e5
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-c.c
@@ -0,0 +1,13 @@
+#include <math_ldbl_opt.h>
+
+#undef __llrint
+#define __llrint __llrint_ppc32
+
+#undef weak_alias
+#define weak_alias(a, b)
+#undef strong_alias
+#define strong_alias(a, b)
+#undef compat_symbol
+#define compat_symbol(a, b, c, d)
+
+#include <sysdeps/powerpc/powerpc32/fpu/s_llrint.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S
index 2ac986db8b..5dcefc0b4f 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S
@@ -20,7 +20,8 @@
 #include <math_ldbl_opt.h>
 
 /* long long int[r3, r4] __llrint (double x[fp1])  */
-ENTRY (__llrint)	
+	.machine power4
+ENTRY (__llrint_power4)
 	CALL_MCOUNT
 	stwu	r1,-16(r1)
 	cfi_adjust_cfa_offset (16)
@@ -31,16 +32,6 @@ ENTRY (__llrint)
 	nop
 	lwz	r3,8(r1)
 	lwz	r4,12(r1)
-	addi	r1,r1,16	
+	addi	r1,r1,16
 	blr
-	END (__llrint)
-
-weak_alias (__llrint, llrint)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__llrint, __llrintl)
-weak_alias (__llrint, llrintl)
-#endif
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __llrint, llrintl, GLIBC_2_1)
-#endif
+END (__llrint_power4)
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S
index 86f51bb4f7..3fc9b0f8df 100644
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S
@@ -20,7 +20,8 @@
 #include <math_ldbl_opt.h>
 
 /* long long int[r3, r4] __llrint (double x[fp1])  */
-ENTRY (__llrint)	
+	.machine power6
+ENTRY (__llrint_power6)
 	CALL_MCOUNT
 	stwu	r1,-16(r1)
 	cfi_adjust_cfa_offset (16)
@@ -31,16 +32,6 @@ ENTRY (__llrint)
 	ori	r1,r1,0
 	lwz	r3,8(r1)
 	lwz	r4,12(r1)
-	addi	r1,r1,16	
+	addi	r1,r1,16
 	blr
-	END (__llrint)
-
-weak_alias (__llrint, llrint)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__llrint, __llrintl)
-weak_alias (__llrint, llrintl)
-#endif
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __llrint, llrintl, GLIBC_2_1)
-#endif
+END (__llrint_power6)
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c
new file mode 100644
index 0000000000..c89c249575
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c
@@ -0,0 +1,43 @@
+/* Multiple versions of s_llrint.
+   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 (__llrint) __llrint_ppc32 attribute_hidden;
+extern __typeof (__llrint) __llrint_power4 attribute_hidden;
+extern __typeof (__llrint) __llrint_power6 attribute_hidden;
+
+libc_ifunc (__llrint,
+	    (hwcap & PPC_FEATURE_ARCH_2_05)
+	    ? __llrint_power6 :
+	      (hwcap & PPC_FEATURE_POWER4)
+	      ? __llrint_power4
+            : __llrint_ppc32);
+
+weak_alias (__llrint, llrint)
+
+#ifdef NO_LONG_DOUBLE
+strong_alias (__llrint, __llrintl)
+weak_alias (__llrint, llrintl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-c.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-c.c
new file mode 100644
index 0000000000..5019f99abe
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-c.c
@@ -0,0 +1,3 @@
+#undef __llrintf
+#define __llrintf __llrintf_ppc32
+#include <sysdeps/powerpc/powerpc32/fpu/s_llrintf.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S
index 98e3aafc8e..f6bab6c182 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S
@@ -19,7 +19,8 @@
 #include <sysdep.h>
 
 /* long long int[r3, r4] __llrintf (float x[fp1])  */
-ENTRY (__llrintf)	
+	.machine power4
+ENTRY (__llrintf_power4)
 	CALL_MCOUNT
 	stwu	r1,-16(r1)
 	cfi_adjust_cfa_offset (16)
@@ -30,9 +31,6 @@ ENTRY (__llrintf)
 	nop
 	lwz	r3,8(r1)
 	lwz	r4,12(r1)
-	addi	r1,r1,16	
+	addi	r1,r1,16
 	blr
-	END (__llrintf)
-
-weak_alias (__llrintf, llrintf)
-
+END (__llrintf_power4)
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S
index 1b06e2b9ba..596f2d5f35 100644
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S
@@ -19,7 +19,8 @@
 #include <sysdep.h>
 
 /* long long int[r3, r4] __llrintf (float x[fp1])  */
-ENTRY (__llrintf)	
+	.machine power6
+ENTRY (__llrintf_power6)
 	CALL_MCOUNT
 	stwu	r1,-16(r1)
 	cfi_adjust_cfa_offset (16)
@@ -30,9 +31,6 @@ ENTRY (__llrintf)
 	ori	r1,r1,0
 	lwz	r3,8(r1)
 	lwz	r4,12(r1)
-	addi	r1,r1,16	
+	addi	r1,r1,16
 	blr
-	END (__llrintf)
-
-weak_alias (__llrintf, llrintf)
-
+END (__llrintf_power6)
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c
new file mode 100644
index 0000000000..3c854157b3
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c
@@ -0,0 +1,34 @@
+/* Multiple versions of s_llrintf.
+   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 (__llrintf) __llrintf_ppc32 attribute_hidden;
+extern __typeof (__llrintf) __llrintf_power4 attribute_hidden;
+extern __typeof (__llrintf) __llrintf_power6 attribute_hidden;
+
+libc_ifunc (__llrintf,
+	    (hwcap & PPC_FEATURE_ARCH_2_05)
+	    ? __llrintf_power6 :
+	      (hwcap & PPC_FEATURE_POWER4)
+	      ? __llrintf_power4
+            : __llrintf_ppc32);
+
+weak_alias (__llrintf, llrintf)