1 /* Multiple versions of strcspn
2 Copyright (C) 2009, 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/>. */
22 #ifdef HAVE_SSE4_SUPPORT
25 #include <init-arch.h>
28 #define STRCSPN_SSE42 __strpbrk_sse42
29 #define STRCSPN_IA32 __strpbrk_ia32
30 #define __GI_STRCSPN __GI_strpbrk
33 #define STRCSPN strcspn
34 #define STRCSPN_SSE42 __strcspn_sse42
35 #define STRCSPN_IA32 __strcspn_ia32
36 #define __GI_STRCSPN __GI_strcspn
40 /* Define multiple versions only for the definition in libc. Don't
41 define multiple versions for strpbrk in static library since we
42 need strpbrk before the initialization happened. */
43 #if (defined SHARED || !defined USE_AS_STRPBRK) && !defined NOT_IN_libc
47 .type STRCSPN, @gnu_indirect_function
49 cfi_adjust_cfa_offset (4)
50 cfi_rel_offset (ebx, 0)
52 cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
54 call __init_cpu_features
55 1: leal STRCSPN_IA32@GOTOFF(%ebx), %eax
56 testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features@GOTOFF(%ebx)
58 leal STRCSPN_SSE42@GOTOFF(%ebx), %eax
60 cfi_adjust_cfa_offset (-4);
67 .type STRCSPN, @gnu_indirect_function
68 cmpl $0, KIND_OFFSET+__cpu_features
70 call __init_cpu_features
71 1: leal STRCSPN_IA32, %eax
72 testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features
74 leal STRCSPN_SSE42, %eax
80 # define ENTRY(name) \
81 .type STRCSPN_IA32, @function; \
82 .globl STRCSPN_IA32; \
84 STRCSPN_IA32: cfi_startproc; \
88 cfi_endproc; .size STRCSPN_IA32, .-STRCSPN_IA32
89 # undef libc_hidden_builtin_def
90 /* IFUNC doesn't work with the hidden functions in shared library since
91 they will be called without setting up EBX needed for PLT which is
93 # define libc_hidden_builtin_def(name) \
94 .globl __GI_STRCSPN; __GI_STRCSPN = STRCSPN_IA32
97 #endif /* HAVE_SSE4_SUPPORT */
100 #include "../../strpbrk.S"
102 #include "../../strcspn.S"