00db10
From 0c36ea57312ce701930b879d49b3f64cead222d8 Mon Sep 17 00:00:00 2001
00db10
From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
00db10
Date: Wed, 30 Jul 2014 05:48:25 -0500
00db10
Subject: [PATCH] PowerPC: multiarch strncasecmp for PowerPC64
00db10
00db10
commit 1c92d9a0e0be6175915128157036cf138ef64af8
00db10
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
00db10
Date:   Fri Dec 13 14:40:28 2013 -0500
00db10
---
00db10
 sysdeps/powerpc/powerpc64/multiarch/Makefile       |  6 +++-
00db10
 .../powerpc/powerpc64/multiarch/ifunc-impl-list.c  | 15 ++++++++
00db10
 .../powerpc/powerpc64/multiarch/strncase-power7.c  | 24 +++++++++++++
00db10
 sysdeps/powerpc/powerpc64/multiarch/strncase.c     | 41 +++++++++++++++++++++
00db10
 .../powerpc64/multiarch/strncase_l-power7.c        | 25 +++++++++++++
00db10
 sysdeps/powerpc/powerpc64/multiarch/strncase_l.c   | 42 ++++++++++++++++++++++
00db10
 6 files changed, 152 insertions(+), 1 deletion(-)
00db10
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strncase-power7.c
00db10
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strncase.c
00db10
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
00db10
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strncase_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 5e172da..4dca756 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,9 @@ 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 strcasecmp-power7 strcasecmp_l-power7
00db10
+                  strnlen-ppc64 strcasecmp-power7 strcasecmp_l-power7 \
00db10
+                  strncase-power7 strncase_l-power7
00db10
+
00db10
+CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops
00db10
+CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops
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 ba78d97..4b8fb22 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
@@ -151,5 +151,20 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
00db10
              IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
00db10
                              __strcasecmp_l_ppc))
00db10
 
00db10
+  /* Support sysdeps/powerpc/powerpc64/multiarch/strncase.c.  */
00db10
+  IFUNC_IMPL (i, name, strncasecmp,
00db10
+             IFUNC_IMPL_ADD (array, i, strncasecmp,
00db10
+                             hwcap & PPC_FEATURE_HAS_VSX,
00db10
+                             __strncasecmp_power7)
00db10
+             IFUNC_IMPL_ADD (array, i, strncasecmp, 1, __strncasecmp_ppc))
00db10
+
00db10
+  /* Support sysdeps/powerpc/powerpc64/multiarch/strncase_l.c.  */
00db10
+  IFUNC_IMPL (i, name, strncasecmp_l,
00db10
+             IFUNC_IMPL_ADD (array, i, strncasecmp_l,
00db10
+                             hwcap & PPC_FEATURE_HAS_VSX,
00db10
+                             __strncasecmp_l_power7)
00db10
+             IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
00db10
+                             __strncasecmp_l_ppc))
00db10
+
00db10
   return i;
00db10
 }
00db10
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase-power7.c
00db10
new file mode 100644
00db10
index 0000000..9c5dbab
00db10
--- /dev/null
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase-power7.c
00db10
@@ -0,0 +1,24 @@
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 <string.h>
00db10
+
00db10
+#define __strncasecmp __strncasecmp_power7
00db10
+
00db10
+extern __typeof (strncasecmp) __strncasecmp_power7 attribute_hidden;
00db10
+
00db10
+#include <string/strncase.c>
00db10
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase.c
00db10
new file mode 100644
00db10
index 0000000..05eba7c
00db10
--- /dev/null
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase.c
00db10
@@ -0,0 +1,41 @@
00db10
+/* Multiple versions of strncasecmp
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 strncasecmp __strncasecmp_ppc
00db10
+extern __typeof (__strncasecmp) __strncasecmp_ppc attribute_hidden;
00db10
+extern __typeof (__strncasecmp) __strncasecmp_power7 attribute_hidden;
00db10
+#endif
00db10
+
00db10
+#include <string/strncase.c>
00db10
+#undef strncasecmp
00db10
+
00db10
+#ifndef NOT_IN_libc
00db10
+# include <shlib-compat.h>
00db10
+# include "init-arch.h"
00db10
+
00db10
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
00db10
+   ifunc symbol properly.  */
00db10
+extern __typeof (__strncasecmp) __libc_strncasecmp;
00db10
+libc_ifunc (__libc_strncasecmp,
00db10
+	     (hwcap & PPC_FEATURE_HAS_VSX)
00db10
+             ? __strncasecmp_power7
00db10
+             : __strncasecmp_ppc);
00db10
+weak_alias (__libc_strncasecmp, strncasecmp)
00db10
+#endif
00db10
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
00db10
new file mode 100644
00db10
index 0000000..8c8cd8d
00db10
--- /dev/null
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
00db10
@@ -0,0 +1,25 @@
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 <string.h>
00db10
+
00db10
+#define __strncasecmp_l __strncasecmp_l_power7
00db10
+#define USE_IN_EXTENDED_LOCALE_MODEL    1
00db10
+
00db10
+extern __typeof (strncasecmp_l) __strncasecmp_l_power7 attribute_hidden;
00db10
+
00db10
+#include <string/strncase.c>
00db10
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase_l.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase_l.c
00db10
new file mode 100644
00db10
index 0000000..4014269
00db10
--- /dev/null
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase_l.c
00db10
@@ -0,0 +1,42 @@
00db10
+/* Multiple versions of strncasecmp_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 strncasecmp_l __strncasecmp_l_ppc
00db10
+extern __typeof (__strncasecmp_l) __strncasecmp_l_ppc attribute_hidden;
00db10
+extern __typeof (__strncasecmp_l) __strncasecmp_l_power7 attribute_hidden;
00db10
+#endif
00db10
+
00db10
+#include <string/strncase_l.c>
00db10
+#undef strncasecmp_l
00db10
+
00db10
+#ifndef NOT_IN_libc
00db10
+# include <shlib-compat.h>
00db10
+# include "init-arch.h"
00db10
+
00db10
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
00db10
+   ifunc symbol properly.  */
00db10
+extern __typeof (__strncasecmp_l) __libc_strncasecmp_l;
00db10
+libc_ifunc (__libc_strncasecmp_l,
00db10
+	     (hwcap & PPC_FEATURE_HAS_VSX)
00db10
+             ? __strncasecmp_l_power7
00db10
+             : __strncasecmp_l_ppc);
00db10
+
00db10
+weak_alias (__libc_strncasecmp_l, strncasecmp_l)
00db10
+#endif
00db10
-- 
00db10
1.8.3.1
00db10