[clang] [AArch64]: Refactor target parser to use Bitset. (PR #65423)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 12 04:13:56 PDT 2023


================
@@ -96,64 +97,65 @@ static_assert(FEAT_MAX <= 64,
 // Arch extension modifiers for CPUs. These are labelled with their Arm ARM
 // feature name (though the canonical reference for those is AArch64.td)
 // clang-format off
-enum ArchExtKind : uint64_t {
-  AEK_NONE =        1,
-  AEK_CRC =         1 << 1,  // FEAT_CRC32
-  AEK_CRYPTO =      1 << 2,
-  AEK_FP =          1 << 3,  // FEAT_FP
-  AEK_SIMD =        1 << 4,  // FEAT_AdvSIMD
-  AEK_FP16 =        1 << 5,  // FEAT_FP16
-  AEK_PROFILE =     1 << 6,  // FEAT_SPE
-  AEK_RAS =         1 << 7,  // FEAT_RAS, FEAT_RASv1p1
-  AEK_LSE =         1 << 8,  // FEAT_LSE
-  AEK_SVE =         1 << 9,  // FEAT_SVE
-  AEK_DOTPROD =     1 << 10, // FEAT_DotProd
-  AEK_RCPC =        1 << 11, // FEAT_LRCPC
-  AEK_RDM =         1 << 12, // FEAT_RDM
-  AEK_SM4 =         1 << 13, // FEAT_SM4, FEAT_SM3
-  AEK_SHA3 =        1 << 14, // FEAT_SHA3, FEAT_SHA512
-  AEK_SHA2 =        1 << 15, // FEAT_SHA1, FEAT_SHA256
-  AEK_AES =         1 << 16, // FEAT_AES, FEAT_PMULL
-  AEK_FP16FML =     1 << 17, // FEAT_FHM
-  AEK_RAND =        1 << 18, // FEAT_RNG
-  AEK_MTE =         1 << 19, // FEAT_MTE, FEAT_MTE2
-  AEK_SSBS =        1 << 20, // FEAT_SSBS, FEAT_SSBS2
-  AEK_SB =          1 << 21, // FEAT_SB
-  AEK_PREDRES =     1 << 22, // FEAT_SPECRES
-  AEK_SVE2 =        1 << 23, // FEAT_SVE2
-  AEK_SVE2AES =     1 << 24, // FEAT_SVE_AES, FEAT_SVE_PMULL128
-  AEK_SVE2SM4 =     1 << 25, // FEAT_SVE_SM4
-  AEK_SVE2SHA3 =    1 << 26, // FEAT_SVE_SHA3
-  AEK_SVE2BITPERM = 1 << 27, // FEAT_SVE_BitPerm
-  AEK_TME =         1 << 28, // FEAT_TME
-  AEK_BF16 =        1 << 29, // FEAT_BF16
-  AEK_I8MM =        1 << 30, // FEAT_I8MM
-  AEK_F32MM =       1ULL << 31, // FEAT_F32MM
-  AEK_F64MM =       1ULL << 32, // FEAT_F64MM
-  AEK_LS64 =        1ULL << 33, // FEAT_LS64, FEAT_LS64_V, FEAT_LS64_ACCDATA
-  AEK_BRBE =        1ULL << 34, // FEAT_BRBE
-  AEK_PAUTH =       1ULL << 35, // FEAT_PAuth
-  AEK_FLAGM =       1ULL << 36, // FEAT_FlagM
-  AEK_SME =         1ULL << 37, // FEAT_SME
-  AEK_SMEF64F64 =   1ULL << 38, // FEAT_SME_F64F64
-  AEK_SMEI16I64 =   1ULL << 39, // FEAT_SME_I16I64
-  AEK_HBC =         1ULL << 40, // FEAT_HBC
-  AEK_MOPS =        1ULL << 41, // FEAT_MOPS
-  AEK_PERFMON =     1ULL << 42, // FEAT_PMUv3
-  AEK_SME2 =        1ULL << 43, // FEAT_SME2
-  AEK_SVE2p1 =      1ULL << 44, // FEAT_SVE2p1
-  AEK_SME2p1 =      1ULL << 45, // FEAT_SME2p1
-  AEK_B16B16 =      1ULL << 46, // FEAT_B16B16
-  AEK_SMEF16F16 =   1ULL << 47, // FEAT_SMEF16F16
-  AEK_CSSC =        1ULL << 48, // FEAT_CSSC
-  AEK_RCPC3 =       1ULL << 49, // FEAT_LRCPC3
-  AEK_THE =         1ULL << 50, // FEAT_THE
-  AEK_D128 =        1ULL << 51, // FEAT_D128
-  AEK_LSE128 =      1ULL << 52, // FEAT_LSE128
-  AEK_SPECRES2 =    1ULL << 53, // FEAT_SPECRES2
-  AEK_RASv2 =       1ULL << 54, // FEAT_RASv2
-  AEK_ITE =         1ULL << 55, // FEAT_ITE
-  AEK_GCS =         1ULL << 56, // FEAT_GCS
+enum ArchExtKind : unsigned {
+  AEK_NONE =          1,
+  AEK_CRC =           2,  // FEAT_CRC32
+  AEK_CRYPTO =        3,
+  AEK_FP =            4,  // FEAT_FP
+  AEK_SIMD =          5,  // FEAT_AdvSIMD
+  AEK_FP16 =          6,  // FEAT_FP16
+  AEK_PROFILE =       7,  // FEAT_SPE
+  AEK_RAS =           8,  // FEAT_RAS, FEAT_RASv1p1
+  AEK_LSE =           9,  // FEAT_LSE
+  AEK_SVE =           10,  // FEAT_SVE
+  AEK_DOTPROD =       11, // FEAT_DotProd
+  AEK_RCPC =          12, // FEAT_LRCPC
+  AEK_RDM =           13, // FEAT_RDM
+  AEK_SM4 =           14, // FEAT_SM4, FEAT_SM3
+  AEK_SHA3 =          15, // FEAT_SHA3, FEAT_SHA512
+  AEK_SHA2 =          16, // FEAT_SHA1, FEAT_SHA256
+  AEK_AES =           17, // FEAT_AES, FEAT_PMULL
+  AEK_FP16FML =       18, // FEAT_FHM
+  AEK_RAND =          19, // FEAT_RNG
+  AEK_MTE =           20, // FEAT_MTE, FEAT_MTE2
+  AEK_SSBS =          21, // FEAT_SSBS, FEAT_SSBS2
+  AEK_SB =            22, // FEAT_SB
+  AEK_PREDRES =       23, // FEAT_SPECRES
+  AEK_SVE2 =          24, // FEAT_SVE2
+  AEK_SVE2AES =       25, // FEAT_SVE_AES, FEAT_SVE_PMULL128
+  AEK_SVE2SM4 =       26, // FEAT_SVE_SM4
+  AEK_SVE2SHA3 =      27, // FEAT_SVE_SHA3
+  AEK_SVE2BITPERM =   28, // FEAT_SVE_BitPerm
+  AEK_TME =           29, // FEAT_TME
+  AEK_BF16 =          30, // FEAT_BF16
+  AEK_I8MM =          31, // FEAT_I8MM
+  AEK_F32MM =         32, // FEAT_F32MM
+  AEK_F64MM =         33, // FEAT_F64MM
+  AEK_LS64 =          34, // FEAT_LS64, FEAT_LS64_V, FEAT_LS64_ACCDATA
+  AEK_BRBE =          35, // FEAT_BRBE
+  AEK_PAUTH =         36, // FEAT_PAuth
+  AEK_FLAGM =         37, // FEAT_FlagM
+  AEK_SME =           38, // FEAT_SME
+  AEK_SMEF64F64 =     39, // FEAT_SME_F64F64
+  AEK_SMEI16I64 =     40, // FEAT_SME_I16I64
+  AEK_HBC =           41, // FEAT_HBC
+  AEK_MOPS =          42, // FEAT_MOPS
+  AEK_PERFMON =       43, // FEAT_PMUv3
+  AEK_SME2 =          44, // FEAT_SME2
+  AEK_SVE2p1 =        45, // FEAT_SVE2p1
+  AEK_SME2p1 =        46, // FEAT_SME2p1
+  AEK_B16B16 =        47, // FEAT_B16B16
+  AEK_SMEF16F16 =     48, // FEAT_SMEF16F16
+  AEK_CSSC =          49, // FEAT_CSSC
+  AEK_RCPC3 =         50, // FEAT_LRCPC3
+  AEK_THE =           51, // FEAT_THE
+  AEK_D128 =          52, // FEAT_D128
+  AEK_LSE128 =        53, // FEAT_LSE128
+  AEK_SPECRES2 =      54, // FEAT_SPECRES2
+  AEK_RASv2 =         55, // FEAT_RASv2
+  AEK_ITE =           56, // FEAT_ITE
+  AEK_GCS =           57, // FEAT_GCS
+  AEK_EXTENSIONS_LAST =  58
----------------
sdesmalen-arm wrote:

I think you should either name this `AEK_NUM_EXTENSIONS = AEK_GCS  + 1` or you should do `AEK_EXTENSIONS_LAST = AEK_GCS` and in other places do `AEK_EXTENSIONS_LAST + 1` to get the number of extensions.

https://github.com/llvm/llvm-project/pull/65423


More information about the cfe-commits mailing list