]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
powerpc: Use generic wcsrchr optimization
[thirdparty/glibc.git] / sysdeps / powerpc / powerpc32 / power4 / multiarch / ifunc-impl-list.c
1 /* Enumerate available IFUNC implementations of a function. PowerPC32 version.
2 Copyright (C) 2013-2019 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 <ldsodefs.h>
23 #include <ifunc-impl-list.h>
24
25 /* Maximum number of IFUNC implementations. */
26 #define MAX_IFUNC 6
27
28 size_t
29 __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
30 size_t max)
31 {
32 assert (max >= MAX_IFUNC);
33
34 size_t i = 0;
35
36 unsigned long int hwcap = GLRO(dl_hwcap);
37 /* hwcap contains only the latest supported ISA, the code checks which is
38 and fills the previous supported ones. */
39 if (hwcap & PPC_FEATURE_ARCH_2_06)
40 hwcap |= PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_POWER5_PLUS |
41 PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4;
42 else if (hwcap & PPC_FEATURE_ARCH_2_05)
43 hwcap |= PPC_FEATURE_POWER5_PLUS | PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4;
44 else if (hwcap & PPC_FEATURE_POWER5_PLUS)
45 hwcap |= PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4;
46 else if (hwcap & PPC_FEATURE_POWER5)
47 hwcap |= PPC_FEATURE_POWER4;
48
49 #ifdef SHARED
50 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c. */
51 IFUNC_IMPL (i, name, memcpy,
52 IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_HAS_VSX,
53 __memcpy_power7)
54 IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_06,
55 __memcpy_a2)
56 IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_05,
57 __memcpy_power6)
58 IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_CELL_BE,
59 __memcpy_cell)
60 IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc))
61
62 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/memmove.c. */
63 IFUNC_IMPL (i, name, memmove,
64 IFUNC_IMPL_ADD (array, i, memmove, hwcap & PPC_FEATURE_HAS_VSX,
65 __memmove_power7)
66 IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_ppc))
67
68 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/memset.c. */
69 IFUNC_IMPL (i, name, memset,
70 IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_HAS_VSX,
71 __memset_power7)
72 IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_ARCH_2_05,
73 __memset_power6)
74 IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ppc))
75
76 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/bzero.c. */
77 IFUNC_IMPL (i, name, bzero,
78 IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_HAS_VSX,
79 __bzero_power7)
80 IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_ARCH_2_05,
81 __bzero_power6)
82 IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ppc))
83
84 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/strlen.c. */
85 IFUNC_IMPL (i, name, strlen,
86 IFUNC_IMPL_ADD (array, i, strlen, hwcap & PPC_FEATURE_HAS_VSX,
87 __strlen_power7)
88 IFUNC_IMPL_ADD (array, i, strlen, 1,
89 __strlen_ppc))
90
91 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/strnlen.c. */
92 IFUNC_IMPL (i, name, strnlen,
93 IFUNC_IMPL_ADD (array, i, strnlen, hwcap & PPC_FEATURE_HAS_VSX,
94 __strnlen_power7)
95 IFUNC_IMPL_ADD (array, i, strnlen, 1,
96 __strnlen_ppc))
97
98 /* Support sysdeps/powerpc/powerpc32/multiarch/strncmp.c. */
99 IFUNC_IMPL (i, name, strncmp,
100 IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_HAS_VSX,
101 __strncmp_power7)
102 IFUNC_IMPL_ADD (array, i, strncmp, 1,
103 __strncmp_ppc))
104 #endif
105
106 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/memcmp.c. */
107 IFUNC_IMPL (i, name, memcmp,
108 IFUNC_IMPL_ADD (array, i, memcmp, hwcap & PPC_FEATURE_HAS_VSX,
109 __memcmp_power7)
110 IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ppc))
111
112 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c. */
113 IFUNC_IMPL (i, name, mempcpy,
114 IFUNC_IMPL_ADD (array, i, mempcpy,
115 hwcap & PPC_FEATURE_HAS_VSX,
116 __mempcpy_power7)
117 IFUNC_IMPL_ADD (array, i, mempcpy, 1,
118 __mempcpy_ppc))
119
120 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/memchr.c. */
121 IFUNC_IMPL (i, name, memchr,
122 IFUNC_IMPL_ADD (array, i, memchr,
123 hwcap & PPC_FEATURE_HAS_VSX,
124 __memchr_power7)
125 IFUNC_IMPL_ADD (array, i, memchr, 1,
126 __memchr_ppc))
127
128 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c. */
129 IFUNC_IMPL (i, name, memrchr,
130 IFUNC_IMPL_ADD (array, i, memrchr,
131 hwcap & PPC_FEATURE_HAS_VSX,
132 __memrchr_power7)
133 IFUNC_IMPL_ADD (array, i, memrchr, 1,
134 __memrchr_ppc))
135
136 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/rawmemchr.c. */
137 IFUNC_IMPL (i, name, rawmemchr,
138 IFUNC_IMPL_ADD (array, i, rawmemchr,
139 hwcap & PPC_FEATURE_HAS_VSX,
140 __rawmemchr_power7)
141 IFUNC_IMPL_ADD (array, i, rawmemchr, 1,
142 __rawmemchr_ppc))
143
144 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/strcasecmp.c. */
145 IFUNC_IMPL (i, name, strcasecmp,
146 IFUNC_IMPL_ADD (array, i, strcasecmp,
147 hwcap & PPC_FEATURE_HAS_VSX,
148 __strcasecmp_power7)
149 IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ppc))
150
151 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/strcasecmp_l.c. */
152 IFUNC_IMPL (i, name, strcasecmp_l,
153 IFUNC_IMPL_ADD (array, i, strcasecmp_l,
154 hwcap & PPC_FEATURE_HAS_VSX,
155 __strcasecmp_l_power7)
156 IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
157 __strcasecmp_l_ppc))
158
159 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/strncase.c. */
160 IFUNC_IMPL (i, name, strncasecmp,
161 IFUNC_IMPL_ADD (array, i, strncasecmp,
162 hwcap & PPC_FEATURE_HAS_VSX,
163 __strncasecmp_power7)
164 IFUNC_IMPL_ADD (array, i, strncasecmp, 1, __strncasecmp_ppc))
165
166 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/strncase_l.c. */
167 IFUNC_IMPL (i, name, strncasecmp_l,
168 IFUNC_IMPL_ADD (array, i, strncasecmp_l,
169 hwcap & PPC_FEATURE_HAS_VSX,
170 __strncasecmp_l_power7)
171 IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
172 __strncasecmp_l_ppc))
173
174 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c. */
175 IFUNC_IMPL (i, name, strchrnul,
176 IFUNC_IMPL_ADD (array, i, strchrnul,
177 hwcap & PPC_FEATURE_HAS_VSX,
178 __strchrnul_power7)
179 IFUNC_IMPL_ADD (array, i, strchrnul, 1,
180 __strchrnul_ppc))
181
182 /* Support sysdeps/powerpc/powerpc32/power4/multiarch/strchr.c. */
183 IFUNC_IMPL (i, name, strchr,
184 IFUNC_IMPL_ADD (array, i, strchr,
185 hwcap & PPC_FEATURE_HAS_VSX,
186 __strchr_power7)
187 IFUNC_IMPL_ADD (array, i, strchr, 1,
188 __strchr_ppc))
189
190 return i;
191 }