]> sourceware.org Git - glibc.git/blob - sysdeps/i386/i686/multiarch/strcmp.S
Add i686 __libc_ifunc_impl_list
[glibc.git] / sysdeps / i386 / i686 / multiarch / strcmp.S
1 /* Multiple versions of strcmp
2 All versions must be listed in ifunc-impl-list.c.
3 Copyright (C) 2010-2012 Free Software Foundation, Inc.
4 Contributed by Intel Corporation.
5 This file is part of the GNU C Library.
6
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.
11
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.
16
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/>. */
20
21 #include <sysdep.h>
22 #include <init-arch.h>
23
24 #ifdef USE_AS_STRNCMP
25 # define STRCMP strncmp
26 # define __GI_STRCMP __GI_strncmp
27 # define __STRCMP_IA32 __strncmp_ia32
28 # define __STRCMP_SSSE3 __strncmp_ssse3
29 # define __STRCMP_SSE4_2 __strncmp_sse4_2
30 #elif defined USE_AS_STRCASECMP_L
31 # define STRCMP __strcasecmp_l
32 # define __GI_STRCMP __GI_strcasecmp_l
33 # define __STRCMP_IA32 __strcasecmp_l_ia32
34 # define __STRCMP_SSSE3 __strcasecmp_l_ssse3
35 # define __STRCMP_SSE4_2 __strcasecmp_l_sse4_2
36 #elif defined USE_AS_STRNCASECMP_L
37 # define STRCMP __strncasecmp_l
38 # define __GI_STRCMP __GI_strncasecmp_l
39 # define __STRCMP_IA32 __strncasecmp_l_ia32
40 # define __STRCMP_SSSE3 __strncasecmp_l_ssse3
41 # define __STRCMP_SSE4_2 __strncasecmp_l_sse4_2
42 #else
43 # define STRCMP strcmp
44 # define __GI_STRCMP __GI_strcmp
45 # define __STRCMP_IA32 __strcmp_ia32
46 # define __STRCMP_SSSE3 __strcmp_ssse3
47 # define __STRCMP_SSE4_2 __strcmp_sse4_2
48 #endif
49
50 /* Define multiple versions only for the definition in libc. Don't
51 define multiple versions for strncmp in static library since we
52 need strncmp before the initialization happened. */
53 #if (defined SHARED || !defined USE_AS_STRNCMP) && !defined NOT_IN_libc
54 # ifdef SHARED
55 .text
56 ENTRY(STRCMP)
57 .type STRCMP, @gnu_indirect_function
58 pushl %ebx
59 cfi_adjust_cfa_offset (4)
60 cfi_rel_offset (ebx, 0)
61 LOAD_PIC_REG(bx)
62 cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
63 jne 1f
64 call __init_cpu_features
65 1: leal __STRCMP_IA32@GOTOFF(%ebx), %eax
66 testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
67 jz 2f
68 leal __STRCMP_SSSE3@GOTOFF(%ebx), %eax
69 testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features@GOTOFF(%ebx)
70 jz 2f
71 leal __STRCMP_SSE4_2@GOTOFF(%ebx), %eax
72 2: popl %ebx
73 cfi_adjust_cfa_offset (-4)
74 cfi_restore (ebx)
75 ret
76 END(STRCMP)
77 # else
78 .text
79 ENTRY(STRCMP)
80 .type STRCMP, @gnu_indirect_function
81 cmpl $0, KIND_OFFSET+__cpu_features
82 jne 1f
83 call __init_cpu_features
84 1: leal __STRCMP_IA32, %eax
85 testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
86 jz 2f
87 leal __STRCMP_SSSE3, %eax
88 testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features
89 jz 2f
90 leal __STRCMP_SSE4_2, %eax
91 2: ret
92 END(STRCMP)
93 # endif
94
95 # undef ENTRY
96 # define ENTRY(name) \
97 .type __STRCMP_IA32, @function; \
98 .p2align 4; \
99 .globl __STRCMP_IA32; \
100 .hidden __STRCMP_IA32; \
101 __STRCMP_IA32: cfi_startproc; \
102 CALL_MCOUNT
103 # undef END
104 # define END(name) \
105 cfi_endproc; .size __STRCMP_IA32, .-__STRCMP_IA32
106
107 # ifdef SHARED
108 # undef libc_hidden_builtin_def
109 /* IFUNC doesn't work with the hidden functions in shared library since
110 they will be called without setting up EBX needed for PLT which is
111 used by IFUNC. */
112 # define libc_hidden_builtin_def(name) \
113 .globl __GI_STRCMP; __GI_STRCMP = __STRCMP_IA32
114 # endif
115 #endif
116
117 #if !defined USE_AS_STRNCMP && !defined USE_AS_STRCASECMP_L \
118 && !defined USE_AS_STRNCASECMP_L
119 # include "../strcmp.S"
120 #endif
This page took 0.040809 seconds and 5 git commands to generate.