]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
PowerPC: wcschr ifunc for PowerPC32
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Tue, 9 Apr 2013 00:32:56 +0000 (19:32 -0500)
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Tue, 9 Apr 2013 17:04:27 +0000 (12:04 -0500)
sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
sysdeps/powerpc/powerpc32/multiarch/wcschr-c.c [new file with mode: 0644]
sysdeps/powerpc/powerpc32/multiarch/wcschr-power6.c [moved from sysdeps/powerpc/powerpc32/power6/wcschr.c with 88% similarity]
sysdeps/powerpc/powerpc32/multiarch/wcschr-power7.c [new file with mode: 0644]
sysdeps/powerpc/powerpc32/multiarch/wcschr.c [new file with mode: 0644]

index faeef4a91c5edfb732d55ddccbd2f584afe759f7..b92152eef494e4c59fe8dfc6602b3e947918ac71 100644 (file)
@@ -155,6 +155,16 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
                              __strchrnul_power7)
              IFUNC_IMPL_ADD (array, i, strchrnul, 1,
                              __strchrnul_ppc32))
+
+  IFUNC_IMPL (i, name, wcschr,
+             IFUNC_IMPL_ADD (array, i, wcschr,
+                             hwcap & PPC_FEATURE_HAS_VSX,
+                             __wcschr_power7)
+             IFUNC_IMPL_ADD (array, i, wcschr,
+                             hwcap & PPC_FEATURE_ARCH_2_05,
+                             __wcschr_power6)
+             IFUNC_IMPL_ADD (array, i, wcschr, 1,
+                             __wcschr_ppc32))
 #endif
 
   return i;
diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcschr-c.c b/sysdeps/powerpc/powerpc32/multiarch/wcschr-c.c
new file mode 100644 (file)
index 0000000..19396d5
--- /dev/null
@@ -0,0 +1,14 @@
+#include <wchar.h>
+
+#ifndef NOT_IN_libc
+# ifdef SHARED
+#   undef libc_hidden_def
+#   define libc_hidden_def(name)  \
+    __hidden_ver1 (__wcschr_ppc32, __GI_wcschr, __wcschr_ppc32);
+# endif
+# define WCSCHR  __wcschr_ppc32
+#endif
+
+extern __typeof (wcschr) __wcschr_ppc32;
+
+#include "wcsmbs/wcschr.c"
similarity index 88%
rename from sysdeps/powerpc/powerpc32/power6/wcschr.c
rename to sysdeps/powerpc/powerpc32/multiarch/wcschr-power6.c
index a989877bb8a28b3e5924d485c280517ae719365b..e6b81188e4c6d509581b582d9b2591a3305a008a 100644 (file)
 
 #include <wchar.h>
 
+#ifdef WCSCHR
+# define __wcschr_power6 WCSCHR
+#endif
+#ifndef WCSCHR_ARCH
+# define WCSCHR_ARCH "power6"
+#endif
+
+__typeof (wcschr) __wcschr_power6
+  __attribute__ ((__target__ ("cpu=" WCSCHR_ARCH)));
 
 /* Find the first occurrence of WC in WCS.  */
 wchar_t *
-wcschr (wcs, wc)
-     register const wchar_t *wcs;
-     register const wchar_t wc;
+__wcschr_power6 (register const wchar_t *wcs, register const wchar_t wc)
 {
   register const wchar_t *wcs2 = wcs + 1;
 
@@ -85,4 +92,3 @@ wcschr (wcs, wc)
 
   return NULL;
 }
-libc_hidden_def (wcschr)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcschr-power7.c b/sysdeps/powerpc/powerpc32/multiarch/wcschr-power7.c
new file mode 100644 (file)
index 0000000..c573681
--- /dev/null
@@ -0,0 +1,3 @@
+#define WCSCHR      __wcschr_power7
+#define WCSCHR_ARCH "power7"
+#include <sysdeps/powerpc/powerpc32/multiarch/wcschr-power6.c>
diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcschr.c b/sysdeps/powerpc/powerpc32/multiarch/wcschr.c
new file mode 100644 (file)
index 0000000..3c3e573
--- /dev/null
@@ -0,0 +1,36 @@
+/* Multiple versions of wcschr
+   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/>.  */
+
+#ifndef NOT_IN_libc
+# include <wchar.h>
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+extern __typeof (wcschr) __wcschr_ppc32 attribute_hidden;
+extern __typeof (wcschr) __wcschr_power6 attribute_hidden;
+extern __typeof (wcschr) __wcschr_power7 attribute_hidden;
+
+libc_ifunc (wcschr,
+            (hwcap & PPC_FEATURE_HAS_VSX)
+             ? __wcschr_power7 :
+              (hwcap & PPC_FEATURE_ARCH_2_05)
+              ? __wcschr_power6
+             : __wcschr_ppc32);
+#else
+#include "wcsmbs/wcschr.c"
+#endif