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

index 4fe9bd04f38b71d918da28bf0ad85d174c5a61e7..19b11e1103a9cf71d1438a30e5cecaf1323941f7 100644 (file)
@@ -13,5 +13,6 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
                   strchrnul-power7 strchrnul-c \
                   wordcopy-power7 wordcopy-power6 wordcopy-power5 \
                   wordcopy-power4 wordcopy-c \
-                  wcschr-power7 wcschr-power6 wcschr-c
+                  wcschr-power7 wcschr-power6 wcschr-c \
+                  wcsrchr-power7 wcsrchr-power6 wcsrchr-c
 endif
index b92152eef494e4c59fe8dfc6602b3e947918ac71..0489e3d651082d49d7975a87019eacb394221a55 100644 (file)
@@ -165,6 +165,16 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
                              __wcschr_power6)
              IFUNC_IMPL_ADD (array, i, wcschr, 1,
                              __wcschr_ppc32))
+
+  IFUNC_IMPL (i, name, wcsrchr,
+             IFUNC_IMPL_ADD (array, i, wcsrchr,
+                             hwcap & PPC_FEATURE_HAS_VSX,
+                             __wcsrchr_power7)
+             IFUNC_IMPL_ADD (array, i, wcsrchr,
+                             hwcap & PPC_FEATURE_ARCH_2_05,
+                             __wcsrchr_power6)
+             IFUNC_IMPL_ADD (array, i, wcsrchr, 1,
+                             __wcsrchr_ppc32))
 #endif
 
   return i;
diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-c.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-c.c
new file mode 100644 (file)
index 0000000..6c893fe
--- /dev/null
@@ -0,0 +1,9 @@
+#include <wchar.h>
+
+#ifndef NOT_IN_libc
+# define WCSRCHR  __wcsrchr_ppc32
+#endif
+
+extern __typeof (wcsrchr) __wcsrchr_ppc32;
+
+#include "wcsmbs/wcsrchr.c"
similarity index 87%
rename from sysdeps/powerpc/powerpc32/power6/wcsrchr.c
rename to sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power6.c
index d0ff9f69cfad4c0ce35c899ca28d912f5e1be966..9da8edcb90b90cb5d27f5549b3653d4dd643ada7 100644 (file)
 
 #include <wchar.h>
 
+#ifdef WCSRCHR
+# define __wcsrchr_power6 WCSRCHR
+#endif
+#ifndef WCSRCHR_ARCH
+# define WCSRCHR_ARCH "power6"
+#endif
+
+__typeof (wcsrchr) __wcsrchr_power6
+  __attribute__ ((__target__ ("cpu=" WCSRCHR_ARCH)));
 
 /* Find the last occurrence of WC in WCS.  */
 wchar_t *
-wcsrchr (wcs, wc)
-     register const wchar_t *wcs;
-     register const wchar_t wc;
+__wcsrchr_power6 (register const wchar_t *wcs, register const wchar_t wc)
 {
   register const wchar_t *wcs2 = wcs + 1;
   const wchar_t *retval = NULL;
diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power7.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power7.c
new file mode 100644 (file)
index 0000000..0c8fe9c
--- /dev/null
@@ -0,0 +1,3 @@
+#define WCSRCHR      __wcsrchr_power7
+#define WCSRCHR_ARCH "power7"
+#include <sysdeps/powerpc/powerpc32/multiarch/wcsrchr-power6.c>
diff --git a/sysdeps/powerpc/powerpc32/multiarch/wcsrchr.c b/sysdeps/powerpc/powerpc32/multiarch/wcsrchr.c
new file mode 100644 (file)
index 0000000..0b06c28
--- /dev/null
@@ -0,0 +1,36 @@
+/* Multiple versions of wcsrchr
+   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 (wcsrchr) __wcsrchr_ppc32 attribute_hidden;
+extern __typeof (wcsrchr) __wcsrchr_power6 attribute_hidden;
+extern __typeof (wcsrchr) __wcsrchr_power7 attribute_hidden;
+
+libc_ifunc (wcsrchr,
+            (hwcap & PPC_FEATURE_HAS_VSX)
+             ? __wcsrchr_power7 :
+              (hwcap & PPC_FEATURE_ARCH_2_05)
+              ? __wcsrchr_power6
+             : __wcsrchr_ppc32);
+#else
+#include "wcsmbs/wcsrchr.c"
+#endif
index 7c3bc968e7bfaafc18ec4cb58284b20ec1a2570f..78479c7826da0f39b61bff339e67120b77e2c201 100644 (file)
 
 
 /* Find the last occurrence of WC in WCS.  */
+#ifdef WCSRCHR
+# define wcsrchr WCSRCHR
+#endif
+
 wchar_t *
 wcsrchr (wcs, wc)
      register const wchar_t *wcs;