00db10
From 4a6eeaf792815ff197f683e424d64cc3a9e16a66 Mon Sep 17 00:00:00 2001
00db10
From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
00db10
Date: Wed, 30 Jul 2014 05:47:00 -0500
00db10
Subject: [PATCH] PowerPC: multiarch strcasecmp for PowerPC64
00db10
00db10
commit 17de3ee3c109a13ecec60b8bc9514f33c5b42178
00db10
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
00db10
Date:   Fri Dec 13 14:39:51 2013 -0500
00db10
---
00db10
 sysdeps/powerpc/powerpc64/multiarch/Makefile       |  2 +-
00db10
 .../powerpc/powerpc64/multiarch/ifunc-impl-list.c  | 15 ++++++++
00db10
 .../powerpc64/multiarch/strcasecmp-power7.S        | 41 +++++++++++++++++++++
00db10
 sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c   | 40 ++++++++++++++++++++
00db10
 .../powerpc64/multiarch/strcasecmp_l-power7.S      | 43 ++++++++++++++++++++++
00db10
 sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c | 40 ++++++++++++++++++++
00db10
 6 files changed, 180 insertions(+), 1 deletion(-)
00db10
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strcasecmp-power7.S
00db10
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c
00db10
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l-power7.S
00db10
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c
00db10
00db10
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
00db10
index 3285fd7..5e172da 100644
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
00db10
@@ -6,5 +6,5 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
00db10
                   mempcpy-power7 mempcpy-ppc64 memchr-power7 memchr-ppc64 \
00db10
                   memrchr-power7 memrchr-ppc64 rawmemchr-power7 \
00db10
                   rawmemchr-ppc64 strlen-power7 strlen-ppc64 strnlen-power7 \
00db10
-                  strnlen-ppc64
00db10
+                  strnlen-ppc64 strcasecmp-power7 strcasecmp_l-power7
00db10
 endif
00db10
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
00db10
index c9125b8..ba78d97 100644
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
00db10
@@ -136,5 +136,20 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
00db10
              IFUNC_IMPL_ADD (array, i, strnlen, 1,
00db10
                              __strnlen_ppc))
00db10
 
00db10
+  /* Support sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c.  */
00db10
+  IFUNC_IMPL (i, name, strcasecmp,
00db10
+             IFUNC_IMPL_ADD (array, i, strcasecmp,
00db10
+                             hwcap & PPC_FEATURE_HAS_VSX,
00db10
+                             __strcasecmp_power7)
00db10
+             IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ppc))
00db10
+
00db10
+  /* Support sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c.  */
00db10
+  IFUNC_IMPL (i, name, strcasecmp_l,
00db10
+             IFUNC_IMPL_ADD (array, i, strcasecmp_l,
00db10
+                             hwcap & PPC_FEATURE_HAS_VSX,
00db10
+                             __strcasecmp_l_power7)
00db10
+             IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
00db10
+                             __strcasecmp_l_ppc))
00db10
+
00db10
   return i;
00db10
 }
