This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.29.9000-182-gf82ed45


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  f82ed45d7f77838bc8cff4c0a4ff33e76bb18a35 (commit)
       via  662c2cc4e9f00ffc789b636db18617538b4d9051 (commit)
       via  421e3005ca16627f4fefc51956811c1ca74377f6 (commit)
       via  7ba0100c6a7f933d32648b7df5d03cb4d75fe301 (commit)
       via  447a1306c3db3fd27be751928cea6892a5867af8 (commit)
       via  e3fd0b0e93a7b49a2f26640633fb2643c460ff4a (commit)
      from  8260f23616c1a2a4e609f989a195fba7690a42ca (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f82ed45d7f77838bc8cff4c0a4ff33e76bb18a35

commit f82ed45d7f77838bc8cff4c0a4ff33e76bb18a35
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Feb 28 08:33:40 2019 -0300

    powerpc: Use generic wcsrchr optimization
    
    This patch removes the power6 wcsrchr optimization and uses generic
    implementation instead.  Currently, both power6 and power7 IFUNC variant
    resulting binary are essentially the same and the generic implementation
    with unrolling loop set to 8 also results in similar performance.
    
    Checked on powerpc64-linux-gnu.
    
    	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcsrchr.c):
    	New rule.
    	* sysdeps/powerpc/power6/wcsrchr.c: Remove file.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power6.c:
    	Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power7.c:
    	Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c:
    	Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power6.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power7.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-ppc64.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c: Likewise.
    	* sysdeps/powerpc/powerpc64/power6/wcsrchr.c: Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
    	[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcsrchr-power6 and
    	wcsrchr-power7.
    	(CFLAGS-wcsrchr-power7.c, CFLAGS-wcsrchr-power6.c): Remove rule.
    	* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
    	Remove wcsrchr optimizations.
    	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.

diff --git a/ChangeLog b/ChangeLog
index c633bc5..b00c783 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
 2019-04-04  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcsrchr.c):
+	New rule.
+	* sysdeps/powerpc/power6/wcsrchr.c: Remove file.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power6.c:
+	Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power7.c:
+	Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c:
+	Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power6.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power7.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-ppc64.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c: Likewise.
+	* sysdeps/powerpc/powerpc64/power6/wcsrchr.c: Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
+	[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcsrchr-power6 and
+	wcsrchr-power7.
+	(CFLAGS-wcsrchr-power7.c, CFLAGS-wcsrchr-power6.c): Remove rule.
+	* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
+	Remove wcsrchr optimizations.
+	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.
+
 	* wcsmbs/wcsrchr.c (WCSRCHR): Use loop_unroll.h to parametrize
 	the loop unroll.
 
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
index 35cf1c6..05675bc 100644
--- a/sysdeps/powerpc/Makefile
+++ b/sysdeps/powerpc/Makefile
@@ -50,4 +50,5 @@ endif
 ifeq ($(subdir),wcsmbs)
 CFLAGS-wcscpy.c += -DUNROLL_NTIMES=8
 CFLAGS-wcschr.c += -DUNROLL_NTIMES=8
+CFLAGS-wcsrchr.c += -DUNROLL_NTIMES=8
 endif
diff --git a/sysdeps/powerpc/power6/wcsrchr.c b/sysdeps/powerpc/power6/wcsrchr.c
deleted file mode 100644
index 1762bd2..0000000
--- a/sysdeps/powerpc/power6/wcsrchr.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* wcsrchr.c - Wide Character Reverse Search for POWER6+.
-   Copyright (C) 2012-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <wchar.h>
-
-#ifndef WCSRCHR
-# define WCSRCHR wcsrchr
-#endif
-
-/* Find the last occurrence of WC in WCS.  */
-wchar_t *
-WCSRCHR (const wchar_t *wcs, const wchar_t wc)
-{
-  const wchar_t *wcs2 = wcs + 1;
-  const wchar_t *retval = NULL;
-
-  if (*wcs == wc)
-    retval = wcs;
-
-  if (*wcs == L'\0') return (wchar_t *) retval;
-
-  do
-    {
-    wcs+=2;
-
-    if (*wcs2 == wc)
-      retval = wcs2;
-    if (*wcs2 == L'\0')
-      return (wchar_t *) retval;
-    wcs2+=2;
-
-    if (*wcs == wc)
-      retval = wcs;
-    if (*wcs == L'\0')
-      return (wchar_t *) retval;
-    wcs+=2;
-
-    if (*wcs2 == wc)
-      retval = wcs2;
-    if (*wcs2 == L'\0')
-      return (wchar_t *) retval;
-    wcs2+=2;
-
-    if (*wcs == wc)
-      retval = wcs;
-    if (*wcs == L'\0')
-      return (wchar_t *) retval;
-    wcs+=2;
-
-    if (*wcs2 == wc)
-      retval = wcs2;
-    if (*wcs2 == L'\0')
-      return (wchar_t *) retval;
-    wcs2+=2;
-
-    if (*wcs == wc)
-      retval = wcs;
-    if (*wcs == L'\0')
-      return (wchar_t *) retval;
-    wcs+=2;
-
-    if (*wcs2 == wc)
-      retval = wcs2;
-    if (*wcs2 == L'\0')
-      return (wchar_t *) retval;
-    wcs2+=2;
-
-    if (*wcs == wc)
-      retval = wcs;
-    }
-  while (*wcs != L'\0');
-
-  return (wchar_t *) retval;
-}
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
index bb87c56..5c68f07 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
@@ -15,10 +15,3 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
 CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops
 CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops
 endif
-
-ifeq ($(subdir),wcsmbs)
-sysdep_routines += wcsrchr-power7 wcsrchr-power6 wcsrchr-ppc32
-
-CFLAGS-wcsrchr-power7.c += -mcpu=power7
-CFLAGS-wcsrchr-power6.c += -mcpu=power6
-endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
index 7624c3d..16a64be 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
@@ -187,16 +187,5 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 	      IFUNC_IMPL_ADD (array, i, strchr, 1,
 			      __strchr_ppc))
 
