|
|
ce426f |
From 2d5b6d3bb4813306ba5aa9ba03a56fe686bc6d4c Mon Sep 17 00:00:00 2001
|
|
|
ce426f |
From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
|
|
|
ce426f |
Date: Wed, 30 Jul 2014 05:05:19 -0500
|
|
|
ce426f |
Subject: [PATCH] PowerPC: multirach memcmp for PowerPC64
|
|
|
ce426f |
|
|
|
ce426f |
commit 07253fcf7b03535b26c81ee216d284ed7f1e250b
|
|
|
ce426f |
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
|
|
ce426f |
Date: Fri Dec 13 14:32:31 2013 -0500
|
|
|
ce426f |
---
|
|
|
ce426f |
string/memcmp.c | 6 +++-
|
|
|
ce426f |
sysdeps/powerpc/powerpc64/multiarch/Makefile | 3 +-
|
|
|
ce426f |
.../powerpc/powerpc64/multiarch/ifunc-impl-list.c | 8 +++++
|
|
|
ce426f |
.../powerpc/powerpc64/multiarch/memcmp-power4.S | 41 ++++++++++++++++++++++
|
|
|
ce426f |
.../powerpc/powerpc64/multiarch/memcmp-power7.S | 41 ++++++++++++++++++++++
|
|
|
ce426f |
sysdeps/powerpc/powerpc64/multiarch/memcmp-ppc64.c | 33 +++++++++++++++++
|
|
|
ce426f |
sysdeps/powerpc/powerpc64/multiarch/memcmp.c | 39 ++++++++++++++++++++
|
|
|
ce426f |
7 files changed, 169 insertions(+), 2 deletions(-)
|
|
|
ce426f |
create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S
|
|
|
ce426f |
create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S
|
|
|
ce426f |
create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcmp-ppc64.c
|
|
|
ce426f |
create mode 100644 sysdeps/powerpc/powerpc64/multiarch/memcmp.c
|
|
|
ce426f |
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/string/memcmp.c glibc-2.17-c758a686/string/memcmp.c
|
|
|
ce426f |
index a73cc19..4a3ef58 100644
|
|
|
ce426f |
--- glibc-2.17-c758a686/string/memcmp.c
|
|
|
ce426f |
+++ glibc-2.17-c758a686/string/memcmp.c
|
|
|
ce426f |
@@ -30,6 +30,10 @@
|
|
|
ce426f |
|
|
|
ce426f |
#undef memcmp
|
|
|
ce426f |
|
|
|
ce426f |
+#ifndef MEMCMP
|
|
|
ce426f |
+# define MEMCMP memcmp
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
+
|
|
|
ce426f |
#ifdef _LIBC
|
|
|
ce426f |
|
|
|
ce426f |
# include <memcopy.h>
|
|
|
ce426f |
@@ -308,7 +312,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
|
|
|
ce426f |
}
|
|
|
ce426f |
|
|
|
ce426f |
int
|
|
|
ce426f |
-memcmp (s1, s2, len)
|
|
|
ce426f |
+MEMCMP (s1, s2, len)
|
|
|
ce426f |
const __ptr_t s1;
|
|
|
ce426f |
const __ptr_t s2;
|
|
|
ce426f |
size_t len;
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
|
|
|
ce426f |
index 638c102..c0bc520 100644
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/Makefile
|
|
|
ce426f |
@@ -1,4 +1,5 @@
|
|
|
ce426f |
ifeq ($(subdir),string)
|
|
|
ce426f |
sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
|
|
|
ce426f |
- memcpy-power4 memcpy-ppc64
|
|
|
ce426f |
+ memcpy-power4 memcpy-ppc64 memcmp-power7 memcmp-power4 \
|
|
|
ce426f |
+ memcmp-ppc64
|
|
|
ce426f |
endif
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
|
|
|
ce426f |
index 5090af4..295ebca 100644
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
|
|
|
ce426f |
@@ -62,5 +62,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
ce426f |
IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc))
|
|
|
ce426f |
#endif
|
|
|
ce426f |
|
|
|
ce426f |
+ /* Support sysdeps/powerpc/powerpc64/multiarch/memcmp.c. */
|
|
|
ce426f |
+ IFUNC_IMPL (i, name, memcmp,
|
|
|
ce426f |
+ IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_HAS_VSX,
|
|
|
ce426f |
+ __memcmp_power7)
|
|
|
ce426f |
+ IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_POWER4,
|
|
|
ce426f |
+ __memcmp_power4)
|
|
|
ce426f |
+ IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ppc))
|
|
|
ce426f |
+
|
|
|
ce426f |
return i;
|
|
|
ce426f |
}
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..12db42c
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S
|
|
|
ce426f |
@@ -0,0 +1,41 @@
|
|
|
ce426f |
+/* Optimized memcmp implementation for PowerPC64/POWER4.
|
|
|
ce426f |
+ Copyright (C) 2013-2014 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#include <sysdep.h>
|
|
|
ce426f |
+
|
|
|
ce426f |
+#undef EALIGN
|
|
|
ce426f |
+#define EALIGN(name, alignt, words) \
|
|
|
ce426f |
+ .section ".text"; \
|
|
|
ce426f |
+ ENTRY_2(__memcmp_power4) \
|
|
|
ce426f |
+ .align ALIGNARG(alignt); \
|
|
|
ce426f |
+ EALIGN_W_##words; \
|
|
|
ce426f |
+ BODY_LABEL(__memcmp_power4): \
|
|
|
ce426f |
+ cfi_startproc;
|
|
|
ce426f |
+
|
|
|
ce426f |
+#undef END
|
|
|
ce426f |
+#define END(name) \
|
|
|
ce426f |
+ cfi_endproc; \
|
|
|
ce426f |
+ TRACEBACK(__memcmp_power4) \
|
|
|
ce426f |
+ END_2(__memcmp_power4)
|
|
|
ce426f |
+
|
|
|
ce426f |
+#undef libc_hidden_builtin_def
|
|
|
ce426f |
+#define libc_hidden_builtin_def(name)
|
|
|
ce426f |
+#undef weak_alias
|
|
|
ce426f |
+#define weak_alias(name,alias)
|
|
|
ce426f |
+
|
|
|
ce426f |
+#include <sysdeps/powerpc/powerpc64/power4/memcmp.S>
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..4898a88
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S
|
|
|
ce426f |
@@ -0,0 +1,41 @@
|
|
|
ce426f |
+/* Optimized memcmp implementation for PowerPC64/POWER7.
|
|
|
ce426f |
+ Copyright (C) 2013-2014 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#include <sysdep.h>
|
|
|
ce426f |
+
|
|
|
ce426f |
+#undef EALIGN
|
|
|
ce426f |
+#define EALIGN(name, alignt, words) \
|
|
|
ce426f |
+ .section ".text"; \
|
|
|
ce426f |
+ ENTRY_2(__memcmp_power7) \
|
|
|
ce426f |
+ .align ALIGNARG(alignt); \
|
|
|
ce426f |
+ EALIGN_W_##words; \
|
|
|
ce426f |
+ BODY_LABEL(__memcmp_power7): \
|
|
|
ce426f |
+ cfi_startproc;
|
|
|
ce426f |
+
|
|
|
ce426f |
+#undef END
|
|
|
ce426f |
+#define END(name) \
|
|
|
ce426f |
+ cfi_endproc; \
|
|
|
ce426f |
+ TRACEBACK(__memcmp_power7) \
|
|
|
ce426f |
+ END_2(__memcmp_power7)
|
|
|
ce426f |
+
|
|
|
ce426f |
+#undef libc_hidden_builtin_def
|
|
|
ce426f |
+#define libc_hidden_builtin_def(name)
|
|
|
ce426f |
+#undef weak_alias
|
|
|
ce426f |
+#define weak_alias(name,alias)
|
|
|
ce426f |
+
|
|
|
ce426f |
+#include <sysdeps/powerpc/powerpc64/power7/memcmp.S>
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp-ppc64.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp-ppc64.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..1a39d4a
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp-ppc64.c
|
|
|
ce426f |
@@ -0,0 +1,33 @@
|
|
|
ce426f |
+/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#include <string.h>
|
|
|
ce426f |
+
|
|
|
ce426f |
+#define MEMCMP __memcmp_ppc
|
|
|
ce426f |
+#undef weak_alias
|
|
|
ce426f |
+#define weak_alias(name, aliasname) \
|
|
|
ce426f |
+ extern __typeof (__memcmp_ppc) aliasname \
|
|
|
ce426f |
+ __attribute__ ((weak, alias ("__memcmp_ppc")));
|
|
|
ce426f |
+#if !defined(NOT_IN_libc) && defined(SHARED)
|
|
|
ce426f |
+# undef libc_hidden_builtin_def
|
|
|
ce426f |
+# define libc_hidden_builtin_def(name) \
|
|
|
ce426f |
+ __hidden_ver1(__memcmp_ppc, __GI_memcmp, __memcmp_ppc);
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
+
|
|
|
ce426f |
+extern __typeof (memcmp) __memcmp_ppc attribute_hidden;
|
|
|
ce426f |
+
|
|
|
ce426f |
+#include <string/memcmp.c>
|
|
|
ce426f |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..af90f0a
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
|
|
|
ce426f |
@@ -0,0 +1,39 @@
|
|
|
ce426f |
+/* Multiple versions of memcmp. PowerPC64 version.
|
|
|
ce426f |
+ Copyright (C) 2013-2014 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+/* Define multiple versions only for definition in libc. */
|
|
|
ce426f |
+#ifndef NOT_IN_libc
|
|
|
ce426f |
+# include <string.h>
|
|
|
ce426f |
+# include <shlib-compat.h>
|
|
|
ce426f |
+# include "init-arch.h"
|
|
|
ce426f |
+
|
|
|
ce426f |
+extern __typeof (memcmp) __memcmp_ppc attribute_hidden;
|
|
|
ce426f |
+extern __typeof (memcmp) __memcmp_power4 attribute_hidden;
|
|
|
ce426f |
+extern __typeof (memcmp) __memcmp_power7 attribute_hidden;
|
|
|
ce426f |
+
|
|
|
ce426f |
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
|
|
|
ce426f |
+ ifunc symbol properly. */
|
|
|
ce426f |
+libc_ifunc (memcmp,
|
|
|
ce426f |
+ (hwcap & PPC_FEATURE_HAS_VSX)
|
|
|
ce426f |
+ ? __memcmp_power7 :
|
|
|
ce426f |
+ (hwcap & PPC_FEATURE_POWER4)
|
|
|
ce426f |
+ ? __memcmp_power4
|
|
|
ce426f |
+ : __memcmp_ppc);
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+#include <string/memcmp.c>
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
--
|
|
|
ce426f |
1.8.3.1
|
|
|
ce426f |
|