00db10
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp-power7.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp-power7.S
00db10
new file mode 100644
00db10
index 0000000..9714f88
00db10
--- /dev/null
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp-power7.S
00db10
@@ -0,0 +1,41 @@
00db10
+/* Optimized strcasecmp implementation foOWER7.
00db10
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#include <sysdep.h>
00db10
+
00db10
+#undef ENTRY
00db10
+#define ENTRY(name)						\
00db10
+  .section ".text";						\
00db10
+  ENTRY_2(__strcasecmp_power7)					\
00db10
+  .align ALIGNARG(2);						\
00db10
+  BODY_LABEL(__strcasecmp_power7):				\
00db10
+  cfi_startproc;
00db10
+
00db10
+#undef END
00db10
+#define END(name)						\
00db10
+  cfi_endproc;							\
00db10
+  TRACEBACK(__strcasecmp_power7)				\
00db10
+  END_2(__strcasecmp_power7)
00db10
+
00db10
+#undef weak_alias
00db10
+#define weak_alias(name, alias)
00db10
+
00db10
+#undef libc_hidden_builtin_def
00db10
+#define libc_hidden_builtin_def(name)
00db10
+
00db10
+#include <sysdeps/powerpc/powerpc64/power7/strcasecmp.S>
00db10
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c
00db10
new file mode 100644
00db10
index 0000000..7f02a25
00db10
--- /dev/null
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp.c
00db10
@@ -0,0 +1,40 @@
00db10
+/* Multiple versions of strcasecmp.
00db10
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#ifndef NOT_IN_libc
00db10
+# include <string.h>
00db10
+# define strcasecmp __strcasecmp_ppc
00db10
+extern __typeof (__strcasecmp) __strcasecmp_ppc attribute_hidden;
00db10
+extern __typeof (__strcasecmp) __strcasecmp_power7 attribute_hidden;
00db10
+#endif
00db10
+
00db10
+#include <string/strcasecmp.c>
00db10
+#undef strcasecmp
00db10
+
00db10
+#ifndef NOT_IN_libc
00db10
+# include <shlib-compat.h>
00db10
+# include "init-arch.h"
00db10
+
00db10
+extern __typeof (__strcasecmp) __libc_strcasecmp;
00db10
+libc_ifunc (__libc_strcasecmp,
00db10
+	    (hwcap & PPC_FEATURE_HAS_VSX)
00db10
+            ? __strcasecmp_power7
00db10
+            : __strcasecmp_ppc);
00db10
+
00db10
+weak_alias (__libc_strcasecmp, strcasecmp)
00db10
+#endif
00db10
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l-power7.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l-power7.S
00db10
new file mode 100644
00db10
index 0000000..117e464
00db10
--- /dev/null
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l-power7.S
00db10
@@ -0,0 +1,43 @@
00db10
+/* Optimized strcasecmp_l implementation for POWER7.
00db10
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#include <sysdep.h>
00db10
+
00db10
+#undef ENTRY
00db10
+#define ENTRY(name)						\
00db10
+  .section ".text";						\
00db10
+  ENTRY_2(__strcasecmp_l_power7)				\
00db10
+  .align ALIGNARG(2);						\
00db10
+  BODY_LABEL(__strcasecmp_l_power7):				\
00db10
+  cfi_startproc;
00db10
+
00db10
+#undef END
00db10
+#define END(name)						\
00db10
+  cfi_endproc;							\
00db10
+  TRACEBACK(__strcasecmp_l_power7)				\
00db10
+  END_2(__strcasecmp_l_power7)
00db10
+
00db10
+#undef weak_alias
00db10
+#define weak_alias(name, alias)
00db10
+
00db10
+#undef libc_hidden_builtin_def
00db10
+#define libc_hidden_builtin_def(name)
00db10
+
00db10
+#define USE_IN_EXTENDED_LOCALE_MODEL
00db10
+
00db10
+#include <sysdeps/powerpc/powerpc64/power7/strcasecmp.S>
00db10
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c
00db10
new file mode 100644
00db10
index 0000000..a3374c3
00db10
--- /dev/null
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l.c
00db10
@@ -0,0 +1,40 @@
00db10
+/* Multiple versions of strcasecmp_l.
00db10
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#ifndef NOT_IN_libc
00db10
+# include <string.h>
00db10
+# define strcasecmp_l __strcasecmp_l_ppc
00db10
+extern __typeof (__strcasecmp_l) __strcasecmp_l_ppc attribute_hidden;
00db10
+extern __typeof (__strcasecmp_l) __strcasecmp_l_power7 attribute_hidden;
00db10
+#endif
00db10
+
00db10
+#include <string/strcasecmp_l.c>
00db10
+#undef strcasecmp_l
00db10
+
00db10
+#ifndef NOT_IN_libc
00db10
+# include <shlib-compat.h>
00db10
+# include "init-arch.h"
00db10
+
00db10
+extern __typeof (__strcasecmp_l) __libc_strcasecmp_l;
00db10
+libc_ifunc (__libc_strcasecmp_l,
00db10
+	    (hwcap & PPC_FEATURE_HAS_VSX)
00db10
+            ? __strcasecmp_l_power7
00db10
+            : __strcasecmp_l_ppc);
00db10
+
00db10
+weak_alias (__libc_strcasecmp_l, strcasecmp_l)
00db10
+#endif
00db10
-- 
00db10
1.8.3.1
00db10