]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/i386/i686/multiarch/ifunc-impl-list.c
89afdc03262f6be382f0596cab4c704101a76280
[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-2020 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 <https://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, CPU_FEATURE_USABLE (SSSE3),
42 __bcopy_ssse3_rep)
43 IFUNC_IMPL_ADD (array, i, bcopy, CPU_FEATURE_USABLE (SSSE3),
44 __bcopy_ssse3)
45 IFUNC_IMPL_ADD (array, i, bcopy, CPU_FEATURE_USABLE (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, CPU_FEATURE_USABLE (SSE2),
52 __bzero_sse2_rep)
53 IFUNC_IMPL_ADD (array, i, bzero, CPU_FEATURE_USABLE (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, CPU_FEATURE_USABLE (SSE2),
60 __memchr_sse2_bsf)
61 IFUNC_IMPL_ADD (array, i, memchr, CPU_FEATURE_USABLE (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, CPU_FEATURE_USABLE (SSE4_2),
68 __memcmp_sse4_2)
69 IFUNC_IMPL_ADD (array, i, memcmp, CPU_FEATURE_USABLE (SSSE3),
70 __memcmp_ssse3)
71 IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ia32))
72
73 #ifdef SHARED
74 /* Support sysdeps/i386/i686/multiarch/memmove_chk.S. */
75 IFUNC_IMPL (i, name, __memmove_chk,
76 IFUNC_IMPL_ADD (array, i, __memmove_chk,
77 CPU_FEATURE_USABLE (SSSE3),
78 __memmove_chk_ssse3_rep)
79 IFUNC_IMPL_ADD (array, i, __memmove_chk,
80 CPU_FEATURE_USABLE (SSSE3),
81 __memmove_chk_ssse3)
82 IFUNC_IMPL_ADD (array, i, __memmove_chk,
83 CPU_FEATURE_USABLE (SSE2),
84 __memmove_chk_sse2_unaligned)
85 IFUNC_IMPL_ADD (array, i, __memmove_chk, 1,
86 __memmove_chk_ia32))
87 #endif
88
89 /* Support sysdeps/i386/i686/multiarch/memmove.S. */
90 IFUNC_IMPL (i, name, memmove,
91 IFUNC_IMPL_ADD (array, i, memmove, CPU_FEATURE_USABLE (SSSE3),
92 __memmove_ssse3_rep)
93 IFUNC_IMPL_ADD (array, i, memmove, CPU_FEATURE_USABLE (SSSE3),
94 __memmove_ssse3)
95 IFUNC_IMPL_ADD (array, i, memmove, CPU_FEATURE_USABLE (SSE2),
96 __memmove_sse2_unaligned)
97 IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_ia32))
98
99 /* Support sysdeps/i386/i686/multiarch/memrchr.S. */
100 IFUNC_IMPL (i, name, memrchr,
101 IFUNC_IMPL_ADD (array, i, memrchr, CPU_FEATURE_USABLE (SSE2),
102 __memrchr_sse2_bsf)
103 IFUNC_IMPL_ADD (array, i, memrchr, CPU_FEATURE_USABLE (SSE2),
104 __memrchr_sse2)
105 IFUNC_IMPL_ADD (array, i, memrchr, 1, __memrchr_ia32))
106
107 #ifdef SHARED
108 /* Support sysdeps/i386/i686/multiarch/memset_chk.S. */
109 IFUNC_IMPL (i, name, __memset_chk,
110 IFUNC_IMPL_ADD (array, i, __memset_chk,
111 CPU_FEATURE_USABLE (SSE2),
112 __memset_chk_sse2_rep)
113 IFUNC_IMPL_ADD (array, i, __memset_chk,
114 CPU_FEATURE_USABLE (SSE2),
115 __memset_chk_sse2)
116 IFUNC_IMPL_ADD (array, i, __memset_chk, 1,
117 __memset_chk_ia32))
118 #endif
119
120 /* Support sysdeps/i386/i686/multiarch/memset.S. */
121 IFUNC_IMPL (i, name, memset,
122 IFUNC_IMPL_ADD (array, i, memset, CPU_FEATURE_USABLE (SSE2),
123 __memset_sse2_rep)
124 IFUNC_IMPL_ADD (array, i, memset, CPU_FEATURE_USABLE (SSE2),
125 __memset_sse2)
126 IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ia32))
127
128 /* Support sysdeps/i386/i686/multiarch/rawmemchr.S. */
129 IFUNC_IMPL (i, name, rawmemchr,
130 IFUNC_IMPL_ADD (array, i, rawmemchr, CPU_FEATURE_USABLE (SSE2),
131 __rawmemchr_sse2_bsf)
132 IFUNC_IMPL_ADD (array, i, rawmemchr, CPU_FEATURE_USABLE (SSE2),
133 __rawmemchr_sse2)
134 IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_ia32))
135
136 /* Support sysdeps/i386/i686/multiarch/stpncpy.S. */
137 IFUNC_IMPL (i, name, stpncpy,
138 IFUNC_IMPL_ADD (array, i, stpncpy, CPU_FEATURE_USABLE (SSSE3),
139 __stpncpy_ssse3)
140 IFUNC_IMPL_ADD (array, i, stpncpy, CPU_FEATURE_USABLE (SSE2),
141 __stpncpy_sse2)
142 IFUNC_IMPL_ADD (array, i, stpncpy, 1, __stpncpy_ia32))
143
144 /* Support sysdeps/i386/i686/multiarch/stpcpy.S. */
145 IFUNC_IMPL (i, name, stpcpy,
146 IFUNC_IMPL_ADD (array, i, stpcpy, CPU_FEATURE_USABLE (SSSE3),
147 __stpcpy_ssse3)
148 IFUNC_IMPL_ADD (array, i, stpcpy, CPU_FEATURE_USABLE (SSE2),
149 __stpcpy_sse2)
150 IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_ia32))
151
152 /* Support sysdeps/i386/i686/multiarch/strcasecmp.S. */
153 IFUNC_IMPL (i, name, strcasecmp,
154 IFUNC_IMPL_ADD (array, i, strcasecmp,
155 CPU_FEATURE_USABLE (SSE4_2),
156 __strcasecmp_sse4_2)
157 IFUNC_IMPL_ADD (array, i, strcasecmp,
158 CPU_FEATURE_USABLE (SSSE3),
159 __strcasecmp_ssse3)
160 IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ia32))
161
162 /* Support sysdeps/i386/i686/multiarch/strcasecmp_l.S. */
163 IFUNC_IMPL (i, name, strcasecmp_l,
164 IFUNC_IMPL_ADD (array, i, strcasecmp_l,
165 CPU_FEATURE_USABLE (SSE4_2),
166 __strcasecmp_l_sse4_2)
167 IFUNC_IMPL_ADD (array, i, strcasecmp_l,
168 CPU_FEATURE_USABLE (SSSE3),
169 __strcasecmp_l_ssse3)
170 IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
171 __strcasecmp_l_ia32))
172
173 /* Support sysdeps/i386/i686/multiarch/strcat.S. */
174 IFUNC_IMPL (i, name, strcat,
175 IFUNC_IMPL_ADD (array, i, strcat, CPU_FEATURE_USABLE (SSSE3),
176 __strcat_ssse3)
177 IFUNC_IMPL_ADD (array, i, strcat, CPU_FEATURE_USABLE (SSE2),
178 __strcat_sse2)
179 IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_ia32))
180
181 /* Support sysdeps/i386/i686/multiarch/strchr.S. */
182 IFUNC_IMPL (i, name, strchr,
183 IFUNC_IMPL_ADD (array, i, strchr, CPU_FEATURE_USABLE (SSE2),
184 __strchr_sse2_bsf)
185 IFUNC_IMPL_ADD (array, i, strchr, CPU_FEATURE_USABLE (SSE2),
186 __strchr_sse2)
187 IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_ia32))
188
189 /* Support sysdeps/i386/i686/multiarch/strcmp.S. */
190 IFUNC_IMPL (i, name, strcmp,
191 IFUNC_IMPL_ADD (array, i, strcmp, CPU_FEATURE_USABLE (SSE4_2),
192 __strcmp_sse4_2)
193 IFUNC_IMPL_ADD (array, i, strcmp, CPU_FEATURE_USABLE (SSSE3),
194 __strcmp_ssse3)
195 IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_ia32))
196
197 /* Support sysdeps/i386/i686/multiarch/strcpy.S. */
198 IFUNC_IMPL (i, name, strcpy,
199 IFUNC_IMPL_ADD (array, i, strcpy, CPU_FEATURE_USABLE (SSSE3),
200 __strcpy_ssse3)
201 IFUNC_IMPL_ADD (array, i, strcpy, CPU_FEATURE_USABLE (SSE2),
202 __strcpy_sse2)
203 IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_ia32))
204
205 /* Support sysdeps/i386/i686/multiarch/strcspn.S. */
206 IFUNC_IMPL (i, name, strcspn,
207 IFUNC_IMPL_ADD (array, i, strcspn, CPU_FEATURE_USABLE (SSE4_2),
208 __strcspn_sse42)
209 IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_ia32))
210
211 /* Support sysdeps/i386/i686/multiarch/strncase.S. */
212 IFUNC_IMPL (i, name, strncasecmp,
213 IFUNC_IMPL_ADD (array, i, strncasecmp,
214 CPU_FEATURE_USABLE (SSE4_2),
215 __strncasecmp_sse4_2)
216 IFUNC_IMPL_ADD (array, i, strncasecmp,
217 CPU_FEATURE_USABLE (SSSE3),
218 __strncasecmp_ssse3)
219 IFUNC_IMPL_ADD (array, i, strncasecmp, 1,
220 __strncasecmp_ia32))
221
222 /* Support sysdeps/i386/i686/multiarch/strncase_l.S. */
223 IFUNC_IMPL (i, name, strncasecmp_l,
224 IFUNC_IMPL_ADD (array, i, strncasecmp_l,
225 CPU_FEATURE_USABLE (SSE4_2),
226 __strncasecmp_l_sse4_2)
227 IFUNC_IMPL_ADD (array, i, strncasecmp_l,
228 CPU_FEATURE_USABLE (SSSE3),
229 __strncasecmp_l_ssse3)
230 IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
231 __strncasecmp_l_ia32))
232
233 /* Support sysdeps/i386/i686/multiarch/strncat.S. */
234 IFUNC_IMPL (i, name, strncat,
235 IFUNC_IMPL_ADD (array, i, strncat, CPU_FEATURE_USABLE (SSSE3),
236 __strncat_ssse3)
237 IFUNC_IMPL_ADD (array, i, strncat, CPU_FEATURE_USABLE (SSE2),
238 __strncat_sse2)
239 IFUNC_IMPL_ADD (array, i, strncat, 1, __strncat_ia32))
240
241 /* Support sysdeps/i386/i686/multiarch/strncpy.S. */
242 IFUNC_IMPL (i, name, strncpy,
243 IFUNC_IMPL_ADD (array, i, strncpy, CPU_FEATURE_USABLE (SSSE3),
244 __strncpy_ssse3)
245 IFUNC_IMPL_ADD (array, i, strncpy, CPU_FEATURE_USABLE (SSE2),
246 __strncpy_sse2)
247 IFUNC_IMPL_ADD (array, i, strncpy, 1, __strncpy_ia32))
248
249 /* Support sysdeps/i386/i686/multiarch/strnlen.S. */
250 IFUNC_IMPL (i, name, strnlen,
251 IFUNC_IMPL_ADD (array, i, strnlen, CPU_FEATURE_USABLE (SSE2),
252 __strnlen_sse2)
253 IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_ia32))
254
255 /* Support sysdeps/i386/i686/multiarch/strpbrk.S. */
256 IFUNC_IMPL (i, name, strpbrk,
257 IFUNC_IMPL_ADD (array, i, strpbrk, CPU_FEATURE_USABLE (SSE4_2),
258 __strpbrk_sse42)
259 IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_ia32))
260
261 /* Support sysdeps/i386/i686/multiarch/strrchr.S. */
262 IFUNC_IMPL (i, name, strrchr,
263 IFUNC_IMPL_ADD (array, i, strrchr, CPU_FEATURE_USABLE (SSE2),
264 __strrchr_sse2_bsf)
265 IFUNC_IMPL_ADD (array, i, strrchr, CPU_FEATURE_USABLE (SSE2),
266 __strrchr_sse2)
267 IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_ia32))
268
269 /* Support sysdeps/i386/i686/multiarch/strspn.S. */
270 IFUNC_IMPL (i, name, strspn,
271 IFUNC_IMPL_ADD (array, i, strspn, CPU_FEATURE_USABLE (SSE4_2),
272 __strspn_sse42)
273 IFUNC_IMPL_ADD (array, i, strspn, 1, __strspn_ia32))
274
275 /* Support sysdeps/i386/i686/multiarch/wcschr.S. */
276 IFUNC_IMPL (i, name, wcschr,
277 IFUNC_IMPL_ADD (array, i, wcschr, CPU_FEATURE_USABLE (SSE2),
278 __wcschr_sse2)
279 IFUNC_IMPL_ADD (array, i, wcschr, 1, __wcschr_ia32))
280
281 /* Support sysdeps/i386/i686/multiarch/wcscmp.S. */
282 IFUNC_IMPL (i, name, wcscmp,
283 IFUNC_IMPL_ADD (array, i, wcscmp, CPU_FEATURE_USABLE (SSE2),
284 __wcscmp_sse2)
285 IFUNC_IMPL_ADD (array, i, wcscmp, 1, __wcscmp_ia32))
286
287 /* Support sysdeps/i386/i686/multiarch/wcscpy.S. */
288 IFUNC_IMPL (i, name, wcscpy,
289 IFUNC_IMPL_ADD (array, i, wcscpy, CPU_FEATURE_USABLE (SSSE3),
290 __wcscpy_ssse3)
291 IFUNC_IMPL_ADD (array, i, wcscpy, 1, __wcscpy_ia32))
292
293 /* Support sysdeps/i386/i686/multiarch/wcslen.S. */
294 IFUNC_IMPL (i, name, wcslen,
295 IFUNC_IMPL_ADD (array, i, wcslen, CPU_FEATURE_USABLE (SSE2),
296 __wcslen_sse2)
297 IFUNC_IMPL_ADD (array, i, wcslen, 1, __wcslen_ia32))
298
299 /* Support sysdeps/i386/i686/multiarch/wcsrchr.S. */
300 IFUNC_IMPL (i, name, wcsrchr,
301 IFUNC_IMPL_ADD (array, i, wcsrchr, CPU_FEATURE_USABLE (SSE2),
302 __wcsrchr_sse2)
303 IFUNC_IMPL_ADD (array, i, wcsrchr, 1, __wcsrchr_ia32))
304
305 /* Support sysdeps/i386/i686/multiarch/wmemcmp.S. */
306 IFUNC_IMPL (i, name, wmemcmp,
307 IFUNC_IMPL_ADD (array, i, wmemcmp, CPU_FEATURE_USABLE (SSE4_2),
308 __wmemcmp_sse4_2)
309 IFUNC_IMPL_ADD (array, i, wmemcmp, CPU_FEATURE_USABLE (SSSE3),
310 __wmemcmp_ssse3)
311 IFUNC_IMPL_ADD (array, i, wmemcmp, 1, __wmemcmp_ia32))
312
313 #ifdef SHARED
314 /* Support sysdeps/i386/i686/multiarch/memcpy_chk.S. */
315 IFUNC_IMPL (i, name, __memcpy_chk,
316 IFUNC_IMPL_ADD (array, i, __memcpy_chk,
317 CPU_FEATURE_USABLE (SSSE3),
318 __memcpy_chk_ssse3_rep)
319 IFUNC_IMPL_ADD (array, i, __memcpy_chk,
320 CPU_FEATURE_USABLE (SSSE3),
321 __memcpy_chk_ssse3)
322 IFUNC_IMPL_ADD (array, i, __memcpy_chk,
323 CPU_FEATURE_USABLE (SSE2),
324 __memcpy_chk_sse2_unaligned)
325 IFUNC_IMPL_ADD (array, i, __memcpy_chk, 1,
326 __memcpy_chk_ia32))
327
328 /* Support sysdeps/i386/i686/multiarch/memcpy.S. */
329 IFUNC_IMPL (i, name, memcpy,
330 IFUNC_IMPL_ADD (array, i, memcpy, CPU_FEATURE_USABLE (SSSE3),
331 __memcpy_ssse3_rep)
332 IFUNC_IMPL_ADD (array, i, memcpy, CPU_FEATURE_USABLE (SSSE3),
333 __memcpy_ssse3)
334 IFUNC_IMPL_ADD (array, i, memcpy, CPU_FEATURE_USABLE (SSE2),
335 __memcpy_sse2_unaligned)
336 IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ia32))
337
338 /* Support sysdeps/i386/i686/multiarch/mempcpy_chk.S. */
339 IFUNC_IMPL (i, name, __mempcpy_chk,
340 IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
341 CPU_FEATURE_USABLE (SSSE3),
342 __mempcpy_chk_ssse3_rep)
343 IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
344 CPU_FEATURE_USABLE (SSSE3),
345 __mempcpy_chk_ssse3)
346 IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
347 CPU_FEATURE_USABLE (SSE2),
348 __mempcpy_chk_sse2_unaligned)
349 IFUNC_IMPL_ADD (array, i, __mempcpy_chk, 1,
350 __mempcpy_chk_ia32))
351
352 /* Support sysdeps/i386/i686/multiarch/mempcpy.S. */
353 IFUNC_IMPL (i, name, mempcpy,
354 IFUNC_IMPL_ADD (array, i, mempcpy, CPU_FEATURE_USABLE (SSSE3),
355 __mempcpy_ssse3_rep)
356 IFUNC_IMPL_ADD (array, i, mempcpy, CPU_FEATURE_USABLE (SSSE3),
357 __mempcpy_ssse3)
358 IFUNC_IMPL_ADD (array, i, mempcpy, CPU_FEATURE_USABLE (SSE2),
359 __mempcpy_sse2_unaligned)
360 IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_ia32))
361
362 /* Support sysdeps/i386/i686/multiarch/strlen.S. */
363 IFUNC_IMPL (i, name, strlen,
364 IFUNC_IMPL_ADD (array, i, strlen, CPU_FEATURE_USABLE (SSE2),
365 __strlen_sse2_bsf)
366 IFUNC_IMPL_ADD (array, i, strlen, CPU_FEATURE_USABLE (SSE2),
367 __strlen_sse2)
368 IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_ia32))
369
370 /* Support sysdeps/i386/i686/multiarch/strncmp.S. */
371 IFUNC_IMPL (i, name, strncmp,
372 IFUNC_IMPL_ADD (array, i, strncmp, CPU_FEATURE_USABLE (SSE4_2),
373 __strncmp_sse4_2)
374 IFUNC_IMPL_ADD (array, i, strncmp, CPU_FEATURE_USABLE (SSSE3),
375 __strncmp_ssse3)
376 IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_ia32))
377 #endif
378
379 return i;
380 }