1
/* Multiple versions of strcpy
2
Copyright (C) 2011 Free Software Foundation, Inc.
3
Contributed by Intel Corporation.
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, write to the Free
18
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22
#include <init-arch.h>
24
#if !defined (USE_AS_STPCPY) && !defined (USE_AS_STRNCPY)
26
# define STRCPY strcpy
31
# ifdef USE_AS_STRNCPY
32
# define STRCPY_SSSE3 __stpncpy_ssse3
33
# define STRCPY_SSE2 __stpncpy_sse2
34
# define STRCPY_IA32 __stpncpy_ia32
35
# define __GI_STRCPY __GI_stpncpy
36
# define __GI___STRCPY __GI___stpncpy
38
# define STRCPY_SSSE3 __stpcpy_ssse3
39
# define STRCPY_SSE2 __stpcpy_sse2
40
# define STRCPY_IA32 __stpcpy_ia32
41
# define __GI_STRCPY __GI_stpcpy
42
# define __GI___STRCPY __GI___stpcpy
45
# ifdef USE_AS_STRNCPY
46
# define STRCPY_SSSE3 __strncpy_ssse3
47
# define STRCPY_SSE2 __strncpy_sse2
48
# define STRCPY_IA32 __strncpy_ia32
49
# define __GI_STRCPY __GI_strncpy
51
# define STRCPY_SSSE3 __strcpy_ssse3
52
# define STRCPY_SSE2 __strcpy_sse2
53
# define STRCPY_IA32 __strcpy_ia32
54
# define __GI_STRCPY __GI_strcpy
59
/* Define multiple versions only for the definition in libc. Don't
60
define multiple versions for strncpy in static library since we
61
need strncpy before the initialization happened. */
65
.section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
66
.globl __i686.get_pc_thunk.bx
67
.hidden __i686.get_pc_thunk.bx
69
.type __i686.get_pc_thunk.bx,@function
70
__i686.get_pc_thunk.bx:
76
.type STRCPY, @gnu_indirect_function
78
cfi_adjust_cfa_offset (4)
79
cfi_rel_offset (ebx, 0)
80
call __i686.get_pc_thunk.bx
81
addl $_GLOBAL_OFFSET_TABLE_, %ebx
82
cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
84
call __init_cpu_features
85
1: leal STRCPY_IA32@GOTOFF(%ebx), %eax
86
testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
88
leal STRCPY_SSE2@GOTOFF(%ebx), %eax
89
testl $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features@GOTOFF(%ebx)
91
testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
93
leal STRCPY_SSSE3@GOTOFF(%ebx), %eax
95
cfi_adjust_cfa_offset (-4)
102
.type STRCPY, @gnu_indirect_function
103
cmpl $0, KIND_OFFSET+__cpu_features
105
call __init_cpu_features
106
1: leal STRCPY_IA32, %eax
107
testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features
109
leal STRCPY_SSE2, %eax
110
testl $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features
112
testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
114
leal STRCPY_SSSE3, %eax
121
# define ENTRY(name) \
122
.type STRCPY_IA32, @function; \
124
STRCPY_IA32: cfi_startproc; \
128
cfi_endproc; .size STRCPY_IA32, .-STRCPY_IA32
131
# undef libc_hidden_builtin_def
132
/* It doesn't make sense to send libc-internal strcpy calls through a PLT.
133
The speedup we get from using SSSE3 instruction is likely eaten away
134
by the indirect call in the PLT. */
135
# define libc_hidden_builtin_def(name) \
136
.globl __GI_STRCPY; __GI_STRCPY = STRCPY_IA32
137
# undef libc_hidden_def
138
# define libc_hidden_def(name) \
139
.globl __GI___STRCPY; __GI___STRCPY = STRCPY_IA32
145
# ifdef USE_AS_STRNCPY
146
# include "../../stpncpy.S"
148
# include "../../i586/stpcpy.S"
151
# ifndef USE_AS_STRNCPY
152
# include "../../i586/strcpy.S"