PowerPC: multirach memcmp for PowerPC64

This commit is contained in:
Adhemerval Zanella 2013-12-13 14:32:31 -05:00
parent b5beafbcee
commit 07253fcf7b
8 changed files with 184 additions and 2 deletions

View File

@ -1,3 +1,16 @@
2013-12-13 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* string/memcmp.c (memcmp): Using macro to redefine symbol name.
* sysdeps/powerpc/powerpc64/multiarch/Makefile: Add memcpy multiarch
implementations.
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Likewise.
* sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S: New file.
* sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S: New file.
* sysdeps/powerpc/powerpc64/multiarch/memcmp-ppc64.c: New file.
* sysdeps/powerpc/powerpc64/multiarch/memcmp.c: New file: multiarch
memcmp for PPC64.
2013-12-13 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc64/multiarch/Makefile: New file to support

View File

@ -29,6 +29,10 @@
#undef memcmp
#ifndef MEMCMP
# define MEMCMP memcmp
#endif
#ifdef _LIBC
# include <memcopy.h>
@ -304,7 +308,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
}
int
memcmp (s1, s2, len)
MEMCMP (s1, s2, len)
const __ptr_t s1;
const __ptr_t s2;
size_t len;

View File

@ -1,4 +1,5 @@
ifeq ($(subdir),string)
sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
memcpy-power4 memcpy-ppc64
memcpy-power4 memcpy-ppc64 memcmp-power7 memcmp-power4 \
memcmp-ppc64
endif

View File

@ -62,5 +62,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc))
#endif
/* Support sysdeps/powerpc/powerpc64/multiarch/memcmp.c. */
IFUNC_IMPL (i, name, memcmp,
IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_HAS_VSX,
__memcmp_power7)
IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_POWER4,
__memcmp_power4)
IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ppc))
return i;
}

View File

@ -0,0 +1,42 @@
/* Optimized memcmp implementation for PowerPC64/POWER4.
Copyright (C) 2013 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>
#undef EALIGN
#define EALIGN(name, alignt, words) \
.section ".text"; \
ENTRY_2(__memcmp_power4) \
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
BODY_LABEL(__memcmp_power4): \
cfi_startproc; \
LOCALENTRY(__memcmp_power4)
#undef END
#define END(name) \
cfi_endproc; \
TRACEBACK(__memcmp_power4) \
END_2(__memcmp_power4)
#undef libc_hidden_builtin_def
#define libc_hidden_builtin_def(name)
#undef weak_alias
#define weak_alias(name,alias)
#include <sysdeps/powerpc/powerpc64/power4/memcmp.S>

View File

@ -0,0 +1,42 @@
/* Optimized memcmp implementation for PowerPC64/POWER7.
Copyright (C) 2013 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>
#undef EALIGN
#define EALIGN(name, alignt, words) \
.section ".text"; \
ENTRY_2(__memcmp_power7) \
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
BODY_LABEL(__memcmp_power7): \
cfi_startproc; \
LOCALENTRY(__memcmp_power7)
#undef END
#define END(name) \
cfi_endproc; \
TRACEBACK(__memcmp_power7) \
END_2(__memcmp_power7)
#undef libc_hidden_builtin_def
#define libc_hidden_builtin_def(name)
#undef weak_alias
#define weak_alias(name,alias)
#include <sysdeps/powerpc/powerpc64/power7/memcmp.S>

View File

@ -0,0 +1,33 @@
/* Copyright (C) 2013 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>
#define MEMCMP __memcmp_ppc
#undef weak_alias
#define weak_alias(name, aliasname) \
extern __typeof (__memcmp_ppc) aliasname \
__attribute__ ((weak, alias ("__memcmp_ppc")));
#if !defined(NOT_IN_libc) && defined(SHARED)
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name) \
__hidden_ver1(__memcmp_ppc, __GI_memcmp, __memcmp_ppc);
#endif
extern __typeof (memcmp) __memcmp_ppc attribute_hidden;
#include <string/memcmp.c>

View File

@ -0,0 +1,39 @@
/* Multiple versions of memcmp. PowerPC64 version.
Copyright (C) 2013 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 multiple versions only for definition in libc. */
#ifndef NOT_IN_libc
# include <string.h>
# include <shlib-compat.h>
# include "init-arch.h"
extern __typeof (memcmp) __memcmp_ppc attribute_hidden;
extern __typeof (memcmp) __memcmp_power4 attribute_hidden;
extern __typeof (memcmp) __memcmp_power7 attribute_hidden;
/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
ifunc symbol properly. */
libc_ifunc (memcmp,
(hwcap & PPC_FEATURE_HAS_VSX)
? __memcmp_power7 :
(hwcap & PPC_FEATURE_POWER4)
? __memcmp_power4
: __memcmp_ppc);
#else
#include <string/memcmp.c>
#endif