about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc64/multiarch
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2015-07-28 17:12:25 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.com>2015-08-11 10:03:10 -0300
commit142e0a9953059bcf5667921f2670efec377be3d5 (patch)
treef24f484833deeee796a02f02a56cc6f89c6ffcae /sysdeps/powerpc/powerpc64/multiarch
parent14362ef154136223b0f77cb0351c31be865ab826 (diff)
downloadglibc-142e0a9953059bcf5667921f2670efec377be3d5.tar.gz
glibc-142e0a9953059bcf5667921f2670efec377be3d5.tar.xz
glibc-142e0a9953059bcf5667921f2670efec377be3d5.zip
powerpc: Use default strcpy optimization for POWER7
This patches uses the default strcpy/stpcpy implementation for
POWER7/PPC64.  This is faster in mostly inputs for benchtests
and for multiarch the implementation uses the POWER7 strlen and
memcpy.

	* string/stpcpy.c (__stpcpy): Use STPCPY to redefine symbol name and
	cleanup macro usage.
	* string/strcpy.c (strcpt): Use STRCPY to redefine symbol name.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.S: Remove file.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/stpcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/stpcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/strcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
	[SHARED && IS_IN (libc)]: Include <string/strcpy.c>.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
	[SHARED && IS_IN (libc)]: Include <string/stpcpy.c>.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.c: New file.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcpy.c: Likewise.
