xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64Features.td (revision 62987288060ff68c817b7056815aa9fb8ba8ecd7)
10fca6ea1SDimitry Andric//=- AArch64Features.td - Describe AArch64 SubtargetFeatures -*- tablegen -*-=//
20fca6ea1SDimitry Andric//
30fca6ea1SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40fca6ea1SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50fca6ea1SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60fca6ea1SDimitry Andric//
70fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
80fca6ea1SDimitry Andric//
90fca6ea1SDimitry Andric//
100fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
110fca6ea1SDimitry Andric
120fca6ea1SDimitry Andric// A SubtargetFeature that represents one or more Architecture Extensions, as
130fca6ea1SDimitry Andric// defined by the Arm ARM and typically identified by a 'FEAT_*' name.
140fca6ea1SDimitry Andric// Each Extension record defines an ExtensionInfo entry in the Target Parser
150fca6ea1SDimitry Andric// with a corresponding 'AEK_*' entry in the ArchExtKind enum.
160fca6ea1SDimitry Andricclass Extension<
170fca6ea1SDimitry Andric  string TargetFeatureName,            // String used for -target-feature, unless overridden.
180fca6ea1SDimitry Andric  string Spelling,                     // The XYZ in HasXYZ and AEK_XYZ.
190fca6ea1SDimitry Andric  string ArchitectureFeatureName,      // The extension's "FEAT_*"" name(s) defined by the architecture
200fca6ea1SDimitry Andric  string Desc,                         // Description.
210fca6ea1SDimitry Andric  list<SubtargetFeature> Implies = []  // List of dependent features.
220fca6ea1SDimitry Andric> : SubtargetFeature<TargetFeatureName, "Has" # Spelling, "true", Desc, Implies>
230fca6ea1SDimitry Andric{
240fca6ea1SDimitry Andric    string ArchExtKindSpelling = "AEK_" # Spelling; // ArchExtKind enum name.
250fca6ea1SDimitry Andric
260fca6ea1SDimitry Andric    string ArchFeatureName = ArchitectureFeatureName;
270fca6ea1SDimitry Andric
280fca6ea1SDimitry Andric    // The user visible name used by -march/-mcpu modifiers and target attribute
290fca6ea1SDimitry Andric    // values. Extensions are not available on these by default.
300fca6ea1SDimitry Andric    string UserVisibleName = "";
310fca6ea1SDimitry Andric
320fca6ea1SDimitry Andric    // An alias that can be used on the command line, if the extension has one.
330fca6ea1SDimitry Andric    // Used for correcting historical names while remaining backwards compatible.
340fca6ea1SDimitry Andric    string UserVisibleAlias = "";
350fca6ea1SDimitry Andric}
360fca6ea1SDimitry Andric
370fca6ea1SDimitry Andric// An Extension that can be toggled via a '-march'/'-mcpu' modifier or a target
380fca6ea1SDimitry Andric// attribute, e.g. '+sm4".
390fca6ea1SDimitry Andricclass ExtensionWithMArch<
400fca6ea1SDimitry Andric  string TargetFeatureName,            // String used for -target-feature and -march, unless overridden.
410fca6ea1SDimitry Andric  string Spelling,                     // The XYZ in HasXYZ and AEK_XYZ.
420fca6ea1SDimitry Andric  string ArchitectureFeatureName,      // The extension's "FEAT_*"" name(s) defined by the architecture
430fca6ea1SDimitry Andric  string Desc,                         // Description.
440fca6ea1SDimitry Andric  list<SubtargetFeature> Implies = []  // List of dependent features.
450fca6ea1SDimitry Andric> : Extension<TargetFeatureName, Spelling, ArchitectureFeatureName, Desc, Implies> {
460fca6ea1SDimitry Andric    // In general, the name written on the command line should match the name
470fca6ea1SDimitry Andric    // used for -target-feature. However, there are exceptions. Therefore we
480fca6ea1SDimitry Andric    // add a separate field for this, to allow overriding it. Strongly prefer
490fca6ea1SDimitry Andric    // not doing so.
500fca6ea1SDimitry Andric    let UserVisibleName = TargetFeatureName;
510fca6ea1SDimitry Andric}
520fca6ea1SDimitry Andric
530fca6ea1SDimitry Andric
540fca6ea1SDimitry Andric
550fca6ea1SDimitry Andric// Each SubtargetFeature which corresponds to an Arm Architecture feature should
560fca6ea1SDimitry Andric// be annotated with the respective FEAT_ feature name from the Architecture
570fca6ea1SDimitry Andric// Reference Manual. If a SubtargetFeature enables instructions from multiple
580fca6ea1SDimitry Andric// Arm Architecture Features, it should list all the relevant features. Not all
590fca6ea1SDimitry Andric// FEAT_ features have a corresponding SubtargetFeature.
600fca6ea1SDimitry Andric
610fca6ea1SDimitry Andric
620fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
630fca6ea1SDimitry Andric//  Armv8.0 Architecture Extensions
640fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
650fca6ea1SDimitry Andric
660fca6ea1SDimitry Andriclet ArchExtKindSpelling = "AEK_FP", UserVisibleName = "fp" in
670fca6ea1SDimitry Andricdef FeatureFPARMv8 : ExtensionWithMArch<"fp-armv8", "FPARMv8", "FEAT_FP",
680fca6ea1SDimitry Andric  "Enable Armv8.0-A Floating Point Extensions">;
690fca6ea1SDimitry Andric
700fca6ea1SDimitry Andriclet ArchExtKindSpelling = "AEK_SIMD", UserVisibleName = "simd" in
710fca6ea1SDimitry Andricdef FeatureNEON : ExtensionWithMArch<"neon", "NEON", "FEAT_AdvSIMD",
720fca6ea1SDimitry Andric  "Enable Advanced SIMD instructions", [FeatureFPARMv8]>;
730fca6ea1SDimitry Andric
740fca6ea1SDimitry Andricdef FeatureSHA2 : ExtensionWithMArch<"sha2", "SHA2", "FEAT_SHA1, FEAT_SHA256",
750fca6ea1SDimitry Andric  "Enable SHA1 and SHA256 support", [FeatureNEON]>;
760fca6ea1SDimitry Andric
770fca6ea1SDimitry Andricdef FeatureAES : ExtensionWithMArch<"aes", "AES", "FEAT_AES, FEAT_PMULL",
780fca6ea1SDimitry Andric  "Enable AES support", [FeatureNEON]>;
790fca6ea1SDimitry Andric
800fca6ea1SDimitry Andric// Crypto has been split up and any combination is now valid (see the
810fca6ea1SDimitry Andric// crypto definitions above). Also, crypto is now context sensitive:
820fca6ea1SDimitry Andric// it has a different meaning for e.g. Armv8.4 than it has for Armv8.2.
830fca6ea1SDimitry Andric// Therefore, we rely on Clang, the user interfacing tool, to pass on the
840fca6ea1SDimitry Andric// appropriate crypto options. But here in the backend, crypto has very little
850fca6ea1SDimitry Andric// meaning anymore. We kept the Crypto definition here for backward
860fca6ea1SDimitry Andric// compatibility, and now imply features SHA2 and AES, which was the
870fca6ea1SDimitry Andric// "traditional" meaning of Crypto.
880fca6ea1SDimitry Andricdef FeatureCrypto : ExtensionWithMArch<"crypto", "Crypto", "FEAT_Crypto",
890fca6ea1SDimitry Andric  "Enable cryptographic instructions", [FeatureNEON, FeatureSHA2, FeatureAES]>;
900fca6ea1SDimitry Andric
910fca6ea1SDimitry Andricdef FeatureCRC : ExtensionWithMArch<"crc", "CRC", "FEAT_CRC32",
920fca6ea1SDimitry Andric  "Enable Armv8.0-A CRC-32 checksum instructions">;
930fca6ea1SDimitry Andric
940fca6ea1SDimitry Andric// This SubtargetFeature is special. It controls only whether codegen will turn
950fca6ea1SDimitry Andric// `llvm.readcyclecounter()` into an access to a PMUv3 System Register. The
960fca6ea1SDimitry Andric// `FEAT_PMUv3*` system registers are always available for assembly/disassembly.
970fca6ea1SDimitry Andriclet UserVisibleName = "pmuv3" in
980fca6ea1SDimitry Andricdef FeaturePerfMon : ExtensionWithMArch<"perfmon", "PerfMon", "FEAT_PMUv3",
990fca6ea1SDimitry Andric  "Enable Armv8.0-A PMUv3 Performance Monitors extension">;
1000fca6ea1SDimitry Andric
1010fca6ea1SDimitry Andricdef FeatureSpecRestrict : Extension<"specrestrict", "SpecRestrict", "FEAT_CSV2_2",
1020fca6ea1SDimitry Andric  "Enable architectural speculation restriction">;
1030fca6ea1SDimitry Andric
1040fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
1050fca6ea1SDimitry Andric//  Armv8.1 Architecture Extensions
1060fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
1070fca6ea1SDimitry Andric
1080fca6ea1SDimitry Andricdef FeatureLSE : ExtensionWithMArch<"lse", "LSE", "FEAT_LSE",
1090fca6ea1SDimitry Andric  "Enable Armv8.1-A Large System Extension (LSE) atomic instructions">;
1100fca6ea1SDimitry Andric
1110fca6ea1SDimitry Andriclet UserVisibleAlias = "rdma" in
1120fca6ea1SDimitry Andricdef FeatureRDM : ExtensionWithMArch<"rdm", "RDM", "FEAT_RDM",
1130fca6ea1SDimitry Andric  "Enable Armv8.1-A Rounding Double Multiply Add/Subtract instructions",
1140fca6ea1SDimitry Andric  [FeatureNEON]>;
1150fca6ea1SDimitry Andric
1160fca6ea1SDimitry Andricdef FeaturePAN : Extension<"pan", "PAN", "FEAT_PAN",
1170fca6ea1SDimitry Andric  "Enable Armv8.1-A Privileged Access-Never extension">;
1180fca6ea1SDimitry Andric
1190fca6ea1SDimitry Andricdef FeatureLOR : Extension<"lor", "LOR", "FEAT_LOR",
1200fca6ea1SDimitry Andric  "Enable Armv8.1-A Limited Ordering Regions extension">;
1210fca6ea1SDimitry Andric
1220fca6ea1SDimitry Andricdef FeatureCONTEXTIDREL2 : SubtargetFeature<"CONTEXTIDREL2", "HasCONTEXTIDREL2",
1230fca6ea1SDimitry Andric  "true", "Enable RW operand CONTEXTIDR_EL2">;
1240fca6ea1SDimitry Andric
1250fca6ea1SDimitry Andricdef FeatureVH : Extension<"vh", "VH", "FEAT_VHE",
1260fca6ea1SDimitry Andric  "Enable Armv8.1-A Virtual Host extension", [FeatureCONTEXTIDREL2]>;
1270fca6ea1SDimitry Andric
1280fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
1290fca6ea1SDimitry Andric//  Armv8.2 Architecture Extensions
1300fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
1310fca6ea1SDimitry Andric
1320fca6ea1SDimitry Andricdef FeatureSM4 : ExtensionWithMArch<"sm4", "SM4", "FEAT_SM4, FEAT_SM3",
1330fca6ea1SDimitry Andric  "Enable SM3 and SM4 support", [FeatureNEON]>;
1340fca6ea1SDimitry Andric
1350fca6ea1SDimitry Andricdef FeatureSHA3 : ExtensionWithMArch<"sha3", "SHA3", "FEAT_SHA3, FEAT_SHA512",
1360fca6ea1SDimitry Andric  "Enable SHA512 and SHA3 support", [FeatureNEON, FeatureSHA2]>;
1370fca6ea1SDimitry Andric
1380fca6ea1SDimitry Andricdef FeatureRAS : ExtensionWithMArch<"ras", "RAS", "FEAT_RAS, FEAT_RASv1p1",
1390fca6ea1SDimitry Andric  "Enable Armv8.0-A Reliability, Availability and Serviceability Extensions">;
1400fca6ea1SDimitry Andric
1410fca6ea1SDimitry Andriclet ArchExtKindSpelling = "AEK_FP16", UserVisibleName = "fp16" in
1420fca6ea1SDimitry Andricdef FeatureFullFP16 : ExtensionWithMArch<"fullfp16", "FullFP16", "FEAT_FP16",
1430fca6ea1SDimitry Andric  "Enable half-precision floating-point data processing", [FeatureFPARMv8]>;
1440fca6ea1SDimitry Andric
1450fca6ea1SDimitry Andriclet ArchExtKindSpelling = "AEK_PROFILE", UserVisibleName = "profile" in
1460fca6ea1SDimitry Andricdef FeatureSPE : ExtensionWithMArch<"spe", "SPE", "FEAT_SPE",
1470fca6ea1SDimitry Andric  "Enable Statistical Profiling extension">;
1480fca6ea1SDimitry Andric
1490fca6ea1SDimitry Andricdef FeaturePAN_RWV : Extension<"pan-rwv", "PAN_RWV", "FEAT_PAN2",
1500fca6ea1SDimitry Andric  "Enable Armv8.2-A PAN s1e1R and s1e1W Variants", [FeaturePAN]>;
1510fca6ea1SDimitry Andric
1520fca6ea1SDimitry Andricdef FeaturePsUAO : Extension<"uaops", "PsUAO", "FEAT_UAO",
1530fca6ea1SDimitry Andric  "Enable Armv8.2-A UAO PState">;
1540fca6ea1SDimitry Andric
1550fca6ea1SDimitry Andricdef FeatureCCPP : Extension<"ccpp", "CCPP", "FEAT_DPB",
1560fca6ea1SDimitry Andric  "Enable Armv8.2-A data Cache Clean to Point of Persistence">;
1570fca6ea1SDimitry Andric
1580fca6ea1SDimitry Andricdef FeatureSVE : ExtensionWithMArch<"sve", "SVE", "FEAT_SVE",
1590fca6ea1SDimitry Andric  "Enable Scalable Vector Extension (SVE) instructions", [FeatureFullFP16]>;
1600fca6ea1SDimitry Andric
1610fca6ea1SDimitry Andriclet ArchExtKindSpelling = "AEK_I8MM" in
1620fca6ea1SDimitry Andricdef FeatureMatMulInt8 : ExtensionWithMArch<"i8mm", "MatMulInt8", "FEAT_I8MM",
1630fca6ea1SDimitry Andric  "Enable Matrix Multiply Int8 Extension">;
1640fca6ea1SDimitry Andric
1650fca6ea1SDimitry Andriclet ArchExtKindSpelling = "AEK_F32MM" in
1660fca6ea1SDimitry Andricdef FeatureMatMulFP32 : ExtensionWithMArch<"f32mm", "MatMulFP32", "FEAT_F32MM",
1670fca6ea1SDimitry Andric  "Enable Matrix Multiply FP32 Extension", [FeatureSVE]>;
1680fca6ea1SDimitry Andric
1690fca6ea1SDimitry Andriclet ArchExtKindSpelling = "AEK_F64MM" in
1700fca6ea1SDimitry Andricdef FeatureMatMulFP64 : ExtensionWithMArch<"f64mm", "MatMulFP64", "FEAT_F64MM",
1710fca6ea1SDimitry Andric  "Enable Matrix Multiply FP64 Extension", [FeatureSVE]>;
1720fca6ea1SDimitry Andric
1730fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
1740fca6ea1SDimitry Andric//  Armv8.3 Architecture Extensions
1750fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
1760fca6ea1SDimitry Andric
1770fca6ea1SDimitry Andricdef FeatureRCPC : ExtensionWithMArch<"rcpc", "RCPC", "FEAT_LRCPC",
1780fca6ea1SDimitry Andric  "Enable support for RCPC extension">;
1790fca6ea1SDimitry Andric
1800fca6ea1SDimitry Andricdef FeaturePAuth : ExtensionWithMArch<"pauth", "PAuth", "FEAT_PAuth",
1810fca6ea1SDimitry Andric  "Enable Armv8.3-A Pointer Authentication extension">;
1820fca6ea1SDimitry Andric
1830fca6ea1SDimitry Andriclet ArchExtKindSpelling = "AEK_JSCVT", UserVisibleName = "jscvt" in
1840fca6ea1SDimitry Andricdef FeatureJS : ExtensionWithMArch<"jsconv", "JS", "FEAT_JSCVT",
1850fca6ea1SDimitry Andric  "Enable Armv8.3-A JavaScript FP conversion instructions",
1860fca6ea1SDimitry Andric  [FeatureFPARMv8]>;
1870fca6ea1SDimitry Andric
1880fca6ea1SDimitry Andricdef FeatureFPAC : Extension<"fpac", "FPAC", "FEAT_FPAC",
1890fca6ea1SDimitry Andric  "Enable v8.3-A Pointer Authentication Faulting enhancement">;
1900fca6ea1SDimitry Andric
1910fca6ea1SDimitry Andricdef FeatureCCIDX : Extension<"ccidx", "CCIDX", "FEAT_CCIDX",
1920fca6ea1SDimitry Andric  "Enable Armv8.3-A Extend of the CCSIDR number of sets">;
1930fca6ea1SDimitry Andric
1940fca6ea1SDimitry Andriclet ArchExtKindSpelling = "AEK_FCMA", UserVisibleName = "fcma" in
1950fca6ea1SDimitry Andricdef FeatureComplxNum : ExtensionWithMArch<"complxnum", "ComplxNum", "FEAT_FCMA",
1960fca6ea1SDimitry Andric  "Enable Armv8.3-A Floating-point complex number support",
1970fca6ea1SDimitry Andric  [FeatureNEON]>;
1980fca6ea1SDimitry Andric
1990fca6ea1SDimitry Andricdef FeatureNV : Extension<"nv", "NV", "FEAT_NV, FEAT_NV2",
2000fca6ea1SDimitry Andric  "Enable Armv8.4-A Nested Virtualization Enchancement">;
2010fca6ea1SDimitry Andric
2020fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
2030fca6ea1SDimitry Andric//  Armv8.4 Architecture Extensions
2040fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
2050fca6ea1SDimitry Andric
2060fca6ea1SDimitry Andricdef FeatureLSE2 : Extension<"lse2", "LSE2", "FEAT_LSE2",
2070fca6ea1SDimitry Andric  "Enable Armv8.4-A Large System Extension 2 (LSE2) atomicity rules">;
2080fca6ea1SDimitry Andric
2090fca6ea1SDimitry Andricdef FeatureFP16FML : ExtensionWithMArch<"fp16fml", "FP16FML", "FEAT_FHM",
2100fca6ea1SDimitry Andric  "Enable FP16 FML instructions", [FeatureFullFP16]>;
2110fca6ea1SDimitry Andric
2120fca6ea1SDimitry Andricdef FeatureDotProd : ExtensionWithMArch<"dotprod", "DotProd", "FEAT_DotProd",
2130fca6ea1SDimitry Andric  "Enable dot product support", [FeatureNEON]>;
2140fca6ea1SDimitry Andric
2150fca6ea1SDimitry Andricdef FeatureMPAM : Extension<"mpam", "MPAM", "FEAT_MPAM",
2160fca6ea1SDimitry Andric  "Enable Armv8.4-A Memory system Partitioning and Monitoring extension">;
2170fca6ea1SDimitry Andric
2180fca6ea1SDimitry Andricdef FeatureDIT : ExtensionWithMArch<"dit", "DIT", "FEAT_DIT",
2190fca6ea1SDimitry Andric  "Enable Armv8.4-A Data Independent Timing instructions">;
2200fca6ea1SDimitry Andric
2210fca6ea1SDimitry Andricdef FeatureTRACEV8_4 : Extension<"tracev8.4", "TRACEV8_4", "FEAT_TRF",
2220fca6ea1SDimitry Andric  "Enable Armv8.4-A Trace extension">;
2230fca6ea1SDimitry Andric
2240fca6ea1SDimitry Andricdef FeatureAM : Extension<"am", "AM", "FEAT_AMUv1",
2250fca6ea1SDimitry Andric  "Enable Armv8.4-A Activity Monitors extension">;
2260fca6ea1SDimitry Andric
2270fca6ea1SDimitry Andricdef FeatureSEL2 : Extension<"sel2", "SEL2", "FEAT_SEL2",
2280fca6ea1SDimitry Andric  "Enable Armv8.4-A Secure Exception Level 2 extension">;
2290fca6ea1SDimitry Andric
2300fca6ea1SDimitry Andricdef FeatureTLB_RMI : Extension<"tlb-rmi", "TLB_RMI",
2310fca6ea1SDimitry Andric  "FEAT_TLBIOS, FEAT_TLBIRANGE",
2320fca6ea1SDimitry Andric  "Enable Armv8.4-A TLB Range and Maintenance instructions">;
2330fca6ea1SDimitry Andric
2340fca6ea1SDimitry Andricdef FeatureFlagM : ExtensionWithMArch<"flagm", "FlagM", "FEAT_FlagM",
2350fca6ea1SDimitry Andric  "Enable Armv8.4-A Flag Manipulation instructions">;
2360fca6ea1SDimitry Andric
2370fca6ea1SDimitry Andricdef FeatureRCPC_IMMO : Extension<"rcpc-immo", "RCPC_IMMO", "FEAT_LRCPC2",
2380fca6ea1SDimitry Andric  "Enable Armv8.4-A RCPC instructions with Immediate Offsets",
2390fca6ea1SDimitry Andric  [FeatureRCPC]>;
2400fca6ea1SDimitry Andric
2410fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
2420fca6ea1SDimitry Andric//  Armv8.5 Architecture Extensions
2430fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
2440fca6ea1SDimitry Andric
2450fca6ea1SDimitry Andricdef FeatureAltFPCmp : Extension<"altnzcv", "AlternativeNZCV", "FEAT_FlagM2",
2460fca6ea1SDimitry Andric  "Enable alternative NZCV format for floating point comparisons">;
2470fca6ea1SDimitry Andric
2480fca6ea1SDimitry Andricdef FeatureFRInt3264 : Extension<"fptoint", "FRInt3264", "FEAT_FRINTTS",
2490fca6ea1SDimitry Andric  "Enable FRInt[32|64][Z|X] instructions that round a floating-point number to "
2500fca6ea1SDimitry Andric  "an integer (in FP format) forcing it to fit into a 32- or 64-bit int">;
2510fca6ea1SDimitry Andric
2520fca6ea1SDimitry Andricdef FeatureSB : ExtensionWithMArch<"sb", "SB", "FEAT_SB",
2530fca6ea1SDimitry Andric  "Enable Armv8.5-A Speculation Barrier">;
2540fca6ea1SDimitry Andric
2550fca6ea1SDimitry Andricdef FeatureSSBS : ExtensionWithMArch<"ssbs", "SSBS", "FEAT_SSBS, FEAT_SSBS2",
2560fca6ea1SDimitry Andric  "Enable Speculative Store Bypass Safe bit">;
2570fca6ea1SDimitry Andric
2580fca6ea1SDimitry Andricdef FeaturePredRes : ExtensionWithMArch<"predres", "PredRes", "FEAT_SPECRES",
2590fca6ea1SDimitry Andric  "Enable Armv8.5-A execution and data prediction invalidation instructions">;
2600fca6ea1SDimitry Andric
2610fca6ea1SDimitry Andricdef FeatureCacheDeepPersist : Extension<"ccdp", "CCDP", "FEAT_DPB2",
2620fca6ea1SDimitry Andric  "Enable Armv8.5-A Cache Clean to Point of Deep Persistence">;
2630fca6ea1SDimitry Andric
2640fca6ea1SDimitry Andricdef FeatureBranchTargetId : ExtensionWithMArch<"bti", "BTI", "FEAT_BTI",
2650fca6ea1SDimitry Andric  "Enable Branch Target Identification">;
2660fca6ea1SDimitry Andric
2670fca6ea1SDimitry Andriclet ArchExtKindSpelling = "AEK_RAND", UserVisibleName = "rng" in
2680fca6ea1SDimitry Andricdef FeatureRandGen : ExtensionWithMArch<"rand", "RandGen", "FEAT_RNG",
2690fca6ea1SDimitry Andric  "Enable Random Number generation instructions">;
2700fca6ea1SDimitry Andric
2710fca6ea1SDimitry Andric// NOTE: "memtag" means FEAT_MTE + FEAT_MTE2 for -march or
2720fca6ea1SDimitry Andric// __attribute((target(...))), but only FEAT_MTE for FMV.
2730fca6ea1SDimitry Andriclet UserVisibleName = "memtag" in
2740fca6ea1SDimitry Andricdef FeatureMTE : ExtensionWithMArch<"mte", "MTE", "FEAT_MTE, FEAT_MTE2",
2750fca6ea1SDimitry Andric  "Enable Memory Tagging Extension">;
2760fca6ea1SDimitry Andric
2770fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
2780fca6ea1SDimitry Andric//  Armv8.6 Architecture Extensions
2790fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
2800fca6ea1SDimitry Andric
2810fca6ea1SDimitry Andricdef FeatureBF16 : ExtensionWithMArch<"bf16", "BF16", "FEAT_BF16",
2820fca6ea1SDimitry Andric  "Enable BFloat16 Extension">;
2830fca6ea1SDimitry Andric
2840fca6ea1SDimitry Andricdef FeatureAMVS : Extension<"amvs", "AMVS", "FEAT_AMUv1p1",
2850fca6ea1SDimitry Andric  "Enable Armv8.6-A Activity Monitors Virtualization support",
2860fca6ea1SDimitry Andric  [FeatureAM]>;
2870fca6ea1SDimitry Andric
2880fca6ea1SDimitry Andricdef FeatureFineGrainedTraps : Extension<"fgt", "FineGrainedTraps", "FEAT_FGT",
2890fca6ea1SDimitry Andric  "Enable fine grained virtualization traps extension">;
2900fca6ea1SDimitry Andric
2910fca6ea1SDimitry Andricdef FeatureEnhancedCounterVirtualization :
2920fca6ea1SDimitry Andric    Extension<"ecv", "EnhancedCounterVirtualization", "FEAT_ECV",
2930fca6ea1SDimitry Andric      "Enable enhanced counter virtualization extension">;
2940fca6ea1SDimitry Andric
2950fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
2960fca6ea1SDimitry Andric//  Armv8.7 Architecture Extensions
2970fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
2980fca6ea1SDimitry Andric
2990fca6ea1SDimitry Andricdef FeatureXS : Extension<"xs", "XS", "FEAT_XS",
3000fca6ea1SDimitry Andric  "Enable Armv8.7-A limited-TLB-maintenance instruction">;
3010fca6ea1SDimitry Andric
3020fca6ea1SDimitry Andricdef FeatureWFxT : ExtensionWithMArch<"wfxt", "WFxT", "FEAT_WFxT",
3030fca6ea1SDimitry Andric  "Enable Armv8.7-A WFET and WFIT instruction">;
3040fca6ea1SDimitry Andric
3050fca6ea1SDimitry Andricdef FeatureHCX : Extension<"hcx", "HCX", "FEAT_HCX",
3060fca6ea1SDimitry Andric  "Enable Armv8.7-A HCRX_EL2 system register">;
3070fca6ea1SDimitry Andric
3080fca6ea1SDimitry Andricdef FeatureLS64 : ExtensionWithMArch<"ls64", "LS64",
3090fca6ea1SDimitry Andric  "FEAT_LS64, FEAT_LS64_V, FEAT_LS64_ACCDATA",
3100fca6ea1SDimitry Andric  "Enable Armv8.7-A LD64B/ST64B Accelerator Extension">;
3110fca6ea1SDimitry Andric
3120fca6ea1SDimitry Andricdef FeatureSPE_EEF : Extension<"spe-eef", "SPE_EEF", "FEAT_SPEv1p2",
3130fca6ea1SDimitry Andric  "Enable extra register in the Statistical Profiling Extension">;
3140fca6ea1SDimitry Andric
3150fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
3160fca6ea1SDimitry Andric//  Armv8.8 Architecture Extensions
3170fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
3180fca6ea1SDimitry Andric
3190fca6ea1SDimitry Andricdef FeatureHBC : ExtensionWithMArch<"hbc", "HBC", "FEAT_HBC",
3200fca6ea1SDimitry Andric    "Enable Armv8.8-A Hinted Conditional Branches Extension">;
3210fca6ea1SDimitry Andric
3220fca6ea1SDimitry Andricdef FeatureMOPS : ExtensionWithMArch<"mops", "MOPS", "FEAT_MOPS",
3230fca6ea1SDimitry Andric    "Enable Armv8.8-A memcpy and memset acceleration instructions">;
3240fca6ea1SDimitry Andric
3250fca6ea1SDimitry Andricdef FeatureNMI : Extension<"nmi", "NMI", "FEAT_NMI, FEAT_GICv3_NMI",
3260fca6ea1SDimitry Andric  "Enable Armv8.8-A Non-maskable Interrupts">;
3270fca6ea1SDimitry Andric
3280fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
3290fca6ea1SDimitry Andric//  Armv8.9 Architecture Extensions
3300fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
3310fca6ea1SDimitry Andric
3320fca6ea1SDimitry Andricdef FeatureRASv2 : ExtensionWithMArch<"rasv2", "RASv2", "FEAT_RASv2",
3330fca6ea1SDimitry Andric  "Enable Armv8.9-A Reliability, Availability and Serviceability Extensions",
3340fca6ea1SDimitry Andric  [FeatureRAS]>;
3350fca6ea1SDimitry Andric
3360fca6ea1SDimitry Andricdef FeatureCSSC : ExtensionWithMArch<"cssc", "CSSC", "FEAT_CSSC",
3370fca6ea1SDimitry Andric  "Enable Common Short Sequence Compression (CSSC) instructions">;
3380fca6ea1SDimitry Andric
3390fca6ea1SDimitry Andricdef FeatureCLRBHB : Extension<"clrbhb", "CLRBHB", "FEAT_CLRBHB",
3400fca6ea1SDimitry Andric  "Enable Clear BHB instruction">;
3410fca6ea1SDimitry Andric
3420fca6ea1SDimitry Andricdef FeaturePRFM_SLC : Extension<"prfm-slc-target", "PRFM_SLC", "FEAT_PRFMSLC",
3430fca6ea1SDimitry Andric  "Enable SLC target for PRFM instruction">;
3440fca6ea1SDimitry Andric
3450fca6ea1SDimitry Andriclet UserVisibleName = "predres2" in
3460fca6ea1SDimitry Andricdef FeatureSPECRES2 : ExtensionWithMArch<"specres2", "SPECRES2", "FEAT_SPECRES2",
3470fca6ea1SDimitry Andric  "Enable Speculation Restriction Instruction",
3480fca6ea1SDimitry Andric  [FeaturePredRes]>;
3490fca6ea1SDimitry Andric
3500fca6ea1SDimitry Andricdef FeatureRCPC3 : ExtensionWithMArch<"rcpc3", "RCPC3", "FEAT_LRCPC3",
3510fca6ea1SDimitry Andric  "Enable Armv8.9-A RCPC instructions for A64 and Advanced SIMD and floating-point instruction set",
3520fca6ea1SDimitry Andric  [FeatureRCPC_IMMO]>;
3530fca6ea1SDimitry Andric
3540fca6ea1SDimitry Andricdef FeatureTHE : ExtensionWithMArch<"the", "THE", "FEAT_THE",
3550fca6ea1SDimitry Andric  "Enable Armv8.9-A Translation Hardening Extension">;
3560fca6ea1SDimitry Andric
3570fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
3580fca6ea1SDimitry Andric//  Armv9.0 Architecture Extensions
3590fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
3600fca6ea1SDimitry Andric
3610fca6ea1SDimitry Andricdef FeatureUseFixedOverScalableIfEqualCost: SubtargetFeature<"use-fixed-over-scalable-if-equal-cost",
3620fca6ea1SDimitry Andric  "UseFixedOverScalableIfEqualCost", "true",
3630fca6ea1SDimitry Andric  "Prefer fixed width loop vectorization over scalable if the cost-model assigns equal costs">;
3640fca6ea1SDimitry Andric
3650fca6ea1SDimitry Andricdef FeatureUseScalarIncVL : SubtargetFeature<"use-scalar-inc-vl",
3660fca6ea1SDimitry Andric  "UseScalarIncVL", "true", "Prefer inc/dec over add+cnt">;
3670fca6ea1SDimitry Andric
3680fca6ea1SDimitry Andricdef FeatureSVE2 : ExtensionWithMArch<"sve2", "SVE2", "FEAT_SVE2",
3690fca6ea1SDimitry Andric  "Enable Scalable Vector Extension 2 (SVE2) instructions",
3700fca6ea1SDimitry Andric  [FeatureSVE, FeatureUseScalarIncVL]>;
3710fca6ea1SDimitry Andric
3720fca6ea1SDimitry Andricdef FeatureSVE2AES : ExtensionWithMArch<"sve2-aes", "SVE2AES",
3730fca6ea1SDimitry Andric  "FEAT_SVE_AES, FEAT_SVE_PMULL128",
3740fca6ea1SDimitry Andric  "Enable AES SVE2 instructions", [FeatureSVE2, FeatureAES]>;
3750fca6ea1SDimitry Andric
3760fca6ea1SDimitry Andricdef FeatureSVE2SM4 : ExtensionWithMArch<"sve2-sm4", "SVE2SM4", "FEAT_SVE_SM4",
3770fca6ea1SDimitry Andric  "Enable SM4 SVE2 instructions", [FeatureSVE2, FeatureSM4]>;
3780fca6ea1SDimitry Andric
3790fca6ea1SDimitry Andricdef FeatureSVE2SHA3 : ExtensionWithMArch<"sve2-sha3", "SVE2SHA3", "FEAT_SVE_SHA3",
3800fca6ea1SDimitry Andric  "Enable SHA3 SVE2 instructions", [FeatureSVE2, FeatureSHA3]>;
3810fca6ea1SDimitry Andric
3820fca6ea1SDimitry Andricdef FeatureSVE2BitPerm : ExtensionWithMArch<"sve2-bitperm", "SVE2BitPerm",
3830fca6ea1SDimitry Andric  "FEAT_SVE_BitPerm",
3840fca6ea1SDimitry Andric  "Enable bit permutation SVE2 instructions", [FeatureSVE2]>;
3850fca6ea1SDimitry Andric
3860fca6ea1SDimitry Andricdef FeatureTRBE : Extension<"trbe", "TRBE", "FEAT_TRBE",
3870fca6ea1SDimitry Andric  "Enable Trace Buffer Extension">;
3880fca6ea1SDimitry Andric
3890fca6ea1SDimitry Andricdef FeatureETE : Extension<"ete", "ETE", "FEAT_ETE",
3900fca6ea1SDimitry Andric  "Enable Embedded Trace Extension", [FeatureTRBE]>;
3910fca6ea1SDimitry Andric
3920fca6ea1SDimitry Andricdef FeatureTME : ExtensionWithMArch<"tme", "TME", "FEAT_TME",
3930fca6ea1SDimitry Andric  "Enable Transactional Memory Extension">;
3940fca6ea1SDimitry Andric
3950fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
3960fca6ea1SDimitry Andric//  Armv9.1 Architecture Extensions
3970fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
3980fca6ea1SDimitry Andric
3990fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
4000fca6ea1SDimitry Andric//  Armv9.2 Architecture Extensions
4010fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
4020fca6ea1SDimitry Andric
4030fca6ea1SDimitry Andricdef FeatureBRBE : ExtensionWithMArch<"brbe", "BRBE", "FEAT_BRBE",
4040fca6ea1SDimitry Andric  "Enable Branch Record Buffer Extension">;
4050fca6ea1SDimitry Andric
4060fca6ea1SDimitry Andricdef FeatureRME : Extension<"rme", "RME", "FEAT_RME",
4070fca6ea1SDimitry Andric  "Enable Realm Management Extension">;
4080fca6ea1SDimitry Andric
4090fca6ea1SDimitry Andricdef FeatureSME : ExtensionWithMArch<"sme", "SME", "FEAT_SME",
4100fca6ea1SDimitry Andric  "Enable Scalable Matrix Extension (SME)", [FeatureBF16, FeatureUseScalarIncVL]>;
4110fca6ea1SDimitry Andric
4120fca6ea1SDimitry Andricdef FeatureSMEF64F64 : ExtensionWithMArch<"sme-f64f64", "SMEF64F64", "FEAT_SME_F64F64",
4130fca6ea1SDimitry Andric  "Enable Scalable Matrix Extension (SME) F64F64 instructions", [FeatureSME]>;
4140fca6ea1SDimitry Andric
4150fca6ea1SDimitry Andricdef FeatureSMEI16I64 : ExtensionWithMArch<"sme-i16i64", "SMEI16I64", "FEAT_SME_I16I64",
4160fca6ea1SDimitry Andric  "Enable Scalable Matrix Extension (SME) I16I64 instructions", [FeatureSME]>;
4170fca6ea1SDimitry Andric
4180fca6ea1SDimitry Andricdef FeatureSMEFA64 : ExtensionWithMArch<"sme-fa64", "SMEFA64", "FEAT_SME_FA64",
4190fca6ea1SDimitry Andric  "Enable the full A64 instruction set in streaming SVE mode", [FeatureSME, FeatureSVE2]>;
4200fca6ea1SDimitry Andric
4210fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
4220fca6ea1SDimitry Andric//  Armv9.3 Architecture Extensions
4230fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
4240fca6ea1SDimitry Andric
4250fca6ea1SDimitry Andricdef FeatureSME2 : ExtensionWithMArch<"sme2", "SME2", "FEAT_SME2",
4260fca6ea1SDimitry Andric  "Enable Scalable Matrix Extension 2 (SME2) instructions", [FeatureSME]>;
4270fca6ea1SDimitry Andric
4280fca6ea1SDimitry Andricdef FeatureMEC : Extension<"mec", "MEC", "FEAT_MEC",
4290fca6ea1SDimitry Andric  "Enable Memory Encryption Contexts Extension", [FeatureRME]>;
4300fca6ea1SDimitry Andric
4310fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
4320fca6ea1SDimitry Andric//  Armv9.4 Architecture Extensions
4330fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
4340fca6ea1SDimitry Andric
4350fca6ea1SDimitry Andricdef FeatureSVE2p1: ExtensionWithMArch<"sve2p1", "SVE2p1", "FEAT_SVE2p1",
4360fca6ea1SDimitry Andric  "Enable Scalable Vector Extension 2.1 instructions", [FeatureSVE2]>;
4370fca6ea1SDimitry Andric
4380fca6ea1SDimitry Andricdef FeatureB16B16 : ExtensionWithMArch<"b16b16", "B16B16", "FEAT_SVE_B16B16",
4390fca6ea1SDimitry Andric  "Enable SVE2.1 or SME2.1 non-widening BFloat16 to BFloat16 instructions", [FeatureBF16]>;
4400fca6ea1SDimitry Andric
441*62987288SDimitry Andric// FeatureSVEB16B16 and FeatureSMEB16B16 act as aliases for {FeatureB16B16}, and
442*62987288SDimitry Andric// {FeatureB16B16, FeatureSME2} respectively. This allows LLVM-20 interfacing programs
443*62987288SDimitry Andric// that use '+sve-b16b16' and '+sme-b16b16' to compile in LLVM-19.
444*62987288SDimitry Andricdef FeatureSVEB16B16 : ExtensionWithMArch<"sve-b16b16", "SVEB16B16", "FEAT_SVE_B16B16",
445*62987288SDimitry Andric  "Enable SVE2 non-widening and SME2 Z-targeting non-widening BFloat16 instructions", [FeatureB16B16]>;
446*62987288SDimitry Andric
447*62987288SDimitry Andricdef FeatureSMEB16B16 : ExtensionWithMArch<"sme-b16b16", "SMEB16B16", "FEAT_SME_B16B16",
448*62987288SDimitry Andric  "Enable SME2.1 ZA-targeting non-widening BFloat16 instructions", [FeatureSME2, FeatureB16B16]>;
449*62987288SDimitry Andric
4500fca6ea1SDimitry Andricdef FeatureSMEF16F16 : ExtensionWithMArch<"sme-f16f16", "SMEF16F16", "FEAT_SME_F16F16",
4510fca6ea1SDimitry Andric  "Enable SME non-widening Float16 instructions", [FeatureSME2]>;
4520fca6ea1SDimitry Andric
4530fca6ea1SDimitry Andricdef FeatureSME2p1 : ExtensionWithMArch<"sme2p1", "SME2p1", "FEAT_SME2p1",
4540fca6ea1SDimitry Andric  "Enable Scalable Matrix Extension 2.1 instructions", [FeatureSME2]>;
4550fca6ea1SDimitry Andric
4560fca6ea1SDimitry Andricdef FeatureCHK : Extension<"chk", "CHK", "FEAT_CHK",
4570fca6ea1SDimitry Andric  "Enable Armv8.0-A Check Feature Status Extension">;
4580fca6ea1SDimitry Andric
4590fca6ea1SDimitry Andricdef FeatureGCS : ExtensionWithMArch<"gcs", "GCS", "FEAT_GCS",
4600fca6ea1SDimitry Andric  "Enable Armv9.4-A Guarded Call Stack Extension", [FeatureCHK]>;
4610fca6ea1SDimitry Andric
4620fca6ea1SDimitry Andricdef FeatureITE : ExtensionWithMArch<"ite", "ITE", "FEAT_ITE",
4630fca6ea1SDimitry Andric  "Enable Armv9.4-A Instrumentation Extension", [FeatureETE, FeatureTRBE]>;
4640fca6ea1SDimitry Andric
4650fca6ea1SDimitry Andricdef FeatureLSE128 : ExtensionWithMArch<"lse128", "LSE128", "FEAT_LSE128",
4660fca6ea1SDimitry Andric  "Enable Armv9.4-A 128-bit Atomic instructions",
4670fca6ea1SDimitry Andric  [FeatureLSE]>;
4680fca6ea1SDimitry Andric
4690fca6ea1SDimitry Andric// FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, and FEAT_SYSINSTR128 are mutually implicit.
4700fca6ea1SDimitry Andric// Therefore group them all under a single feature flag, d128:
4710fca6ea1SDimitry Andricdef FeatureD128 : ExtensionWithMArch<"d128", "D128",
4720fca6ea1SDimitry Andric  "FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, FEAT_SYSINSTR128",
4730fca6ea1SDimitry Andric  "Enable Armv9.4-A 128-bit Page Table Descriptors, System Registers "
4740fca6ea1SDimitry Andric  "and instructions",
4750fca6ea1SDimitry Andric  [FeatureLSE128]>;
4760fca6ea1SDimitry Andric
4770fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
4780fca6ea1SDimitry Andric//  Armv9.5 Architecture Extensions
4790fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
4800fca6ea1SDimitry Andric
4810fca6ea1SDimitry Andricdef FeatureFAMINMAX: ExtensionWithMArch<"faminmax", "FAMINMAX", "FEAT_FAMINMAX",
4820fca6ea1SDimitry Andric "Enable FAMIN and FAMAX instructions">;
4830fca6ea1SDimitry Andric
4840fca6ea1SDimitry Andricdef FeatureLUT: ExtensionWithMArch<"lut", "LUT", "FEAT_LUT",
4850fca6ea1SDimitry Andric "Enable Lookup Table instructions">;
4860fca6ea1SDimitry Andric
4870fca6ea1SDimitry Andricdef FeatureFP8 : ExtensionWithMArch<"fp8", "FP8", "FEAT_FP8",
4880fca6ea1SDimitry Andric  "Enable FP8 instructions", [FeatureFAMINMAX, FeatureLUT, FeatureBF16]>;
4890fca6ea1SDimitry Andric
4900fca6ea1SDimitry Andricdef FeatureFP8FMA : ExtensionWithMArch<"fp8fma", "FP8FMA", "FEAT_FP8FMA",
4910fca6ea1SDimitry Andric  "Enable Armv9.5-A FP8 multiply-add instructions", [FeatureFP8]>;
4920fca6ea1SDimitry Andric
4930fca6ea1SDimitry Andricdef FeatureSSVE_FP8FMA : ExtensionWithMArch<"ssve-fp8fma", "SSVE_FP8FMA", "FEAT_SSVE_FP8FMA",
4940fca6ea1SDimitry Andric  "Enable SVE2 FP8 multiply-add instructions", [FeatureSME2, FeatureFP8]>;
4950fca6ea1SDimitry Andric
4960fca6ea1SDimitry Andricdef FeatureFP8DOT4: ExtensionWithMArch<"fp8dot4", "FP8DOT4", "FEAT_FP8DOT4",
4970fca6ea1SDimitry Andric  "Enable FP8 4-way dot instructions", [FeatureFP8FMA]>;
4980fca6ea1SDimitry Andric
4990fca6ea1SDimitry Andricdef FeatureFP8DOT2: ExtensionWithMArch<"fp8dot2", "FP8DOT2", "FEAT_FP8DOT2",
5000fca6ea1SDimitry Andric  "Enable FP8 2-way dot instructions", [FeatureFP8DOT4]>;
5010fca6ea1SDimitry Andric
5020fca6ea1SDimitry Andricdef FeatureSSVE_FP8DOT4 : ExtensionWithMArch<"ssve-fp8dot4", "SSVE_FP8DOT4", "FEAT_SSVE_FP8DOT4",
5030fca6ea1SDimitry Andric  "Enable SVE2 FP8 4-way dot product instructions", [FeatureSSVE_FP8FMA]>;
5040fca6ea1SDimitry Andric
5050fca6ea1SDimitry Andricdef FeatureSSVE_FP8DOT2 : ExtensionWithMArch<"ssve-fp8dot2", "SSVE_FP8DOT2", "FEAT_SSVE_FP8DOT2",
5060fca6ea1SDimitry Andric  "Enable SVE2 FP8 2-way dot product instructions", [FeatureSSVE_FP8DOT4]>;
5070fca6ea1SDimitry Andric
5080fca6ea1SDimitry Andricdef FeatureSME_LUTv2 : ExtensionWithMArch<"sme-lutv2", "SME_LUTv2", "FEAT_SME_LUTv2",
5090fca6ea1SDimitry Andric  "Enable Scalable Matrix Extension (SME) LUTv2 instructions">;
5100fca6ea1SDimitry Andric
5110fca6ea1SDimitry Andricdef FeatureSMEF8F32 : ExtensionWithMArch<"sme-f8f32", "SMEF8F32", "FEAT_SME_F8F32",
5120fca6ea1SDimitry Andric  "Enable Scalable Matrix Extension (SME) F8F32 instructions", [FeatureSME2, FeatureFP8]>;
5130fca6ea1SDimitry Andric
5140fca6ea1SDimitry Andricdef FeatureSMEF8F16 : ExtensionWithMArch<"sme-f8f16", "SMEF8F16", "FEAT_SME_F8F16",
5150fca6ea1SDimitry Andric  "Enable Scalable Matrix Extension (SME) F8F16 instructions", [FeatureSMEF8F32]>;
5160fca6ea1SDimitry Andric
5170fca6ea1SDimitry Andricdef FeatureCPA : ExtensionWithMArch<"cpa", "CPA", "FEAT_CPA",
5180fca6ea1SDimitry Andric  "Enable Armv9.5-A Checked Pointer Arithmetic">;
5190fca6ea1SDimitry Andric
5200fca6ea1SDimitry Andricdef FeaturePAuthLR : ExtensionWithMArch<"pauth-lr", "PAuthLR", "FEAT_PAuth_LR",
5210fca6ea1SDimitry Andric  "Enable Armv9.5-A PAC enhancements">;
5220fca6ea1SDimitry Andric
5230fca6ea1SDimitry Andricdef FeatureTLBIW : ExtensionWithMArch<"tlbiw", "TLBIW", "FEAT_TLBIW",
5240fca6ea1SDimitry Andric  "Enable Armv9.5-A TLBI VMALL for Dirty State">;
5250fca6ea1SDimitry Andric
5260fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
5270fca6ea1SDimitry Andric//  Other Features
5280fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
5290fca6ea1SDimitry Andric
5300fca6ea1SDimitry Andricdef FeatureOutlineAtomics : SubtargetFeature<"outline-atomics", "OutlineAtomics", "true",
5310fca6ea1SDimitry Andric  "Enable out of line atomics to support LSE instructions">;
5320fca6ea1SDimitry Andric
5330fca6ea1SDimitry Andricdef FeatureFMV : SubtargetFeature<"fmv", "HasFMV", "true",
5340fca6ea1SDimitry Andric  "Enable Function Multi Versioning support.">;
5350fca6ea1SDimitry Andric
5360fca6ea1SDimitry Andric// This flag is currently still labeled as Experimental, but when fully
5370fca6ea1SDimitry Andric// implemented this should tell the compiler to use the zeroing pseudos to
5380fca6ea1SDimitry Andric// benefit from the reverse instructions (e.g. SUB vs SUBR) if the inactive
5390fca6ea1SDimitry Andric// lanes are known to be zero. The pseudos will then be expanded using the
5400fca6ea1SDimitry Andric// MOVPRFX instruction to zero the inactive lanes. This feature should only be
5410fca6ea1SDimitry Andric// enabled if MOVPRFX instructions are known to merge with the destructive
5420fca6ea1SDimitry Andric// operations they prefix.
5430fca6ea1SDimitry Andric//
5440fca6ea1SDimitry Andric// This feature could similarly be extended to support cheap merging of _any_
5450fca6ea1SDimitry Andric// value into the inactive lanes using the MOVPRFX instruction that uses
5460fca6ea1SDimitry Andric// merging-predication.
5470fca6ea1SDimitry Andricdef FeatureExperimentalZeroingPseudos
5480fca6ea1SDimitry Andric    : SubtargetFeature<"use-experimental-zeroing-pseudos",
5490fca6ea1SDimitry Andric                       "UseExperimentalZeroingPseudos", "true",
5500fca6ea1SDimitry Andric                       "Hint to the compiler that the MOVPRFX instruction is "
5510fca6ea1SDimitry Andric                       "merged with destructive operations",
5520fca6ea1SDimitry Andric                       []>;
5530fca6ea1SDimitry Andric
5540fca6ea1SDimitry Andricdef FeatureNoSVEFPLD1R : SubtargetFeature<"no-sve-fp-ld1r",
5550fca6ea1SDimitry Andric  "NoSVEFPLD1R", "true", "Avoid using LD1RX instructions for FP">;
5560fca6ea1SDimitry Andric
5570fca6ea1SDimitry Andricdef FeatureZCRegMove : SubtargetFeature<"zcm", "HasZeroCycleRegMove", "true",
5580fca6ea1SDimitry Andric                                        "Has zero-cycle register moves">;
5590fca6ea1SDimitry Andric
5600fca6ea1SDimitry Andricdef FeatureZCZeroingGP : SubtargetFeature<"zcz-gp", "HasZeroCycleZeroingGP", "true",
5610fca6ea1SDimitry Andric                                        "Has zero-cycle zeroing instructions for generic registers">;
5620fca6ea1SDimitry Andric
5630fca6ea1SDimitry Andric// It is generally beneficial to rewrite "fmov s0, wzr" to "movi d0, #0".
5640fca6ea1SDimitry Andric// as movi is more efficient across all cores. Newer cores can eliminate
5650fca6ea1SDimitry Andric// fmovs early and there is no difference with movi, but this not true for
5660fca6ea1SDimitry Andric// all implementations.
5670fca6ea1SDimitry Andricdef FeatureNoZCZeroingFP : SubtargetFeature<"no-zcz-fp", "HasZeroCycleZeroingFP", "false",
5680fca6ea1SDimitry Andric                                        "Has no zero-cycle zeroing instructions for FP registers">;
5690fca6ea1SDimitry Andric
5700fca6ea1SDimitry Andricdef FeatureZCZeroing : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
5710fca6ea1SDimitry Andric                                        "Has zero-cycle zeroing instructions",
5720fca6ea1SDimitry Andric                                        [FeatureZCZeroingGP]>;
5730fca6ea1SDimitry Andric
5740fca6ea1SDimitry Andric/// ... but the floating-point version doesn't quite work in rare cases on older
5750fca6ea1SDimitry Andric/// CPUs.
5760fca6ea1SDimitry Andricdef FeatureZCZeroingFPWorkaround : SubtargetFeature<"zcz-fp-workaround",
5770fca6ea1SDimitry Andric    "HasZeroCycleZeroingFPWorkaround", "true",
5780fca6ea1SDimitry Andric    "The zero-cycle floating-point zeroing instruction has a bug">;
5790fca6ea1SDimitry Andric
5800fca6ea1SDimitry Andricdef FeatureStrictAlign : SubtargetFeature<"strict-align",
5810fca6ea1SDimitry Andric                                          "RequiresStrictAlign", "true",
5820fca6ea1SDimitry Andric                                          "Disallow all unaligned memory "
5830fca6ea1SDimitry Andric                                          "access">;
5840fca6ea1SDimitry Andric
5850fca6ea1SDimitry Andricforeach i = {1-7,9-15,18,20-28} in
5860fca6ea1SDimitry Andric    def FeatureReserveX#i : SubtargetFeature<"reserve-x"#i, "ReserveXRegister["#i#"]", "true",
5870fca6ea1SDimitry Andric                                             "Reserve X"#i#", making it unavailable "
5880fca6ea1SDimitry Andric                                             "as a GPR">;
5890fca6ea1SDimitry Andric
5900fca6ea1SDimitry Andricdef FeatureReserveLRForRA : SubtargetFeature<"reserve-lr-for-ra",
5910fca6ea1SDimitry Andric                                             "ReserveLRForRA", "true",
5920fca6ea1SDimitry Andric                                             "Reserve LR for call use only">;
5930fca6ea1SDimitry Andric
5940fca6ea1SDimitry Andricforeach i = {8-15,18} in
5950fca6ea1SDimitry Andric    def FeatureCallSavedX#i : SubtargetFeature<"call-saved-x"#i,
5960fca6ea1SDimitry Andric         "CustomCallSavedXRegs["#i#"]", "true", "Make X"#i#" callee saved.">;
5970fca6ea1SDimitry Andric
5980fca6ea1SDimitry Andricdef FeatureBalanceFPOps : SubtargetFeature<"balance-fp-ops", "BalanceFPOps",
5990fca6ea1SDimitry Andric    "true",
6000fca6ea1SDimitry Andric    "balance mix of odd and even D-registers for fp multiply(-accumulate) ops">;
6010fca6ea1SDimitry Andric
6020fca6ea1SDimitry Andricdef FeaturePredictableSelectIsExpensive : SubtargetFeature<
6030fca6ea1SDimitry Andric    "predictable-select-expensive", "PredictableSelectIsExpensive", "true",
6040fca6ea1SDimitry Andric    "Prefer likely predicted branches over selects">;
6050fca6ea1SDimitry Andric
6060fca6ea1SDimitry Andricdef FeatureEnableSelectOptimize : SubtargetFeature<
6070fca6ea1SDimitry Andric    "enable-select-opt", "EnableSelectOptimize", "true",
6080fca6ea1SDimitry Andric    "Enable the select optimize pass for select loop heuristics">;
6090fca6ea1SDimitry Andric
6100fca6ea1SDimitry Andricdef FeatureExynosCheapAsMoveHandling : SubtargetFeature<"exynos-cheap-as-move",
6110fca6ea1SDimitry Andric    "HasExynosCheapAsMoveHandling", "true",
6120fca6ea1SDimitry Andric    "Use Exynos specific handling of cheap instructions">;
6130fca6ea1SDimitry Andric
6140fca6ea1SDimitry Andricdef FeaturePostRAScheduler : SubtargetFeature<"use-postra-scheduler",
6150fca6ea1SDimitry Andric    "UsePostRAScheduler", "true", "Schedule again after register allocation">;
6160fca6ea1SDimitry Andric
6170fca6ea1SDimitry Andricdef FeatureSlowMisaligned128Store : SubtargetFeature<"slow-misaligned-128store",
6180fca6ea1SDimitry Andric    "IsMisaligned128StoreSlow", "true", "Misaligned 128 bit stores are slow">;
6190fca6ea1SDimitry Andric
6200fca6ea1SDimitry Andricdef FeatureSlowPaired128 : SubtargetFeature<"slow-paired-128",
6210fca6ea1SDimitry Andric    "IsPaired128Slow", "true", "Paired 128 bit loads and stores are slow">;
6220fca6ea1SDimitry Andric
6230fca6ea1SDimitry Andricdef FeatureAscendStoreAddress : SubtargetFeature<"ascend-store-address",
6240fca6ea1SDimitry Andric    "IsStoreAddressAscend", "true",
6250fca6ea1SDimitry Andric    "Schedule vector stores by ascending address">;
6260fca6ea1SDimitry Andric
6270fca6ea1SDimitry Andricdef FeatureSlowSTRQro : SubtargetFeature<"slow-strqro-store", "IsSTRQroSlow",
6280fca6ea1SDimitry Andric    "true", "STR of Q register with register offset is slow">;
6290fca6ea1SDimitry Andric
6300fca6ea1SDimitry Andricdef FeatureAlternateSExtLoadCVTF32Pattern : SubtargetFeature<
6310fca6ea1SDimitry Andric    "alternate-sextload-cvt-f32-pattern", "UseAlternateSExtLoadCVTF32Pattern",
6320fca6ea1SDimitry Andric    "true", "Use alternative pattern for sextload convert to f32">;
6330fca6ea1SDimitry Andric
6340fca6ea1SDimitry Andricdef FeatureArithmeticBccFusion : SubtargetFeature<
6350fca6ea1SDimitry Andric    "arith-bcc-fusion", "HasArithmeticBccFusion", "true",
6360fca6ea1SDimitry Andric    "CPU fuses arithmetic+bcc operations">;
6370fca6ea1SDimitry Andric
6380fca6ea1SDimitry Andricdef FeatureArithmeticCbzFusion : SubtargetFeature<
6390fca6ea1SDimitry Andric    "arith-cbz-fusion", "HasArithmeticCbzFusion", "true",
6400fca6ea1SDimitry Andric    "CPU fuses arithmetic + cbz/cbnz operations">;
6410fca6ea1SDimitry Andric
6420fca6ea1SDimitry Andricdef FeatureCmpBccFusion : SubtargetFeature<
6430fca6ea1SDimitry Andric    "cmp-bcc-fusion", "HasCmpBccFusion", "true",
6440fca6ea1SDimitry Andric    "CPU fuses cmp+bcc operations">;
6450fca6ea1SDimitry Andric
6460fca6ea1SDimitry Andricdef FeatureFuseAddress : SubtargetFeature<
6470fca6ea1SDimitry Andric    "fuse-address", "HasFuseAddress", "true",
6480fca6ea1SDimitry Andric    "CPU fuses address generation and memory operations">;
6490fca6ea1SDimitry Andric
6500fca6ea1SDimitry Andricdef FeatureFuseAES : SubtargetFeature<
6510fca6ea1SDimitry Andric    "fuse-aes", "HasFuseAES", "true",
6520fca6ea1SDimitry Andric    "CPU fuses AES crypto operations">;
6530fca6ea1SDimitry Andric
6540fca6ea1SDimitry Andricdef FeatureFuseArithmeticLogic : SubtargetFeature<
6550fca6ea1SDimitry Andric    "fuse-arith-logic", "HasFuseArithmeticLogic", "true",
6560fca6ea1SDimitry Andric    "CPU fuses arithmetic and logic operations">;
6570fca6ea1SDimitry Andric
6580fca6ea1SDimitry Andricdef FeatureFuseCCSelect : SubtargetFeature<
6590fca6ea1SDimitry Andric    "fuse-csel", "HasFuseCCSelect", "true",
6600fca6ea1SDimitry Andric    "CPU fuses conditional select operations">;
6610fca6ea1SDimitry Andric
6620fca6ea1SDimitry Andricdef FeatureFuseCryptoEOR : SubtargetFeature<
6630fca6ea1SDimitry Andric    "fuse-crypto-eor", "HasFuseCryptoEOR", "true",
6640fca6ea1SDimitry Andric    "CPU fuses AES/PMULL and EOR operations">;
6650fca6ea1SDimitry Andric
6660fca6ea1SDimitry Andricdef FeatureFuseAdrpAdd : SubtargetFeature<
6670fca6ea1SDimitry Andric    "fuse-adrp-add", "HasFuseAdrpAdd", "true",
6680fca6ea1SDimitry Andric    "CPU fuses adrp+add operations">;
6690fca6ea1SDimitry Andric
6700fca6ea1SDimitry Andricdef FeatureFuseLiterals : SubtargetFeature<
6710fca6ea1SDimitry Andric    "fuse-literals", "HasFuseLiterals", "true",
6720fca6ea1SDimitry Andric    "CPU fuses literal generation operations">;
6730fca6ea1SDimitry Andric
6740fca6ea1SDimitry Andricdef FeatureFuseAddSub2RegAndConstOne : SubtargetFeature<
6750fca6ea1SDimitry Andric   "fuse-addsub-2reg-const1", "HasFuseAddSub2RegAndConstOne", "true",
6760fca6ea1SDimitry Andric   "CPU fuses (a + b + 1) and (a - b - 1)">;
6770fca6ea1SDimitry Andric
6780fca6ea1SDimitry Andricdef FeatureDisableLatencySchedHeuristic : SubtargetFeature<
6790fca6ea1SDimitry Andric    "disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
6800fca6ea1SDimitry Andric    "Disable latency scheduling heuristic">;
6810fca6ea1SDimitry Andric
6820fca6ea1SDimitry Andricdef FeatureStorePairSuppress : SubtargetFeature<
6830fca6ea1SDimitry Andric    "store-pair-suppress", "EnableStorePairSuppress", "true",
6840fca6ea1SDimitry Andric    "Enable Store Pair Suppression heuristics">;
6850fca6ea1SDimitry Andric
6860fca6ea1SDimitry Andricdef FeatureForce32BitJumpTables
6870fca6ea1SDimitry Andric   : SubtargetFeature<"force-32bit-jump-tables", "Force32BitJumpTables", "true",
6880fca6ea1SDimitry Andric                      "Force jump table entries to be 32-bits wide except at MinSize">;
6890fca6ea1SDimitry Andric
6900fca6ea1SDimitry Andricdef FeatureUseRSqrt : SubtargetFeature<
6910fca6ea1SDimitry Andric    "use-reciprocal-square-root", "UseRSqrt", "true",
6920fca6ea1SDimitry Andric    "Use the reciprocal square root approximation">;
6930fca6ea1SDimitry Andric
6940fca6ea1SDimitry Andricdef FeatureNoNegativeImmediates : SubtargetFeature<"no-neg-immediates",
6950fca6ea1SDimitry Andric                                        "NegativeImmediates", "false",
6960fca6ea1SDimitry Andric                                        "Convert immediates and instructions "
6970fca6ea1SDimitry Andric                                        "to their negated or complemented "
6980fca6ea1SDimitry Andric                                        "equivalent when the immediate does "
6990fca6ea1SDimitry Andric                                        "not fit in the encoding.">;
7000fca6ea1SDimitry Andric
7010fca6ea1SDimitry Andric// Address operands with shift amount 2 or 3 are fast on all Arm chips except
7020fca6ea1SDimitry Andric// some old Apple cores (A7-A10?) which handle all shifts slowly. Cortex-A57
7030fca6ea1SDimitry Andric// and derived designs through Cortex-X1 take an extra micro-op for shifts
7040fca6ea1SDimitry Andric// of 1 or 4. Other Arm chips handle all shifted operands at the same speed
7050fca6ea1SDimitry Andric// as unshifted operands.
7060fca6ea1SDimitry Andric//
7070fca6ea1SDimitry Andric// We don't try to model the behavior of the old Apple cores because new code
7080fca6ea1SDimitry Andric// targeting A7 is very unlikely to actually run on an A7. The Cortex cores
7090fca6ea1SDimitry Andric// are modeled by FeatureAddrLSLSlow14.
7100fca6ea1SDimitry Andricdef FeatureAddrLSLSlow14 : SubtargetFeature<
7110fca6ea1SDimitry Andric    "addr-lsl-slow-14", "HasAddrLSLSlow14", "true",
7120fca6ea1SDimitry Andric    "Address operands with shift amount of 1 or 4 are slow">;
7130fca6ea1SDimitry Andric
7140fca6ea1SDimitry Andricdef FeatureALULSLFast : SubtargetFeature<
7150fca6ea1SDimitry Andric    "alu-lsl-fast", "HasALULSLFast", "true",
7160fca6ea1SDimitry Andric    "Add/Sub operations with lsl shift <= 4 are cheap">;
7170fca6ea1SDimitry Andric
7180fca6ea1SDimitry Andricdef FeatureAggressiveFMA :
7190fca6ea1SDimitry Andric  SubtargetFeature<"aggressive-fma",
7200fca6ea1SDimitry Andric                   "HasAggressiveFMA",
7210fca6ea1SDimitry Andric                   "true",
7220fca6ea1SDimitry Andric                   "Enable Aggressive FMA for floating-point.">;
7230fca6ea1SDimitry Andric
7240fca6ea1SDimitry Andricdef FeatureTaggedGlobals : SubtargetFeature<"tagged-globals",
7250fca6ea1SDimitry Andric    "AllowTaggedGlobals",
7260fca6ea1SDimitry Andric    "true", "Use an instruction sequence for taking the address of a global "
7270fca6ea1SDimitry Andric    "that allows a memory tag in the upper address bits">;
7280fca6ea1SDimitry Andric
7290fca6ea1SDimitry Andricdef FeatureAppleA7SysReg  : SubtargetFeature<"apple-a7-sysreg", "HasAppleA7SysReg", "true",
7300fca6ea1SDimitry Andric  "Apple A7 (the CPU formerly known as Cyclone)">;
7310fca6ea1SDimitry Andric
7320fca6ea1SDimitry Andricdef FeatureEL2VMSA : SubtargetFeature<"el2vmsa", "HasEL2VMSA", "true",
7330fca6ea1SDimitry Andric  "Enable Exception Level 2 Virtual Memory System Architecture">;
7340fca6ea1SDimitry Andric
7350fca6ea1SDimitry Andricdef FeatureEL3 : SubtargetFeature<"el3", "HasEL3", "true",
7360fca6ea1SDimitry Andric  "Enable Exception Level 3">;
7370fca6ea1SDimitry Andric
7380fca6ea1SDimitry Andricdef FeatureFixCortexA53_835769 : SubtargetFeature<"fix-cortex-a53-835769",
7390fca6ea1SDimitry Andric  "FixCortexA53_835769", "true", "Mitigate Cortex-A53 Erratum 835769">;
7400fca6ea1SDimitry Andric
7410fca6ea1SDimitry Andricdef FeatureNoBTIAtReturnTwice : SubtargetFeature<"no-bti-at-return-twice",
7420fca6ea1SDimitry Andric                                                 "NoBTIAtReturnTwice", "true",
7430fca6ea1SDimitry Andric                                                 "Don't place a BTI instruction "
7440fca6ea1SDimitry Andric                                                 "after a return-twice">;
7450fca6ea1SDimitry Andric
7460fca6ea1SDimitry Andricdef FeatureDisableLdp : SubtargetFeature<"disable-ldp", "HasDisableLdp",
7470fca6ea1SDimitry Andric    "true", "Do not emit ldp">;
7480fca6ea1SDimitry Andric
7490fca6ea1SDimitry Andricdef FeatureDisableStp : SubtargetFeature<"disable-stp", "HasDisableStp",
7500fca6ea1SDimitry Andric    "true", "Do not emit stp">;
7510fca6ea1SDimitry Andric
7520fca6ea1SDimitry Andricdef FeatureLdpAlignedOnly : SubtargetFeature<"ldp-aligned-only", "HasLdpAlignedOnly",
7530fca6ea1SDimitry Andric    "true", "In order to emit ldp, first check if the load will be aligned to 2 * element_size">;
7540fca6ea1SDimitry Andric
7550fca6ea1SDimitry Andricdef FeatureStpAlignedOnly : SubtargetFeature<"stp-aligned-only", "HasStpAlignedOnly",
7560fca6ea1SDimitry Andric    "true", "In order to emit stp, first check if the store will be aligned to 2 * element_size">;
7570fca6ea1SDimitry Andric
7580fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
7590fca6ea1SDimitry Andric// Architectures.
7600fca6ea1SDimitry Andric//
7610fca6ea1SDimitry Andricclass Architecture64<
7620fca6ea1SDimitry Andric  int major, int minor, string profile,
7630fca6ea1SDimitry Andric  string target_feature_name,
7640fca6ea1SDimitry Andric  list<SubtargetFeature> implied_features,
7650fca6ea1SDimitry Andric  list<Extension> default_extensions
7660fca6ea1SDimitry Andric> : SubtargetFeature<target_feature_name,
7670fca6ea1SDimitry Andric    "HasV" # major # "_" # minor # profile # "Ops", "true",
7680fca6ea1SDimitry Andric    "Support ARM " # target_feature_name # " architecture",
7690fca6ea1SDimitry Andric    implied_features
7700fca6ea1SDimitry Andric> {
7710fca6ea1SDimitry Andric  int Major = major;
7720fca6ea1SDimitry Andric  int Minor = minor;
7730fca6ea1SDimitry Andric  string Profile = profile;
7740fca6ea1SDimitry Andric
7750fca6ea1SDimitry Andric  // Extensions enabled by default. Not the same as implied SubtargetFeatures.
7760fca6ea1SDimitry Andric  list<Extension> DefaultExts = default_extensions;
7770fca6ea1SDimitry Andric}
7780fca6ea1SDimitry Andric
7790fca6ea1SDimitry Andricdef HasV8_0aOps : Architecture64<8, 0, "a", "v8a",
7800fca6ea1SDimitry Andric  [FeatureEL2VMSA, FeatureEL3],
7810fca6ea1SDimitry Andric  [FeatureFPARMv8, FeatureNEON]>;
7820fca6ea1SDimitry Andricdef HasV8_1aOps : Architecture64<8, 1, "a", "v8.1a",
7830fca6ea1SDimitry Andric  [HasV8_0aOps, FeatureCRC, FeatureLSE, FeatureRDM, FeaturePAN, FeatureLOR,
7840fca6ea1SDimitry Andric   FeatureVH],
7850fca6ea1SDimitry Andric  !listconcat(HasV8_0aOps.DefaultExts, [FeatureCRC, FeatureLSE, FeatureRDM])>;
7860fca6ea1SDimitry Andricdef HasV8_2aOps : Architecture64<8, 2, "a", "v8.2a",
7870fca6ea1SDimitry Andric  [HasV8_1aOps, FeaturePsUAO, FeaturePAN_RWV, FeatureRAS, FeatureCCPP],
7880fca6ea1SDimitry Andric  !listconcat(HasV8_1aOps.DefaultExts, [FeatureRAS])>;
7890fca6ea1SDimitry Andricdef HasV8_3aOps : Architecture64<8, 3, "a", "v8.3a",
790*62987288SDimitry Andric  [HasV8_2aOps, FeatureRCPC, FeaturePAuth, FeatureJS, FeatureComplxNum],
7910fca6ea1SDimitry Andric  !listconcat(HasV8_2aOps.DefaultExts, [FeatureComplxNum, FeatureJS,
792*62987288SDimitry Andric    FeaturePAuth, FeatureRCPC,  FeatureCCIDX])>;
7930fca6ea1SDimitry Andricdef HasV8_4aOps : Architecture64<8, 4, "a", "v8.4a",
7940fca6ea1SDimitry Andric  [HasV8_3aOps, FeatureDotProd, FeatureNV, FeatureMPAM, FeatureDIT,
7950fca6ea1SDimitry Andric    FeatureTRACEV8_4, FeatureAM, FeatureSEL2, FeatureTLB_RMI, FeatureFlagM,
7960fca6ea1SDimitry Andric    FeatureRCPC_IMMO, FeatureLSE2],
797*62987288SDimitry Andric  !listconcat(HasV8_3aOps.DefaultExts, [FeatureDotProd, FeatureDIT, FeatureFlagM])>;
7980fca6ea1SDimitry Andricdef HasV8_5aOps : Architecture64<8, 5, "a", "v8.5a",
7990fca6ea1SDimitry Andric  [HasV8_4aOps, FeatureAltFPCmp, FeatureFRInt3264, FeatureSpecRestrict,
800*62987288SDimitry Andric    FeatureSB, FeaturePredRes, FeatureCacheDeepPersist,
8010fca6ea1SDimitry Andric    FeatureBranchTargetId],
802*62987288SDimitry Andric  !listconcat(HasV8_4aOps.DefaultExts, [FeaturePredRes, FeatureSSBS, FeatureBranchTargetId, FeatureSB])>;
8030fca6ea1SDimitry Andricdef HasV8_6aOps : Architecture64<8, 6, "a", "v8.6a",
8040fca6ea1SDimitry Andric  [HasV8_5aOps, FeatureAMVS, FeatureBF16, FeatureFineGrainedTraps,
8050fca6ea1SDimitry Andric    FeatureEnhancedCounterVirtualization, FeatureMatMulInt8],
8060fca6ea1SDimitry Andric  !listconcat(HasV8_5aOps.DefaultExts, [FeatureBF16, FeatureMatMulInt8])>;
8070fca6ea1SDimitry Andricdef HasV8_7aOps : Architecture64<8, 7, "a", "v8.7a",
8080fca6ea1SDimitry Andric  [HasV8_6aOps, FeatureXS, FeatureWFxT, FeatureHCX],
809*62987288SDimitry Andric  !listconcat(HasV8_6aOps.DefaultExts, [FeatureWFxT])>;
8100fca6ea1SDimitry Andricdef HasV8_8aOps : Architecture64<8, 8, "a", "v8.8a",
8110fca6ea1SDimitry Andric  [HasV8_7aOps, FeatureHBC, FeatureMOPS, FeatureNMI],
8120fca6ea1SDimitry Andric  !listconcat(HasV8_7aOps.DefaultExts, [FeatureMOPS, FeatureHBC])>;
8130fca6ea1SDimitry Andricdef HasV8_9aOps : Architecture64<8, 9, "a", "v8.9a",
8140fca6ea1SDimitry Andric  [HasV8_8aOps, FeatureCLRBHB, FeaturePRFM_SLC, FeatureSPECRES2,
8150fca6ea1SDimitry Andric   FeatureCSSC, FeatureRASv2, FeatureCHK],
8160fca6ea1SDimitry Andric  !listconcat(HasV8_8aOps.DefaultExts, [FeatureSPECRES2, FeatureCSSC,
8170fca6ea1SDimitry Andric    FeatureRASv2])>;
8180fca6ea1SDimitry Andricdef HasV9_0aOps : Architecture64<9, 0, "a", "v9a",
8190fca6ea1SDimitry Andric  [HasV8_5aOps],
8200fca6ea1SDimitry Andric  !listconcat(HasV8_5aOps.DefaultExts, [FeatureFullFP16, FeatureSVE,
8210fca6ea1SDimitry Andric    FeatureSVE2])>;
8220fca6ea1SDimitry Andricdef HasV9_1aOps : Architecture64<9, 1, "a", "v9.1a",
8230fca6ea1SDimitry Andric  [HasV8_6aOps, HasV9_0aOps],
8240fca6ea1SDimitry Andric  !listconcat(HasV9_0aOps.DefaultExts, [FeatureBF16, FeatureMatMulInt8, FeatureRME])>;
8250fca6ea1SDimitry Andricdef HasV9_2aOps : Architecture64<9, 2, "a", "v9.2a",
8260fca6ea1SDimitry Andric  [HasV8_7aOps, HasV9_1aOps],
827*62987288SDimitry Andric  !listconcat(HasV9_1aOps.DefaultExts, [FeatureMEC, FeatureWFxT])>;
8280fca6ea1SDimitry Andricdef HasV9_3aOps : Architecture64<9, 3, "a", "v9.3a",
8290fca6ea1SDimitry Andric  [HasV8_8aOps, HasV9_2aOps],
8300fca6ea1SDimitry Andric  !listconcat(HasV9_2aOps.DefaultExts, [FeatureMOPS, FeatureHBC])>;
8310fca6ea1SDimitry Andricdef HasV9_4aOps : Architecture64<9, 4, "a", "v9.4a",
8320fca6ea1SDimitry Andric  [HasV8_9aOps, HasV9_3aOps],
8330fca6ea1SDimitry Andric  !listconcat(HasV9_3aOps.DefaultExts, [FeatureSPECRES2, FeatureCSSC,
8340fca6ea1SDimitry Andric    FeatureRASv2])>;
8350fca6ea1SDimitry Andricdef HasV9_5aOps : Architecture64<9, 5, "a", "v9.5a",
8360fca6ea1SDimitry Andric  [HasV9_4aOps, FeatureCPA],
8370fca6ea1SDimitry Andric  !listconcat(HasV9_4aOps.DefaultExts, [FeatureCPA,  FeatureLUT, FeatureFAMINMAX])>;
8380fca6ea1SDimitry Andricdef HasV8_0rOps : Architecture64<8, 0, "r", "v8r",
8390fca6ea1SDimitry Andric  [ //v8.1
8400fca6ea1SDimitry Andric    FeatureCRC, FeaturePAN, FeatureLSE, FeatureCONTEXTIDREL2,
8410fca6ea1SDimitry Andric    //v8.2
8420fca6ea1SDimitry Andric    FeatureRAS, FeaturePsUAO, FeatureCCPP, FeaturePAN_RWV,
8430fca6ea1SDimitry Andric    //v8.3
844*62987288SDimitry Andric    FeaturePAuth, FeatureRCPC,
8450fca6ea1SDimitry Andric    //v8.4
8460fca6ea1SDimitry Andric    FeatureTRACEV8_4, FeatureTLB_RMI, FeatureFlagM, FeatureDIT, FeatureSEL2,
8470fca6ea1SDimitry Andric    FeatureRCPC_IMMO,
8480fca6ea1SDimitry Andric    // Not mandatory in v8.0-R, but included here on the grounds that it
8490fca6ea1SDimitry Andric    // only enables names of system registers
8500fca6ea1SDimitry Andric    FeatureSpecRestrict
8510fca6ea1SDimitry Andric  ],
8520fca6ea1SDimitry Andric  // For v8-R, we do not enable crypto and align with GCC that enables a more
8530fca6ea1SDimitry Andric  // minimal set of optional architecture extensions.
8540fca6ea1SDimitry Andric  !listconcat(
855*62987288SDimitry Andric    !listremove(HasV8_5aOps.DefaultExts, [FeatureBranchTargetId, FeaturePredRes]),
8560fca6ea1SDimitry Andric    [FeatureSSBS, FeatureFullFP16, FeatureFP16FML, FeatureSB]
8570fca6ea1SDimitry Andric  )>;
8580fca6ea1SDimitry Andric
8590fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
8600fca6ea1SDimitry Andric// Access to privileged registers
8610fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
8620fca6ea1SDimitry Andric
8630fca6ea1SDimitry Andricforeach i = 1-3 in
8640fca6ea1SDimitry Andricdef FeatureUseEL#i#ForTP : SubtargetFeature<"tpidr-el"#i, "UseEL"#i#"ForTP",
8650fca6ea1SDimitry Andric  "true", "Permit use of TPIDR_EL"#i#" for the TLS base">;
8660fca6ea1SDimitry Andricdef FeatureUseROEL0ForTP : SubtargetFeature<"tpidrro-el0", "UseROEL0ForTP",
8670fca6ea1SDimitry Andric  "true", "Permit use of TPIDRRO_EL0 for the TLS base">;
8680fca6ea1SDimitry Andric
8690fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
8700fca6ea1SDimitry Andric// Control codegen mitigation against Straight Line Speculation vulnerability.
8710fca6ea1SDimitry Andric//===----------------------------------------------------------------------===//
8720fca6ea1SDimitry Andric
8730fca6ea1SDimitry Andricdef FeatureHardenSlsRetBr : SubtargetFeature<"harden-sls-retbr",
8740fca6ea1SDimitry Andric  "HardenSlsRetBr", "true",
8750fca6ea1SDimitry Andric  "Harden against straight line speculation across RET and BR instructions">;
8760fca6ea1SDimitry Andricdef FeatureHardenSlsBlr : SubtargetFeature<"harden-sls-blr",
8770fca6ea1SDimitry Andric  "HardenSlsBlr", "true",
8780fca6ea1SDimitry Andric  "Harden against straight line speculation across BLR instructions">;
8790fca6ea1SDimitry Andricdef FeatureHardenSlsNoComdat : SubtargetFeature<"harden-sls-nocomdat",
8800fca6ea1SDimitry Andric  "HardenSlsNoComdat", "true",
8810fca6ea1SDimitry Andric  "Generate thunk code for SLS mitigation in the normal text section">;
8820fca6ea1SDimitry Andric
8830fca6ea1SDimitry Andric
8840fca6ea1SDimitry Andric// Only intended to be used by disassemblers.
8850fca6ea1SDimitry Andricdef FeatureAll
8860fca6ea1SDimitry Andric    : SubtargetFeature<"all", "IsAll", "true", "Enable all instructions">;
887