Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AArch64][TargetParser] move CPUInfo into tablegen [NFC] #92145

Merged

Conversation

tmatheson-arm
Copy link
Contributor

This builds on top of #92037, which moves the architecture information. The new changes start at 52b8af6.

The changes to AArch64Processors.td look like a lot, but actually all that is happening for each processor is:

  • The class is changed from ProcessorModel to AArch64Processor
  • The base architecture is added, as a reference to the Architecture64 e.g. HasV9_0aOps
  • The list of "enabled by default" extensions is added.

@llvmbot
Copy link

llvmbot commented May 14, 2024

@llvm/pr-subscribers-backend-aarch64

Author: Tomas Matheson (tmatheson-arm)

Changes

This builds on top of #92037, which moves the architecture information. The new changes start at 52b8af6.

The changes to AArch64Processors.td look like a lot, but actually all that is happening for each processor is:

  • The class is changed from ProcessorModel to AArch64Processor
  • The base architecture is added, as a reference to the Architecture64 e.g. HasV9_0aOps
  • The list of "enabled by default" extensions is added.

Patch is 62.32 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/92145.diff

4 Files Affected:

  • (modified) llvm/include/llvm/TargetParser/AArch64TargetParser.h (+6-361)
  • (modified) llvm/lib/Target/AArch64/AArch64Features.td (+94-80)
  • (modified) llvm/lib/Target/AArch64/AArch64Processors.td (+246-153)
  • (modified) llvm/utils/TableGen/ARMTargetDefEmitter.cpp (+98)
diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
index 20c3f95173c28..2402f02ab99c1 100644
--- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -238,8 +238,8 @@ enum ArchProfile { AProfile = 'A', RProfile = 'R', InvalidProfile = '?' };
 struct ArchInfo {
   VersionTuple Version;  // Architecture version, major + minor.
   ArchProfile Profile;   // Architecuture profile
-  StringRef Name;        // Human readable name, e.g. "armv8.1-a"
-  StringRef ArchFeature; // Command line feature flag, e.g. +v8a
+  StringRef Name;        // Name as supplied to -march e.g. "armv8.1-a"
+  StringRef ArchFeature; // Name as supplied to -target-feature, e.g. "+v8a"
   AArch64::ExtensionBitset
       DefaultExts; // bitfield of default extensions ArchExtKind
 
@@ -288,48 +288,8 @@ struct ArchInfo {
   static std::optional<ArchInfo> findBySubArch(StringRef SubArch);
 };
 
-// clang-format off
-inline constexpr ArchInfo ARMV8A    = { VersionTuple{8, 0}, AProfile, "armv8-a", "+v8a", (
-                                        AArch64::ExtensionBitset({AArch64::AEK_FP, AArch64::AEK_SIMD})), };
-inline constexpr ArchInfo ARMV8_1A  = { VersionTuple{8, 1}, AProfile, "armv8.1-a", "+v8.1a", (ARMV8A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_CRC, AArch64::AEK_LSE, AArch64::AEK_RDM}))};
-inline constexpr ArchInfo ARMV8_2A  = { VersionTuple{8, 2}, AProfile, "armv8.2-a", "+v8.2a", (ARMV8_1A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_RAS}))};
-inline constexpr ArchInfo ARMV8_3A  = { VersionTuple{8, 3}, AProfile, "armv8.3-a", "+v8.3a", (ARMV8_2A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_FCMA, AArch64::AEK_JSCVT, AArch64::AEK_PAUTH, AArch64::AEK_RCPC}))};
-inline constexpr ArchInfo ARMV8_4A  = { VersionTuple{8, 4}, AProfile, "armv8.4-a", "+v8.4a", (ARMV8_3A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_DOTPROD}))};
-inline constexpr ArchInfo ARMV8_5A  = { VersionTuple{8, 5}, AProfile, "armv8.5-a", "+v8.5a", (ARMV8_4A.DefaultExts)};
-inline constexpr ArchInfo ARMV8_6A  = { VersionTuple{8, 6}, AProfile, "armv8.6-a", "+v8.6a", (ARMV8_5A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_BF16, AArch64::AEK_I8MM}))};
-inline constexpr ArchInfo ARMV8_7A  = { VersionTuple{8, 7}, AProfile, "armv8.7-a", "+v8.7a", (ARMV8_6A.DefaultExts)};
-inline constexpr ArchInfo ARMV8_8A  = { VersionTuple{8, 8}, AProfile, "armv8.8-a", "+v8.8a", (ARMV8_7A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_MOPS, AArch64::AEK_HBC}))};
-inline constexpr ArchInfo ARMV8_9A  = { VersionTuple{8, 9}, AProfile, "armv8.9-a", "+v8.9a", (ARMV8_8A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_SPECRES2, AArch64::AEK_CSSC, AArch64::AEK_RASV2}))};
-inline constexpr ArchInfo ARMV9A    = { VersionTuple{9, 0}, AProfile, "armv9-a", "+v9a", (ARMV8_5A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_FP16, AArch64::AEK_SVE, AArch64::AEK_SVE2}))};
-inline constexpr ArchInfo ARMV9_1A  = { VersionTuple{9, 1}, AProfile, "armv9.1-a", "+v9.1a", (ARMV9A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_BF16, AArch64::AEK_I8MM}))};
-inline constexpr ArchInfo ARMV9_2A  = { VersionTuple{9, 2}, AProfile, "armv9.2-a", "+v9.2a", (ARMV9_1A.DefaultExts)};
-inline constexpr ArchInfo ARMV9_3A  = { VersionTuple{9, 3}, AProfile, "armv9.3-a", "+v9.3a", (ARMV9_2A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_MOPS, AArch64::AEK_HBC}))};
-inline constexpr ArchInfo ARMV9_4A  = { VersionTuple{9, 4}, AProfile, "armv9.4-a", "+v9.4a", (ARMV9_3A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_SPECRES2, AArch64::AEK_CSSC, AArch64::AEK_RASV2}))};
-inline constexpr ArchInfo ARMV9_5A  = { VersionTuple{9, 5}, AProfile, "armv9.5-a", "+v9.5a", (ARMV9_4A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_CPA}))};
-// For v8-R, we do not enable crypto and align with GCC that enables a more minimal set of optional architecture extensions.
-inline constexpr ArchInfo ARMV8R    = { VersionTuple{8, 0}, RProfile, "armv8-r", "+v8r", (ARMV8_5A.DefaultExts |
-                                        AArch64::ExtensionBitset({AArch64::AEK_SSBS,
-                                        AArch64::AEK_FP16, AArch64::AEK_FP16FML, AArch64::AEK_SB}).flip(AArch64::AEK_LSE))};
-// clang-format on
-
-// The set of all architectures
-static constexpr std::array<const ArchInfo *, 17> ArchInfos = {
-    &ARMV8A,   &ARMV8_1A, &ARMV8_2A, &ARMV8_3A, &ARMV8_4A, &ARMV8_5A,
-    &ARMV8_6A, &ARMV8_7A, &ARMV8_8A, &ARMV8_9A, &ARMV9A,   &ARMV9_1A,
-    &ARMV9_2A, &ARMV9_3A, &ARMV9_4A, &ARMV9_5A, &ARMV8R,
-};
+#define EMIT_ARCHITECTURES
+#include "llvm/TargetParser/AArch64TargetParserDef.inc"
 
 // Details of a specific CPU.
 struct CpuInfo {
@@ -347,323 +307,8 @@ struct CpuInfo {
   }
 };
 
