1 /* Multiple versions of memset
2 All versions must be listed in ifunc-impl-list.c.
3 Copyright (C) 2010-2012 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
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.
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.
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/>. */
21 #include <init-arch.h>
23 /* Define multiple versions only for the definition in lib. */
26 .type memset, @gnu_indirect_function
27 cmpl $0, __cpu_features+KIND_OFFSET(%rip)
29 call __init_cpu_features
30 1: leaq __memset_x86_64(%rip), %rax
31 testl $bit_Prefer_SSE_for_memop, __cpu_features+FEATURE_OFFSET+index_Prefer_SSE_for_memop(%rip)
33 leaq __memset_sse2(%rip), %rax
37 /* Define internal IFUNC memset for bzero. */
40 __libc_memset = memset
45 # define ENTRY(name) \
46 .type __memset_sse2, @function; \
47 .globl __memset_sse2; \
49 __memset_sse2: cfi_startproc; \
53 cfi_endproc; .size __memset_sse2, .-__memset_sse2
56 # define ENTRY_CHK(name) \
57 .type __memset_chk_sse2, @function; \
58 .globl __memset_chk_sse2; \
60 __memset_chk_sse2: cfi_startproc; \
63 # define END_CHK(name) \
64 cfi_endproc; .size __memset_chk_sse2, .-__memset_chk_sse2
67 # undef libc_hidden_builtin_def
68 /* It doesn't make sense to send libc-internal memset calls through a PLT.
69 The speedup we get from using GPR instruction is likely eaten away
70 by the indirect call in the PLT. */
71 # define libc_hidden_builtin_def(name) \
72 .globl __GI_memset; __GI_memset = __memset_sse2
76 # define strong_alias(original, alias)
79 #include "../memset.S"