]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
PowerPC: llrint/llrintf multilib for PowerPC32
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Tue, 9 Apr 2013 18:36:56 +0000 (13:36 -0500)
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Fri, 12 Apr 2013 12:21:34 +0000 (07:21 -0500)
sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile [new file with mode: 0644]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-c.c [new file with mode: 0644]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S [moved from sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S with 81% similarity]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S [moved from sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S with 81% similarity]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c [new file with mode: 0644]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-c.c [new file with mode: 0644]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S [moved from sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S with 93% similarity]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S [moved from sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S with 93% similarity]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c [new file with mode: 0644]

diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
new file mode 100644 (file)
index 0000000..4c63e5d
--- /dev/null
@@ -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 (file)
index 0000000..a83db3f
--- /dev/null
@@ -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>
similarity index 81%
rename from sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S
index 2ac986db8bfb1cf8e2cb7d8ac4b9143239252341..5dcefc0b4fe4463c18d659dd88b5f14db42bd039 100644 (file)
@@ -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)
similarity index 81%
rename from sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S
index 86f51bb4f71640287f448f420f8e733e9af28924..3fc9b0f8dfd0a4ad1add9f3f6eda814f5c74b78e 100644 (file)
@@ -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 (file)
index 0000000..c89c249
--- /dev/null
@@ -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 (file)
index 0000000..5019f99
--- /dev/null
@@ -0,0 +1,3 @@
+#undef __llrintf
+#define __llrintf __llrintf_ppc32
+#include <sysdeps/powerpc/powerpc32/fpu/s_llrintf.c>
similarity index 93%
rename from sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S
index 98e3aafc8e9d0d049fe1eb6835108059dc0cc748..f6bab6c182c29b230c0725dd88c4d8fc6ebb45e9 100644 (file)
@@ -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)
similarity index 93%
rename from sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S
rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S
index 1b06e2b9ba530a837c9504857f2194eac3cbffde..596f2d5f3577ee22a3d46f58c455796a0d7ff359 100644 (file)
@@ -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 (file)
index 0000000..3c85415
--- /dev/null
@@ -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)