5de29b
From 0c36ea57312ce701930b879d49b3f64cead222d8 Mon Sep 17 00:00:00 2001
5de29b
From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
5de29b
Date: Wed, 30 Jul 2014 05:48:25 -0500
5de29b
Subject: [PATCH] PowerPC: multiarch strncasecmp for PowerPC64
5de29b
5de29b
commit 1c92d9a0e0be6175915128157036cf138ef64af8
5de29b
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
5de29b
Date:   Fri Dec 13 14:40:28 2013 -0500
5de29b
---
5de29b
 sysdeps/powerpc/powerpc64/multiarch/Makefile       |  6 +++-
5de29b
 .../powerpc/powerpc64/multiarch/ifunc-impl-list.c  | 15 ++++++++
5de29b
 .../powerpc/powerpc64/multiarch/strncase-power7.c  | 24 +++++++++++++
5de29b
 sysdeps/powerpc/powerpc64/multiarch/strncase.c     | 41 +++++++++++++++++++++
5de29b
 .../powerpc64/multiarch/strncase_l-power7.c        | 25 +++++++++++++
5de29b
 sysdeps/powerpc/powerpc64/multiarch/strncase_l.c   | 42 ++++++++++++++++++++++
5de29b
 6 files changed, 152 insertions(+), 1 deletion(-)
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strncase-power7.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strncase.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/multiarch/strncase_l.c
5de29b
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
5de29b
index 5e172da..4dca756 100644
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
5de29b
@@ -6,5 +6,9 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
5de29b
                   mempcpy-power7 mempcpy-ppc64 memchr-power7 memchr-ppc64 \
5de29b
                   memrchr-power7 memrchr-ppc64 rawmemchr-power7 \
5de29b
                   rawmemchr-ppc64 strlen-power7 strlen-ppc64 strnlen-power7 \
5de29b
-                  strnlen-ppc64 strcasecmp-power7 strcasecmp_l-power7
5de29b
+                  strnlen-ppc64 strcasecmp-power7 strcasecmp_l-power7 \
5de29b
+                  strncase-power7 strncase_l-power7
5de29b
+
5de29b
+CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops
5de29b
+CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops
5de29b
 endif
12745e
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
5de29b
index ba78d97..4b8fb22 100644
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
5de29b
@@ -151,5 +151,20 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
5de29b
              IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
5de29b
                              __strcasecmp_l_ppc))
5de29b
 
5de29b
+  /* Support sysdeps/powerpc/powerpc64/multiarch/strncase.c.  */
5de29b
+  IFUNC_IMPL (i, name, strncasecmp,
5de29b
+             IFUNC_IMPL_ADD (array, i, strncasecmp,
5de29b
+                             hwcap & PPC_FEATURE_HAS_VSX,
5de29b
+                             __strncasecmp_power7)
5de29b
+             IFUNC_IMPL_ADD (array, i, strncasecmp, 1, __strncasecmp_ppc))
5de29b
+
5de29b
+  /* Support sysdeps/powerpc/powerpc64/multiarch/strncase_l.c.  */
5de29b
+  IFUNC_IMPL (i, name, strncasecmp_l,
5de29b
+             IFUNC_IMPL_ADD (array, i, strncasecmp_l,
5de29b
+                             hwcap & PPC_FEATURE_HAS_VSX,
5de29b
+                             __strncasecmp_l_power7)
5de29b
+             IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
5de29b
+                             __strncasecmp_l_ppc))
5de29b
+
5de29b
   return i;
5de29b
 }
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase-power7.c
5de29b
new file mode 100644
5de29b
index 0000000..9c5dbab
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase-power7.c
5de29b
@@ -0,0 +1,24 @@
5de29b
+/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <string.h>
5de29b
+
5de29b
+#define __strncasecmp __strncasecmp_power7
5de29b
+
5de29b
+extern __typeof (strncasecmp) __strncasecmp_power7 attribute_hidden;
5de29b
+
5de29b
+#include <string/strncase.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase.c
5de29b
new file mode 100644
5de29b
index 0000000..05eba7c
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase.c
5de29b
@@ -0,0 +1,41 @@
5de29b
+/* Multiple versions of strncasecmp
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#ifndef NOT_IN_libc
5de29b
+# include <string.h>
5de29b
+# define strncasecmp __strncasecmp_ppc
5de29b
+extern __typeof (__strncasecmp) __strncasecmp_ppc attribute_hidden;
5de29b
+extern __typeof (__strncasecmp) __strncasecmp_power7 attribute_hidden;
5de29b
+#endif
5de29b
+
5de29b
+#include <string/strncase.c>
5de29b
+#undef strncasecmp
5de29b
+
5de29b
+#ifndef NOT_IN_libc
5de29b
+# include <shlib-compat.h>
5de29b
+# include "init-arch.h"
5de29b
+
5de29b
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
5de29b
+   ifunc symbol properly.  */
5de29b
+extern __typeof (__strncasecmp) __libc_strncasecmp;
5de29b
+libc_ifunc (__libc_strncasecmp,
5de29b
+	     (hwcap & PPC_FEATURE_HAS_VSX)
5de29b
+             ? __strncasecmp_power7
5de29b
+             : __strncasecmp_ppc);
5de29b
+weak_alias (__libc_strncasecmp, strncasecmp)
5de29b
+#endif
12745e
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
5de29b
new file mode 100644
5de29b
index 0000000..8c8cd8d
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase_l-power7.c
5de29b
@@ -0,0 +1,25 @@
5de29b
+/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <string.h>
5de29b
+
5de29b
+#define __strncasecmp_l __strncasecmp_l_power7
5de29b
+#define USE_IN_EXTENDED_LOCALE_MODEL    1
5de29b
+
5de29b
+extern __typeof (strncasecmp_l) __strncasecmp_l_power7 attribute_hidden;
5de29b
+
5de29b
+#include <string/strncase.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase_l.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase_l.c
5de29b
new file mode 100644
5de29b
index 0000000..4014269
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/strncase_l.c
5de29b
@@ -0,0 +1,42 @@
5de29b
+/* Multiple versions of strncasecmp_l
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#ifndef NOT_IN_libc
5de29b
+# include <string.h>
5de29b
+# define strncasecmp_l __strncasecmp_l_ppc
5de29b
+extern __typeof (__strncasecmp_l) __strncasecmp_l_ppc attribute_hidden;
5de29b
+extern __typeof (__strncasecmp_l) __strncasecmp_l_power7 attribute_hidden;
5de29b
+#endif
5de29b
+
5de29b
+#include <string/strncase_l.c>
5de29b
+#undef strncasecmp_l
5de29b
+
5de29b
+#ifndef NOT_IN_libc
5de29b
+# include <shlib-compat.h>
5de29b
+# include "init-arch.h"
5de29b
+
5de29b
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
5de29b
+   ifunc symbol properly.  */
5de29b
+extern __typeof (__strncasecmp_l) __libc_strncasecmp_l;
5de29b
+libc_ifunc (__libc_strncasecmp_l,
5de29b
+	     (hwcap & PPC_FEATURE_HAS_VSX)
5de29b
+             ? __strncasecmp_l_power7
5de29b
+             : __strncasecmp_l_ppc);
5de29b
+
5de29b
+weak_alias (__libc_strncasecmp_l, strncasecmp_l)
5de29b
+#endif
5de29b
-- 
5de29b
1.8.3.1
5de29b