blob: 2937092af3da963864ffe7622208e1a9431b3c43 [file] [log] [blame]
Colin Crossa6845402020-11-16 15:08:19 -08001// Copyright 2020 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package android
16
Colin Crossa6845402020-11-16 15:08:19 -080017var archVariants = map[ArchType][]string{
18 Arm: {
Colin Crossa6845402020-11-16 15:08:19 -080019 "armv7-a-neon",
20 "armv8-a",
21 "armv8-2a",
Colin Crossa6845402020-11-16 15:08:19 -080022 },
23 Arm64: {
Liz Kammer2c2afe22022-02-11 11:35:03 -050024 "armv8-a",
25 "armv8-a-branchprot",
26 "armv8-2a",
Colin Crossa6845402020-11-16 15:08:19 -080027 "armv8-2a-dotprod",
Evgenii Stepanov80d74922023-02-10 19:13:49 -080028 "armv9-a",
Colin Crossa6845402020-11-16 15:08:19 -080029 },
30 X86: {
31 "amberlake",
32 "atom",
33 "broadwell",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090034 "goldmont",
35 "goldmont-plus",
Satoshi Niwab6d818d2024-01-24 16:17:00 +090036 // Target arch is goldmont, but without supporting SHA and XSAVES.
Satoshi Niwac41f2112023-12-14 17:33:36 +090037 // This ensures efficient execution on a broad range of Intel/AMD CPUs used
Satoshi Niwab6d818d2024-01-24 16:17:00 +090038 // in Chromebooks, including those lacking SHA or XSAVES support.
Satoshi Niwac41f2112023-12-14 17:33:36 +090039 // (e.g. Kaby Lake, Gemini Lake, Alder Lake and AMD Zen series)
Satoshi Niwab6d818d2024-01-24 16:17:00 +090040 "goldmont-without-sha-xsaves",
Colin Crossa6845402020-11-16 15:08:19 -080041 "haswell",
42 "icelake",
43 "ivybridge",
44 "kabylake",
45 "sandybridge",
46 "silvermont",
47 "skylake",
48 "stoneyridge",
49 "tigerlake",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090050 "tremont",
Colin Crossa6845402020-11-16 15:08:19 -080051 "whiskeylake",
52 "x86_64",
53 },
54 X86_64: {
55 "amberlake",
56 "broadwell",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090057 "goldmont",
58 "goldmont-plus",
Satoshi Niwab6d818d2024-01-24 16:17:00 +090059 "goldmont-without-sha-xsaves",
Colin Crossa6845402020-11-16 15:08:19 -080060 "haswell",
61 "icelake",
62 "ivybridge",
63 "kabylake",
64 "sandybridge",
65 "silvermont",
66 "skylake",
67 "stoneyridge",
68 "tigerlake",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090069 "tremont",
Colin Crossa6845402020-11-16 15:08:19 -080070 "whiskeylake",
71 },
72}
73
Liz Kammer2c2afe22022-02-11 11:35:03 -050074var cpuVariants = map[ArchType][]string{
75 Arm: {
76 "cortex-a7",
77 "cortex-a8",
78 "cortex-a9",
79 "cortex-a15",
Jesus Sanchez-Palenciade7c7842023-03-02 16:56:05 -080080 "cortex-a32",
Liz Kammer2c2afe22022-02-11 11:35:03 -050081 "cortex-a53",
82 "cortex-a53.a57",
83 "cortex-a55",
84 "cortex-a72",
85 "cortex-a73",
86 "cortex-a75",
87 "cortex-a76",
88 "krait",
89 "kryo",
90 "kryo385",
91 "exynos-m1",
92 "exynos-m2",
93 },
94 Arm64: {
95 "cortex-a53",
96 "cortex-a55",
97 "cortex-a72",
98 "cortex-a73",
99 "cortex-a75",
100 "cortex-a76",
101 "kryo",
102 "kryo385",
103 "exynos-m1",
104 "exynos-m2",
Roopesh Nataraja826912e2024-07-08 15:27:45 -0700105 "oryon",
Liz Kammer2c2afe22022-02-11 11:35:03 -0500106 },
107 X86: {},
108 X86_64: {},
109}
110
Colin Crossa6845402020-11-16 15:08:19 -0800111var archFeatures = map[ArchType][]string{
112 Arm: {
113 "neon",
114 },
115 Arm64: {
116 "dotprod",
117 },
118 X86: {
119 "ssse3",
120 "sse4",
121 "sse4_1",
122 "sse4_2",
123 "aes_ni",
124 "avx",
125 "avx2",
126 "avx512",
127 "popcnt",
128 "movbe",
129 },
130 X86_64: {
131 "ssse3",
132 "sse4",
133 "sse4_1",
134 "sse4_2",
135 "aes_ni",
136 "avx",
137 "avx2",
138 "avx512",
139 "popcnt",
140 },
141}
142
Liz Kammere8303bd2022-02-16 09:02:48 -0500143var androidArchFeatureMap = map[ArchType]map[string][]string{
Colin Crossa6845402020-11-16 15:08:19 -0800144 Arm: {
145 "armv7-a-neon": {
146 "neon",
147 },
148 "armv8-a": {
149 "neon",
150 },
151 "armv8-2a": {
152 "neon",
153 },
154 },
155 Arm64: {
156 "armv8-2a-dotprod": {
157 "dotprod",
158 },
Evgenii Stepanov80d74922023-02-10 19:13:49 -0800159 "armv9-a": {
160 "dotprod",
161 },
Krzysztof KosiƄski918d2652024-09-04 21:24:06 +0000162 "armv9-2a": {
163 "dotprod",
164 },
Colin Crossa6845402020-11-16 15:08:19 -0800165 },
166 X86: {
167 "amberlake": {
168 "ssse3",
169 "sse4",
170 "sse4_1",
171 "sse4_2",
172 "avx",
173 "avx2",
174 "aes_ni",
175 "popcnt",
176 },
177 "atom": {
178 "ssse3",
179 "movbe",
180 },
181 "broadwell": {
182 "ssse3",
183 "sse4",
184 "sse4_1",
185 "sse4_2",
186 "avx",
187 "avx2",
188 "aes_ni",
189 "popcnt",
190 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900191 "goldmont": {
192 "ssse3",
193 "sse4",
194 "sse4_1",
195 "sse4_2",
196 "aes_ni",
197 "popcnt",
198 "movbe",
199 },
200 "goldmont-plus": {
201 "ssse3",
202 "sse4",
203 "sse4_1",
204 "sse4_2",
205 "aes_ni",
206 "popcnt",
207 "movbe",
208 },
Satoshi Niwab6d818d2024-01-24 16:17:00 +0900209 "goldmont-without-sha-xsaves": {
Satoshi Niwac41f2112023-12-14 17:33:36 +0900210 "ssse3",
211 "sse4",
212 "sse4_1",
213 "sse4_2",
214 "aes_ni",
215 "popcnt",
216 "movbe",
217 },
Colin Crossa6845402020-11-16 15:08:19 -0800218 "haswell": {
219 "ssse3",
220 "sse4",
221 "sse4_1",
222 "sse4_2",
223 "aes_ni",
224 "avx",
225 "popcnt",
226 "movbe",
227 },
228 "icelake": {
229 "ssse3",
230 "sse4",
231 "sse4_1",
232 "sse4_2",
233 "avx",
234 "avx2",
235 "avx512",
236 "aes_ni",
237 "popcnt",
238 },
239 "ivybridge": {
240 "ssse3",
241 "sse4",
242 "sse4_1",
243 "sse4_2",
244 "aes_ni",
245 "avx",
246 "popcnt",
247 },
248 "kabylake": {
249 "ssse3",
250 "sse4",
251 "sse4_1",
252 "sse4_2",
253 "avx",
254 "avx2",
255 "aes_ni",
256 "popcnt",
257 },
258 "sandybridge": {
259 "ssse3",
260 "sse4",
261 "sse4_1",
262 "sse4_2",
263 "popcnt",
264 },
265 "silvermont": {
266 "ssse3",
267 "sse4",
268 "sse4_1",
269 "sse4_2",
270 "aes_ni",
271 "popcnt",
272 "movbe",
273 },
274 "skylake": {
275 "ssse3",
276 "sse4",
277 "sse4_1",
278 "sse4_2",
279 "avx",
280 "avx2",
281 "avx512",
282 "aes_ni",
283 "popcnt",
284 },
285 "stoneyridge": {
286 "ssse3",
287 "sse4",
288 "sse4_1",
289 "sse4_2",
290 "aes_ni",
291 "avx",
292 "avx2",
293 "popcnt",
294 "movbe",
295 },
296 "tigerlake": {
297 "ssse3",
298 "sse4",
299 "sse4_1",
300 "sse4_2",
301 "avx",
302 "avx2",
303 "avx512",
304 "aes_ni",
305 "popcnt",
306 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900307 "tremont": {
308 "ssse3",
309 "sse4",
310 "sse4_1",
311 "sse4_2",
312 "aes_ni",
313 "popcnt",
314 "movbe",
315 },
Colin Crossa6845402020-11-16 15:08:19 -0800316 "whiskeylake": {
317 "ssse3",
318 "sse4",
319 "sse4_1",
320 "sse4_2",
321 "avx",
322 "avx2",
323 "avx512",
324 "aes_ni",
325 "popcnt",
326 },
327 "x86_64": {
328 "ssse3",
329 "sse4",
330 "sse4_1",
331 "sse4_2",
332 "popcnt",
333 },
334 },
335 X86_64: {
Liz Kammere8303bd2022-02-16 09:02:48 -0500336 "" /*default */ : {
337 "ssse3",
338 "sse4",
339 "sse4_1",
340 "sse4_2",
341 "popcnt",
342 },
Colin Crossa6845402020-11-16 15:08:19 -0800343 "amberlake": {
344 "ssse3",
345 "sse4",
346 "sse4_1",
347 "sse4_2",
348 "avx",
349 "avx2",
350 "aes_ni",
351 "popcnt",
352 },
353 "broadwell": {
354 "ssse3",
355 "sse4",
356 "sse4_1",
357 "sse4_2",
358 "avx",
359 "avx2",
360 "aes_ni",
361 "popcnt",
362 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900363 "goldmont": {
364 "ssse3",
365 "sse4",
366 "sse4_1",
367 "sse4_2",
368 "aes_ni",
369 "popcnt",
370 },
371 "goldmont-plus": {
372 "ssse3",
373 "sse4",
374 "sse4_1",
375 "sse4_2",
376 "aes_ni",
377 "popcnt",
378 },
Satoshi Niwab6d818d2024-01-24 16:17:00 +0900379 "goldmont-without-sha-xsaves": {
Satoshi Niwac41f2112023-12-14 17:33:36 +0900380 "ssse3",
381 "sse4",
382 "sse4_1",
383 "sse4_2",
384 "aes_ni",
385 "popcnt",
386 },
Colin Crossa6845402020-11-16 15:08:19 -0800387 "haswell": {
388 "ssse3",
389 "sse4",
390 "sse4_1",
391 "sse4_2",
392 "aes_ni",
393 "avx",
394 "popcnt",
395 },
396 "icelake": {
397 "ssse3",
398 "sse4",
399 "sse4_1",
400 "sse4_2",
401 "avx",
402 "avx2",
403 "avx512",
404 "aes_ni",
405 "popcnt",
406 },
407 "ivybridge": {
408 "ssse3",
409 "sse4",
410 "sse4_1",
411 "sse4_2",
412 "aes_ni",
413 "avx",
414 "popcnt",
415 },
416 "kabylake": {
417 "ssse3",
418 "sse4",
419 "sse4_1",
420 "sse4_2",
421 "avx",
422 "avx2",
423 "aes_ni",
424 "popcnt",
425 },
426 "sandybridge": {
427 "ssse3",
428 "sse4",
429 "sse4_1",
430 "sse4_2",
431 "popcnt",
432 },
433 "silvermont": {
434 "ssse3",
435 "sse4",
436 "sse4_1",
437 "sse4_2",
438 "aes_ni",
439 "popcnt",
440 },
441 "skylake": {
442 "ssse3",
443 "sse4",
444 "sse4_1",
445 "sse4_2",
446 "avx",
447 "avx2",
448 "avx512",
449 "aes_ni",
450 "popcnt",
451 },
452 "stoneyridge": {
453 "ssse3",
454 "sse4",
455 "sse4_1",
456 "sse4_2",
457 "aes_ni",
458 "avx",
459 "avx2",
460 "popcnt",
461 },
462 "tigerlake": {
463 "ssse3",
464 "sse4",
465 "sse4_1",
466 "sse4_2",
467 "avx",
468 "avx2",
469 "avx512",
470 "aes_ni",
471 "popcnt",
472 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900473 "tremont": {
474 "ssse3",
475 "sse4",
476 "sse4_1",
477 "sse4_2",
478 "aes_ni",
479 "popcnt",
480 },
Colin Crossa6845402020-11-16 15:08:19 -0800481 "whiskeylake": {
482 "ssse3",
483 "sse4",
484 "sse4_1",
485 "sse4_2",
486 "avx",
487 "avx2",
488 "avx512",
489 "aes_ni",
490 "popcnt",
491 },
492 },
493}