1 | /* Multiple versions of __memmove_chk |
2 | All versions must be listed in ifunc-impl-list.c. |
3 | Copyright (C) 2016 Free Software Foundation, Inc. |
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 |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ |
19 | |
20 | #include <sysdep.h> |
21 | #include <init-arch.h> |
22 | |
23 | /* Define multiple versions only for the definition in lib and for |
24 | DSO. There are no multiarch memmove functions for static binaries. |
25 | */ |
26 | #if IS_IN (libc) |
27 | # ifdef SHARED |
28 | .text |
29 | ENTRY(__memmove_chk) |
30 | .type __memmove_chk, @gnu_indirect_function |
31 | LOAD_RTLD_GLOBAL_RO_RDX |
32 | HAS_ARCH_FEATURE (AVX512F_Usable) |
33 | jz 1f |
34 | lea __memmove_chk_avx512_no_vzeroupper(%rip), %RAX_LP |
35 | HAS_ARCH_FEATURE (Prefer_No_VZEROUPPER) |
36 | jnz 2f |
37 | lea __memmove_chk_avx512_unaligned_erms(%rip), %RAX_LP |
38 | HAS_CPU_FEATURE (ERMS) |
39 | jnz 2f |
40 | lea __memmove_chk_avx512_unaligned(%rip), %RAX_LP |
41 | ret |
42 | 1: lea __memmove_chk_avx_unaligned(%rip), %RAX_LP |
43 | HAS_ARCH_FEATURE (AVX_Fast_Unaligned_Load) |
44 | jz L(Fast_Unaligned_Load) |
45 | HAS_CPU_FEATURE (ERMS) |
46 | jz 2f |
47 | lea __memmove_chk_avx_unaligned_erms(%rip), %RAX_LP |
48 | ret |
49 | L(Fast_Unaligned_Load): |
50 | lea __memmove_chk_sse2_unaligned(%rip), %RAX_LP |
51 | HAS_ARCH_FEATURE (Fast_Unaligned_Copy) |
52 | jz L(SSSE3) |
53 | HAS_CPU_FEATURE (ERMS) |
54 | jz 2f |
55 | lea __memmove_chk_sse2_unaligned_erms(%rip), %RAX_LP |
56 | ret |
57 | L(SSSE3): |
58 | HAS_CPU_FEATURE (SSSE3) |
59 | jz 2f |
60 | lea __memmove_chk_ssse3_back(%rip), %RAX_LP |
61 | HAS_ARCH_FEATURE (Fast_Copy_Backward) |
62 | jnz 2f |
63 | lea __memmove_chk_ssse3(%rip), %RAX_LP |
64 | 2: ret |
65 | END(__memmove_chk) |
66 | # else |
67 | # include "../memmove_chk.S" |
68 | # endif |
69 | #endif |
70 | |