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