blob: 9501c877c0aeb0fbbdfb8bfd8195b2c91b82e986 [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: {
32 "amberlake",
33 "atom",
34 "broadwell",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090035 "goldmont",
36 "goldmont-plus",
Satoshi Niwab6d818d2024-01-24 16:17:00 +090037 // Target arch is goldmont, but without supporting SHA and XSAVES.
Satoshi Niwac41f2112023-12-14 17:33:36 +090038 // This ensures efficient execution on a broad range of Intel/AMD CPUs used
Satoshi Niwab6d818d2024-01-24 16:17:00 +090039 // in Chromebooks, including those lacking SHA or XSAVES support.
Satoshi Niwac41f2112023-12-14 17:33:36 +090040 // (e.g. Kaby Lake, Gemini Lake, Alder Lake and AMD Zen series)
Satoshi Niwab6d818d2024-01-24 16:17:00 +090041 "goldmont-without-sha-xsaves",
Colin Crossa6845402020-11-16 15:08:19 -080042 "haswell",
43 "icelake",
44 "ivybridge",
45 "kabylake",
46 "sandybridge",
47 "silvermont",
48 "skylake",
49 "stoneyridge",
50 "tigerlake",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090051 "tremont",
Colin Crossa6845402020-11-16 15:08:19 -080052 "whiskeylake",
53 "x86_64",
54 },
55 X86_64: {
56 "amberlake",
57 "broadwell",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090058 "goldmont",
59 "goldmont-plus",
Satoshi Niwab6d818d2024-01-24 16:17:00 +090060 "goldmont-without-sha-xsaves",
Colin Crossa6845402020-11-16 15:08:19 -080061 "haswell",
62 "icelake",
63 "ivybridge",
64 "kabylake",
65 "sandybridge",
66 "silvermont",
67 "skylake",
68 "stoneyridge",
69 "tigerlake",
Ryo Hashimotof68c18f2022-11-16 17:25:01 +090070 "tremont",
Colin Crossa6845402020-11-16 15:08:19 -080071 "whiskeylake",
72 },
73}
74
Liz Kammer2c2afe22022-02-11 11:35:03 -050075var cpuVariants = map[ArchType][]string{
76 Arm: {
77 "cortex-a7",
78 "cortex-a8",
79 "cortex-a9",
80 "cortex-a15",
Jesus Sanchez-Palenciade7c7842023-03-02 16:56:05 -080081 "cortex-a32",
Liz Kammer2c2afe22022-02-11 11:35:03 -050082 "cortex-a53",
83 "cortex-a53.a57",
84 "cortex-a55",
85 "cortex-a72",
86 "cortex-a73",
87 "cortex-a75",
88 "cortex-a76",
89 "krait",
90 "kryo",
91 "kryo385",
92 "exynos-m1",
93 "exynos-m2",
94 },
95 Arm64: {
96 "cortex-a53",
97 "cortex-a55",
98 "cortex-a72",
99 "cortex-a73",
100 "cortex-a75",
101 "cortex-a76",
102 "kryo",
103 "kryo385",
104 "exynos-m1",
105 "exynos-m2",
Roopesh Nataraja826912e2024-07-08 15:27:45 -0700106 "oryon",
Liz Kammer2c2afe22022-02-11 11:35:03 -0500107 },
108 X86: {},
109 X86_64: {},
110}
111
Colin Crossa6845402020-11-16 15:08:19 -0800112var archFeatures = map[ArchType][]string{
113 Arm: {
114 "neon",
115 },
116 Arm64: {
117 "dotprod",
118 },
119 X86: {
120 "ssse3",
121 "sse4",
122 "sse4_1",
123 "sse4_2",
124 "aes_ni",
125 "avx",
126 "avx2",
127 "avx512",
128 "popcnt",
129 "movbe",
130 },
131 X86_64: {
132 "ssse3",
133 "sse4",
134 "sse4_1",
135 "sse4_2",
136 "aes_ni",
137 "avx",
138 "avx2",
139 "avx512",
140 "popcnt",
141 },
142}
143
Liz Kammere8303bd2022-02-16 09:02:48 -0500144var androidArchFeatureMap = map[ArchType]map[string][]string{
Colin Crossa6845402020-11-16 15:08:19 -0800145 Arm: {
146 "armv7-a-neon": {
147 "neon",
148 },
149 "armv8-a": {
150 "neon",
151 },
152 "armv8-2a": {
153 "neon",
154 },
155 },
156 Arm64: {
157 "armv8-2a-dotprod": {
158 "dotprod",
159 },
Evgenii Stepanov80d74922023-02-10 19:13:49 -0800160 "armv9-a": {
161 "dotprod",
162 },
Krzysztof Kosiński918d2652024-09-04 21:24:06 +0000163 "armv9-2a": {
164 "dotprod",
165 },
Colin Crossa6845402020-11-16 15:08:19 -0800166 },
167 X86: {
168 "amberlake": {
169 "ssse3",
170 "sse4",
171 "sse4_1",
172 "sse4_2",
173 "avx",
174 "avx2",
175 "aes_ni",
176 "popcnt",
177 },
178 "atom": {
179 "ssse3",
180 "movbe",
181 },
182 "broadwell": {
183 "ssse3",
184 "sse4",
185 "sse4_1",
186 "sse4_2",
187 "avx",
188 "avx2",
189 "aes_ni",
190 "popcnt",
191 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900192 "goldmont": {
193 "ssse3",
194 "sse4",
195 "sse4_1",
196 "sse4_2",
197 "aes_ni",
198 "popcnt",
199 "movbe",
200 },
201 "goldmont-plus": {
202 "ssse3",
203 "sse4",
204 "sse4_1",
205 "sse4_2",
206 "aes_ni",
207 "popcnt",
208 "movbe",
209 },
Satoshi Niwab6d818d2024-01-24 16:17:00 +0900210 "goldmont-without-sha-xsaves": {
Satoshi Niwac41f2112023-12-14 17:33:36 +0900211 "ssse3",
212 "sse4",
213 "sse4_1",
214 "sse4_2",
215 "aes_ni",
216 "popcnt",
217 "movbe",
218 },
Colin Crossa6845402020-11-16 15:08:19 -0800219 "haswell": {
220 "ssse3",
221 "sse4",
222 "sse4_1",
223 "sse4_2",
224 "aes_ni",
225 "avx",
226 "popcnt",
227 "movbe",
228 },
229 "icelake": {
230 "ssse3",
231 "sse4",
232 "sse4_1",
233 "sse4_2",
234 "avx",
235 "avx2",
236 "avx512",
237 "aes_ni",
238 "popcnt",
239 },
240 "ivybridge": {
241 "ssse3",
242 "sse4",
243 "sse4_1",
244 "sse4_2",
245 "aes_ni",
246 "avx",
247 "popcnt",
248 },
249 "kabylake": {
250 "ssse3",
251 "sse4",
252 "sse4_1",
253 "sse4_2",
254 "avx",
255 "avx2",
256 "aes_ni",
257 "popcnt",
258 },
259 "sandybridge": {
260 "ssse3",
261 "sse4",
262 "sse4_1",
263 "sse4_2",
264 "popcnt",
265 },
266 "silvermont": {
267 "ssse3",
268 "sse4",
269 "sse4_1",
270 "sse4_2",
271 "aes_ni",
272 "popcnt",
273 "movbe",
274 },
275 "skylake": {
276 "ssse3",
277 "sse4",
278 "sse4_1",
279 "sse4_2",
280 "avx",
281 "avx2",
282 "avx512",
283 "aes_ni",
284 "popcnt",
285 },
286 "stoneyridge": {
287 "ssse3",
288 "sse4",
289 "sse4_1",
290 "sse4_2",
291 "aes_ni",
292 "avx",
293 "avx2",
294 "popcnt",
295 "movbe",
296 },
297 "tigerlake": {
298 "ssse3",
299 "sse4",
300 "sse4_1",
301 "sse4_2",
302 "avx",
303 "avx2",
304 "avx512",
305 "aes_ni",
306 "popcnt",
307 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900308 "tremont": {
309 "ssse3",
310 "sse4",
311 "sse4_1",
312 "sse4_2",
313 "aes_ni",
314 "popcnt",
315 "movbe",
316 },
Colin Crossa6845402020-11-16 15:08:19 -0800317 "whiskeylake": {
318 "ssse3",
319 "sse4",
320 "sse4_1",
321 "sse4_2",
322 "avx",
323 "avx2",
324 "avx512",
325 "aes_ni",
326 "popcnt",
327 },
328 "x86_64": {
329 "ssse3",
330 "sse4",
331 "sse4_1",
332 "sse4_2",
333 "popcnt",
334 },
335 },
336 X86_64: {
Liz Kammere8303bd2022-02-16 09:02:48 -0500337 "" /*default */ : {
338 "ssse3",
339 "sse4",
340 "sse4_1",
341 "sse4_2",
342 "popcnt",
343 },
Colin Crossa6845402020-11-16 15:08:19 -0800344 "amberlake": {
345 "ssse3",
346 "sse4",
347 "sse4_1",
348 "sse4_2",
349 "avx",
350 "avx2",
351 "aes_ni",
352 "popcnt",
353 },
354 "broadwell": {
355 "ssse3",
356 "sse4",
357 "sse4_1",
358 "sse4_2",
359 "avx",
360 "avx2",
361 "aes_ni",
362 "popcnt",
363 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900364 "goldmont": {
365 "ssse3",
366 "sse4",
367 "sse4_1",
368 "sse4_2",
369 "aes_ni",
370 "popcnt",
371 },
372 "goldmont-plus": {
373 "ssse3",
374 "sse4",
375 "sse4_1",
376 "sse4_2",
377 "aes_ni",
378 "popcnt",
379 },
Satoshi Niwab6d818d2024-01-24 16:17:00 +0900380 "goldmont-without-sha-xsaves": {
Satoshi Niwac41f2112023-12-14 17:33:36 +0900381 "ssse3",
382 "sse4",
383 "sse4_1",
384 "sse4_2",
385 "aes_ni",
386 "popcnt",
387 },
Colin Crossa6845402020-11-16 15:08:19 -0800388 "haswell": {
389 "ssse3",
390 "sse4",
391 "sse4_1",
392 "sse4_2",
393 "aes_ni",
394 "avx",
395 "popcnt",
396 },
397 "icelake": {
398 "ssse3",
399 "sse4",
400 "sse4_1",
401 "sse4_2",
402 "avx",
403 "avx2",
404 "avx512",
405 "aes_ni",
406 "popcnt",
407 },
408 "ivybridge": {
409 "ssse3",
410 "sse4",
411 "sse4_1",
412 "sse4_2",
413 "aes_ni",
414 "avx",
415 "popcnt",
416 },
417 "kabylake": {
418 "ssse3",
419 "sse4",
420 "sse4_1",
421 "sse4_2",
422 "avx",
423 "avx2",
424 "aes_ni",
425 "popcnt",
426 },
427 "sandybridge": {
428 "ssse3",
429 "sse4",
430 "sse4_1",
431 "sse4_2",
432 "popcnt",
433 },
434 "silvermont": {
435 "ssse3",
436 "sse4",
437 "sse4_1",
438 "sse4_2",
439 "aes_ni",
440 "popcnt",
441 },
442 "skylake": {
443 "ssse3",
444 "sse4",
445 "sse4_1",
446 "sse4_2",
447 "avx",
448 "avx2",
449 "avx512",
450 "aes_ni",
451 "popcnt",
452 },
453 "stoneyridge": {
454 "ssse3",
455 "sse4",
456 "sse4_1",
457 "sse4_2",
458 "aes_ni",
459 "avx",
460 "avx2",
461 "popcnt",
462 },
463 "tigerlake": {
464 "ssse3",
465 "sse4",
466 "sse4_1",
467 "sse4_2",
468 "avx",
469 "avx2",
470 "avx512",
471 "aes_ni",
472 "popcnt",
473 },
Ryo Hashimotof68c18f2022-11-16 17:25:01 +0900474 "tremont": {
475 "ssse3",
476 "sse4",
477 "sse4_1",
478 "sse4_2",
479 "aes_ni",
480 "popcnt",
481 },
Colin Crossa6845402020-11-16 15:08:19 -0800482 "whiskeylake": {
483 "ssse3",
484 "sse4",
485 "sse4_1",
486 "sse4_2",
487 "avx",
488 "avx2",
489 "avx512",
490 "aes_ni",
491 "popcnt",
492 },
493 },
494}