]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/x86_64/multiarch/memmove.c
Use AVX unaligned memcpy only if AVX2 is available
[thirdparty/glibc.git] / sysdeps / x86_64 / multiarch / memmove.c
CommitLineData
8b2b7715 1/* Multiple versions of memmove.
ac49ecaf 2 All versions must be listed in ifunc-impl-list.c.
b168057a 3 Copyright (C) 2010-2015 Free Software Foundation, Inc.
8b2b7715
RM
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
8b2b7715 19
4f41c682 20#if IS_IN (libc)
9a0a5486
RM
21# define MEMMOVE __memmove_sse2
22# ifdef SHARED
23# undef libc_hidden_builtin_def
24# define libc_hidden_builtin_def(name) \
6fb8cbcb 25 __hidden_ver1 (__memmove_sse2, __GI_memmove, __memmove_sse2);
9a0a5486 26# endif
6fb8cbcb 27
f85fa270
L
28/* Redefine memmove so that the compiler won't complain about the type
29 mismatch with the IFUNC selector in strong_alias, below. */
9a0a5486
RM
30# undef memmove
31# define memmove __redirect_memmove
32# include <string.h>
33# undef memmove
34
35extern __typeof (__redirect_memmove) __memmove_sse2 attribute_hidden;
36extern __typeof (__redirect_memmove) __memmove_ssse3 attribute_hidden;
37extern __typeof (__redirect_memmove) __memmove_ssse3_back attribute_hidden;
05f3633d
LM
38extern __typeof (__redirect_memmove) __memmove_avx_unaligned attribute_hidden;
39
f85fa270 40#endif
8b2b7715 41
6fb8cbcb
L
42#include "string/memmove.c"
43
4f41c682 44#if IS_IN (libc)
9a0a5486
RM
45# include <shlib-compat.h>
46# include "init-arch.h"
f85fa270
L
47
48/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
49 ifunc symbol properly. */
50extern __typeof (__redirect_memmove) __libc_memmove;
51libc_ifunc (__libc_memmove,
5f3d0b78 52 HAS_AVX_FAST_UNALIGNED_LOAD
05f3633d
LM
53 ? __memmove_avx_unaligned
54 : (HAS_SSSE3
55 ? (HAS_FAST_COPY_BACKWARD
56 ? __memmove_ssse3_back : __memmove_ssse3)
57 : __memmove_sse2));
f85fa270 58
f85fa270 59strong_alias (__libc_memmove, memmove)
0354e355 60
9a0a5486 61# if SHLIB_COMPAT (libc, GLIBC_2_2_5, GLIBC_2_14)
0354e355 62compat_symbol (libc, memmove, memcpy, GLIBC_2_2_5);
9a0a5486 63# endif
6fb8cbcb 64#endif