]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/i386/i686/multiarch/ifunc-impl-list.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / i386 / i686 / multiarch / ifunc-impl-list.c
1 /* Enumerate available IFUNC implementations of a function. i686 version.
2 Copyright (C) 2012-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19 #include <assert.h>
20 #include <string.h>
21 #include <wchar.h>
22 #include <ifunc-impl-list.h>
23 #include "init-arch.h"
24
25 /* Maximum number of IFUNC implementations. */
26 #define MAX_IFUNC 4
27
28 /* Fill ARRAY of MAX elements with IFUNC implementations for function
29 NAME and return the number of valid entries. */
30
31 size_t
32 __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
33 size_t max)
34 {
35 assert (max >= MAX_IFUNC);
36
37 size_t i = 0;
38
39 /* Support sysdeps/i386/i686/multiarch/bcopy.S. */
40 IFUNC_IMPL (i, name, bcopy,
41 IFUNC_IMPL_ADD (array, i, bcopy, HAS_CPU_FEATURE (SSSE3),
42 __bcopy_ssse3_rep)
43 IFUNC_IMPL_ADD (array, i, bcopy, HAS_CPU_FEATURE (SSSE3),
44 __bcopy_ssse3)
45 IFUNC_IMPL_ADD (array, i, bcopy, HAS_CPU_FEATURE (SSE2),
46 __bcopy_sse2_unaligned)
47 IFUNC_IMPL_ADD (array, i, bcopy, 1, __bcopy_ia32))
48
49 /* Support sysdeps/i386/i686/multiarch/bzero.S. */
50 IFUNC_IMPL (i, name, bzero,
51 IFUNC_IMPL_ADD (array, i, bzero, HAS_CPU_FEATURE (SSE2),
52 __bzero_sse2_rep)
53 IFUNC_IMPL_ADD (array, i, bzero, HAS_CPU_FEATURE (SSE2),
54 __bzero_sse2)
55 IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ia32))
56
57 /* Support sysdeps/i386/i686/multiarch/memchr.S. */
58 IFUNC_IMPL (i, name, memchr,
59 IFUNC_IMPL_ADD (array, i, memchr, HAS_CPU_FEATURE (SSE2),
60 __memchr_sse2_bsf)
61 IFUNC_IMPL_ADD (array, i, memchr, HAS_CPU_FEATURE (SSE2),
62 __memchr_sse2)
63 IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_ia32))
64
65 /* Support sysdeps/i386/i686/multiarch/memcmp.S. */
66 IFUNC_IMPL (i, name, memcmp,
67 IFUNC_IMPL_ADD (array, i, memcmp, HAS_CPU_FEATURE (SSE4_2),
68 __memcmp_sse4_2)
69 IFUNC_IMPL_ADD (array, i, memcmp, HAS_CPU_FEATURE (SSSE3),
70 __memcmp_ssse3)
71 IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ia32))
72
73 /* Support sysdeps/i386/i686/multiarch/memmove_chk.S. */
74 IFUNC_IMPL (i, name, __memmove_chk,
75 IFUNC_IMPL_ADD (array, i, __memmove_chk,
76 HAS_CPU_FEATURE (SSSE3),
77 __memmove_chk_ssse3_rep)
78 IFUNC_IMPL_ADD (array, i, __memmove_chk,
79 HAS_CPU_FEATURE (SSSE3),
80 __memmove_chk_ssse3)
81 IFUNC_IMPL_ADD (array, i, __memmove_chk,
82 HAS_CPU_FEATURE (SSE2),
83 __memmove_chk_sse2_unaligned)
84 IFUNC_IMPL_ADD (array, i, __memmove_chk, 1,
85 __memmove_chk_ia32))
86
87 /* Support sysdeps/i386/i686/multiarch/memmove.S. */
88 IFUNC_IMPL (i, name, memmove,
89 IFUNC_IMPL_ADD (array, i, memmove, HAS_CPU_FEATURE (SSSE3),
90 __memmove_ssse3_rep)
91 IFUNC_IMPL_ADD (array, i, memmove, HAS_CPU_FEATURE (SSSE3),
92 __memmove_ssse3)
93 IFUNC_IMPL_ADD (array, i, memmove, HAS_CPU_FEATURE (SSE2),
94 __memmove_sse2_unaligned)
95 IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_ia32))
96
97 /* Support sysdeps/i386/i686/multiarch/memrchr.S. */
98 IFUNC_IMPL (i, name, memrchr,
99 IFUNC_IMPL_ADD (array, i, memrchr, HAS_CPU_FEATURE (SSE2),
100 __memrchr_sse2_bsf)
101 IFUNC_IMPL_ADD (array, i, memrchr, HAS_CPU_FEATURE (SSE2),
102 __memrchr_sse2)
103 IFUNC_IMPL_ADD (array, i, memrchr, 1, __memrchr_ia32))
104
105 /* Support sysdeps/i386/i686/multiarch/memset_chk.S. */
106 IFUNC_IMPL (i, name, __memset_chk,
107 IFUNC_IMPL_ADD (array, i, __memset_chk,
108 HAS_CPU_FEATURE (SSE2),
109 __memset_chk_sse2_rep)
110 IFUNC_IMPL_ADD (array, i, __memset_chk,
111 HAS_CPU_FEATURE (SSE2),
112 __memset_chk_sse2)
113 IFUNC_IMPL_ADD (array, i, __memset_chk, 1,
114 __memset_chk_ia32))
115
116 /* Support sysdeps/i386/i686/multiarch/memset.S. */
117 IFUNC_IMPL (i, name, memset,
118 IFUNC_IMPL_ADD (array, i, memset, HAS_CPU_FEATURE (SSE2),
119 __memset_sse2_rep)
120 IFUNC_IMPL_ADD (array, i, memset, HAS_CPU_FEATURE (SSE2),
121 __memset_sse2)
122 IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ia32))
123
124 /* Support sysdeps/i386/i686/multiarch/rawmemchr.S. */
125 IFUNC_IMPL (i, name, rawmemchr,
126 IFUNC_IMPL_ADD (array, i, rawmemchr, HAS_CPU_FEATURE (SSE2),
127 __rawmemchr_sse2_bsf)
128 IFUNC_IMPL_ADD (array, i, rawmemchr, HAS_CPU_FEATURE (SSE2),
129 __rawmemchr_sse2)
130 IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_ia32))
131
132 /* Support sysdeps/i386/i686/multiarch/stpncpy.S. */
133 IFUNC_IMPL (i, name, stpncpy,
134 IFUNC_IMPL_ADD (array, i, stpncpy, HAS_CPU_FEATURE (SSSE3),
135 __stpncpy_ssse3)
136 IFUNC_IMPL_ADD (array, i, stpncpy, HAS_CPU_FEATURE (SSE2),
137 __stpncpy_sse2)
138 IFUNC_IMPL_ADD (array, i, stpncpy, 1, __stpncpy_ia32))
139
140 /* Support sysdeps/i386/i686/multiarch/stpcpy.S. */
141 IFUNC_IMPL (i, name, stpcpy,
142 IFUNC_IMPL_ADD (array, i, stpcpy, HAS_CPU_FEATURE (SSSE3),
143 __stpcpy_ssse3)
144 IFUNC_IMPL_ADD (array, i, stpcpy, HAS_CPU_FEATURE (SSE2),
145 __stpcpy_sse2)
146 IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_ia32))
147
148 /* Support sysdeps/i386/i686/multiarch/strcasecmp.S. */
149 IFUNC_IMPL (i, name, strcasecmp,
150 IFUNC_IMPL_ADD (array, i, strcasecmp,
151 HAS_CPU_FEATURE (SSE4_2),
152 __strcasecmp_sse4_2)
153 IFUNC_IMPL_ADD (array, i, strcasecmp,
154 HAS_CPU_FEATURE (SSSE3),
155 __strcasecmp_ssse3)
156 IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ia32))
157
158 /* Support sysdeps/i386/i686/multiarch/strcasecmp_l.S. */
159 IFUNC_IMPL (i, name, strcasecmp_l,
160 IFUNC_IMPL_ADD (array, i, strcasecmp_l,
161 HAS_CPU_FEATURE (SSE4_2),
162 __strcasecmp_l_sse4_2)
163 IFUNC_IMPL_ADD (array, i, strcasecmp_l,
164 HAS_CPU_FEATURE (SSSE3),
165 __strcasecmp_l_ssse3)
166 IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
167 __strcasecmp_l_ia32))
168
169 /* Support sysdeps/i386/i686/multiarch/strcat.S. */
170 IFUNC_IMPL (i, name, strcat,
171 IFUNC_IMPL_ADD (array, i, strcat, HAS_CPU_FEATURE (SSSE3),
172 __strcat_ssse3)
173 IFUNC_IMPL_ADD (array, i, strcat, HAS_CPU_FEATURE (SSE2),
174 __strcat_sse2)
175 IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_ia32))
176
177 /* Support sysdeps/i386/i686/multiarch/strchr.S. */
178 IFUNC_IMPL (i, name, strchr,
179 IFUNC_IMPL_ADD (array, i, strchr, HAS_CPU_FEATURE (SSE2),
180 __strchr_sse2_bsf)
181 IFUNC_IMPL_ADD (array, i, strchr, HAS_CPU_FEATURE (SSE2),
182 __strchr_sse2)
183 IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_ia32))
184
185 /* Support sysdeps/i386/i686/multiarch/strcmp.S. */
186 IFUNC_IMPL (i, name, strcmp,
187 IFUNC_IMPL_ADD (array, i, strcmp, HAS_CPU_FEATURE (SSE4_2),
188 __strcmp_sse4_2)
189 IFUNC_IMPL_ADD (array, i, strcmp, HAS_CPU_FEATURE (SSSE3),
190 __strcmp_ssse3)
191 IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_ia32))
192
193 /* Support sysdeps/i386/i686/multiarch/strcpy.S. */
194 IFUNC_IMPL (i, name, strcpy,
195 IFUNC_IMPL_ADD (array, i, strcpy, HAS_CPU_FEATURE (SSSE3),
196 __strcpy_ssse3)
197 IFUNC_IMPL_ADD (array, i, strcpy, HAS_CPU_FEATURE (SSE2),
198 __strcpy_sse2)
199 IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_ia32))
200
201 /* Support sysdeps/i386/i686/multiarch/strcspn.S. */
202 IFUNC_IMPL (i, name, strcspn,
203 IFUNC_IMPL_ADD (array, i, strcspn, HAS_CPU_FEATURE (SSE4_2),
204 __strcspn_sse42)
205 IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_ia32))
206
207 /* Support sysdeps/i386/i686/multiarch/strncase.S. */
208 IFUNC_IMPL (i, name, strncasecmp,
209 IFUNC_IMPL_ADD (array, i, strncasecmp,
210 HAS_CPU_FEATURE (SSE4_2),
211 __strncasecmp_sse4_2)
212 IFUNC_IMPL_ADD (array, i, strncasecmp,
213 HAS_CPU_FEATURE (SSSE3),
214 __strncasecmp_ssse3)
215 IFUNC_IMPL_ADD (array, i, strncasecmp, 1,
216 __strncasecmp_ia32))
217
218 /* Support sysdeps/i386/i686/multiarch/strncase_l.S. */
219 IFUNC_IMPL (i, name, strncasecmp_l,
220 IFUNC_IMPL_ADD (array, i, strncasecmp_l,
221 HAS_CPU_FEATURE (SSE4_2),
222 __strncasecmp_l_sse4_2)
223 IFUNC_IMPL_ADD (array, i, strncasecmp_l,
224 HAS_CPU_FEATURE (SSSE3),
225 __strncasecmp_l_ssse3)
226 IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
227 __strncasecmp_l_ia32))
228
229 /* Support sysdeps/i386/i686/multiarch/strncat.S. */
230 IFUNC_IMPL (i, name, strncat,
231 IFUNC_IMPL_ADD (array, i, strncat, HAS_CPU_FEATURE (SSSE3),
232 __strncat_ssse3)
233 IFUNC_IMPL_ADD (array, i, strncat, HAS_CPU_FEATURE (SSE2),
234 __strncat_sse2)
235 IFUNC_IMPL_ADD (array, i, strncat, 1, __strncat_ia32))
236
237 /* Support sysdeps/i386/i686/multiarch/strncpy.S. */
238 IFUNC_IMPL (i, name, strncpy,
239 IFUNC_IMPL_ADD (array, i, strncpy, HAS_CPU_FEATURE (SSSE3),
240 __strncpy_ssse3)
241 IFUNC_IMPL_ADD (array, i, strncpy, HAS_CPU_FEATURE (SSE2),
242 __strncpy_sse2)
243 IFUNC_IMPL_ADD (array, i, strncpy, 1, __strncpy_ia32))
244
245 /* Support sysdeps/i386/i686/multiarch/strnlen.S. */
246 IFUNC_IMPL (i, name, strnlen,
247 IFUNC_IMPL_ADD (array, i, strnlen, HAS_CPU_FEATURE (SSE2),
248 __strnlen_sse2)
249 IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_ia32))
250
251 /* Support sysdeps/i386/i686/multiarch/strpbrk.S. */
252 IFUNC_IMPL (i, name, strpbrk,
253 IFUNC_IMPL_ADD (array, i, strpbrk, HAS_CPU_FEATURE (SSE4_2),
254 __strpbrk_sse42)
255 IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_ia32))
256
257 /* Support sysdeps/i386/i686/multiarch/strrchr.S. */
258 IFUNC_IMPL (i, name, strrchr,
259 IFUNC_IMPL_ADD (array, i, strrchr, HAS_CPU_FEATURE (SSE2),
260 __strrchr_sse2_bsf)
261 IFUNC_IMPL_ADD (array, i, strrchr, HAS_CPU_FEATURE (SSE2),
262 __strrchr_sse2)
263 IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_ia32))
264
265 /* Support sysdeps/i386/i686/multiarch/strspn.S. */
266 IFUNC_IMPL (i, name, strspn,
267 IFUNC_IMPL_ADD (array, i, strspn, HAS_CPU_FEATURE (SSE4_2),
268 __strspn_sse42)
269 IFUNC_IMPL_ADD (array, i, strspn, 1, __strspn_ia32))
270
271 /* Support sysdeps/i386/i686/multiarch/wcschr.S. */
272 IFUNC_IMPL (i, name, wcschr,
273 IFUNC_IMPL_ADD (array, i, wcschr, HAS_CPU_FEATURE (SSE2),
274 __wcschr_sse2)
275 IFUNC_IMPL_ADD (array, i, wcschr, 1, __wcschr_ia32))
276
277 /* Support sysdeps/i386/i686/multiarch/wcscmp.S. */
278 IFUNC_IMPL (i, name, wcscmp,
279 IFUNC_IMPL_ADD (array, i, wcscmp, HAS_CPU_FEATURE (SSE2),
280 __wcscmp_sse2)
281 IFUNC_IMPL_ADD (array, i, wcscmp, 1, __wcscmp_ia32))
282
283 /* Support sysdeps/i386/i686/multiarch/wcscpy.S. */
284 IFUNC_IMPL (i, name, wcscpy,
285 IFUNC_IMPL_ADD (array, i, wcscpy, HAS_CPU_FEATURE (SSSE3),
286 __wcscpy_ssse3)
287 IFUNC_IMPL_ADD (array, i, wcscpy, 1, __wcscpy_ia32))
288
289 /* Support sysdeps/i386/i686/multiarch/wcslen.S. */
290 IFUNC_IMPL (i, name, wcslen,
291 IFUNC_IMPL_ADD (array, i, wcslen, HAS_CPU_FEATURE (SSE2),
292 __wcslen_sse2)
293 IFUNC_IMPL_ADD (array, i, wcslen, 1, __wcslen_ia32))
294
295 /* Support sysdeps/i386/i686/multiarch/wcsrchr.S. */
296 IFUNC_IMPL (i, name, wcsrchr,
297 IFUNC_IMPL_ADD (array, i, wcsrchr, HAS_CPU_FEATURE (SSE2),
298 __wcsrchr_sse2)
299 IFUNC_IMPL_ADD (array, i, wcsrchr, 1, __wcsrchr_ia32))
300
301 /* Support sysdeps/i386/i686/multiarch/wmemcmp.S. */
302 IFUNC_IMPL (i, name, wmemcmp,
303 IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_CPU_FEATURE (SSE4_2),
304 __wmemcmp_sse4_2)
305 IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_CPU_FEATURE (SSSE3),
306 __wmemcmp_ssse3)
307 IFUNC_IMPL_ADD (array, i, wmemcmp, 1, __wmemcmp_ia32))
308
309 #ifdef SHARED
310 /* Support sysdeps/i386/i686/multiarch/memcpy_chk.S. */
311 IFUNC_IMPL (i, name, __memcpy_chk,
312 IFUNC_IMPL_ADD (array, i, __memcpy_chk,
313 HAS_CPU_FEATURE (SSSE3),
314 __memcpy_chk_ssse3_rep)
315 IFUNC_IMPL_ADD (array, i, __memcpy_chk,
316 HAS_CPU_FEATURE (SSSE3),
317 __memcpy_chk_ssse3)
318 IFUNC_IMPL_ADD (array, i, __memcpy_chk,
319 HAS_CPU_FEATURE (SSE2),
320 __memcpy_chk_sse2_unaligned)
321 IFUNC_IMPL_ADD (array, i, __memcpy_chk, 1,
322 __memcpy_chk_ia32))
323
324 /* Support sysdeps/i386/i686/multiarch/memcpy.S. */
325 IFUNC_IMPL (i, name, memcpy,
326 IFUNC_IMPL_ADD (array, i, memcpy, HAS_CPU_FEATURE (SSSE3),
327 __memcpy_ssse3_rep)
328 IFUNC_IMPL_ADD (array, i, memcpy, HAS_CPU_FEATURE (SSSE3),
329 __memcpy_ssse3)
330 IFUNC_IMPL_ADD (array, i, memcpy, HAS_CPU_FEATURE (SSE2),
331 __memcpy_sse2_unaligned)
332 IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ia32))
333
334 /* Support sysdeps/i386/i686/multiarch/mempcpy_chk.S. */
335 IFUNC_IMPL (i, name, __mempcpy_chk,
336 IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
337 HAS_CPU_FEATURE (SSSE3),
338 __mempcpy_chk_ssse3_rep)
339 IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
340 HAS_CPU_FEATURE (SSSE3),
341 __mempcpy_chk_ssse3)
342 IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
343 HAS_CPU_FEATURE (SSE2),
344 __mempcpy_chk_sse2_unaligned)
345 IFUNC_IMPL_ADD (array, i, __mempcpy_chk, 1,
346 __mempcpy_chk_ia32))
347
348 /* Support sysdeps/i386/i686/multiarch/mempcpy.S. */
349 IFUNC_IMPL (i, name, mempcpy,
350 IFUNC_IMPL_ADD (array, i, mempcpy, HAS_CPU_FEATURE (SSSE3),
351 __mempcpy_ssse3_rep)
352 IFUNC_IMPL_ADD (array, i, mempcpy, HAS_CPU_FEATURE (SSSE3),
353 __mempcpy_ssse3)
354 IFUNC_IMPL_ADD (array, i, mempcpy, HAS_CPU_FEATURE (SSE2),
355 __mempcpy_sse2_unaligned)
356 IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_ia32))
357
358 /* Support sysdeps/i386/i686/multiarch/strlen.S. */
359 IFUNC_IMPL (i, name, strlen,
360 IFUNC_IMPL_ADD (array, i, strlen, HAS_CPU_FEATURE (SSE2),
361 __strlen_sse2_bsf)
362 IFUNC_IMPL_ADD (array, i, strlen, HAS_CPU_FEATURE (SSE2),
363 __strlen_sse2)
364 IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_ia32))
365
366 /* Support sysdeps/i386/i686/multiarch/strncmp.S. */
367 IFUNC_IMPL (i, name, strncmp,
368 IFUNC_IMPL_ADD (array, i, strncmp, HAS_CPU_FEATURE (SSE4_2),
369 __strncmp_sse4_2)
370 IFUNC_IMPL_ADD (array, i, strncmp, HAS_CPU_FEATURE (SSSE3),
371 __strncmp_ssse3)
372 IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_ia32))
373 #endif
374
375 return i;
376 }