-  /* Support sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c.  */
-  IFUNC_IMPL (i, name, wcsrchr,
-	      IFUNC_IMPL_ADD (array, i, wcsrchr,
-			      hwcap & PPC_FEATURE_HAS_VSX,
-			      __wcsrchr_power7)
-	      IFUNC_IMPL_ADD (array, i, wcsrchr,
-			      hwcap & PPC_FEATURE_ARCH_2_05,
-			      __wcsrchr_power6)
-	      IFUNC_IMPL_ADD (array, i, wcsrchr, 1,
-			      __wcsrchr_ppc))
-
   return i;
 }
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power6.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power6.c
deleted file mode 100644
index 93c8bde..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power6.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2013-2019 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/>.  */
-
-#define WCSRCHR      __wcsrchr_power6
-
-#include <sysdeps/powerpc/power6/wcsrchr.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power7.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power7.c
deleted file mode 100644
index a32a984..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power7.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2013-2019 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/>.  */
-
-#define WCSRCHR      __wcsrchr_power7
-
-#include <sysdeps/powerpc/power6/wcsrchr.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c
deleted file mode 100644
index 690faf4..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2013-2019 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/>.  */
-
-#include <wchar.h>
-
-#if IS_IN (libc)
-# define WCSRCHR  __wcsrchr_ppc
-#endif
-
-extern __typeof (wcsrchr) __wcsrchr_ppc;
-
-#include <wcsmbs/wcsrchr.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c
deleted file mode 100644
index 80adc7b..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Multiple versions of wcsrchr
-   Copyright (C) 2013-2019 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/>.  */
-
-#if IS_IN (libc)
-# include <wchar.h>
-# include <shlib-compat.h>
-# include "init-arch.h"
-
-extern __typeof (wcsrchr) __wcsrchr_ppc attribute_hidden;
-extern __typeof (wcsrchr) __wcsrchr_power6 attribute_hidden;
-extern __typeof (wcsrchr) __wcsrchr_power7 attribute_hidden;
-
-libc_ifunc (wcsrchr,
-	     (hwcap & PPC_FEATURE_HAS_VSX)
-             ? __wcsrchr_power7 :
-	       (hwcap & PPC_FEATURE_ARCH_2_05)
-	       ? __wcsrchr_power6
-             : __wcsrchr_ppc);
-#else
-#include <wcsmbs/wcsrchr.c>
-#endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/Makefile b/sysdeps/powerpc/powerpc64/multiarch/Makefile
index c70f4a2..ea936bf 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/multiarch/Makefile
@@ -37,10 +37,3 @@ endif
 CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops
 CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops
 endif
-
-ifeq ($(subdir),wcsmbs)
-sysdep_routines += wcsrchr-power7 wcsrchr-power6 wcsrchr-ppc64
-
-CFLAGS-wcsrchr-power7.c += -mcpu=power7
-CFLAGS-wcsrchr-power6.c += -mcpu=power6
-endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
index 9b1e4d1..c0a927d 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
@@ -260,17 +260,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 	      IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
 			      __strncasecmp_l_ppc))
 
-  /* Support sysdeps/powerpc/powerpc64/multiarch/wcschr.c.  */
-  IFUNC_IMPL (i, name, wcsrchr,
-	      IFUNC_IMPL_ADD (array, i, wcsrchr,
-			      hwcap & PPC_FEATURE_HAS_VSX,
-			      __wcsrchr_power7)
-	      IFUNC_IMPL_ADD (array, i, wcsrchr,
-			      hwcap & PPC_FEATURE_ARCH_2_05,
-			      __wcsrchr_power6)
-	      IFUNC_IMPL_ADD (array, i, wcsrchr, 1,
-			      __wcsrchr_ppc))
-
   /* Support sysdeps/powerpc/powerpc64/multiarch/strrchr.c.  */
   IFUNC_IMPL (i, name, strrchr,
 	      IFUNC_IMPL_ADD (array, i, strrchr,
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power6.c b/sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power6.c
deleted file mode 100644
index a68569d..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power6.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* wcsrchr.c - Wide Character Search for powerpc64/power6.
-   Copyright (C) 2013-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power6.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power7.c b/sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power7.c
deleted file mode 100644
index f27553f..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power7.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* wcsrchr.c - Wide Character Search for powerpc64/power7.
-   Copyright (C) 2013-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power7.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcsrchr-ppc64.c b/sysdeps/powerpc/powerpc64/multiarch/wcsrchr-ppc64.c
deleted file mode 100644
index b6504eb..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcsrchr-ppc64.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (C) 2013-2019 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/>.  */
-
-#include <sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c b/sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c
deleted file mode 100644
index 52371a1..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Multiple versions of wcsrchr.
-   Copyright (C) 2013-2019 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/>.  */
-
-#if IS_IN (libc)
-# include <wchar.h>
-# include <shlib-compat.h>
-# include "init-arch.h"
-
-extern __typeof (wcsrchr) __wcsrchr_ppc attribute_hidden;
-extern __typeof (wcsrchr) __wcsrchr_power6 attribute_hidden;
-extern __typeof (wcsrchr) __wcsrchr_power7 attribute_hidden;
-
-libc_ifunc (wcsrchr,
-	     (hwcap & PPC_FEATURE_HAS_VSX)
-             ? __wcsrchr_power7 :
-	       (hwcap & PPC_FEATURE_ARCH_2_05)
-	       ? __wcsrchr_power6
-             : __wcsrchr_ppc);
-#else
-#include <wcsmbs/wcsrchr.c>
-#endif
diff --git a/sysdeps/powerpc/powerpc64/power6/wcsrchr.c b/sysdeps/powerpc/powerpc64/power6/wcsrchr.c
deleted file mode 100644
index b86472d..0000000
--- a/sysdeps/powerpc/powerpc64/power6/wcsrchr.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/powerpc/power6/wcsrchr.c>

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=662c2cc4e9f00ffc789b636db18617538b4d9051

commit 662c2cc4e9f00ffc789b636db18617538b4d9051
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 12 10:05:49 2019 -0300

    wcsmbs: Use loop_unroll on wcsrchr
    
    This allows an architecture to set explicit loop unrolling.
    
    Checked on aarch64-linux-gnu.
    
    	* wcsmbs/wcsrchr.c (WCSRCHR): Use loop_unroll.h to parametrize
    	the loop unroll.

diff --git a/ChangeLog b/ChangeLog
index 33ea5d5..c633bc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-04-04  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* wcsmbs/wcsrchr.c (WCSRCHR): Use loop_unroll.h to parametrize
+	the loop unroll.
+
 	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcschr.c):
 	New rule.
 	* sysdeps/powerpc/power6/wcschr.c: Remove file.
diff --git a/wcsmbs/wcsrchr.c b/wcsmbs/wcsrchr.c
index 0d4bad0..7679534 100644
--- a/wcsmbs/wcsrchr.c
+++ b/wcsmbs/wcsrchr.c
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <wchar.h>
+#include <loop_unroll.h>
 
 #ifndef WCSRCHR
 # define WCSRCHR wcsrchr
@@ -26,12 +27,21 @@
 wchar_t *
 WCSRCHR (const wchar_t *wcs, const wchar_t wc)
 {
-  const wchar_t *retval = NULL;
+  wchar_t *retval = NULL;
 
-  do
-    if (*wcs == wc)
-      retval = wcs;
-  while (*wcs++ != L'\0');
+#define ITERATION(index)		\
+  ({					\
+    if (*wcs == wc)			\
+      retval = (wchar_t*) wcs;		\
+    *wcs++ != L'\0';	\
+  })
 
-  return (wchar_t *) retval;
+#ifndef UNROLL_NTIMES
+# define UNROLL_NTIMES 1
+#endif
+
+  while (1)
+    UNROLL_REPEAT (UNROLL_NTIMES, ITERATION);
+
+  return retval;
 }

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=421e3005ca16627f4fefc51956811c1ca74377f6

commit 421e3005ca16627f4fefc51956811c1ca74377f6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Feb 27 15:15:51 2019 -0300

    powerpc: Use generic wcschr optimization
    
    This patch removes the power6 wcschr optimization and uses generic
    implementation instead.  Currently, both power6 and power7 IFUNC variant
    resulting binary are essentially the same and the generic implementation
    with unrolling loop set to 8 also results in similar performance.
    
    Checked on powerpc64-linux-gnu.
    
    	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcschr.c):
    	New rule.
    	* sysdeps/powerpc/power6/wcschr.c: Remove file.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power6.c:
    	Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power7.c:
    	Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c:
    	Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcschr-power7.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcschr-ppc64.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcschr.c: Likewise.
    	* sysdeps/powerpc/powerpc64/power6/wcschr.c: Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
    	[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcschr-power6 and
    	wcschr-power7.
    	(CFLAGS-wcschr-power7.c, CFLAGS-wcschr-power6.c): Remove rule.
    	* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
    	Remove wcschr optimizations.
    	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 3671de0..33ea5d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
 2019-04-04  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcschr.c):
