powerpc: Improve memcmp performance for POWER8

Vectorization improves performance over the current implementation.
Tested on powerpc64 and powerpc64le.
This commit is contained in:
Rajalakshmi Srinivasaraghavan 2017-05-18 11:21:20 +05:30
parent 477bf19a59
commit dec4a7105e
6 changed files with 1494 additions and 2 deletions

View File

@ -1,3 +1,14 @@
2017-05-18 Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc64/multiarch/Makefile
(sysdep_routines): Add memcmp-power8.
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
(memcmp): Add __memcmp_power8 to list of memcmp functions.
* sysdeps/powerpc/powerpc64/multiarch/memcmp.c
(memcmp): Add __memcmp_power8 to ifunc list.
* sysdeps/powerpc/powerpc64/multiarch/memcmp-power8.S: New file.
* sysdeps/powerpc/powerpc64/power8/memcmp.S: New file.
2017-05-17 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>

View File

@ -1,7 +1,8 @@
ifeq ($(subdir),string)
sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
memcpy-power4 memcpy-ppc64 memcmp-power7 memcmp-power4 \
memcmp-ppc64 memset-power7 memset-power6 memset-power4 \
memcpy-power4 memcpy-ppc64 \
memcmp-power8 memcmp-power7 memcmp-power4 memcmp-ppc64 \
memset-power7 memset-power6 memset-power4 \
memset-ppc64 memset-power8 \
mempcpy-power7 mempcpy-ppc64 memchr-power7 memchr-ppc64 \
memrchr-power7 memrchr-ppc64 rawmemchr-power7 \

View File

@ -146,6 +146,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
/* Support sysdeps/powerpc/powerpc64/multiarch/memcmp.c. */
IFUNC_IMPL (i, name, memcmp,
IFUNC_IMPL_ADD (array, i, memcmp, hwcap2 & PPC_FEATURE2_ARCH_2_07,
__memcmp_power8)
IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_HAS_VSX,
__memcmp_power7)
IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_POWER4,

View File

@ -0,0 +1,28 @@
/* Optimized memcmp implementation for PowerPC64/POWER8.
Copyright (C) 2017 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>
#define MEMCMP __memcmp_power8
#undef libc_hidden_builtin_def
#define libc_hidden_builtin_def(name)
#undef weak_alias
#define weak_alias(name,alias)
#include <sysdeps/powerpc/powerpc64/power8/memcmp.S>

View File

@ -26,11 +26,14 @@
extern __typeof (memcmp) __memcmp_ppc attribute_hidden;
extern __typeof (memcmp) __memcmp_power4 attribute_hidden;
extern __typeof (memcmp) __memcmp_power7 attribute_hidden;
extern __typeof (memcmp) __memcmp_power8 attribute_hidden;
# undef memcmp
/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
ifunc symbol properly. */
libc_ifunc_redirected (__redirect_memcmp, memcmp,
(hwcap2 & PPC_FEATURE2_ARCH_2_07)
? __memcmp_power8 :
(hwcap & PPC_FEATURE_HAS_VSX)
? __memcmp_power7
: (hwcap & PPC_FEATURE_POWER4)

File diff suppressed because it is too large Load Diff