Diffstat (limited to 'sysdeps/powerpc/powerpc64/multiarch')
-rw-r--r--sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.c (renamed from sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.S)32
-rw-r--r--sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.S48
-rw-r--r--sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c39
-rw-r--r--sysdeps/powerpc/powerpc64/multiarch/stpcpy.c2
-rw-r--r--sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.c (renamed from sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.S)28
-rw-r--r--sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.c (renamed from sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.S)34
6 files changed, 78 insertions, 105 deletions
diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.S b/sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.c
index 09436115f4..6362066299 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.c
@@ -1,5 +1,5 @@
-/* Optimized stpcpy implementation for POWER7.
-   Copyright (C) 2013-2015 Free Software Foundation, Inc.
+/* Multiarch stpcpy for POWER7/PPC64.
+   Copyright (C) 2015 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
@@ -16,25 +16,21 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sysdep.h>
+#include <string.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__stpcpy_power7)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__stpcpy_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__stpcpy_power7)
+extern __typeof (memcpy) __memcpy_power7 attribute_hidden;
+extern __typeof (strlen) __strlen_power7 attribute_hidden;
+extern __typeof (stpcpy) __stpcpy_power7 attribute_hidden;
 
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__stpcpy_power7)					\
-  END_2(__stpcpy_power7)
+#define STPCPY __stpcpy_power7
+#define memcpy __memcpy_power7
+#define strlen __strlen_power7
 
+#undef libc_hidden_def
+#define libc_hidden_def(name)
+#undef weak_alias
+#define weak_alias(name, alias)
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
 
-#include <sysdeps/powerpc/powerpc64/power7/stpcpy.S>
+#include <string/stpcpy.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.S
deleted file mode 100644
index 858f885aa6..0000000000
--- a/sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Default stpcpy implementation for PowerPC64.
-   Copyright (C) 2013-2015 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 <sysdep.h>
-
-#if defined SHARED && IS_IN (libc)
-# undef EALIGN
-# define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__stpcpy_ppc)						\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__stpcpy_ppc):					\
-  cfi_startproc;						\
-  LOCALENTRY(__stpcpy_ppc)
-
-# undef END
-# define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__stpcpy_ppc)					\
-  END_2(__stpcpy_ppc)
-
-# undef weak_alias
-# define weak_alias(name, alias)
-# undef libc_hidden_def
-# define libc_hidden_def(name)
-
-# undef libc_hidden_builtin_def
-# define libc_hidden_builtin_def(name)				\
-    .globl __GI___stpcpy; __GI___stpcpy = __stpcpy_ppc
-#endif
-
-#include <sysdeps/powerpc/powerpc64/stpcpy.S>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c b/sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c
new file mode 100644
index 0000000000..6e437fb6b9
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c
@@ -0,0 +1,39 @@
+/* Multiarch stpcpy for PPC64.
+   Copyright (C) 2015 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 <string.h>
+
+extern __typeof (memcpy) __memcpy_ppc attribute_hidden;
+extern __typeof (strlen) __strlen_ppc attribute_hidden;
+extern __typeof (stpcpy) __stpcpy_ppc attribute_hidden;
+
+#define STPCPY __stpcpy_ppc
+#define memcpy __memcpy_ppc
+#define strlen __strlen_ppc
+
+#undef weak_alias
+#define weak_alias(name, aliasname) \
+  extern __typeof (__stpcpy_ppc) aliasname \
+    __attribute__ ((weak, alias ("__stpcpy_ppc")));
+
+#undef libc_hidden_def
+#define libc_hidden_def(name)
+#undef libc_hidden_builtin_def
+#define libc_hidden_builtin_def(name)
+
+#include <string/stpcpy.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
index a5e1c037a1..c809f99982 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
@@ -32,4 +32,6 @@ libc_ifunc (__stpcpy,
 
 weak_alias (__stpcpy, stpcpy)
 libc_hidden_def (stpcpy)
+#else
+# include <string/stpcpy.c>
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.S b/sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.c
index 69851bb70e..9f091d217e 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.c
@@ -1,5 +1,5 @@
-/* Optimized strcpy implementation for POWER7.
-   Copyright (C) 2013-2015 Free Software Foundation, Inc.
+/* Multiarch strcpy for POWER7/PPC64.
+   Copyright (C) 2015 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
@@ -16,25 +16,17 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sysdep.h>
+#include <string.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__strcpy_power7)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__strcpy_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strcpy_power7)
+extern __typeof (memcpy) __memcpy_power7 attribute_hidden;
+extern __typeof (strlen) __strlen_power7 attribute_hidden;
+extern __typeof (strcpy) __strcpy_power7 attribute_hidden;
 
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strcpy_power7)					\
-  END_2(__strcpy_power7)
+#define STRCPY __strcpy_power7
+#define memcpy __memcpy_power7
+#define strlen __strlen_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
 
-#include <sysdeps/powerpc/powerpc64/power7/strcpy.S>
+#include <string/strcpy.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.c
index f937555b6a..b72203016f 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.c
@@ -1,5 +1,5 @@
-/* Default strcpy implementation for PowerPC64.
-   Copyright (C) 2013-2015 Free Software Foundation, Inc.
+/* Multiarch strcpy for PPC64.
+   Copyright (C) 2015 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
@@ -16,28 +16,20 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sysdep.h>
+#include <string.h>
 
 #if defined SHARED && IS_IN (libc)
-# undef EALIGN
-# define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__strcpy_ppc)						\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__strcpy_ppc):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strcpy_ppc)
-
-# undef END
-# define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strcpy_ppc)					\
-  END_2(__strcpy_ppc)
+extern __typeof (memcpy) __memcpy_ppc attribute_hidden;
+extern __typeof (strlen) __strlen_ppc attribute_hidden;
+extern __typeof (strcpy) __strcpy_ppc attribute_hidden;
+
+# define STRCPY __strcpy_ppc
+# define memcpy __memcpy_ppc
+# define strlen __strlen_ppc
 
 # undef libc_hidden_builtin_def
-# define libc_hidden_builtin_def(name)				\
-    .globl __GI_strcpy; __GI_strcpy = __strcpy_ppc
+# define libc_hidden_builtin_def(name) \
+  __hidden_ver1 (__strcpy_ppc, __GI_strcpy, __strcpy_ppc);
 #endif
 
-#include <sysdeps/powerpc/powerpc64/strcpy.S>
+#include <string/strcpy.c>