+	New rule.
+	* sysdeps/powerpc/power6/wcschr.c: Remove file.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power6.c:
+	Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power7.c:
+	Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c:
+	Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcschr-power7.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcschr-ppc64.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcschr.c: Likewise.
+	* sysdeps/powerpc/powerpc64/power6/wcschr.c: Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
+	[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcschr-power6 and
+	wcschr-power7.
+	(CFLAGS-wcschr-power7.c, CFLAGS-wcschr-power6.c): Remove rule.
+	* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
+	Remove wcschr optimizations.
+	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.
+
 	* wcsmbs/wcschr.c (WCSCHR): Use loop_unroll.h to parametrize
 	the loop unroll.
 
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
index ba137e4..35cf1c6 100644
--- a/sysdeps/powerpc/Makefile
+++ b/sysdeps/powerpc/Makefile
@@ -49,4 +49,5 @@ endif
 
 ifeq ($(subdir),wcsmbs)
 CFLAGS-wcscpy.c += -DUNROLL_NTIMES=8
+CFLAGS-wcschr.c += -DUNROLL_NTIMES=8
 endif
diff --git a/sysdeps/powerpc/power6/wcschr.c b/sysdeps/powerpc/power6/wcschr.c
deleted file mode 100644
index e3f9356..0000000
--- a/sysdeps/powerpc/power6/wcschr.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* wcschr.c - Wide Character Search for POWER6+.
-   Copyright (C) 2012-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <wchar.h>
-
-#ifndef WCSCHR
-# define WCSCHR __wcschr
-# define DEFAULT_WCSCHR
-#endif
-
-/* Find the first occurrence of WC in WCS.  */
-wchar_t *
-WCSCHR (const wchar_t *wcs, const wchar_t wc)
-{
-  const wchar_t *wcs2 = wcs + 1;
-
-  if (*wcs == wc)
-    return (wchar_t *) wcs;
-  if (*wcs == L'\0')
-    return NULL;
-
-  do
-    {
-      wcs += 2;
-
-      if (*wcs2 == wc)
-        return (wchar_t *) wcs2;
-      if (*wcs2 == L'\0')
-        return NULL;
-       wcs2 += 2;
-
-      if (*wcs == wc)
-        return (wchar_t *) wcs;
-      if (*wcs == L'\0')
-        return NULL;
-      wcs += 2;
-
-      if (*wcs2 == wc)
-        return (wchar_t *) wcs2;
-      if (*wcs2 == L'\0')
-        return NULL;
-      wcs2 += 2;
-
-      if (*wcs == wc)
-        return (wchar_t *) wcs;
-      if (*wcs == L'\0')
-        return NULL;
-      wcs += 2;
-
-      if (*wcs2 == wc)
-        return (wchar_t *) wcs2;
-      if (*wcs2 == L'\0')
-        return NULL;
-      wcs2 += 2;
-
-      if (*wcs == wc)
-        return (wchar_t *) wcs;
-      if (*wcs == L'\0')
-        return NULL;
-      wcs += 2;
-
-      if (*wcs2 == wc)
-        return (wchar_t *) wcs2;
-      if (*wcs2 == L'\0')
-        return NULL;
-      wcs2 += 2;
-
-      if (*wcs == wc)
-        return (wchar_t *) wcs;
-    }
-  while (*wcs != L'\0');
-
-  return NULL;
-}
-#ifdef DEFAULT_WCSCHR
-libc_hidden_def (__wcschr)
-weak_alias (__wcschr, wcschr)
-libc_hidden_weak (wcschr)
-#else
-libc_hidden_def (wcschr)
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
index f5141bc..bb87c56 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
@@ -17,11 +17,8 @@ CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops
 endif
 
 ifeq ($(subdir),wcsmbs)
-sysdep_routines += wcschr-power7 wcschr-power6 wcschr-ppc32 \
-		   wcsrchr-power7 wcsrchr-power6 wcsrchr-ppc32
+sysdep_routines += wcsrchr-power7 wcsrchr-power6 wcsrchr-ppc32
 
-CFLAGS-wcschr-power7.c += -mcpu=power7
-CFLAGS-wcschr-power6.c += -mcpu=power6
 CFLAGS-wcsrchr-power7.c += -mcpu=power7
 CFLAGS-wcsrchr-power6.c += -mcpu=power6
 endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
index ae581d6..7624c3d 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
@@ -187,17 +187,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 	      IFUNC_IMPL_ADD (array, i, strchr, 1,
 			      __strchr_ppc))
 
-  /* Support sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c.  */
-  IFUNC_IMPL (i, name, wcschr,
-	      IFUNC_IMPL_ADD (array, i, wcschr,
-			      hwcap & PPC_FEATURE_HAS_VSX,
-			      __wcschr_power7)
-	      IFUNC_IMPL_ADD (array, i, wcschr,
-			      hwcap & PPC_FEATURE_ARCH_2_05,
-			      __wcschr_power6)
-	      IFUNC_IMPL_ADD (array, i, wcschr, 1,
-			      __wcschr_ppc))
-
   /* Support sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c.  */
   IFUNC_IMPL (i, name, wcsrchr,
 	      IFUNC_IMPL_ADD (array, i, wcsrchr,
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power6.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power6.c
deleted file mode 100644
index 516f0f8..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power6.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* wcschr.c - Wide Character Search for powerpc32/power6.
-   Copyright (C) 2013-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <wchar.h>
-
-#define WCSCHR __wcschr_power6
-
-#undef libc_hidden_def
-#define libc_hidden_def(name)
-
-#include <sysdeps/powerpc/power6/wcschr.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power7.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power7.c
deleted file mode 100644
index 5dc5265..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power7.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* wcschr.c - Wide Character Search for powerpc32/power7.
-   Copyright (C) 2013-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <wchar.h>
-
-#define WCSCHR __wcschr_power7
-
-#undef libc_hidden_def
-#define libc_hidden_def(name)
-
-#include <sysdeps/powerpc/power6/wcschr.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c
deleted file mode 100644
index 55873fb..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 2013-2019 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/>.  */
-
-#include <wchar.h>
-
-#if IS_IN (libc)
-# undef libc_hidden_weak
-# define libc_hidden_weak(name)
-
-# undef weak_alias
-# undef libc_hidden_def
-
-# ifdef SHARED
-#  define libc_hidden_def(name)  \
-    __hidden_ver1 (__wcschr_ppc, __GI_wcschr, __wcschr_ppc); \
-    strong_alias (__wcschr_ppc, __wcschr_ppc_1); \
-    __hidden_ver1 (__wcschr_ppc_1, __GI___wcschr, __wcschr_ppc_1);
-#  define weak_alias(name,alias)
-# else
-#  define weak_alias(name, alias) \
-    _weak_alias(__wcschr_ppc, __wcschr)
-#  define libc_hidden_def(name)
-# endif /* SHARED  */
-#endif
-
-extern __typeof (wcschr) __wcschr_ppc;
-
-#define WCSCHR  __wcschr_ppc
-#include <wcsmbs/wcschr.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c
deleted file mode 100644
index c8379a2..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Multiple versions of wcschr
-   Copyright (C) 2013-2019 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/>.  */
-
-#if IS_IN (libc)
-# define wcschr __redirect_wcschr
-# include <wchar.h>
-# include <shlib-compat.h>
-# include "init-arch.h"
-
-extern __typeof (__redirect_wcschr) __wcschr_ppc attribute_hidden;
-extern __typeof (__redirect_wcschr) __wcschr_power6 attribute_hidden;
-extern __typeof (__redirect_wcschr) __wcschr_power7 attribute_hidden;
-
-extern __typeof (__redirect_wcschr) __libc_wcschr;
-
-libc_ifunc (__libc_wcschr,
-	     (hwcap & PPC_FEATURE_HAS_VSX)
-             ? __wcschr_power7 :
-	       (hwcap & PPC_FEATURE_ARCH_2_05)
-	       ? __wcschr_power6
-             : __wcschr_ppc);
-#undef wcschr
-weak_alias (__libc_wcschr, wcschr)
-#else
-#include <wcsmbs/wcschr.c>
-#endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/Makefile b/sysdeps/powerpc/powerpc64/multiarch/Makefile
index 3913ef5..c70f4a2 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/multiarch/Makefile
@@ -39,11 +39,8 @@ CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops
 endif
 
 ifeq ($(subdir),wcsmbs)
-sysdep_routines += wcschr-power7 wcschr-power6 wcschr-ppc64 \
-		   wcsrchr-power7 wcsrchr-power6 wcsrchr-ppc64
+sysdep_routines += wcsrchr-power7 wcsrchr-power6 wcsrchr-ppc64
 
-CFLAGS-wcschr-power7.c += -mcpu=power7
-CFLAGS-wcschr-power6.c += -mcpu=power6
 CFLAGS-wcsrchr-power7.c += -mcpu=power7
 CFLAGS-wcsrchr-power6.c += -mcpu=power6
 endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
index 06d33d7..9b1e4d1 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
@@ -261,17 +261,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 			      __strncasecmp_l_ppc))
 
   /* Support sysdeps/powerpc/powerpc64/multiarch/wcschr.c.  */
-  IFUNC_IMPL (i, name, wcschr,
-	      IFUNC_IMPL_ADD (array, i, wcschr,
-			      hwcap & PPC_FEATURE_HAS_VSX,
-			      __wcschr_power7)
-	      IFUNC_IMPL_ADD (array, i, wcschr,
-			      hwcap & PPC_FEATURE_ARCH_2_05,
-			      __wcschr_power6)
-	      IFUNC_IMPL_ADD (array, i, wcschr, 1,
-			      __wcschr_ppc))
-
-  /* Support sysdeps/powerpc/powerpc64/multiarch/wcschr.c.  */
   IFUNC_IMPL (i, name, wcsrchr,
 	      IFUNC_IMPL_ADD (array, i, wcsrchr,
 			      hwcap & PPC_FEATURE_HAS_VSX,
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c b/sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c
deleted file mode 100644
index 029608c..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* wcschr.c - Wide Character Search for powerpc64/power6.
-   Copyright (C) 2013-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power6.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcschr-power7.c b/sysdeps/powerpc/powerpc64/multiarch/wcschr-power7.c
deleted file mode 100644
index 9b11103..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcschr-power7.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* wcschr.c - Wide Character Search for powerpc64/power7.
-   Copyright (C) 2013-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power7.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcschr-ppc64.c b/sysdeps/powerpc/powerpc64/multiarch/wcschr-ppc64.c
deleted file mode 100644
index f956fc0..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcschr-ppc64.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (C) 2013-2019 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/>.  */
-
-#include <sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcschr.c b/sysdeps/powerpc/powerpc64/multiarch/wcschr.c
deleted file mode 100644
index 0a279f0..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcschr.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Multiple versions of wcschr
-   Copyright (C) 2013-2019 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/>.  */
-
-#if IS_IN (libc)
-# define wcschr __redirect_wcschr
-# define __wcschr __redirect___wcschr
-# include <wchar.h>
-# include <shlib-compat.h>
-# include "init-arch.h"
-
-extern __typeof (wcschr) __wcschr_ppc attribute_hidden;
-extern __typeof (wcschr) __wcschr_power6 attribute_hidden;
-extern __typeof (wcschr) __wcschr_power7 attribute_hidden;
-# undef wcschr
-# undef __wcschr
-
-libc_ifunc_redirected (__redirect___wcschr, __wcschr,
-		       (hwcap & PPC_FEATURE_HAS_VSX)
-		       ? __wcschr_power7
-		       : (hwcap & PPC_FEATURE_ARCH_2_05)
-			 ? __wcschr_power6
-			 : __wcschr_ppc);
-weak_alias (__wcschr, wcschr)
-#else
-#undef libc_hidden_def
-#define libc_hidden_def(a)
-#include <wcsmbs/wcschr.c>
-#endif
diff --git a/sysdeps/powerpc/powerpc64/power6/wcschr.c b/sysdeps/powerpc/powerpc64/power6/wcschr.c
deleted file mode 100644
index ae04a13..0000000
--- a/sysdeps/powerpc/powerpc64/power6/wcschr.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/powerpc/power6/wcschr.c>

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7ba0100c6a7f933d32648b7df5d03cb4d75fe301

commit 7ba0100c6a7f933d32648b7df5d03cb4d75fe301
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 12 09:33:03 2019 -0300

    wcsmbs: Use loop_unroll on wcschr
    
    This allows an architecture to set explicit loop unrolling.
    
    Checked on aarch64-linux-gnu.
    
    	* wcsmbs/wcschr.c (WCSCHR): Use loop_unroll.h to parametrize
    	the loop unroll.

diff --git a/ChangeLog b/ChangeLog
index db83b9e..3671de0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-04-04  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* wcsmbs/wcschr.c (WCSCHR): Use loop_unroll.h to parametrize
+	the loop unroll.
+
 	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcscpy.c):
 	New rule.
 	* sysdeps/powerpc/power6/wcscpy.c: Remove file.
diff --git a/wcsmbs/wcschr.c b/wcsmbs/wcschr.c
index cd66b2a..6ed7916 100644
--- a/wcsmbs/wcschr.c
+++ b/wcsmbs/wcschr.c
@@ -16,6 +16,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <wchar.h>
+#include <loop_unroll.h>
 
 #ifndef WCSCHR
 # define WCSCHR __wcschr
@@ -25,12 +26,23 @@
 wchar_t *
 WCSCHR (const wchar_t *wcs, const wchar_t wc)
 {
-  do
-    if (*wcs == wc)
-      return (wchar_t *) wcs;
-  while (*wcs++ != L'\0');
+  wchar_t *dest = NULL;
 
-  return NULL;
+#define ITERATION(index)		\
+  ({					\
+    if (*wcs == wc)			\
+      dest = (wchar_t*) wcs;		\
+    dest == NULL && *wcs++ != L'\0';	\
+  })
+
+#ifndef UNROLL_NTIMES
+# define UNROLL_NTIMES 1
+#endif
+
+  while (1)
+    UNROLL_REPEAT (UNROLL_NTIMES, ITERATION);
+
+  return dest;
 }
 libc_hidden_def (__wcschr)
 weak_alias (__wcschr, wcschr)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=447a1306c3db3fd27be751928cea6892a5867af8

commit 447a1306c3db3fd27be751928cea6892a5867af8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Feb 27 11:21:35 2019 -0300

    powerpc: Use generic wcscpy optimization
    
    This patch removes the power6 wcscpy optimization and uses generic
    implementation instead.  Currently, both power6 and power7 IFUNC variant
    resulting binary are essentially the same and the generic implementation
    with unrolling loop set to 8 also results in similar performance.
    
    Checked on powerpc64-linux-gnu.
    
    	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcscpy.c):
    	New rule.
    	* sysdeps/powerpc/power6/wcscpy.c: Remove file.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power6.c:
    	Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power7.c:
    	Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c:
    	Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcscpy-power6.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcscpy-power7.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcscpy-ppc64.c: Likewise.
    	* sysdeps/powerpc/powerpc64/multiarch/wcscpy.c: Likewise.
    	* sysdeps/powerpc/powerpc64/power6/wcscpy.c: Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
    	[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcscpy-power6 and
    	wcscpy-power7.
    	(CFLAGS-wcscpy-power7.c, CFLAGS-wcscpy-power6.c): Remove rule.
    	* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
    	Remove wcscpy optimizations.
    	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 89558b0..db83b9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
 2019-04-04  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcscpy.c):
+	New rule.
+	* sysdeps/powerpc/power6/wcscpy.c: Remove file.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power6.c:
+	Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power7.c:
+	Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c:
+	Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcscpy-power6.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcscpy-power7.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcscpy-ppc64.c: Likewise.
+	* sysdeps/powerpc/powerpc64/multiarch/wcscpy.c: Likewise.
+	* sysdeps/powerpc/powerpc64/power6/wcscpy.c: Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
+	[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcscpy-power6 and
+	wcscpy-power7.
+	(CFLAGS-wcscpy-power7.c, CFLAGS-wcscpy-power6.c): Remove rule.
+	* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
+	Remove wcscpy optimizations.
+	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.
+
 	* include/loop_unroll.h: New file.
 	* wcsmbs/wcscpy (__wcscpy): Add option to use loop unrolling
 	besides generic implementation.
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
index bac5a3a..ba137e4 100644
--- a/sysdeps/powerpc/Makefile
+++ b/sysdeps/powerpc/Makefile
@@ -46,3 +46,7 @@ sysdep_headers += sys/platform/ppc.h
 tests += test-gettimebase
 tests += tst-set_ppr
 endif
+
+ifeq ($(subdir),wcsmbs)
+CFLAGS-wcscpy.c += -DUNROLL_NTIMES=8
+endif
diff --git a/sysdeps/powerpc/power6/wcscpy.c b/sysdeps/powerpc/power6/wcscpy.c
deleted file mode 100644
index 11c04b0..0000000
--- a/sysdeps/powerpc/power6/wcscpy.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* wcscpy.c - Wide Character Copy for POWER6+.
-   Copyright (C) 2012-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <stddef.h>
-#include <wchar.h>
-
-#ifndef WCSCPY
-# define WCSCPY wcscpy
-#endif
-
-/* Copy SRC to DEST.  */
-wchar_t *
-WCSCPY (wchar_t *dest, const wchar_t *src)
-{
-  wint_t c,d;
-  wchar_t *wcp, *wcp2;
-
-  if (__alignof__ (wchar_t) >= sizeof (wchar_t))
-    {
-      const ptrdiff_t off = dest - src;
-
-      wcp = (wchar_t *) src;
-      wcp2 = wcp + 1 ;
-
-      do
-        {
-          d = *wcp;
-          wcp[off] = d;
-          if (d == L'\0')
-            return dest;
-          wcp += 2;
-
-          c = *wcp2;
-          wcp2[off] = c;
-          if (c == L'\0')
-            return dest;
-          wcp2 += 2;
-
-          d = *wcp;
-          wcp[off] = d;
-          if (d == L'\0')
-            return dest;
-          wcp += 2;
-
-          c = *wcp2;
-          wcp2[off] = c;
-          if (c == L'\0')
-            return dest;
-          wcp2 += 2;
-
-          d = *wcp;
-          wcp[off] = d;
-          if (d == L'\0')
-            return dest;
-          wcp += 2;
-
-          c = *wcp2;
-          wcp2[off] = c;
-          if (c == L'\0')
-            return dest;
-          wcp2 += 2;
-
-          d = *wcp;
-          wcp[off] = d;
-          if (d == L'\0')
-            return dest;
-          wcp += 2;
-
-          c = *wcp2;
-          wcp2[off] = c;
-          if (c == L'\0')
-            return dest;
-          wcp2 += 2;
-        }
-      while (c != L'\0');
-
-    }
-  else
-    {
-      wcp = dest;
-
-      do
-        {
-          c = *src++;
-          *wcp++ = c;
-        }
-      while (c != L'\0');
-    }
-  return dest;
-}
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
index bd9d360..f5141bc 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
@@ -18,13 +18,10 @@ endif
 
 ifeq ($(subdir),wcsmbs)
 sysdep_routines += wcschr-power7 wcschr-power6 wcschr-ppc32 \
-		   wcsrchr-power7 wcsrchr-power6 wcsrchr-ppc32 \
-		   wcscpy-power7 wcscpy-power6 wcscpy-ppc32
+		   wcsrchr-power7 wcsrchr-power6 wcsrchr-ppc32
 
 CFLAGS-wcschr-power7.c += -mcpu=power7
 CFLAGS-wcschr-power6.c += -mcpu=power6
 CFLAGS-wcsrchr-power7.c += -mcpu=power7
 CFLAGS-wcsrchr-power6.c += -mcpu=power6
-CFLAGS-wcscpy-power7.c += -mcpu=power7
-CFLAGS-wcscpy-power6.c += -mcpu=power6
 endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
index bcd38e0..ae581d6 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
@@ -209,16 +209,5 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 	      IFUNC_IMPL_ADD (array, i, wcsrchr, 1,
 			      __wcsrchr_ppc))
 
-  /* Support sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c.  */
-  IFUNC_IMPL (i, name, wcscpy,
-	      IFUNC_IMPL_ADD (array, i, wcscpy,
-			      hwcap & PPC_FEATURE_HAS_VSX,
-			      __wcscpy_power7)
-	      IFUNC_IMPL_ADD (array, i, wcscpy,
-			      hwcap & PPC_FEATURE_ARCH_2_05,
-			      __wcscpy_power6)
-	      IFUNC_IMPL_ADD (array, i, wcscpy, 1,
-			      __wcscpy_ppc))
-
   return i;
 }
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power6.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power6.c
deleted file mode 100644
index 5bb0c82..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power6.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 2013-2019 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/>.  */
-
-#include <wchar.h>
-
-#define WCSCPY __wcscpy_power6
-
-#include <sysdeps/powerpc/power6/wcscpy.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power7.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power7.c
deleted file mode 100644
index 5375094..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power7.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 2013-2019 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/>.  */
-
-#include <wchar.h>
-
-#define WCSCPY __wcscpy_power7
-
-#include <sysdeps/powerpc/power6/wcscpy.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c
deleted file mode 100644
index 31e0d81..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 2013-2019 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/>.  */
-
-#include <wchar.h>
-
-extern __typeof (wcscpy) __wcscpy_ppc;
-
-#define WCSCPY  __wcscpy_ppc
-#include <wcsmbs/wcscpy.c>
-
-#ifdef SHARED
-__hidden_ver1 (__wcscpy_ppc, __GI___wcscpy, __wcscpy_ppc);
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c
deleted file mode 100644
index 0daf55c..0000000
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Multiple versions of wcscpy
-   Copyright (C) 2013-2019 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/>.  */
-
-#if IS_IN (libc)
-# define __wcscpy __redirect_wcscpy
-# include <wchar.h>
-# undef __wcscpy
-# include "init-arch.h"
-
-extern __typeof (__redirect_wcscpy) __wcscpy_ppc attribute_hidden;
-extern __typeof (__redirect_wcscpy) __wcscpy_power6 attribute_hidden;
-extern __typeof (__redirect_wcscpy) __wcscpy_power7 attribute_hidden;
-
-libc_ifunc_redirected (__redirect_wcscpy, __wcscpy,
-		       (hwcap & PPC_FEATURE_HAS_VSX)
-		       ? __wcscpy_power7 :
-			 (hwcap & PPC_FEATURE_ARCH_2_05)
-			 ? __wcscpy_power6
-		       : __wcscpy_ppc);
-weak_alias (__wcscpy, wcscpy)
-#endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/Makefile b/sysdeps/powerpc/powerpc64/multiarch/Makefile
index 963ea84..3913ef5 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/multiarch/Makefile
@@ -40,13 +40,10 @@ endif
 
 ifeq ($(subdir),wcsmbs)
 sysdep_routines += wcschr-power7 wcschr-power6 wcschr-ppc64 \
-		   wcsrchr-power7 wcsrchr-power6 wcsrchr-ppc64 \
-		   wcscpy-power7 wcscpy-power6 wcscpy-ppc64 \
+		   wcsrchr-power7 wcsrchr-power6 wcsrchr-ppc64
 
 CFLAGS-wcschr-power7.c += -mcpu=power7
 CFLAGS-wcschr-power6.c += -mcpu=power6
 CFLAGS-wcsrchr-power7.c += -mcpu=power7
 CFLAGS-wcsrchr-power6.c += -mcpu=power6
-CFLAGS-wcscpy-power7.c += -mcpu=power7
-CFLAGS-wcscpy-power6.c += -mcpu=power6
 endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
