1 /* Multiple versions of memset
2 Copyright (C) 2010-2012 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
20 #include <init-arch.h>
22 /* Define multiple versions only for the definition in lib. */
25 .type memset, @gnu_indirect_function
26 cmpl $0, __cpu_features+KIND_OFFSET(%rip)
28 call __init_cpu_features
29 1: leaq __memset_x86_64(%rip), %rax
30 testl $bit_Prefer_SSE_for_memop, __cpu_features+FEATURE_OFFSET+index_Prefer_SSE_for_memop(%rip)
32 leaq __memset_sse2(%rip), %rax
36 /* Define internal IFUNC memset for bzero. */
39 __libc_memset = memset
44 # define ENTRY(name) \
45 .type __memset_sse2, @function; \
46 .globl __memset_sse2; \
48 __memset_sse2: cfi_startproc; \
52 cfi_endproc; .size __memset_sse2, .-__memset_sse2
55 # define ENTRY_CHK(name) \
56 .type __memset_chk_sse2, @function; \
57 .globl __memset_chk_sse2; \
59 __memset_chk_sse2: cfi_startproc; \
62 # define END_CHK(name) \
63 cfi_endproc; .size __memset_chk_sse2, .-__memset_chk_sse2
66 # undef libc_hidden_builtin_def
67 /* It doesn't make sense to send libc-internal memset calls through a PLT.
68 The speedup we get from using GPR instruction is likely eaten away
69 by the indirect call in the PLT. */
70 # define libc_hidden_builtin_def(name) \
71 .globl __GI_memset; __GI_memset = __memset_sse2
75 # define strong_alias(original, alias)
78 #include "../memset.S"