]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
PowerPC: strcasecmp ifunc implementation for PPC32
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Tue, 26 Mar 2013 17:31:15 +0000 (12:31 -0500)
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Tue, 26 Mar 2013 17:31:15 +0000 (12:31 -0500)
sysdeps/powerpc/powerpc32/multiarch/Makefile
sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
sysdeps/powerpc/powerpc32/multiarch/init-arch.h [new file with mode: 0644]
sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S [moved from sysdeps/powerpc/powerpc32/power7/strcasecmp.S with 98% similarity]
sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c [new file with mode: 0644]
sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S [new file with mode: 0644]
sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c [new file with mode: 0644]
sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S [deleted file]

index 4d935fecffa383dae6ea727d05b31fb4db6abdf5..22deb1759ffc0e3a1c29abdc157fd48234ad327c 100644 (file)
@@ -2,5 +2,6 @@ ifeq ($(subdir),string)
 sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
                   memcmp-power7 memset-power4 memset-power6 memset-power7 \
                   bzero-power4 bzero-power6 bzero-power7 \
-                  strncmp-power7 strncmp-power4 strlen-power7
+                  strncmp-power7 strncmp-power4 strlen-power7 \
+                   strcasecmp-power7 strcasecmp_l-power7
 endif
index 371467620b738ba29a4c04a96108343a3500acd9..7ca97acdf7d7caa944186ae84fb0f6cf957e1939 100644 (file)
@@ -93,6 +93,19 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
              IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_POWER4,
                              __strncmp_power4)
              IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_ppc32))
+
+  IFUNC_IMPL (i, name, strcasecmp,
+             IFUNC_IMPL_ADD (array, i, strcasecmp,
+                             hwcap & PPC_FEATURE_HAS_VSX,
+                             __strcasecmp_power7)
+             IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ppc32))
+
+  IFUNC_IMPL (i, name, strcasecmp_l,
+             IFUNC_IMPL_ADD (array, i, strcasecmp_l,
+                             hwcap & PPC_FEATURE_HAS_VSX,
+                             __strcasecmp_l_power7)
+             IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
+                             __strcasecmp_l_ppc32))
 #endif
 
   return i;
diff --git a/sysdeps/powerpc/powerpc32/multiarch/init-arch.h b/sysdeps/powerpc/powerpc32/multiarch/init-arch.h
new file mode 100644 (file)
index 0000000..17f8708
--- /dev/null
@@ -0,0 +1,21 @@
+/* This file is part of the GNU C Library.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+   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 <ldsodefs.h>
+
+# define INIT_ARCH() \
+  unsigned long int hwcap = GLRO(dl_hwcap);
similarity index 98%
rename from sysdeps/powerpc/powerpc32/power7/strcasecmp.S
rename to sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S
index 7f0046c34d2af0baf6ac335a22d4ee4a88be429f..5f48271b1507e56cb1188d639c7778e9d8405004 100644 (file)
@@ -27,8 +27,8 @@
                           __locale_t loc [r5]) */
 
 #ifndef STRCMP
-# define __STRCMP __strcasecmp
-# define STRCMP   strcasecmp
+# define __STRCMP __strcasecmp_power7
+# define STRCMP   strcasecmp_power7
 #endif
 
 ENTRY (__STRCMP)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c
new file mode 100644 (file)
index 0000000..1885ce9
--- /dev/null
@@ -0,0 +1,54 @@
+/* Multiple versions of strcasecmp.
+   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
+# ifdef SHARED
+#  undef libc_hidden_builtin_def
+#  define libc_hidden_builtin_def(name) \
+  __hidden_ver1 (__strcasecmp_ppc32, __GI_strcasecmp, __strcasecmp_ppc32);
+# endif
+
+/* Redefine memmove so that the compiler won't complain about the type
+   mismatch with the IFUNC selector in strong_alias, below.  */
+# undef strcasecmp
+# define strcasecmp __redirect_strcasecmp
+# include <string.h>
+# undef strcasecmp
+# define strcasecmp __strcasecmp_ppc32
+
+extern __typeof (__redirect_strcasecmp) __strcasecmp_ppc32 attribute_hidden;
+extern __typeof (__redirect_strcasecmp) __strcasecmp_power7 attribute_hidden;
+#endif
+
+#include "string/strcasecmp.c"
+#undef strcasecmp
+
+#ifndef NOT_IN_libc
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+   ifunc symbol properly.  */
+extern __typeof (__redirect_strcasecmp) __libc_strcasecmp;
+libc_ifunc (__libc_strcasecmp,
+           (hwcap & PPC_FEATURE_HAS_VSX)
+            ? __strcasecmp_power7
+            : __strcasecmp_ppc32);
+
+weak_alias (__libc_strcasecmp, strcasecmp)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S
new file mode 100644 (file)
index 0000000..d07d4b8
--- /dev/null
@@ -0,0 +1,5 @@
+#define USE_IN_EXTENDED_LOCALE_MODEL
+#define STRCMP   strcasecmp_l_power7
+#define __STRCMP __strcasecmp_l_power7
+
+#include "strcasecmp-power7.S"
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c
new file mode 100644 (file)
index 0000000..71e37cf
--- /dev/null
@@ -0,0 +1,54 @@
+/* Multiple versions of strcasecmp.
+   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
+# ifdef SHARED
+#  undef libc_hidden_builtin_def
+#  define libc_hidden_builtin_def(name) \
+  __hidden_ver1 (__strcasecmp_l_ppc32, __GI_strcasecmp_l, __strcasecmp_l_ppc32);
+# endif
+
+/* Redefine memmove so that the compiler won't complain about the type
+   mismatch with the IFUNC selector in strong_alias, below.  */
+# undef strcasecmp_l
+# define strcasecmp_l __redirect_strcasecmp_l
+# include <string.h>
+# undef strcasecmp_l
+# define strcasecmp_l __strcasecmp_l_ppc32
+
+extern __typeof (__redirect_strcasecmp_l) __strcasecmp_l_ppc32 attribute_hidden;
+extern __typeof (__redirect_strcasecmp_l) __strcasecmp_l_power7 attribute_hidden;
+#endif
+
+#include "string/strcasecmp_l.c"
+#undef strcasecmp_l
+
+#ifndef NOT_IN_libc
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+   ifunc symbol properly.  */
+extern __typeof (__redirect_strcasecmp_l) __libc_strcasecmp_l;
+libc_ifunc (__libc_strcasecmp_l,
+           (hwcap & PPC_FEATURE_HAS_VSX)
+            ? __strcasecmp_l_power7
+            : __strcasecmp_l_ppc32);
+
+weak_alias (__libc_strcasecmp_l, strcasecmp_l)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S b/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S
deleted file mode 100644 (file)
index c13c4eb..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#define USE_IN_EXTENDED_LOCALE_MODEL
-#define STRCMP   strcasecmp_l
-#define __STRCMP __strcasecmp_l
-
-#include "strcasecmp.S"