]>
Commit | Line | Data |
---|---|---|
02cea471 | 1 | /* Multiple versions of strcspn |
b090e8ea | 2 | All versions must be listed in ifunc-impl-list.c. |
f7a9f785 | 3 | Copyright (C) 2009-2016 Free Software Foundation, Inc. |
02cea471 L |
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 | |
59ba27a6 PE |
18 | License along with the GNU C Library; if not, see |
19 | <http://www.gnu.org/licenses/>. */ | |
02cea471 L |
20 | |
21 | #include <config.h> | |
02cea471 | 22 | #include <sysdep.h> |
2510d01d | 23 | #include <init-arch.h> |
02cea471 L |
24 | |
25 | #ifdef USE_AS_STRPBRK | |
26 | #define STRCSPN_SSE42 __strpbrk_sse42 | |
27 | #define STRCSPN_IA32 __strpbrk_ia32 | |
28 | #define __GI_STRCSPN __GI_strpbrk | |
29 | #else | |
30 | #ifndef STRCSPN | |
31 | #define STRCSPN strcspn | |
32 | #define STRCSPN_SSE42 __strcspn_sse42 | |
33 | #define STRCSPN_IA32 __strcspn_ia32 | |
34 | #define __GI_STRCSPN __GI_strcspn | |
35 | #endif | |
36 | #endif | |
37 | ||
38 | /* Define multiple versions only for the definition in libc. Don't | |
39 | define multiple versions for strpbrk in static library since we | |
40 | need strpbrk before the initialization happened. */ | |
4f41c682 | 41 | #if (defined SHARED || !defined USE_AS_STRPBRK) && IS_IN (libc) |
02cea471 L |
42 | .text |
43 | ENTRY(STRCSPN) | |
44 | .type STRCSPN, @gnu_indirect_function | |
1aee37a2 L |
45 | LOAD_GOT_AND_RTLD_GLOBAL_RO |
46 | LOAD_FUNC_GOT_EAX (STRCSPN_IA32) | |
47 | HAS_CPU_FEATURE (SSE4_2) | |
02cea471 | 48 | jz 2f |
1aee37a2 | 49 | LOAD_FUNC_GOT_EAX (STRCSPN_SSE42) |
fc1870e6 L |
50 | 2: ret |
51 | END(STRCSPN) | |
02cea471 L |
52 | |
53 | # undef ENTRY | |
54 | # define ENTRY(name) \ | |
55 | .type STRCSPN_IA32, @function; \ | |
56 | .globl STRCSPN_IA32; \ | |
57 | .p2align 4; \ | |
58 | STRCSPN_IA32: cfi_startproc; \ | |
59 | CALL_MCOUNT | |
60 | # undef END | |
61 | # define END(name) \ | |
62 | cfi_endproc; .size STRCSPN_IA32, .-STRCSPN_IA32 | |
63 | # undef libc_hidden_builtin_def | |
2c709c6f UD |
64 | /* IFUNC doesn't work with the hidden functions in shared library since |
65 | they will be called without setting up EBX needed for PLT which is | |
66 | used by IFUNC. */ | |
02cea471 L |
67 | # define libc_hidden_builtin_def(name) \ |
68 | .globl __GI_STRCSPN; __GI_STRCSPN = STRCSPN_IA32 | |
69 | #endif | |
70 | ||
02cea471 L |
71 | #ifdef USE_AS_STRPBRK |
72 | #include "../../strpbrk.S" | |
73 | #else | |
74 | #include "../../strcspn.S" | |
75 | #endif |