1 /* Multiple versions of strcmp
2 Copyright (C) 2010 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_STRNCMP
25 # define STRCMP strcmp
26 # define __GI_STRCMP __GI_strcmp
27 # define __STRCMP_IA32 __strcmp_ia32
28 # define __STRCMP_SSSE3 __strcmp_ssse3
29 # define __STRCMP_SSE4_2 __strcmp_sse4_2
31 # define STRCMP strncmp
32 # define __GI_STRCMP __GI_strncmp
33 # define __STRCMP_IA32 __strncmp_ia32
34 # define __STRCMP_SSSE3 __strncmp_ssse3
35 # define __STRCMP_SSE4_2 __strncmp_sse4_2
38 /* Define multiple versions only for the definition in libc. Don't
39 define multiple versions for strncmp in static library since we
40 need strncmp before the initialization happened. */
41 #if (defined SHARED || !defined USE_AS_STRNCMP) && !defined NOT_IN_libc
43 .section .gnu.linkonce.t.__i686.get_pc_thunk.dx,"ax",@progbits
44 .globl __i686.get_pc_thunk.dx
45 .hidden __i686.get_pc_thunk.dx
47 .type __i686.get_pc_thunk.dx,@function
48 __i686.get_pc_thunk.dx:
51 .size __i686.get_pc_thunk.dx, .-__i686.get_pc_thunk.dx
55 .type STRCMP, @gnu_indirect_function
56 call __i686.get_pc_thunk.dx
57 addl $_GLOBAL_OFFSET_TABLE_, %edx
58 cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%edx)
60 call __init_cpu_features
61 1: leal __STRCMP_SSE4_2@GOTOFF(%edx), %eax
62 testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features@GOTOFF(%edx)
64 leal __STRCMP_SSSE3@GOTOFF(%edx), %eax
65 testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%edx)
67 leal __STRCMP_IA32@GOTOFF(%edx), %ecx
73 .type STRCMP, @gnu_indirect_function
74 cmpl $0, KIND_OFFSET+__cpu_features
76 call __init_cpu_features
77 1: leal __STRCMP_SSE4_2, %eax
78 testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features
80 leal __STRCMP_SSSE3, %eax
81 testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features
83 leal __STRCMP_IA32, %eax
89 # define ENTRY(name) \
90 .type __STRCMP_IA32, @function; \
92 __STRCMP_IA32: cfi_startproc; \
96 cfi_endproc; .size __STRCMP_IA32, .-__STRCMP_IA32
99 # undef libc_hidden_builtin_def
100 /* IFUNC doesn't work with the hidden functions in shared library since
101 they will be called without setting up EBX needed for PLT which is
103 # define libc_hidden_builtin_def(name) \
104 .globl __GI_STRCMP; __GI_STRCMP = __STRCMP_IA32
108 #ifndef USE_AS_STRNCMP
109 # include "../strcmp.S"