1 /* Multiple versions of strcat
2 All versions must be listed in ifunc-impl-list.c.
3 Copyright (C) 2011-2014 Free Software Foundation, Inc.
4 Contributed by Intel Corporation.
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
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. */
51 .type STRCAT, @gnu_indirect_function
53 cfi_adjust_cfa_offset (4)
54 cfi_rel_offset (ebx, 0)
56 cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
58 call __init_cpu_features
59 1: leal STRCAT_IA32@GOTOFF(%ebx), %eax
60 testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
62 leal STRCAT_SSE2@GOTOFF(%ebx), %eax
63 testl $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features@GOTOFF(%ebx)
65 testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
67 leal STRCAT_SSSE3@GOTOFF(%ebx), %eax
69 cfi_adjust_cfa_offset (-4)
76 .type STRCAT, @gnu_indirect_function
77 cmpl $0, KIND_OFFSET+__cpu_features
79 call __init_cpu_features
80 1: leal STRCAT_IA32, %eax
81 testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features
83 leal STRCAT_SSE2, %eax
84 testl $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features
86 testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
88 leal STRCAT_SSSE3, %eax
95 # define ENTRY(name) \
96 .type STRCAT_IA32, @function; \
99 .hidden STRCAT_IA32; \
100 STRCAT_IA32: cfi_startproc; \
104 cfi_endproc; .size STRCAT_IA32, .-STRCAT_IA32
107 # undef libc_hidden_builtin_def
108 /* It doesn't make sense to send libc-internal strcat calls through a PLT.
109 The speedup we get from using SSSE3 instruction is likely eaten away
110 by the indirect call in the PLT. */
111 # define libc_hidden_builtin_def(name) \
112 .globl __GI_STRCAT; __GI_STRCAT = STRCAT_IA32
113 # undef libc_hidden_def
114 # define libc_hidden_def(name) \
115 .globl __GI___STRCAT; __GI___STRCAT = STRCAT_IA32
120 #ifndef USE_AS_STRNCAT
121 # include "../../i486/strcat.S"