PowerPC: multiarch memcpy for PowerPC32

This commit is contained in:
Adhemerval Zanella 2013-10-14 07:24:12 -05:00
parent 4c628e0026
commit 930de6f09e
9 changed files with 271 additions and 1 deletions

View File

@ -1,3 +1,20 @@
2013-12-06 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy-a2.S: New file.
* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy-cell.S: New file.
* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy-power6.S: New
file.
* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy-power7.S: New
file.
* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy-ppc32.S: New
file.
* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c: New file:
multiarch memcpy for PPC32.
* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile: Add memcpy
multiarch objects.
* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Likewise.
2013-12-06 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile: New file to

View File

@ -1,3 +1,4 @@
ifeq ($(subdir),string)
sysdep_routines +=
sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
memcpy-ppc32
endif

View File

@ -46,5 +46,19 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
else if (hwcap & PPC_FEATURE_POWER5)
hwcap |= PPC_FEATURE_POWER4;
#ifdef SHARED
/* Support sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c. */
IFUNC_IMPL (i, name, memcpy,
IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_HAS_VSX,
__memcpy_power7)
IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_06,
__memcpy_a2)
IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_05,
__memcpy_power6)
IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_CELL_BE,
__memcpy_cell)
IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc))
#endif
return i;
}

View File

@ -0,0 +1,38 @@
/* Optimized memcpy implementation for PowerPC A2.
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) \
.globl C_SYMBOL_NAME(__memcpy_a2); \
.type C_SYMBOL_NAME(__memcpy_a2),@function; \
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
C_LABEL(__memcpy_a2) \
cfi_startproc;
#undef END
#define END(name) \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(__memcpy_a2)
#undef libc_hidden_builtin_def
#define libc_hidden_builtin_def(name)
#include <sysdeps/powerpc/powerpc32/a2/memcpy.S>

View File

@ -0,0 +1,38 @@
/* Optimized memcpy implementation for CELL BE PowerPC.
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) \
.globl C_SYMBOL_NAME(__memcpy_cell); \
.type C_SYMBOL_NAME(__memcpy_cell),@function; \
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
C_LABEL(__memcpy_cell) \
cfi_startproc;
#undef END
#define END(name) \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(__memcpy_cell)
#undef libc_hidden_builtin_def
#define libc_hidden_builtin_def(name)
#include <sysdeps/powerpc/powerpc32/cell/memcpy.S>

View File

@ -0,0 +1,38 @@
/* Optimized memcpy implementation for PowerPC32 on POWER6.
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) \
.globl C_SYMBOL_NAME(__memcpy_power6); \
.type C_SYMBOL_NAME(__memcpy_power6),@function; \
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
C_LABEL(__memcpy_power6) \
cfi_startproc;
#undef END
#define END(name) \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(__memcpy_power6)
#undef libc_hidden_builtin_def
#define libc_hidden_builtin_def(name)
#include <sysdeps/powerpc/powerpc32/power6/memcpy.S>

View File

@ -0,0 +1,38 @@
/* Optimized memcpy implementation for PowerPC32/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) \
.globl C_SYMBOL_NAME(__memcpy_power7); \
.type C_SYMBOL_NAME(__memcpy_power7),@function; \
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
C_LABEL(__memcpy_power7) \
cfi_startproc;
#undef END
#define END(name) \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(__memcpy_power7)
#undef libc_hidden_builtin_def
#define libc_hidden_builtin_def(name)
#include <sysdeps/powerpc/powerpc32/power7/memcpy.S>

View File

@ -0,0 +1,41 @@
/* Default memcpy implementation for PowerPC32.
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>
#if defined SHARED && !defined NOT_IN_libc
# undef EALIGN
# define EALIGN(name, alignt, words) \
.globl C_SYMBOL_NAME(__memcpy_ppc); \
.type C_SYMBOL_NAME(__memcpy_ppc),@function; \
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
C_LABEL(__memcpy_ppc) \
cfi_startproc;
# undef END
# define END(name) \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(__memcpy_ppc)
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name) \
.globl __GI_memcpy; __GI_memcpy = __memcpy_ppc
#endif
#include <sysdeps/powerpc/powerpc32/power4/memcpy.S>

View File

@ -0,0 +1,45 @@
/* Multiple versions of memcpy.
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 the definition in lib and for
DSO. In static binaries we need memcpy before the initialization
happened. */
#if defined SHARED && !defined NOT_IN_libc
# include <string.h>
# include <shlib-compat.h>
# include "init-arch.h"
extern __typeof (memcpy) __memcpy_ppc attribute_hidden;
extern __typeof (memcpy) __memcpy_cell attribute_hidden;
extern __typeof (memcpy) __memcpy_power6 attribute_hidden;
extern __typeof (memcpy) __memcpy_a2 attribute_hidden;
extern __typeof (memcpy) __memcpy_power7 attribute_hidden;
/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
ifunc symbol properly. */
libc_ifunc (memcpy,
(hwcap & PPC_FEATURE_HAS_VSX)
? __memcpy_power7 :
(hwcap & PPC_FEATURE_ARCH_2_06)
? __memcpy_a2 :
(hwcap & PPC_FEATURE_ARCH_2_05)
? __memcpy_power6 :
(hwcap & PPC_FEATURE_CELL_BE)
? __memcpy_cell
: __memcpy_ppc);
#endif