1 /* Multiple versions of strcat
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 #ifndef USE_AS_STRNCAT
26 # define STRCAT strcat
31 # define STRCAT_SSSE3 __strncat_ssse3
32 # define STRCAT_SSE2 __strncat_sse2
33 # define STRCAT_IA32 __strncat_ia32
34 # define __GI_STRCAT __GI_strncat
36 # define STRCAT_SSSE3 __strcat_ssse3
37 # define STRCAT_SSE2 __strcat_sse2
38 # define STRCAT_IA32 __strcat_ia32
39 # define __GI_STRCAT __GI_strcat
43 /* Define multiple versions only for the definition in libc. Don't
44 define multiple versions for strncat in static library since we
45 need strncat before the initialization happened. */
49 .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
50 .globl __i686.get_pc_thunk.bx
51 .hidden __i686.get_pc_thunk.bx
53 .type __i686.get_pc_thunk.bx,@function
54 __i686.get_pc_thunk.bx:
60 .type STRCAT, @gnu_indirect_function
62 cfi_adjust_cfa_offset (4)
63 cfi_rel_offset (ebx, 0)
64 call __i686.get_pc_thunk.bx
65 addl $_GLOBAL_OFFSET_TABLE_, %ebx
66 cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
68 call __init_cpu_features
69 1: leal STRCAT_IA32@GOTOFF(%ebx), %eax
70 testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
72 leal STRCAT_SSE2@GOTOFF(%ebx), %eax
73 testl $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features@GOTOFF(%ebx)
75 testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
77 leal STRCAT_SSSE3@GOTOFF(%ebx), %eax
79 cfi_adjust_cfa_offset (-4)
86 .type STRCAT, @gnu_indirect_function
87 cmpl $0, KIND_OFFSET+__cpu_features
89 call __init_cpu_features
90 1: leal STRCAT_IA32, %eax
91 testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features
93 leal STRCAT_SSE2, %eax
94 testl $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features
96 testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
98 leal STRCAT_SSSE3, %eax
105 # define ENTRY(name) \
106 .type STRCAT_IA32, @function; \
108 STRCAT_IA32: cfi_startproc; \
112 cfi_endproc; .size STRCAT_IA32, .-STRCAT_IA32
115 # undef libc_hidden_builtin_def
116 /* It doesn't make sense to send libc-internal strcat calls through a PLT.
117 The speedup we get from using SSSE3 instruction is likely eaten away
118 by the indirect call in the PLT. */
119 # define libc_hidden_builtin_def(name) \
120 .globl __GI_STRCAT; __GI_STRCAT = STRCAT_IA32
121 # undef libc_hidden_def
122 # define libc_hidden_def(name) \
123 .globl __GI___STRCAT; __GI___STRCAT = STRCAT_IA32
128 #ifndef USE_AS_STRNCAT
129 # include "../../i486/strcat.S"