1// 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 17var archVariants = map[ArchType][]string{ 18 Arm: { 19 "armv7-a", 20 "armv7-a-neon", 21 "armv8-a", 22 "armv8-2a", 23 }, 24 Arm64: { 25 "armv8-a", 26 "armv8-a-branchprot", 27 "armv8-2a", 28 "armv8-2a-dotprod", 29 "armv9-a", 30 }, 31 X86: { 32 "amberlake", 33 "atom", 34 "broadwell", 35 "goldmont", 36 "goldmont-plus", 37 // Target arch is goldmont, but without supporting SHA and XSAVES. 38 // This ensures efficient execution on a broad range of Intel/AMD CPUs used 39 // in Chromebooks, including those lacking SHA or XSAVES support. 40 // (e.g. Kaby Lake, Gemini Lake, Alder Lake and AMD Zen series) 41 "goldmont-without-sha-xsaves", 42 "haswell", 43 "icelake", 44 "ivybridge", 45 "kabylake", 46 "sandybridge", 47 "silvermont", 48 "skylake", 49 "stoneyridge", 50 "tigerlake", 51 "tremont", 52 "whiskeylake", 53 "x86_64", 54 }, 55 X86_64: { 56 "amberlake", 57 "broadwell", 58 "goldmont", 59 "goldmont-plus", 60 "goldmont-without-sha-xsaves", 61 "haswell", 62 "icelake", 63 "ivybridge", 64 "kabylake", 65 "sandybridge", 66 "silvermont", 67 "skylake", 68 "stoneyridge", 69 "tigerlake", 70 "tremont", 71 "whiskeylake", 72 }, 73} 74 75var cpuVariants = map[ArchType][]string{ 76 Arm: { 77 "cortex-a7", 78 "cortex-a8", 79 "cortex-a9", 80 "cortex-a15", 81 "cortex-a32", 82 "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", 106 "oryon", 107 }, 108 X86: {}, 109 X86_64: {}, 110} 111 112var 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 144var androidArchFeatureMap = map[ArchType]map[string][]string{ 145 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 }, 160 "armv9-a": { 161 "dotprod", 162 }, 163 }, 164 X86: { 165 "amberlake": { 166 "ssse3", 167 "sse4", 168 "sse4_1", 169 "sse4_2", 170 "avx", 171 "avx2", 172 "aes_ni", 173 "popcnt", 174 }, 175 "atom": { 176 "ssse3", 177 "movbe", 178 }, 179 "broadwell": { 180 "ssse3", 181 "sse4", 182 "sse4_1", 183 "sse4_2", 184 "avx", 185 "avx2", 186 "aes_ni", 187 "popcnt", 188 }, 189 "goldmont": { 190 "ssse3", 191 "sse4", 192 "sse4_1", 193 "sse4_2", 194 "aes_ni", 195 "popcnt", 196 "movbe", 197 }, 198 "goldmont-plus": { 199 "ssse3", 200 "sse4", 201 "sse4_1", 202 "sse4_2", 203 "aes_ni", 204 "popcnt", 205 "movbe", 206 }, 207 "goldmont-without-sha-xsaves": { 208 "ssse3", 209 "sse4", 210 "sse4_1", 211 "sse4_2", 212 "aes_ni", 213 "popcnt", 214 "movbe", 215 }, 216 "haswell": { 217 "ssse3", 218 "sse4", 219 "sse4_1", 220 "sse4_2", 221 "aes_ni", 222 "avx", 223 "popcnt", 224 "movbe", 225 }, 226 "icelake": { 227 "ssse3", 228 "sse4", 229 "sse4_1", 230 "sse4_2", 231 "avx", 232 "avx2", 233 "avx512", 234 "aes_ni", 235 "popcnt", 236 }, 237 "ivybridge": { 238 "ssse3", 239 "sse4", 240 "sse4_1", 241 "sse4_2", 242 "aes_ni", 243 "avx", 244 "popcnt", 245 }, 246 "kabylake": { 247 "ssse3", 248 "sse4", 249 "sse4_1", 250 "sse4_2", 251 "avx", 252 "avx2", 253 "aes_ni", 254 "popcnt", 255 }, 256 "sandybridge": { 257 "ssse3", 258 "sse4", 259 "sse4_1", 260 "sse4_2", 261 "popcnt", 262 }, 263 "silvermont": { 264 "ssse3", 265 "sse4", 266 "sse4_1", 267 "sse4_2", 268 "aes_ni", 269 "popcnt", 270 "movbe", 271 }, 272 "skylake": { 273 "ssse3", 274 "sse4", 275 "sse4_1", 276 "sse4_2", 277 "avx", 278 "avx2", 279 "avx512", 280 "aes_ni", 281 "popcnt", 282 }, 283 "stoneyridge": { 284 "ssse3", 285 "sse4", 286 "sse4_1", 287 "sse4_2", 288 "aes_ni", 289 "avx", 290 "avx2", 291 "popcnt", 292 "movbe", 293 }, 294 "tigerlake": { 295 "ssse3", 296 "sse4", 297 "sse4_1", 298 "sse4_2", 299 "avx", 300 "avx2", 301 "avx512", 302 "aes_ni", 303 "popcnt", 304 }, 305 "tremont": { 306 "ssse3", 307 "sse4", 308 "sse4_1", 309 "sse4_2", 310 "aes_ni", 311 "popcnt", 312 "movbe", 313 }, 314 "whiskeylake": { 315 "ssse3", 316 "sse4", 317 "sse4_1", 318 "sse4_2", 319 "avx", 320 "avx2", 321 "avx512", 322 "aes_ni", 323 "popcnt", 324 }, 325 "x86_64": { 326 "ssse3", 327 "sse4", 328 "sse4_1", 329 "sse4_2", 330 "popcnt", 331 }, 332 }, 333 X86_64: { 334 "" /*default */ : { 335 "ssse3", 336 "sse4", 337 "sse4_1", 338 "sse4_2", 339 "popcnt", 340 }, 341 "amberlake": { 342 "ssse3", 343 "sse4", 344 "sse4_1", 345 "sse4_2", 346 "avx", 347 "avx2", 348 "aes_ni", 349 "popcnt", 350 }, 351 "broadwell": { 352 "ssse3", 353 "sse4", 354 "sse4_1", 355 "sse4_2", 356 "avx", 357 "avx2", 358 "aes_ni", 359 "popcnt", 360 }, 361 "goldmont": { 362 "ssse3", 363 "sse4", 364 "sse4_1", 365 "sse4_2", 366 "aes_ni", 367 "popcnt", 368 }, 369 "goldmont-plus": { 370 "ssse3", 371 "sse4", 372 "sse4_1", 373 "sse4_2", 374 "aes_ni", 375 "popcnt", 376 }, 377 "goldmont-without-sha-xsaves": { 378 "ssse3", 379 "sse4", 380 "sse4_1", 381 "sse4_2", 382 "aes_ni", 383 "popcnt", 384 }, 385 "haswell": { 386 "ssse3", 387 "sse4", 388 "sse4_1", 389 "sse4_2", 390 "aes_ni", 391 "avx", 392 "popcnt", 393 }, 394 "icelake": { 395 "ssse3", 396 "sse4", 397 "sse4_1", 398 "sse4_2", 399 "avx", 400 "avx2", 401 "avx512", 402 "aes_ni", 403 "popcnt", 404 }, 405 "ivybridge": { 406 "ssse3", 407 "sse4", 408 "sse4_1", 409 "sse4_2", 410 "aes_ni", 411 "avx", 412 "popcnt", 413 }, 414 "kabylake": { 415 "ssse3", 416 "sse4", 417 "sse4_1", 418 "sse4_2", 419 "avx", 420 "avx2", 421 "aes_ni", 422 "popcnt", 423 }, 424 "sandybridge": { 425 "ssse3", 426 "sse4", 427 "sse4_1", 428 "sse4_2", 429 "popcnt", 430 }, 431 "silvermont": { 432 "ssse3", 433 "sse4", 434 "sse4_1", 435 "sse4_2", 436 "aes_ni", 437 "popcnt", 438 }, 439 "skylake": { 440 "ssse3", 441 "sse4", 442 "sse4_1", 443 "sse4_2", 444 "avx", 445 "avx2", 446 "avx512", 447 "aes_ni", 448 "popcnt", 449 }, 450 "stoneyridge": { 451 "ssse3", 452 "sse4", 453 "sse4_1", 454 "sse4_2", 455 "aes_ni", 456 "avx", 457 "avx2", 458 "popcnt", 459 }, 460 "tigerlake": { 461 "ssse3", 462 "sse4", 463 "sse4_1", 464 "sse4_2", 465 "avx", 466 "avx2", 467 "avx512", 468 "aes_ni", 469 "popcnt", 470 }, 471 "tremont": { 472 "ssse3", 473 "sse4", 474 "sse4_1", 475 "sse4_2", 476 "aes_ni", 477 "popcnt", 478 }, 479 "whiskeylake": { 480 "ssse3", 481 "sse4", 482 "sse4_1", 483 "sse4_2", 484 "avx", 485 "avx2", 486 "avx512", 487 "aes_ni", 488 "popcnt", 489 }, 490 }, 491} 492