index 8d91d9a..06d33d7 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
@@ -282,17 +282,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 	      IFUNC_IMPL_ADD (array, i, wcsrchr, 1,
 			      __wcsrchr_ppc))
 
-  /* Support sysdeps/powerpc/powerpc64/multiarch/wcscpy.c.  */
-  IFUNC_IMPL (i, name, wcscpy,
-	      IFUNC_IMPL_ADD (array, i, wcscpy,
-			      hwcap & PPC_FEATURE_HAS_VSX,
-			      __wcscpy_power7)
-	      IFUNC_IMPL_ADD (array, i, wcscpy,
-			      hwcap & PPC_FEATURE_ARCH_2_05,
-			      __wcscpy_power6)
-	      IFUNC_IMPL_ADD (array, i, wcscpy, 1,
-			      __wcscpy_ppc))
-
   /* Support sysdeps/powerpc/powerpc64/multiarch/strrchr.c.  */
   IFUNC_IMPL (i, name, strrchr,
 	      IFUNC_IMPL_ADD (array, i, strrchr,
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcscpy-power6.c b/sysdeps/powerpc/powerpc64/multiarch/wcscpy-power6.c
deleted file mode 100644
index abe2e0f..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcscpy-power6.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* wcscpy.c - Wide Character Search for powerpc64/power6.
-   Copyright (C) 2013-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power6.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcscpy-power7.c b/sysdeps/powerpc/powerpc64/multiarch/wcscpy-power7.c
deleted file mode 100644
index be95cd9..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcscpy-power7.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* wcscpy.c - Wide Character Search for powerpc64/power7.
-   Copyright (C) 2013-2019 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power7.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcscpy-ppc64.c b/sysdeps/powerpc/powerpc64/multiarch/wcscpy-ppc64.c
deleted file mode 100644
index faa3c16..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcscpy-ppc64.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (C) 2013-2019 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/>.  */
-
-#include <sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcscpy.c b/sysdeps/powerpc/powerpc64/multiarch/wcscpy.c
deleted file mode 100644
index 3f918b2..0000000
--- a/sysdeps/powerpc/powerpc64/multiarch/wcscpy.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Multiple versions of wcscpy.
-   Copyright (C) 2013-2019 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/>.  */
-
-#define __wcscpy __redirect___wcscpy
-#include <wchar.h>
-#undef __wcscpy
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (wcscpy) __wcscpy_ppc attribute_hidden;
-extern __typeof (wcscpy) __wcscpy_power6 attribute_hidden;
-extern __typeof (wcscpy) __wcscpy_power7 attribute_hidden;
-
-libc_ifunc_redirected (__redirect___wcscpy, __wcscpy,
-		       (hwcap & PPC_FEATURE_HAS_VSX)
-		       ? __wcscpy_power7 :
-		         (hwcap & PPC_FEATURE_ARCH_2_05)
-		         ? __wcscpy_power6
-	               : __wcscpy_ppc);
-weak_alias (__wcscpy, wcscpy)
diff --git a/sysdeps/powerpc/powerpc64/power6/wcscpy.c b/sysdeps/powerpc/powerpc64/power6/wcscpy.c
deleted file mode 100644
index 59cfb28..0000000
--- a/sysdeps/powerpc/powerpc64/power6/wcscpy.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#define WCSCPY __wcscpy
-#include <sysdeps/powerpc/power6/wcscpy.c>
-libc_hidden_def (__wcscpy)
-weak_alias (__wcscpy, wcscpy)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e3fd0b0e93a7b49a2f26640633fb2643c460ff4a

commit e3fd0b0e93a7b49a2f26640633fb2643c460ff4a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon Mar 11 23:39:15 2019 -0300

    wcsmbs: Add wcscpy loop unroll option
    
    This allows an architecture to use the old generic implementation
    and also set explicit loop unrolling.
    
    Checked on aarch64-linux-gnu.
    
    	* include/loop_unroll.h: New file.
    	* wcsmbs/wcscpy (__wcscpy): Add option to use loop unrolling
    	besides generic implementation.

diff --git a/ChangeLog b/ChangeLog
index b5c13e8..89558b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-04-04  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+	* include/loop_unroll.h: New file.
+	* wcsmbs/wcscpy (__wcscpy): Add option to use loop unrolling
+	besides generic implementation.
+
 2019-04-03  DJ Delorie  <dj@redhat.com>
 
 	* time/tst-strftime3.c (tm_to_printed): Disable warning about
diff --git a/include/loop_unroll.h b/include/loop_unroll.h
new file mode 100644
index 0000000..d6a84e6
--- /dev/null
+++ b/include/loop_unroll.h
@@ -0,0 +1,78 @@
+/* Macro for explicit loop unrolling.
+   Copyright (C) 2019 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 _LOOP_UNROLL_H
+#define _LOOP_UNROLL_H
+
+/* Loop unroll macro to be used for explicit force loop unrolling with a
+   configurable number of iterations.  The idea is to make the loop unrolling
+   independent of whether the compiler is able to unroll through specific
+   optimizations options (-funroll-loops or -funroll-all-loops).
+
+   For instance, to implement strcpy with SRC being the source input and
+   DEST the destination buffer, it is expected the macro to be used in this
+   way:
+
+     #define ITERATION(index)	\
+       ({ char c = *str++; *dest++ = c; c != '\0' })
+
+     while (1)
+       UNROLL_REPEAT (4, ITERATION)
+
+   The loop will be manually unrolled 4 times.  Another option is to do
+   the index update after the tests:
+
+     #define ITERATION(index)	\
+       ({ char c = *(str + index); *(dest + index) = c; c != '\0' })
+     #define UPDATE(n)		\
+       str += n; dst += n
+
+     while (1)
+       UNROLL_REPEAT_UPDATE (4, ITERATION, UPDATE)
+
+   The loop will be manually unrolled 4 times and the SRC and DEST pointers
+   will be updated only after the last iteration.
+
+   Currently, both macros unroll the loop 8 times at maximum.  */
+
+#define UNROLL_REPEAT_1(X)    if (!X(0)) break;
+#define UNROLL_REPEAT_2(X)    UNROLL_REPEAT_1 (X) if (!X (1)) break;
+#define UNROLL_REPEAT_3(X)    UNROLL_REPEAT_2 (X) if (!X (2)) break;
+#define UNROLL_REPEAT_4(X)    UNROLL_REPEAT_3 (X) if (!X (3)) break;
+#define UNROLL_REPEAT_5(X)    UNROLL_REPEAT_4 (X) if (!X (4)) break;
+#define UNROLL_REPEAT_6(X)    UNROLL_REPEAT_5 (X) if (!X (5)) break;
+#define UNROLL_REPEAT_7(X)    UNROLL_REPEAT_6 (X) if (!X (6)) break;
+#define UNROLL_REPEAT_8(X)    UNROLL_REPEAT_7 (X) if (!X (7)) break;
+
+#define UNROLL_EXPAND(...)    __VA_ARGS__
+
+#define UNROLL_REPEAT__(N, X) UNROLL_EXPAND(UNROLL_REPEAT_ ## N) (X)
+#define UNROLL_REPEAT_(N, X)  UNROLL_REPEAT__ (N, X)
+
+#define UNROLL_REPEAT(N, X)                \
+  (void) ({                                \
+    UNROLL_REPEAT_ (UNROLL_EXPAND(N), X);  \
+  })
+
+#define UNROLL_REPEAT_UPDATE(N, X, U)      \
+  (void) ({                                \
+    UNROLL_REPEAT_ (UNROLL_EXPAND(N), X);  \
+    UPDATE (N);                            \
+  })
+
+#endif
diff --git a/wcsmbs/wcscpy.c b/wcsmbs/wcscpy.c
index 6fb2969..36c001f 100644
--- a/wcsmbs/wcscpy.c
+++ b/wcsmbs/wcscpy.c
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <wchar.h>
+#include <loop_unroll.h>
 
 
 #ifdef WCSCPY
@@ -27,7 +28,25 @@
 wchar_t *
 __wcscpy (wchar_t *dest, const wchar_t *src)
 {
+#ifndef UNROLL_NTIMES
   return __wmemcpy (dest, src, __wcslen (src) + 1);
+#else
+  /* Some architectures might have costly tail function call (powerpc
+     for instance) where wmemcpy call overhead for smalls sizes might
+     be more costly than just unrolling the main loop.  */
+  wchar_t *wcp = dest;
+
+#define ITERATION(index)		\
+  ({					\
+     wchar_t c = *src++;		\
+     *wcp++ = c;			\
+     c != L'\0';			\
+  })
+
+  while (1)
+    UNROLL_REPEAT(UNROLL_NTIMES, ITERATION);
+  return dest;
+#endif
 }
 #ifndef WCSCPY
 weak_alias (__wcscpy, wcscpy)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   84 ++++++++++++++++
 include/loop_unroll.h                              |   78 +++++++++++++++
 sysdeps/powerpc/Makefile                           |    6 +
 sysdeps/powerpc/power6/wcschr.c                    |   96 ------------------
 sysdeps/powerpc/power6/wcscpy.c                    |  105 --------------------
 sysdeps/powerpc/power6/wcsrchr.c                   |   89 -----------------
 .../powerpc/powerpc32/power4/multiarch/Makefile    |   13 ---
 .../powerpc32/power4/multiarch/ifunc-impl-list.c   |   33 ------
 .../powerpc32/power4/multiarch/wcschr-power6.c     |   26 -----
 .../powerpc32/power4/multiarch/wcschr-power7.c     |   26 -----
 .../powerpc32/power4/multiarch/wcschr-ppc32.c      |   43 --------
 .../powerpc/powerpc32/power4/multiarch/wcschr.c    |   41 --------
 .../powerpc32/power4/multiarch/wcscpy-power6.c     |   22 ----
 .../powerpc32/power4/multiarch/wcscpy-power7.c     |   22 ----
 .../powerpc32/power4/multiarch/wcscpy-ppc32.c      |   27 -----
 .../powerpc/powerpc32/power4/multiarch/wcscpy.c    |   36 -------
 .../powerpc32/power4/multiarch/wcsrchr-power6.c    |   20 ----
 .../powerpc32/power4/multiarch/wcsrchr-power7.c    |   20 ----
 .../powerpc32/power4/multiarch/wcsrchr-ppc32.c     |   26 -----
 .../powerpc/powerpc32/power4/multiarch/wcsrchr.c   |   36 -------
 sysdeps/powerpc/powerpc64/multiarch/Makefile       |   13 ---
 .../powerpc/powerpc64/multiarch/ifunc-impl-list.c  |   33 ------
 .../powerpc/powerpc64/multiarch/wcschr-power6.c    |   19 ----
 .../powerpc/powerpc64/multiarch/wcschr-power7.c    |   19 ----
 sysdeps/powerpc/powerpc64/multiarch/wcschr-ppc64.c |   18 ----
 sysdeps/powerpc/powerpc64/multiarch/wcschr.c       |   43 --------
 .../powerpc/powerpc64/multiarch/wcscpy-power6.c    |   19 ----
 .../powerpc/powerpc64/multiarch/wcscpy-power7.c    |   19 ----
 sysdeps/powerpc/powerpc64/multiarch/wcscpy-ppc64.c |   18 ----
 sysdeps/powerpc/powerpc64/multiarch/wcscpy.c       |   35 -------
 .../powerpc/powerpc64/multiarch/wcsrchr-power6.c   |   19 ----
 .../powerpc/powerpc64/multiarch/wcsrchr-power7.c   |   19 ----
 .../powerpc/powerpc64/multiarch/wcsrchr-ppc64.c    |   18 ----
 sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c      |   36 -------
 sysdeps/powerpc/powerpc64/power6/wcschr.c          |    1 -
 sysdeps/powerpc/powerpc64/power6/wcscpy.c          |    4 -
 sysdeps/powerpc/powerpc64/power6/wcsrchr.c         |    1 -
 wcsmbs/wcschr.c                                    |   22 +++-
 wcsmbs/wcscpy.c                                    |   19 ++++
 wcsmbs/wcsrchr.c                                   |   22 +++-
 40 files changed, 220 insertions(+), 1026 deletions(-)
 create mode 100644 include/loop_unroll.h
 delete mode 100644 sysdeps/powerpc/power6/wcschr.c
 delete mode 100644 sysdeps/powerpc/power6/wcscpy.c
 delete mode 100644 sysdeps/powerpc/power6/wcsrchr.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power7.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power7.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power7.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcschr-power7.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcschr-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcschr.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcscpy-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcscpy-power7.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcscpy-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcscpy.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power7.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcsrchr-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c
 delete mode 100644 sysdeps/powerpc/powerpc64/power6/wcschr.c
 delete mode 100644 sysdeps/powerpc/powerpc64/power6/wcscpy.c
 delete mode 100644 sysdeps/powerpc/powerpc64/power6/wcsrchr.c


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]