2010-06-30 15:26:11 +00:00
|
|
|
/* Multiple versions of memcpy
|
2012-10-10 14:49:12 +00:00
|
|
|
All versions must be listed in ifunc-impl-list.c.
|
2017-01-01 00:14:16 +00:00
|
|
|
Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
2010-06-30 15:26:11 +00:00
|
|
|
Contributed by Intel Corporation.
|
|
|
|
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
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2010-06-30 15:26:11 +00:00
|
|
|
|
|
|
|
#include <sysdep.h>
|
|
|
|
#include <init-arch.h>
|
|
|
|
|
|
|
|
/* Define multiple versions only for the definition in lib and for
|
|
|
|
DSO. In static binaries we need memcpy before the initialization
|
|
|
|
happened. */
|
2014-11-24 09:33:45 +00:00
|
|
|
#if defined SHARED && IS_IN (libc)
|
2010-06-30 15:26:11 +00:00
|
|
|
.text
|
2011-04-01 23:38:21 +00:00
|
|
|
ENTRY(__new_memcpy)
|
|
|
|
.type __new_memcpy, @gnu_indirect_function
|
2015-08-13 10:38:47 +00:00
|
|
|
LOAD_RTLD_GLOBAL_RO_RDX
|
2016-06-30 14:57:07 +00:00
|
|
|
lea __memcpy_erms(%rip), %RAX_LP
|
|
|
|
HAS_ARCH_FEATURE (Prefer_ERMS)
|
|
|
|
jnz 2f
|
2016-01-15 21:49:45 +00:00
|
|
|
HAS_ARCH_FEATURE (AVX512F_Usable)
|
|
|
|
jz 1f
|
2016-06-08 20:57:50 +00:00
|
|
|
lea __memcpy_avx512_no_vzeroupper(%rip), %RAX_LP
|
2016-01-15 21:49:45 +00:00
|
|
|
HAS_ARCH_FEATURE (Prefer_No_VZEROUPPER)
|
2016-06-08 20:57:50 +00:00
|
|
|
jnz 2f
|
|
|
|
lea __memcpy_avx512_unaligned_erms(%rip), %RAX_LP
|
|
|
|
HAS_CPU_FEATURE (ERMS)
|
|
|
|
jnz 2f
|
|
|
|
lea __memcpy_avx512_unaligned(%rip), %RAX_LP
|
2016-01-15 21:49:45 +00:00
|
|
|
ret
|
2016-03-04 16:37:40 +00:00
|
|
|
1: lea __memcpy_avx_unaligned(%rip), %RAX_LP
|
2015-08-13 10:38:47 +00:00
|
|
|
HAS_ARCH_FEATURE (AVX_Fast_Unaligned_Load)
|
2016-06-08 20:57:50 +00:00
|
|
|
jz L(Fast_Unaligned_Load)
|
|
|
|
HAS_CPU_FEATURE (ERMS)
|
|
|
|
jz 2f
|
|
|
|
lea __memcpy_avx_unaligned_erms(%rip), %RAX_LP
|
|
|
|
ret
|
|
|
|
L(Fast_Unaligned_Load):
|
2016-03-04 16:37:40 +00:00
|
|
|
lea __memcpy_sse2_unaligned(%rip), %RAX_LP
|
2016-03-28 11:39:48 +00:00
|
|
|
HAS_ARCH_FEATURE (Fast_Unaligned_Copy)
|
2016-06-08 20:57:50 +00:00
|
|
|
jz L(SSSE3)
|
|
|
|
HAS_CPU_FEATURE (ERMS)
|
|
|
|
jz 2f
|
|
|
|
lea __memcpy_sse2_unaligned_erms(%rip), %RAX_LP
|
|
|
|
ret
|
|
|
|
L(SSSE3):
|
2016-03-04 16:37:40 +00:00
|
|
|
HAS_CPU_FEATURE (SSSE3)
|
|
|
|
jz 2f
|
|
|
|
lea __memcpy_ssse3_back(%rip), %RAX_LP
|
|
|
|
HAS_ARCH_FEATURE (Fast_Copy_Backward)
|
|
|
|
jnz 2f
|
|
|
|
lea __memcpy_ssse3(%rip), %RAX_LP
|
|
|
|
2: ret
|
2011-04-01 23:38:21 +00:00
|
|
|
END(__new_memcpy)
|
2010-06-30 15:26:11 +00:00
|
|
|
|
2016-06-08 20:57:50 +00:00
|
|
|
# undef memcpy
|
|
|
|
# include <shlib-compat.h>
|
2011-04-01 23:38:21 +00:00
|
|
|
versioned_symbol (libc, __new_memcpy, memcpy, GLIBC_2_14);
|
2010-06-30 15:26:11 +00:00
|
|
|
#endif
|