Replace FSF snail mail address with URLs.
[glibc.git] / sysdeps / i386 / i686 / multiarch / strcat.S
blobe68fecafb3bf3fe2893ec5878a1f6927c571eade
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/>.  */
20 #include <sysdep.h>
21 #include <init-arch.h>
23 #ifndef USE_AS_STRNCAT
24 # ifndef STRCAT
25 #  define STRCAT strcat
26 # endif
27 #endif
29 #ifdef USE_AS_STRNCAT
30 # define STRCAT_SSSE3   __strncat_ssse3
31 # define STRCAT_SSE2            __strncat_sse2
32 # define STRCAT_IA32            __strncat_ia32
33 # define __GI_STRCAT            __GI_strncat
34 #else
35 # define STRCAT_SSSE3   __strcat_ssse3
36 # define STRCAT_SSE2            __strcat_sse2
37 # define STRCAT_IA32            __strcat_ia32
38 # define __GI_STRCAT            __GI_strcat
39 #endif
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.  */
45 #ifndef NOT_IN_libc
47 # ifdef SHARED
48         .text
49 ENTRY(STRCAT)
50         .type   STRCAT, @gnu_indirect_function
51         pushl   %ebx
52         cfi_adjust_cfa_offset (4)
53         cfi_rel_offset (ebx, 0)
54         LOAD_PIC_REG(bx)
55         cmpl    $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
56         jne     1f
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)
60         jz      2f
61         leal    STRCAT_SSE2@GOTOFF(%ebx), %eax
62         testl   $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features@GOTOFF(%ebx)
63         jnz     2f
64         testl   $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
65         jz      2f
66         leal    STRCAT_SSSE3@GOTOFF(%ebx), %eax
67 2:      popl    %ebx
68         cfi_adjust_cfa_offset (-4)
69         cfi_restore (ebx)
70         ret
71 END(STRCAT)
72 # else
74 ENTRY(STRCAT)
75         .type   STRCAT, @gnu_indirect_function
76         cmpl    $0, KIND_OFFSET+__cpu_features
77         jne     1f
78         call    __init_cpu_features
79 1:      leal    STRCAT_IA32, %eax
80         testl   $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features
81         jz      2f
82         leal    STRCAT_SSE2, %eax
83         testl   $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features
84         jnz     2f
85         testl   $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
86         jz      2f
87         leal    STRCAT_SSSE3, %eax
88 2:      ret
89 END(STRCAT)
91 # endif
93 # undef ENTRY
94 # define ENTRY(name) \
95         .type STRCAT_IA32, @function; \
96         .align 16; \
97         STRCAT_IA32: cfi_startproc; \
98         CALL_MCOUNT
99 # undef END
100 # define END(name) \
101         cfi_endproc; .size STRCAT_IA32, .-STRCAT_IA32
103 # ifdef SHARED
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
114 # endif
115 #endif
117 #ifndef USE_AS_STRNCAT
118 # include "../../i486/strcat.S"
119 #endif