blob: 389f194e8bf33f54cf5521aae563fb6398a05dd9 [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",
Krzysztof Kosińskib8c5e952024-09-07 00:01:55 +000029 "armv9-2a",
Colin Crossa6845402020-11-16 15:08:19 -080030 },
31 X86: {
Yudhistira Erlandinata162b4892024-09-23 11:53:16 +080032 "alderlake",
Colin Crossa6845402020-11-16 15:08:19 -080033 "amberlake",
34 "atom",
35 "broadwell",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090036 "goldmont",
37 "goldmont-plus",
Satoshi Niwab6d818d2024-01-24 16:17:00 +090038 // Target arch is goldmont, but without supporting SHA and XSAVES.
Satoshi Niwac41f2112023-12-14 17:33:36 +090039 // This ensures efficient execution on a broad range of Intel/AMD CPUs used
Satoshi Niwab6d818d2024-01-24 16:17:00 +090040 // in Chromebooks, including those lacking SHA or XSAVES support.
Satoshi Niwac41f2112023-12-14 17:33:36 +090041 // (e.g. Kaby Lake, Gemini Lake, Alder Lake and AMD Zen series)
Satoshi Niwab6d818d2024-01-24 16:17:00 +090042 "goldmont-without-sha-xsaves",
Colin Crossa6845402020-11-16 15:08:19 -080043 "haswell",
44 "icelake",
45 "ivybridge",
46 "kabylake",
47 "sandybridge",
48 "silvermont",
49 "skylake",
50 "stoneyridge",
51 "tigerlake",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090052 "tremont",
Colin Crossa6845402020-11-16 15:08:19 -080053 "whiskeylake",
54 "x86_64",
55 },
56 X86_64: {
Yudhistira Erlandinata162b4892024-09-23 11:53:16 +080057 "alderlake",
Colin Crossa6845402020-11-16 15:08:19 -080058 "amberlake",
59 "broadwell",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090060 "goldmont",
61 "goldmont-plus",
Satoshi Niwab6d818d2024-01-24 16:17:00 +090062 "goldmont-without-sha-xsaves",
Colin Crossa6845402020-11-16 15:08:19 -080063 "haswell",
64 "icelake",
65 "ivybridge",
66 "kabylake",
67 "sandybridge",
68 "silvermont",
69 "skylake",
70 "stoneyridge",
71 "tigerlake",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090072 "tremont",
Colin Crossa6845402020-11-16 15:08:19 -080073 "whiskeylake",
74 },
75}
76
Liz Kammer2c2afe22022-02-11 11:35:03 -050077var cpuVariants = map[ArchType][]string{
78 Arm: {
79 "cortex-a7",
80 "cortex-a8",
81 "cortex-a9",
82 "cortex-a15",
Jesus Sanchez-Palenciade7c7842023-03-02 16:56:05 -080083 "cortex-a32",
Liz Kammer2c2afe22022-02-11 11:35:03 -050084 "cortex-a53",
85 "cortex-a53.a57",
86 "cortex-a55",
87 "cortex-a72",
88 "cortex-a73",
89 "cortex-a75",
90 "cortex-a76",
91 "krait",
92 "kryo",
93 "kryo385",
94 "exynos-m1",
95 "exynos-m2",
96 },
97 Arm64: {
98 "cortex-a53",
99 "cortex-a55",
100 "cortex-a72",
101 "cortex-a73",
102 "cortex-a75",
103 "cortex-a76",
104 "kryo",
105 "kryo385",
106 "exynos-m1",
107 "exynos-m2",
Roopesh Nataraja826912e2024-07-08 15:27:45 -0700108 "oryon",
Liz Kammer2c2afe22022-02-11 11:35:03 -0500109 },
110 X86: {},
111 X86_64: {},
112}
113
Colin Crossa6845402020-11-16 15:08:19 -0800114var archFeatures = map[ArchType][]string{
Colin Crossa6845402020-11-16 15:08:19 -0800115 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 Arm64: {
145 "armv8-2a-dotprod": {
146 "dotprod",
147 },
Evgenii Stepanov80d74922023-02-10 19:13:49 -0800148 "armv9-a": {
149 "dotprod",
150 },
Krzysztof Kosiński918d2652024-09-04 21:24:06 +0000151 "armv9-2a": {
152 "dotprod",
153 },
Colin Crossa6845402020-11-16 15:08:19 -0800154 },
155 X86: {
Yudhistira Erlandinata162b4892024-09-23 11:53:16 +0800156 "alderlake": {
157 "ssse3",
158 "sse4",
159 "sse4_1",
160 "sse4_2",
161 "avx",
162 "avx2",
163 "aes_ni",
164 "popcnt",
165 },
Colin Crossa6845402020-11-16 15:08:19 -0800166 "amberlake": {
167 "ssse3",
168 "sse4",
169 "sse4_1",
170 "sse4_2",
171 "avx",
172 "avx2",
173 "aes_ni",
174 "popcnt",
175 },
176 "atom": {
177 "ssse3",
178 "movbe",
179 },
180 "broadwell": {
181 "ssse3",
182 "sse4",
183 "sse4_1",
184 "sse4_2",
185 "avx",
186 "avx2",
187 "aes_ni",
188 "popcnt",
189 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900190 "goldmont": {
191 "ssse3",
192 "sse4",
193 "sse4_1",
194 "sse4_2",
195 "aes_ni",
196 "popcnt",
197 "movbe",
198 },
199 "goldmont-plus": {
200 "ssse3",
201 "sse4",
202 "sse4_1",
203 "sse4_2",
204 "aes_ni",
205 "popcnt",
206 "movbe",
207 },
Satoshi Niwab6d818d2024-01-24 16:17:00 +0900208 "goldmont-without-sha-xsaves": {
Satoshi Niwac41f2112023-12-14 17:33:36 +0900209 "ssse3",
210 "sse4",
211 "sse4_1",
212 "sse4_2",
213 "aes_ni",
214 "popcnt",
215 "movbe",
216 },
Colin Crossa6845402020-11-16 15:08:19 -0800217 "haswell": {
218 "ssse3",
219 "sse4",
220 "sse4_1",
221 "sse4_2",
222 "aes_ni",
223 "avx",
224 "popcnt",
225 "movbe",
226 },
227 "icelake": {
228 "ssse3",
229 "sse4",
230 "sse4_1",
231 "sse4_2",
232 "avx",
233 "avx2",
234 "avx512",
235 "aes_ni",
236 "popcnt",
237 },
238 "ivybridge": {
239 "ssse3",
240 "sse4",
241 "sse4_1",
242 "sse4_2",
243 "aes_ni",
244 "avx",
245 "popcnt",
246 },
247 "kabylake": {
248 "ssse3",
249 "sse4",
250 "sse4_1",
251 "sse4_2",
252 "avx",
253 "avx2",
254 "aes_ni",
255 "popcnt",
256 },
257 "sandybridge": {
258 "ssse3",
259 "sse4",
260 "sse4_1",
261 "sse4_2",
262 "popcnt",
263 },
264 "silvermont": {
265 "ssse3",
266 "sse4",
267 "sse4_1",
268 "sse4_2",
269 "aes_ni",
270 "popcnt",
271 "movbe",
272 },
273 "skylake": {
274 "ssse3",
275 "sse4",
276 "sse4_1",
277 "sse4_2",
278 "avx",
279 "avx2",
280 "avx512",
281 "aes_ni",
282 "popcnt",
283 },
284 "stoneyridge": {
285 "ssse3",
286 "sse4",
287 "sse4_1",
288 "sse4_2",
289 "aes_ni",
290 "avx",
291 "avx2",
292 "popcnt",
293 "movbe",
294 },
295 "tigerlake": {
296 "ssse3",
297 "sse4",
298 "sse4_1",
299 "sse4_2",
300 "avx",
301 "avx2",
302 "avx512",
303 "aes_ni",
304 "popcnt",
305 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900306 "tremont": {
307 "ssse3",
308 "sse4",
309 "sse4_1",
310 "sse4_2",
311 "aes_ni",
312 "popcnt",
313 "movbe",
314 },
Colin Crossa6845402020-11-16 15:08:19 -0800315 "whiskeylake": {
316 "ssse3",
317 "sse4",
318 "sse4_1",
319 "sse4_2",
320 "avx",
321 "avx2",
322 "avx512",
323 "aes_ni",
324 "popcnt",
325 },
326 "x86_64": {
327 "ssse3",
328 "sse4",
329 "sse4_1",
330 "sse4_2",
331 "popcnt",
332 },
333 },
334 X86_64: {
Liz Kammere8303bd2022-02-16 09:02:48 -0500335 "" /*default */ : {
336 "ssse3",
337 "sse4",
338 "sse4_1",
339 "sse4_2",
340 "popcnt",
341 },
Yudhistira Erlandinata162b4892024-09-23 11:53:16 +0800342 "alderlake": {
343 "ssse3",
344 "sse4",
345 "sse4_1",
346 "sse4_2",
347 "avx",
348 "avx2",
349 "aes_ni",
350 "popcnt",
351 },
Colin Crossa6845402020-11-16 15:08:19 -0800352 "amberlake": {
353 "ssse3",
354 "sse4",
355 "sse4_1",
356 "sse4_2",
357 "avx",
358 "avx2",
359 "aes_ni",
360 "popcnt",
361 },
362 "broadwell": {
363 "ssse3",
364 "sse4",
365 "sse4_1",
366 "sse4_2",
367 "avx",
368 "avx2",
369 "aes_ni",
370 "popcnt",
371 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900372 "goldmont": {
373 "ssse3",
374 "sse4",
375 "sse4_1",
376 "sse4_2",
377 "aes_ni",
378 "popcnt",
379 },
380 "goldmont-plus": {
381 "ssse3",
382 "sse4",
383 "sse4_1",
384 "sse4_2",
385 "aes_ni",
386 "popcnt",
387 },
Satoshi Niwab6d818d2024-01-24 16:17:00 +0900388 "goldmont-without-sha-xsaves": {
Satoshi Niwac41f2112023-12-14 17:33:36 +0900389 "ssse3",
390 "sse4",
391 "sse4_1",
392 "sse4_2",
393 "aes_ni",
394 "popcnt",
395 },
Colin Crossa6845402020-11-16 15:08:19 -0800396 "haswell": {
397 "ssse3",
398 "sse4",
399 "sse4_1",
400 "sse4_2",
401 "aes_ni",
402 "avx",
403 "popcnt",
404 },
405 "icelake": {
406 "ssse3",
407 "sse4",
408 "sse4_1",
409 "sse4_2",
410 "avx",
411 "avx2",
412 "avx512",
413 "aes_ni",
414 "popcnt",
415 },
416 "ivybridge": {
417 "ssse3",
418 "sse4",
419 "sse4_1",
420 "sse4_2",
421 "aes_ni",
422 "avx",
423 "popcnt",
424 },
425 "kabylake": {
426 "ssse3",
427 "sse4",
428 "sse4_1",
429 "sse4_2",
430 "avx",
431 "avx2",
432 "aes_ni",
433 "popcnt",
434 },
435 "sandybridge": {
436 "ssse3",
437 "sse4",
438 "sse4_1",
439 "sse4_2",
440 "popcnt",
441 },
442 "silvermont": {
443 "ssse3",
444 "sse4",
445 "sse4_1",
446 "sse4_2",
447 "aes_ni",
448 "popcnt",
449 },
450 "skylake": {
451 "ssse3",
452 "sse4",
453 "sse4_1",
454 "sse4_2",
455 "avx",
456 "avx2",
457 "avx512",
458 "aes_ni",
459 "popcnt",
460 },
461 "stoneyridge": {
462 "ssse3",
463 "sse4",
464 "sse4_1",
465 "sse4_2",
466 "aes_ni",
467 "avx",
468 "avx2",
469 "popcnt",
470 },
471 "tigerlake": {
472 "ssse3",
473 "sse4",
474 "sse4_1",
475 "sse4_2",
476 "avx",
477 "avx2",
478 "avx512",
479 "aes_ni",
480 "popcnt",
481 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900482 "tremont": {
483 "ssse3",
484 "sse4",
485 "sse4_1",
486 "sse4_2",
487 "aes_ni",
488 "popcnt",
489 },
Colin Crossa6845402020-11-16 15:08:19 -0800490 "whiskeylake": {
491 "ssse3",
492 "sse4",
493 "sse4_1",
494 "sse4_2",
495 "avx",
496 "avx2",
497 "avx512",
498 "aes_ni",
499 "popcnt",
500 },
501 },
502}