1 /* Multiple versions of strcspn
2 All versions must be listed in ifunc-impl-list.c.
3 Copyright (C) 2009, 2012 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/>. */
23 #ifdef HAVE_SSE4_SUPPORT
26 #include <init-arch.h>
29 #define STRCSPN_SSE42 __strpbrk_sse42
30 #define STRCSPN_IA32 __strpbrk_ia32
31 #define __GI_STRCSPN __GI_strpbrk
34 #define STRCSPN strcspn
35 #define STRCSPN_SSE42 __strcspn_sse42
36 #define STRCSPN_IA32 __strcspn_ia32
37 #define __GI_STRCSPN __GI_strcspn
41 /* Define multiple versions only for the definition in libc. Don't
42 define multiple versions for strpbrk in static library since we
43 need strpbrk before the initialization happened. */
44 #if (defined SHARED || !defined USE_AS_STRPBRK) && !defined NOT_IN_libc
48 .type STRCSPN, @gnu_indirect_function
50 cfi_adjust_cfa_offset (4)
51 cfi_rel_offset (ebx, 0)
53 cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
55 call __init_cpu_features
56 1: leal STRCSPN_IA32@GOTOFF(%ebx), %eax
57 testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features@GOTOFF(%ebx)
59 leal STRCSPN_SSE42@GOTOFF(%ebx), %eax
61 cfi_adjust_cfa_offset (-4);
68 .type STRCSPN, @gnu_indirect_function
69 cmpl $0, KIND_OFFSET+__cpu_features
71 call __init_cpu_features
72 1: leal STRCSPN_IA32, %eax
73 testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features
75 leal STRCSPN_SSE42, %eax
81 # define ENTRY(name) \
82 .type STRCSPN_IA32, @function; \
83 .globl STRCSPN_IA32; \
85 STRCSPN_IA32: cfi_startproc; \
89 cfi_endproc; .size STRCSPN_IA32, .-STRCSPN_IA32
90 # undef libc_hidden_builtin_def
91 /* IFUNC doesn't work with the hidden functions in shared library since
92 they will be called without setting up EBX needed for PLT which is
94 # define libc_hidden_builtin_def(name) \
95 .globl __GI_STRCSPN; __GI_STRCSPN = STRCSPN_IA32
98 #endif /* HAVE_SSE4_SUPPORT */
100 #ifdef USE_AS_STRPBRK
101 #include "../../strpbrk.S"
103 #include "../../strcspn.S"