1 /* Multiple versions of strcat
2 Copyright (C) 2011-2012 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, see
18 <http://www.gnu.org/licenses/>. */
21 #include <init-arch.h>
23 #ifndef USE_AS_STRNCAT
25 # define STRCAT strcat
30 # define STRCAT_SSSE3 __strncat_ssse3
31 # define STRCAT_SSE2 __strncat_sse2
32 # define STRCAT_IA32 __strncat_ia32
33 # define __GI_STRCAT __GI_strncat
35 # define STRCAT_SSSE3 __strcat_ssse3
36 # define STRCAT_SSE2 __strcat_sse2
37 # define STRCAT_IA32 __strcat_ia32
38 # define __GI_STRCAT __GI_strcat
42 /* Define multiple versions only for the definition in libc. Don't
43 define multiple versions for strncat in static library since we
44 need strncat before the initialization happened. */
50 .type STRCAT, @gnu_indirect_function
52 cfi_adjust_cfa_offset (4)
53 cfi_rel_offset (ebx, 0)
55 cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
57 call __init_cpu_features
58 1: leal STRCAT_IA32@GOTOFF(%ebx), %eax
59 testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
61 leal STRCAT_SSE2@GOTOFF(%ebx), %eax
62 testl $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features@GOTOFF(%ebx)
64 testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
66 leal STRCAT_SSSE3@GOTOFF(%ebx), %eax
68 cfi_adjust_cfa_offset (-4)
75 .type STRCAT, @gnu_indirect_function
76 cmpl $0, KIND_OFFSET+__cpu_features
78 call __init_cpu_features
79 1: leal STRCAT_IA32, %eax
80 testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features
82 leal STRCAT_SSE2, %eax
83 testl $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features
85 testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
87 leal STRCAT_SSSE3, %eax
94 # define ENTRY(name) \
95 .type STRCAT_IA32, @function; \
97 STRCAT_IA32: cfi_startproc; \
101 cfi_endproc; .size STRCAT_IA32, .-STRCAT_IA32
104 # undef libc_hidden_builtin_def
105 /* It doesn't make sense to send libc-internal strcat calls through a PLT.
106 The speedup we get from using SSSE3 instruction is likely eaten away
107 by the indirect call in the PLT. */
108 # define libc_hidden_builtin_def(name) \
109 .globl __GI_STRCAT; __GI_STRCAT = STRCAT_IA32
110 # undef libc_hidden_def
111 # define libc_hidden_def(name) \
112 .globl __GI___STRCAT; __GI___STRCAT = STRCAT_IA32
117 #ifndef USE_AS_STRNCAT
118 # include "../../i486/strcat.S"