-inline constexpr CpuInfo CpuInfos[] = {
-    {"cortex-a34", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_CRC})},
-    {"cortex-a35", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_CRC})},
-    {"cortex-a53", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_CRC})},
-    {"cortex-a55", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_FP16, AArch64::AEK_DOTPROD,
-                               AArch64::AEK_RCPC})},
-    {"cortex-a510", ARMV9A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SB,
-          AArch64::AEK_PAUTH, AArch64::AEK_MTE, AArch64::AEK_SSBS,
-          AArch64::AEK_SVE, AArch64::AEK_SVE2, AArch64::AEK_SVE2BITPERM,
-          AArch64::AEK_FP16FML})},
-    {"cortex-a520", ARMV9_2A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_SB, AArch64::AEK_SSBS, AArch64::AEK_MTE,
-          AArch64::AEK_FP16FML, AArch64::AEK_PAUTH, AArch64::AEK_SVE2BITPERM,
-          AArch64::AEK_FLAGM, AArch64::AEK_PERFMON, AArch64::AEK_PREDRES})},
-    {"cortex-a520ae", ARMV9_2A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_SB, AArch64::AEK_SSBS, AArch64::AEK_MTE,
-          AArch64::AEK_FP16FML, AArch64::AEK_PAUTH, AArch64::AEK_SVE2BITPERM,
-          AArch64::AEK_FLAGM, AArch64::AEK_PERFMON, AArch64::AEK_PREDRES})},
-    {"cortex-a57", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_CRC})},
-    {"cortex-a65", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_DOTPROD, AArch64::AEK_FP16,
-                               AArch64::AEK_RCPC, AArch64::AEK_SSBS})},
-    {"cortex-a65ae", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_DOTPROD, AArch64::AEK_FP16,
-                               AArch64::AEK_RCPC, AArch64::AEK_SSBS})},
-    {"cortex-a72", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_CRC})},
-    {"cortex-a73", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_CRC})},
-    {"cortex-a75", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_FP16, AArch64::AEK_DOTPROD,
-                               AArch64::AEK_RCPC})},
-    {"cortex-a76", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_FP16, AArch64::AEK_DOTPROD,
-                               AArch64::AEK_RCPC, AArch64::AEK_SSBS})},
-    {"cortex-a76ae", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_FP16, AArch64::AEK_DOTPROD,
-                               AArch64::AEK_RCPC, AArch64::AEK_SSBS})},
-    {"cortex-a77", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_FP16, AArch64::AEK_RCPC,
-                               AArch64::AEK_DOTPROD, AArch64::AEK_SSBS})},
-    {"cortex-a78", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_FP16, AArch64::AEK_DOTPROD,
-                               AArch64::AEK_RCPC, AArch64::AEK_SSBS,
-                               AArch64::AEK_PROFILE})},
-    {"cortex-a78ae", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_FP16, AArch64::AEK_DOTPROD,
-                               AArch64::AEK_RCPC, AArch64::AEK_SSBS,
-                               AArch64::AEK_PROFILE})},
-    {"cortex-a78c", ARMV8_2A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_FP16,
-          AArch64::AEK_DOTPROD, AArch64::AEK_RCPC, AArch64::AEK_SSBS,
-          AArch64::AEK_PROFILE, AArch64::AEK_FLAGM, AArch64::AEK_PAUTH})},
-    {"cortex-a710", ARMV9A,
-     AArch64::ExtensionBitset({AArch64::AEK_MTE, AArch64::AEK_PAUTH,
-                               AArch64::AEK_FLAGM, AArch64::AEK_SB,
-                               AArch64::AEK_I8MM, AArch64::AEK_FP16FML,
-                               AArch64::AEK_SVE, AArch64::AEK_SVE2,
-                               AArch64::AEK_SVE2BITPERM, AArch64::AEK_BF16})},
-    {"cortex-a715", ARMV9A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_SB, AArch64::AEK_SSBS, AArch64::AEK_MTE,
-          AArch64::AEK_FP16, AArch64::AEK_FP16FML, AArch64::AEK_PAUTH,
-          AArch64::AEK_I8MM, AArch64::AEK_PREDRES, AArch64::AEK_PERFMON,
-          AArch64::AEK_PROFILE, AArch64::AEK_SVE, AArch64::AEK_SVE2BITPERM,
-          AArch64::AEK_BF16, AArch64::AEK_FLAGM})},
-    {"cortex-a720", ARMV9_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_SB, AArch64::AEK_SSBS,
-                               AArch64::AEK_MTE, AArch64::AEK_FP16FML,
-                               AArch64::AEK_PAUTH, AArch64::AEK_SVE2BITPERM,
-                               AArch64::AEK_FLAGM, AArch64::AEK_PERFMON,
-                               AArch64::AEK_PREDRES, AArch64::AEK_PROFILE})},
-    {"cortex-a720ae", ARMV9_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_SB, AArch64::AEK_SSBS,
-                               AArch64::AEK_MTE, AArch64::AEK_FP16FML,
-                               AArch64::AEK_PAUTH, AArch64::AEK_SVE2BITPERM,
-                               AArch64::AEK_FLAGM, AArch64::AEK_PERFMON,
-                               AArch64::AEK_PREDRES, AArch64::AEK_PROFILE})},
-    {"cortex-r82", ARMV8R,
-     AArch64::ExtensionBitset({AArch64::AEK_LSE, AArch64::AEK_FLAGM,
-                               AArch64::AEK_PERFMON, AArch64::AEK_PREDRES})},
-    {"cortex-r82ae", ARMV8R,
-     AArch64::ExtensionBitset({AArch64::AEK_LSE, AArch64::AEK_FLAGM,
-                               AArch64::AEK_PERFMON, AArch64::AEK_PREDRES})},
-    {"cortex-x1", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_FP16, AArch64::AEK_DOTPROD,
-                               AArch64::AEK_RCPC, AArch64::AEK_SSBS,
-                               AArch64::AEK_PROFILE})},
-    {"cortex-x1c", ARMV8_2A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_FP16,
-          AArch64::AEK_DOTPROD, AArch64::AEK_RCPC, AArch64::AEK_SSBS,
-          AArch64::AEK_PAUTH, AArch64::AEK_PROFILE, AArch64::AEK_FLAGM})},
-    {"cortex-x2", ARMV9A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_MTE, AArch64::AEK_BF16, AArch64::AEK_I8MM,
-          AArch64::AEK_PAUTH, AArch64::AEK_SSBS, AArch64::AEK_SB,
-          AArch64::AEK_SVE, AArch64::AEK_SVE2, AArch64::AEK_SVE2BITPERM,
-          AArch64::AEK_FP16FML, AArch64::AEK_FLAGM})},
-    {"cortex-x3", ARMV9A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_SVE, AArch64::AEK_PERFMON, AArch64::AEK_PROFILE,
-          AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_MTE,
-          AArch64::AEK_SVE2BITPERM, AArch64::AEK_SB, AArch64::AEK_PAUTH,
-          AArch64::AEK_FP16, AArch64::AEK_FP16FML, AArch64::AEK_PREDRES,
-          AArch64::AEK_FLAGM, AArch64::AEK_SSBS})},
-    {"cortex-x4", ARMV9_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_SB, AArch64::AEK_SSBS,
-                               AArch64::AEK_MTE, AArch64::AEK_FP16FML,
-                               AArch64::AEK_PAUTH, AArch64::AEK_SVE2BITPERM,
-                               AArch64::AEK_FLAGM, AArch64::AEK_PERFMON,
-                               AArch64::AEK_PREDRES, AArch64::AEK_PROFILE})},
-    {"neoverse-e1", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_DOTPROD, AArch64::AEK_FP16,
-                               AArch64::AEK_RCPC, AArch64::AEK_SSBS})},
-    {"neoverse-n1", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_DOTPROD, AArch64::AEK_FP16,
-                               AArch64::AEK_PROFILE, AArch64::AEK_RCPC,
-                               AArch64::AEK_SSBS})},
-    {"neoverse-n2", ARMV9A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_BF16, AArch64::AEK_DOTPROD, AArch64::AEK_FP16,
-          AArch64::AEK_FP16FML, AArch64::AEK_I8MM, AArch64::AEK_MTE,
-          AArch64::AEK_SB, AArch64::AEK_SSBS, AArch64::AEK_SVE,
-          AArch64::AEK_SVE2, AArch64::AEK_SVE2BITPERM})},
-    {"neoverse-n3", ARMV9_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_MTE, AArch64::AEK_SSBS,
-                               AArch64::AEK_SB, AArch64::AEK_PREDRES,
-                               AArch64::AEK_FP16FML, AArch64::AEK_PAUTH,
-                               AArch64::AEK_FLAGM, AArch64::AEK_PERFMON,
-                               AArch64::AEK_RAND, AArch64::AEK_SVE2BITPERM,
-                               AArch64::AEK_PROFILE, AArch64::AEK_PERFMON})},
-    {"neoverse-512tvb", ARMV8_4A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_SHA3,
-          AArch64::AEK_SM4, AArch64::AEK_SVE, AArch64::AEK_SSBS,
-          AArch64::AEK_FP16, AArch64::AEK_BF16, AArch64::AEK_DOTPROD,
-          AArch64::AEK_PROFILE, AArch64::AEK_RAND, AArch64::AEK_FP16FML,
-          AArch64::AEK_I8MM})},
-    {"neoverse-v1", ARMV8_4A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_SHA3,
-          AArch64::AEK_SM4, AArch64::AEK_SVE, AArch64::AEK_SSBS,
-          AArch64::AEK_FP16, AArch64::AEK_BF16, AArch64::AEK_DOTPROD,
-          AArch64::AEK_PROFILE, AArch64::AEK_RAND, AArch64::AEK_FP16FML,
-          AArch64::AEK_I8MM})},
-    {"neoverse-v2", ARMV9A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_SVE, AArch64::AEK_SVE2, AArch64::AEK_SSBS,
-          AArch64::AEK_FP16, AArch64::AEK_BF16, AArch64::AEK_RAND,
-          AArch64::AEK_DOTPROD, AArch64::AEK_PROFILE, AArch64::AEK_SVE2BITPERM,
-          AArch64::AEK_FP16FML, AArch64::AEK_I8MM, AArch64::AEK_MTE})},
-    {"neoverse-v3", ARMV9_2A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_PROFILE, AArch64::AEK_MTE, AArch64::AEK_SSBS,
-          AArch64::AEK_SB, AArch64::AEK_PREDRES, AArch64::AEK_LS64,
-          AArch64::AEK_BRBE, AArch64::AEK_PAUTH, AArch64::AEK_FLAGM,
-          AArch64::AEK_PERFMON, AArch64::AEK_RAND, AArch64::AEK_SVE2BITPERM,
-          AArch64::AEK_FP16FML})},
-    {"neoverse-v3ae", ARMV9_2A,
-     (AArch64::ExtensionBitset(
-         {AArch64::AEK_PROFILE, AArch64::AEK_MTE, AArch64::AEK_SSBS,
-          AArch64::AEK_SB, AArch64::AEK_PREDRES, AArch64::AEK_LS64,
-          AArch64::AEK_BRBE, AArch64::AEK_PAUTH, AArch64::AEK_FLAGM,
-          AArch64::AEK_PERFMON, AArch64::AEK_RAND, AArch64::AEK_SVE2BITPERM,
-          AArch64::AEK_FP16FML}))},
-    {"cyclone", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_NONE})},
-    {"apple-a7", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_NONE})},
-    {"apple-a8", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_NONE})},
-    {"apple-a9", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_NONE})},
-    {"apple-a10", ARMV8A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_CRC, AArch64::AEK_RDM})},
-    {"apple-a11", ARMV8_2A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_FP16})},
-    {"apple-a12", ARMV8_3A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_FP16})},
-    {"apple-a13", ARMV8_4A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_SHA3, AArch64::AEK_FP16,
-                               AArch64::AEK_FP16FML})},
-    {"apple-a14", ARMV8_5A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_SHA3, AArch64::AEK_FP16,
-                               AArch64::AEK_FP16FML})},
-    {"apple-a15", ARMV8_6A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_SHA3, AArch64::AEK_FP16,
-                               AArch64::AEK_FP16FML})},
-    {"apple-a16", ARMV8_6A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_SHA3, AArch64::AEK_FP16,
-                               AArch64::AEK_FP16FML})},
-    {"apple-a17", ARMV8_6A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_SHA3, AArch64::AEK_FP16,
-                               AArch64::AEK_FP16FML})},
-
-    {"apple-m1", ARMV8_5A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_SHA3, AArch64::AEK_FP16,
-                               AArch64::AEK_FP16FML})},
-    {"apple-m2", ARMV8_6A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_SHA3, AArch64::AEK_FP16,
-                               AArch64::AEK_FP16FML})},
-    {"apple-m3", ARMV8_6A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_SHA3, AArch64::AEK_FP16,
-                               AArch64::AEK_FP16FML})},
-
-    {"apple-s4", ARMV8_3A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_FP16})},
-    {"apple-s5", ARMV8_3A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_FP16})},
-    {"exynos-m3", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_CRC})},
-    {"exynos-m4", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_DOTPROD, AArch64::AEK_FP16})},
-    {"exynos-m5", ARMV8_2A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_DOTPROD, AArch64::AEK_FP16})},
-    {"falkor", ARMV8A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
-                               AArch64::AEK_CRC, AArch64::AEK_RDM})},
-    {"saphira", ARMV8_3A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_PROFILE})},
-    {"kryo", ARMV8A,
-     AArch64::ExtensionBitset(
-         {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_CRC})},
-    {"thunderx2t99", ARMV8_1A,
-     AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2})},
-    {"thunderx3t110", ARMV8...
[truncated]

@tmatheson-arm tmatheson-arm changed the title [AArch64][TargetParser] move CPUInfo into tablegen [AArch64][TargetParser] move CPUInfo into tablegen [NFC] May 14, 2024
Making generic a AArch64Processor caused two test failures:
 - aarch64-targetattr.c (minor fix)
 - aarch64-fmv-dependencies.c (all dependencies completely wrong)
The order of CPUs has changed
This avoids the need to change a lot of TargetParserTest cases
Fold CPU default extensions into the list of SubtargetFeatures

TargetParserTest fixes because Implies and DefaultExts are combined

Now that they are combined, more things are accounted for in the
targetparser, i.e. more extensions are listed as being enabled for the
given CPUs.

clang test fixes because Implies and DefaultExts are combined
@tmatheson-arm
Copy link
Contributor Author

Summary of the PR after the recent changes:

  • CPUInfo in TargetParser is now generated from AArch64Processors.td
  • The printed order of CPUs has changed, due to definition order.
  • +perfmon now appears in target-features for some CPUs. This is because FeaturePerfMon was in the list of SubtargetFeatures for the CPU but not in the TargetParser CPUInfo, which is now generated from the list of features. This is reflected in TargetParserTest.cpp.
  • The same applies to +sb and +ssbs in the case of apple-m1, +complxnum for a64fx, +wfxt for ampere1b.
  • References to FeatureCrypto in CPU feature lists were replaced by FeatureSHA2 + FeatureAES. This prevents +crypto being output by TargetParser.
  • Made "generic" a real CPU in AArch64Processors.td. This removes some special treatment in code, and makes "generic" appear in the list of CPUs. It also means some "target-features"="+fp-armv8,+neon" appear for the generic CPU. NumAArch64CPUArchs increases.
  • Some CPUs specified AEK_NONE as an extension. This looks like a mistake, removed.

The AArch64Processor class still takes a top-level reference to an architecture.

tmatheson-arm and others added 2 commits May 17, 2024 16:07
The only thing this added over ProcModel was the Architecture field.
Instead, search the list of Features to find the architecture for
each processor.

Since the "generic" processor does not have an Architecture, it needs
special treatment in the emitter.
Copy link

github-actions bot commented May 17, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@jthackray jthackray self-requested a review June 12, 2024 12:28
Copy link
Contributor

@jthackray jthackray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, assuming it causes no regressions.

Copy link
Contributor

@pratlucas pratlucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@tmatheson-arm tmatheson-arm merged commit f07d300 into llvm:main Jun 18, 2024
7 checks passed
@tmatheson-arm tmatheson-arm deleted the targetparser_from_tablegen_cpuinfo branch June 18, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants