unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3] powerpc: remove power6 wcscpy optimization
@ 2019-03-04 19:43 Adhemerval Zanella
  2019-03-04 19:43 ` [PATCH 2/3] powerpc: remove power6 wcschr optimization Adhemerval Zanella
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2019-03-04 19:43 UTC (permalink / raw
  To: libc-alpha

This patch removes the power6 wcscpy optimization.  It is rarely
int real word codo, the optimizations can be potentially implemented
in generic code (which would also benefit not only powerpc), and
the power6 and power7 resulting binary are essentially the same.

Checked on powerpc64-linux-gnu.

	* 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/ifunc-impl-list.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/power6/wcscpy.c               | 105 ------------------
 .../powerpc32/power4/multiarch/Makefile       |   5 +-
 .../power4/multiarch/ifunc-impl-list.c        |  11 --
 .../power4/multiarch/wcscpy-power6.c          |  22 ----
 .../power4/multiarch/wcscpy-power7.c          |  22 ----
 .../powerpc32/power4/multiarch/wcscpy-ppc32.c |  27 -----
 .../powerpc32/power4/multiarch/wcscpy.c       |  36 ------
 sysdeps/powerpc/powerpc64/multiarch/Makefile  |   5 +-
 .../powerpc64/multiarch/ifunc-impl-list.c     |  11 --
 .../powerpc64/multiarch/wcscpy-power6.c       |  19 ----
 .../powerpc64/multiarch/wcscpy-power7.c       |  19 ----
 .../powerpc64/multiarch/wcscpy-ppc64.c        |  18 ---
 sysdeps/powerpc/powerpc64/multiarch/wcscpy.c  |  35 ------
 sysdeps/powerpc/powerpc64/power6/wcscpy.c     |   1 -
 14 files changed, 2 insertions(+), 334 deletions(-)
 delete mode 100644 sysdeps/powerpc/power6/wcscpy.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/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/power6/wcscpy.c

diff --git a/sysdeps/powerpc/power6/wcscpy.c b/sysdeps/powerpc/power6/wcscpy.c
deleted file mode 100644
index 11c04b081a..0000000000
--- 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 bd9d360efa..f5141bc5b5 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 bcd38e0f79..ae581d62f8 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 5bb0c82462..0000000000
--- 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 5375094b60..0000000000
--- 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 31e0d81ef0..0000000000
--- 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 0daf55cf70..0000000000
--- 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 963ea84dbf..3913ef580e 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 8d91d9abb9..06d33d71e0 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 abe2e0f073..0000000000
--- 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 be95cd9074..0000000000
--- 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 faa3c1614f..0000000000
--- 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 3f918b27c6..0000000000
--- 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 722c8f995b..0000000000
--- a/sysdeps/powerpc/powerpc64/power6/wcscpy.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/powerpc/power6/wcscpy.c>
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] powerpc: remove power6 wcschr optimization
  2019-03-04 19:43 [PATCH 1/3] powerpc: remove power6 wcscpy optimization Adhemerval Zanella
@ 2019-03-04 19:43 ` Adhemerval Zanella
  2019-03-04 19:43 ` [PATCH 3/3] powerpc: remove power6 wcsrchr optimization Adhemerval Zanella
  2019-03-09 16:08 ` [PATCH 1/3] powerpc: remove power6 wcscpy optimization Gabriel F. T. Gomes
  2 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2019-03-04 19:43 UTC (permalink / raw
  To: libc-alpha

This patch removes the power6 wcschr optimization.  It is rarely
int real word codo, the optimizations can be potentially implemented
in generic code (which would also benefit not only powerpc), and
the power6 and power7 resulting binary are essentially the same.

Checked on powerpc64-linux-gnu.

	* 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/ifunc-impl-list.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/power6/wcschr.c               | 96 -------------------
 .../powerpc32/power4/multiarch/Makefile       |  5 +-
 .../power4/multiarch/ifunc-impl-list.c        | 11 ---
 .../power4/multiarch/wcschr-power6.c          | 26 -----
 .../power4/multiarch/wcschr-power7.c          | 26 -----
 .../powerpc32/power4/multiarch/wcschr-ppc32.c | 43 ---------
 .../powerpc32/power4/multiarch/wcschr.c       | 41 --------
 sysdeps/powerpc/powerpc64/multiarch/Makefile  |  5 +-
 .../powerpc64/multiarch/ifunc-impl-list.c     | 11 ---
 .../powerpc64/multiarch/wcschr-power6.c       | 19 ----
 .../powerpc64/multiarch/wcschr-power7.c       | 19 ----
 .../powerpc64/multiarch/wcschr-ppc64.c        | 18 ----
 sysdeps/powerpc/powerpc64/multiarch/wcschr.c  | 43 ---------
 sysdeps/powerpc/powerpc64/power6/wcschr.c     |  1 -
 14 files changed, 2 insertions(+), 362 deletions(-)
 delete mode 100644 sysdeps/powerpc/power6/wcschr.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/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/power6/wcschr.c

diff --git a/sysdeps/powerpc/power6/wcschr.c b/sysdeps/powerpc/power6/wcschr.c
deleted file mode 100644
index e3f93569dd..0000000000
--- 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 f5141bc5b5..bb87c56b4d 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 ae581d62f8..7624c3d5f0 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 516f0f8584..0000000000
--- 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 5dc52659e8..0000000000
--- 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 55873fbcf4..0000000000
--- 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 c8379a2dca..0000000000
--- 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 3913ef580e..c70f4a2b5a 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 06d33d71e0..9b1e4d141d 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, 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,
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c b/sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c
deleted file mode 100644
index 029608c512..0000000000
--- 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 9b11103976..0000000000
--- 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 f956fc0aa2..0000000000
--- 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 0a279f0dd2..0000000000
--- 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 ae04a130cc..0000000000
--- a/sysdeps/powerpc/powerpc64/power6/wcschr.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/powerpc/power6/wcschr.c>
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] powerpc: remove power6 wcsrchr optimization
  2019-03-04 19:43 [PATCH 1/3] powerpc: remove power6 wcscpy optimization Adhemerval Zanella
  2019-03-04 19:43 ` [PATCH 2/3] powerpc: remove power6 wcschr optimization Adhemerval Zanella
@ 2019-03-04 19:43 ` Adhemerval Zanella
  2019-03-09 16:08 ` [PATCH 1/3] powerpc: remove power6 wcscpy optimization Gabriel F. T. Gomes
  2 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2019-03-04 19:43 UTC (permalink / raw
  To: libc-alpha

This patch removes the power6 wcsrchr optimization.  It is rarely
int real word codo, the optimizations can be potentially implemented
in generic code (which would also benefit not only powerpc), and
the power6 and power7 resulting binary are essentially the same.

Checked on powerpc64-linux-gnu.

	* 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/ifunc-impl-list.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/power6/wcsrchr.c              | 89 -------------------
 .../powerpc32/power4/multiarch/Makefile       |  7 --
 .../power4/multiarch/ifunc-impl-list.c        | 11 ---
 .../power4/multiarch/wcsrchr-power6.c         | 20 -----
 .../power4/multiarch/wcsrchr-power7.c         | 20 -----
 .../power4/multiarch/wcsrchr-ppc32.c          | 26 ------
 .../powerpc32/power4/multiarch/wcsrchr.c      | 36 --------
 sysdeps/powerpc/powerpc64/multiarch/Makefile  |  7 --
 .../powerpc64/multiarch/ifunc-impl-list.c     | 11 ---
 .../powerpc64/multiarch/wcsrchr-power6.c      | 19 ----
 .../powerpc64/multiarch/wcsrchr-power7.c      | 19 ----
 .../powerpc64/multiarch/wcsrchr-ppc64.c       | 18 ----
 sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c | 36 --------
 sysdeps/powerpc/powerpc64/power6/wcsrchr.c    |  1 -
 14 files changed, 320 deletions(-)
 delete mode 100644 sysdeps/powerpc/power6/wcsrchr.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/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/wcsrchr.c

diff --git a/sysdeps/powerpc/power6/wcsrchr.c b/sysdeps/powerpc/power6/wcsrchr.c
deleted file mode 100644
index 1762bd276c..0000000000
--- 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 bb87c56b4d..5c68f07d19 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 7624c3d5f0..16a64beb33 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 93c8bde9ba..0000000000
--- 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 a32a9845b7..0000000000
--- 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 690faf48b8..0000000000
--- 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 80adc7bcd1..0000000000
--- 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 c70f4a2b5a..ea936bf9ed 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 9b1e4d141d..c0a927d73e 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 a68569d30c..0000000000
--- 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 f27553f4ab..0000000000
--- 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 b6504ebaef..0000000000
--- 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 52371a18b7..0000000000
--- 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 b86472d7bd..0000000000
--- a/sysdeps/powerpc/powerpc64/power6/wcsrchr.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/powerpc/power6/wcsrchr.c>
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] powerpc: remove power6 wcscpy optimization
  2019-03-04 19:43 [PATCH 1/3] powerpc: remove power6 wcscpy optimization Adhemerval Zanella
  2019-03-04 19:43 ` [PATCH 2/3] powerpc: remove power6 wcschr optimization Adhemerval Zanella
  2019-03-04 19:43 ` [PATCH 3/3] powerpc: remove power6 wcsrchr optimization Adhemerval Zanella
@ 2019-03-09 16:08 ` Gabriel F. T. Gomes
  2019-03-11 13:02   ` Adhemerval Zanella
  2 siblings, 1 reply; 7+ messages in thread
From: Gabriel F. T. Gomes @ 2019-03-09 16:08 UTC (permalink / raw
  To: Adhemerval Zanella; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 2807 bytes --]

On Mon, Mar 04 2019, Adhemerval Zanella wrote:
> This patch removes the power6 wcscpy optimization.  It is rarely
> int real word codo, the optimizations can be potentially implemented
> in generic code (which would also benefit not only powerpc), and
> the power6 and power7 resulting binary are essentially the same.

Although I agree that optimizations could be implemented in generic
code, and that it might benefit other architectures, I tested this patch
and it causes large performance regressions in benchtests, when ran on
Power8 and Power9 machines (Power 7 numbers were OK).  Based on that
result (which I shall present and discuss later in this message), I
think this patch should not be committed to master.

I am aware that this patch has the additional benefit of easing code
maintenance, however, the performance impact on Power would be seen
immediately, while the benefit of an optimization to the generic
algorithm would need more time to implement.  Thus, I suggest that this
patch be delayed until we have such implementation.


Now, regarding the results, I have attached a few spreadsheets, each
containing the raw data collected from 'make bench' runs on different
machines, as well as comparisons between the master branch and another
branch with this patch applied.

  attachment/wcscpy-LE-P9.ods: Runs on a Power 9, little-endian machine.
  attachment/wcscpy-LE-P8.ods: Runs on a Power 8, little-endian machine.
  attachment/wcscpy-BE-P8.ods: Runs on a Power 8, big-endian machine.
  attachment/wcscpy-BE-P7.ods: Runs on a Power 7, big-endian machine.

In each of these files, each sheet is named according to the data it
contains: for instance, 'master - cpu=p8' contains the raw data
collected from a build of the master branch, which has been configured
with --with-cpu=power8.  Likewise, 'patched - cpu=p8' contains similar
data, but from a build of a branch with this patch applied.  Finally, a
sheet named 'compare p8' contains the performance comparison between the
two.  In such 'compare pN' sheets, I added a graph of the performance
comparison of the two, in which the data is sorted from worst to best
case, so that we can have a visual assessment of how good or bad the
change is for the whole set of inputs tested (I believe that this kind
of plot is common practice, but I'm not sure, hence this explanation).

In wcscpy-BE-P8.ods, wcscpy-LE-P8.ods, and wcscpy-LE-P9.ods, we can see
that, for allmost all inputs, there is a performance regression (dots
below 0% are regressions).  On wcscpy-BE-P7.ods, there are more
performance gains than regressions, and I would be OK with this patch
being applied to master, if it weren't for the P8 and P9 results.

PS: I have not yet tested the other patches in this patch set.  This
message is only about this specific patch.

[-- Attachment #2: wcscpy-LE-P9.ods --]
[-- Type: application/vnd.oasis.opendocument.spreadsheet, Size: 462613 bytes --]

[-- Attachment #3: wcscpy-LE-P8.ods --]
[-- Type: application/vnd.oasis.opendocument.spreadsheet, Size: 239794 bytes --]

[-- Attachment #4: wcscpy-BE-P8.ods --]
[-- Type: application/vnd.oasis.opendocument.spreadsheet, Size: 462752 bytes --]

[-- Attachment #5: wcscpy-BE-P7.ods --]
[-- Type: application/vnd.oasis.opendocument.spreadsheet, Size: 254580 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] powerpc: remove power6 wcscpy optimization
  2019-03-09 16:08 ` [PATCH 1/3] powerpc: remove power6 wcscpy optimization Gabriel F. T. Gomes
@ 2019-03-11 13:02   ` Adhemerval Zanella
  2019-03-11 19:04     ` Gabriel F. T. Gomes
  0 siblings, 1 reply; 7+ messages in thread
From: Adhemerval Zanella @ 2019-03-11 13:02 UTC (permalink / raw
  To: Gabriel F. T. Gomes; +Cc: libc-alpha



On 09/03/2019 13:08, Gabriel F. T. Gomes wrote:
> On Mon, Mar 04 2019, Adhemerval Zanella wrote:
>> This patch removes the power6 wcscpy optimization.  It is rarely
>> int real word codo, the optimizations can be potentially implemented
>> in generic code (which would also benefit not only powerpc), and
>> the power6 and power7 resulting binary are essentially the same.
> 
> Although I agree that optimizations could be implemented in generic
> code, and that it might benefit other architectures, I tested this patch
> and it causes large performance regressions in benchtests, when ran on
> Power8 and Power9 machines (Power 7 numbers were OK).  Based on that
> result (which I shall present and discuss later in this message), I
> think this patch should not be committed to master.
> 
> I am aware that this patch has the additional benefit of easing code
> maintenance, however, the performance impact on Power would be seen
> immediately, while the benefit of an optimization to the generic
> algorithm would need more time to implement.  Thus, I suggest that this
> patch be delayed until we have such implementation.
> 
> 
> Now, regarding the results, I have attached a few spreadsheets, each
> containing the raw data collected from 'make bench' runs on different
> machines, as well as comparisons between the master branch and another
> branch with this patch applied.
> 
>   attachment/wcscpy-LE-P9.ods: Runs on a Power 9, little-endian machine.
>   attachment/wcscpy-LE-P8.ods: Runs on a Power 8, little-endian machine.
>   attachment/wcscpy-BE-P8.ods: Runs on a Power 8, big-endian machine.
>   attachment/wcscpy-BE-P7.ods: Runs on a Power 7, big-endian machine.
> 
> In each of these files, each sheet is named according to the data it
> contains: for instance, 'master - cpu=p8' contains the raw data
> collected from a build of the master branch, which has been configured
> with --with-cpu=power8.  Likewise, 'patched - cpu=p8' contains similar
> data, but from a build of a branch with this patch applied.  Finally, a
> sheet named 'compare p8' contains the performance comparison between the
> two.  In such 'compare pN' sheets, I added a graph of the performance
> comparison of the two, in which the data is sorted from worst to best
> case, so that we can have a visual assessment of how good or bad the
> change is for the whole set of inputs tested (I believe that this kind
> of plot is common practice, but I'm not sure, hence this explanation).
> 
> In wcscpy-BE-P8.ods, wcscpy-LE-P8.ods, and wcscpy-LE-P9.ods, we can see
> that, for allmost all inputs, there is a performance regression (dots
> below 0% are regressions).  On wcscpy-BE-P7.ods, there are more
> performance gains than regressions, and I would be OK with this patch
> being applied to master, if it weren't for the P8 and P9 results.
> 
> PS: I have not yet tested the other patches in this patch set.  This
> message is only about this specific patch.
> 

Yes, I am aware this is a performance regression on power. Specifically
for wcscpy it would require 3 call functions call: wcslen follower by
wmemcpy and memcpy (and it is worse on powerpc64le abi which does not
allow tail-cail optimization).

The main question here is should we really care to optimize wcs* 
routines at all? 

  - Mostly uses I could find on https://codesearch.debian.net are for
    Win32 routines (which uses UTF16 as default).

  - gnulib define the wchar module as obsolete and even on the project
    that does it, it is tied to windows routines.

  - wide char routine are inherit problematic regarding portability
    (standard does not define wchar_t size).

  - Although some runtime environments might use UTF16 as default
    (JavaScript, java, Qt, Python), afaik they do not rely on C runtime
    exactly for the previous issue and they reimplement all string
    routines internally.

  - Mostly uses are not performance extensive.

The architectures that does provide optimized routine for it (x86
and s390) seems to do so only to advertise the architecture instruction
set than to focus on realword cases.  

Besides the issues described with wcs* routines, my main issue with 
powerpc optimization is I really think we should avoid that kind of
optimizations that try to leverage bad compiler code generation or
lack of optimization. Our recent move is to try to leverage the 
compiler itself (take for instance the internal math.h refactoring
we did). Also, if I recall correctly I tried to add a loop unrolling
on strcasecmp on generic that was refused exactly because such
optimization should *not* be in generic implementation (which I tend
to agree).

So what is really the point of still providing such complexity for
powerpc for routines that are most likely not used in realworld cases?
If powerpc performance for this routines are really demanded I think
I can thinker some macro to unroll the generic routines for power only.
This will still show some performance hit on wcscpy (mostly the function
call overhead).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] powerpc: remove power6 wcscpy optimization
  2019-03-11 13:02   ` Adhemerval Zanella
@ 2019-03-11 19:04     ` Gabriel F. T. Gomes
  2019-03-11 20:26       ` Adhemerval Zanella
  0 siblings, 1 reply; 7+ messages in thread
From: Gabriel F. T. Gomes @ 2019-03-11 19:04 UTC (permalink / raw
  To: Adhemerval Zanella; +Cc: libc-alpha

On Mon, Mar 11 2019, Adhemerval Zanella wrote:
> 
> Yes, I am aware this is a performance regression on power. Specifically
> for wcscpy it would require 3 call functions call: wcslen follower by
> wmemcpy and memcpy (and it is worse on powerpc64le abi which does not
> allow tail-cail optimization).
> 
> The main question here is should we really care to optimize wcs* 
> routines at all? 

This question is two-fold.  On the one hand, and based on the usage
analysis you provided below, I tend to agree that we shouldn't spend
time trying to optimize them.  On the other hand, the optimization is
already in place, so I don't see a compelling reason to remove it.

I get it that the benefit of removing such optimizations is easier code
maintenance, but the events of problems seem to be rare enough that
fixing them when they show up, is something I would be willing to do
(assuming that that is really the only benefit of the code removal).
Maybe I'll regret it in the future, but then I could change my mind :).
 
>   - Mostly uses I could find on https://codesearch.debian.net are for
>     Win32 routines (which uses UTF16 as default).
> 
>   - gnulib define the wchar module as obsolete and even on the project
>     that does it, it is tied to windows routines.
> 
>   - wide char routine are inherit problematic regarding portability
>     (standard does not define wchar_t size).
> 
>   - Although some runtime environments might use UTF16 as default
>     (JavaScript, java, Qt, Python), afaik they do not rely on C runtime
>     exactly for the previous issue and they reimplement all string
>     routines internally.
> 
>   - Mostly uses are not performance extensive.

Thanks for doing this research.
 
> Besides the issues described with wcs* routines my main issue with 
> powerpc optimization is I really think we should avoid that kind of
> optimizations that try to leverage bad compiler code generation or
> lack of optimization. Our recent move is to try to leverage the 
> compiler itself (take for instance the internal math.h refactoring
> we did). 

OK, but at the same time, this discussion is also about the fact that we
don't want to spend time to optimize wcs* functions any *further*.  One
of the arguments for the removal of the code is that the compiler should
provide such optimization, however, it currently doesn't.

> So what is really the point of still providing such complexity for
> powerpc for routines that are most likely not used in realworld cases?

I can't say that there aren't realworld cases, even though it seems to
be the case in the research you did, because we don't have access to
everybody's software.

Anyhow, we, as community, still don't know if we want wcs* functions to
be optimized, but if we decide that we don't want platform-specific
optimizations in glibc, then this should be done globally, not for
powerpc alone.  Right now, this patch only impacts powerpc with a
performance degradation.

The only benefit of removing the optimization is to ease code
maintenance/complexity.  I'm not convinced that it justifies the
performance impact.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] powerpc: remove power6 wcscpy optimization
  2019-03-11 19:04     ` Gabriel F. T. Gomes
@ 2019-03-11 20:26       ` Adhemerval Zanella
  0 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2019-03-11 20:26 UTC (permalink / raw
  To: Gabriel F. T. Gomes; +Cc: libc-alpha



On 11/03/2019 16:04, Gabriel F. T. Gomes wrote:
> On Mon, Mar 11 2019, Adhemerval Zanella wrote:
>>
>> Yes, I am aware this is a performance regression on power. Specifically
>> for wcscpy it would require 3 call functions call: wcslen follower by
>> wmemcpy and memcpy (and it is worse on powerpc64le abi which does not
>> allow tail-cail optimization).
>>
>> The main question here is should we really care to optimize wcs* 
>> routines at all? 
> 
> This question is two-fold.  On the one hand, and based on the usage
> analysis you provided below, I tend to agree that we shouldn't spend
> time trying to optimize them.  On the other hand, the optimization is
> already in place, so I don't see a compelling reason to remove it.
> 
> I get it that the benefit of removing such optimizations is easier code
> maintenance, but the events of problems seem to be rare enough that
> fixing them when they show up, is something I would be willing to do
> (assuming that that is really the only benefit of the code removal).
> Maybe I'll regret it in the future, but then I could change my mind :).

It is more in term of the current goals of making glibc as simple of
possible, while still retaining optimizations where they *matter*. As I
said we used to make up for lack of compiler support on math and string
optimizations and current trend is to avoid and remove such complications.

Same idea is for a lot of assembly optimization, where a more clean C
implementation usually does not only pays of for simplicity, but sometimes
might also shows better performance with better compiler support.

>  
>>   - Mostly uses I could find on https://codesearch.debian.net are for
>>     Win32 routines (which uses UTF16 as default).
>>
>>   - gnulib define the wchar module as obsolete and even on the project
>>     that does it, it is tied to windows routines.
>>
>>   - wide char routine are inherit problematic regarding portability
>>     (standard does not define wchar_t size).
>>
>>   - Although some runtime environments might use UTF16 as default
>>     (JavaScript, java, Qt, Python), afaik they do not rely on C runtime
>>     exactly for the previous issue and they reimplement all string
>>     routines internally.
>>
>>   - Mostly uses are not performance extensive.
> 
> Thanks for doing this research.
>  
>> Besides the issues described with wcs* routines my main issue with 
>> powerpc optimization is I really think we should avoid that kind of
>> optimizations that try to leverage bad compiler code generation or
>> lack of optimization. Our recent move is to try to leverage the 
>> compiler itself (take for instance the internal math.h refactoring
>> we did). 
> 
> OK, but at the same time, this discussion is also about the fact that we
> don't want to spend time to optimize wcs* functions any *further*.  One
> of the arguments for the removal of the code is that the compiler should
> provide such optimization, however, it currently doesn't.

No, the argument is such optimization should *not* in libc without a good
reason and we should aim to first improve generic implementations and only
push to arch-specific implementation when generic code is not a 
straightforward gain on all architectures (with strategies such as unaligned
access, prefetch, etc.).

> 
>> So what is really the point of still providing such complexity for
>> powerpc for routines that are most likely not used in realworld cases?
> 
> I can't say that there aren't realworld cases, even though it seems to
> be the case in the research you did, because we don't have access to
> everybody's software.
> 
> Anyhow, we, as community, still don't know if we want wcs* functions to
> be optimized, but if we decide that we don't want platform-specific
> optimizations in glibc, then this should be done globally, not for
> powerpc alone.  Right now, this patch only impacts powerpc with a
> performance degradation.
> 
> The only benefit of removing the optimization is to ease code
> maintenance/complexity.  I'm not convinced that it justifies the
> performance impact.
> 

My point if this kind of code would be proposed nowadays we would probably
make it generic instead of pushing for arch-specific code.  In any case 
I think we can towards in not hurting powerpc performance while still
simplifying the code by adding the loop unroll in generic implementation
and making powerpc unroll by default. I still think this complexity is
still practically unnecessary, but better than what we have today.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-03-11 20:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-04 19:43 [PATCH 1/3] powerpc: remove power6 wcscpy optimization Adhemerval Zanella
2019-03-04 19:43 ` [PATCH 2/3] powerpc: remove power6 wcschr optimization Adhemerval Zanella
2019-03-04 19:43 ` [PATCH 3/3] powerpc: remove power6 wcsrchr optimization Adhemerval Zanella
2019-03-09 16:08 ` [PATCH 1/3] powerpc: remove power6 wcscpy optimization Gabriel F. T. Gomes
2019-03-11 13:02   ` Adhemerval Zanella
2019-03-11 19:04     ` Gabriel F. T. Gomes
2019-03-11 20:26       ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).