]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
PowerPC: lround/lroundf multilib for PowerPC32
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Mon, 15 Apr 2013 12:48:56 +0000 (07:48 -0500)
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Tue, 16 Apr 2013 13:53:52 +0000 (08:53 -0500)
sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-power5+.S [moved from sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S with 83% similarity]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-power6x.S [moved from sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S with 82% similarity]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-ppc32.S [new file with mode: 0644]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround.c [new file with mode: 0644]
sysdeps/powerpc/powerpc32/fpu/multiarch/s_lroundf.c [new file with mode: 0644]

index 14d33213fd5cbfb5406f8459dddb35f99977a1ab..0ee4c9f8d70d2a84a7cc5851a1a33a2a2ba94692 100644 (file)
@@ -23,7 +23,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-c \
                        s_round-power5+ s_round-ppc32 \
                        s_roundf-power5+ s_roundf-ppc32 \
                        s_trunc-power5+ s_trunc-ppc32 \
-                       s_truncf-power5+ s_truncf-ppc32
+                       s_truncf-power5+ s_truncf-ppc32 \
+                       s_lround-power6x s_lround-power5+ s_lround-ppc32
 
 CFLAGS-s_llround.c = -fno-builtin-llroundf
 endif
similarity index 83%
rename from sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S
rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-power5+.S
index 0fa359d079b501355ef953f97986eca6a0da6670..bb3ea76a11de7b00ebd4ff06e40f1598d5228656 100644 (file)
    <http://www.gnu.org/licenses/>.  */
 #include <sysdep.h>
 #include <math_ldbl_opt.h>
-       
+
 /* long [r3] lround (float x [fp1])
-   IEEE 1003.1 lround function.  IEEE specifies "round to the nearest 
+   IEEE 1003.1 lround function.  IEEE specifies "round to the nearest
    integer value, rounding halfway cases away from zero, regardless of
    the current rounding mode."  However PowerPC Architecture defines
-   "round to Nearest" as "Choose the best approximation. In case of a 
-   tie, choose the one that is even (least significant bit o).". 
+   "round to Nearest" as "Choose the best approximation. In case of a
+   tie, choose the one that is even (least significant bit o).".
    So we pre-round using the V2.02 Floating Round to Integer Nearest
    instruction before we use the Floating Convert to Integer Word with
    round to zero instruction.  */
 
        .machine        "power5"
-ENTRY (__lround)
+ENTRY (__lround_power5plus)
        stwu    r1,-16(r1)
        cfi_adjust_cfa_offset (16)
        frin    fp2,fp1
@@ -41,17 +41,4 @@ ENTRY (__lround)
        lwz     r3,12(r1)
        addi    r1,r1,16
        blr
-       END (__lround)
-
-weak_alias (__lround, lround)
-
-strong_alias (__lround, __lroundf)
-weak_alias (__lround, lroundf)
-
-#ifdef NO_LONG_DOUBLE
-weak_alias (__lround, lroundl)
-strong_alias (__lround, __lroundl)
-#endif
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __lround, lroundl, GLIBC_2_1)
-#endif
+END (__lround_power5plus)
similarity index 82%
rename from sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S
rename to sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-power6x.S
index 950b69536a700ba985e17eda450f4b98f9539984..49c5a7109e1912900a52cdc7365de6fd3d688e64 100644 (file)
 
 #include <sysdep.h>
 #include <math_ldbl_opt.h>
-       
+
 /* long [r3] lround (float x [fp1])
-   IEEE 1003.1 lround function.  IEEE specifies "round to the nearest 
+   IEEE 1003.1 lround function.  IEEE specifies "round to the nearest
    integer value, rounding halfway cases away from zero, regardless of
    the current rounding mode."  However PowerPC Architecture defines
-   "round to Nearest" as "Choose the best approximation. In case of a 
-   tie, choose the one that is even (least significant bit o).". 
+   "round to Nearest" as "Choose the best approximation. In case of a
+   tie, choose the one that is even (least significant bit o).".
    So we pre-round using the V2.02 Floating Round to Integer Nearest
    instruction before we use the Floating Convert to Integer Word with
    round to zero instruction.  */
 
        .machine        "power6"
-ENTRY (__lround)
+ENTRY (__lround_power6x)
        frin    fp2,fp1 /* Pre-round +-0.5.  */
        fctiwz  fp3,fp2 /* Convert To Integer Word lround toward 0.  */
        mftgpr  r3,fp3  /* Transfer fpr3 to r3.  */
        blr
-       END (__lround)
-
-weak_alias (__lround, lround)
-
-strong_alias (__lround, __lroundf)
-weak_alias (__lround, lroundf)
-
-#ifdef NO_LONG_DOUBLE
-weak_alias (__lround, lroundl)
-strong_alias (__lround, __lroundl)
-#endif
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __lround, lroundl, GLIBC_2_1)
-#endif
+END (__lround_power6x)
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-ppc32.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround-ppc32.S
new file mode 100644 (file)
index 0000000..de6b919
--- /dev/null
@@ -0,0 +1,13 @@
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+#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)
+
+#define __lround __lround_ppc32
+
+#include <sysdeps/powerpc/powerpc32/fpu/s_lround.S>
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lround.c
new file mode 100644 (file)
index 0000000..f133120
--- /dev/null
@@ -0,0 +1,55 @@
+/* Multiple versions of s_lround.
+   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/>.  */
+
+/* Redefine lroundf/__lroundf so that compiler won't complain abouti
+   the type mismatch with the IFUNC selector in strong_alias/weak_alias
+   below.  */
+#undef lroundf
+#define lroundf __redirect_lroundf
+#undef __lroundf
+#define __lroundf __redirect___lroundf
+#include <math.h>
+#undef lroundf
+#undef __lroundf
+#include <math_ldbl_opt.h>
+#include <shlib-compat.h>
+#include "init-arch.h"
+
+extern __typeof (__lround) __lround_ppc32 attribute_hidden;
+extern __typeof (__lround) __lround_power5plus attribute_hidden;
+extern __typeof (__lround) __lround_power6x attribute_hidden;
+
+libc_ifunc (__lround,
+           (hwcap & PPC_FEATURE_POWER6_EXT) ?
+             __lround_power6x
+               : (hwcap & PPC_FEATURE_POWER5_PLUS) ?
+                 __lround_power5plus
+            : __lround_ppc32);
+
+weak_alias (__lround, lround)
+
+weak_alias (__lround, lroundf)
+strong_alias(__lround, __lroundf)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias (__lround, lroundl)
+strong_alias (__lround, __lroundl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lround, lroundl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lroundf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_lroundf.c
new file mode 100644 (file)
index 0000000..eb546b4
--- /dev/null
@@ -0,0 +1 @@
+/* s_lroundf.c is in s_lround.c  */