[mlir] More fixes for 9fddaf6b14102963f12dbb9730f101fc52e662c1
[llvm-project.git] / llvm / lib / Target / AArch64 / AArch64Features.td
blob20db70ee38572f2d9644a9a798c1d5967b12f1ba
1 //=- AArch64Features.td - Describe AArch64 SubtargetFeatures -*- tablegen -*-=//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 //
10 //===----------------------------------------------------------------------===//
12 // A SubtargetFeature that represents one or more Architecture Extensions, as
13 // defined by the Arm ARM and typically identified by a 'FEAT_*' name.
14 // Each Extension record defines an ExtensionInfo entry in the Target Parser
15 // with a corresponding 'AEK_*' entry in the ArchExtKind enum.
16 class Extension<
17   string TargetFeatureName,            // String used for -target-feature, unless overridden.
18   string Spelling,                     // The XYZ in HasXYZ and AEK_XYZ.
19   string ArchitectureFeatureName,      // The extension's "FEAT_*"" name(s) defined by the architecture
20   string Desc,                         // Description.
21   list<SubtargetFeature> Implies = []  // List of dependent features.
22 > : SubtargetFeature<TargetFeatureName, "Has" # Spelling, "true", Desc, Implies>
24     string ArchExtKindSpelling = "AEK_" # Spelling; // ArchExtKind enum name.
26     string ArchFeatureName = ArchitectureFeatureName;
28     // The user visible name used by -march/-mcpu modifiers and target attribute
29     // values. Extensions are not available on these by default.
30     string UserVisibleName = "";
32     // An alias that can be used on the command line, if the extension has one.
33     // Used for correcting historical names while remaining backwards compatible.
34     string UserVisibleAlias = "";
37 // An Extension that can be toggled via a '-march'/'-mcpu' modifier or a target
38 // attribute, e.g. '+sm4".
39 class ExtensionWithMArch<
40   string TargetFeatureName,            // String used for -target-feature and -march, unless overridden.
41   string Spelling,                     // The XYZ in HasXYZ and AEK_XYZ.
42   string ArchitectureFeatureName,      // The extension's "FEAT_*"" name(s) defined by the architecture
43   string Desc,                         // Description.
44   list<SubtargetFeature> Implies = []  // List of dependent features.
45 > : Extension<TargetFeatureName, Spelling, ArchitectureFeatureName, Desc, Implies> {
46     // In general, the name written on the command line should match the name
47     // used for -target-feature. However, there are exceptions. Therefore we
48     // add a separate field for this, to allow overriding it. Strongly prefer
49     // not doing so.
50     let UserVisibleName = TargetFeatureName;
55 // Each SubtargetFeature which corresponds to an Arm Architecture feature should
56 // be annotated with the respective FEAT_ feature name from the Architecture
57 // Reference Manual. If a SubtargetFeature enables instructions from multiple
58 // Arm Architecture Features, it should list all the relevant features. Not all
59 // FEAT_ features have a corresponding SubtargetFeature.
62 //===----------------------------------------------------------------------===//
63 //  Armv8.0 Architecture Extensions
64 //===----------------------------------------------------------------------===//
66 let ArchExtKindSpelling = "AEK_FP", UserVisibleName = "fp" in
67 def FeatureFPARMv8 : ExtensionWithMArch<"fp-armv8", "FPARMv8", "FEAT_FP",
68   "Enable Armv8.0-A Floating Point Extensions">;
70 let ArchExtKindSpelling = "AEK_SIMD", UserVisibleName = "simd" in
71 def FeatureNEON : ExtensionWithMArch<"neon", "NEON", "FEAT_AdvSIMD",
72   "Enable Advanced SIMD instructions", [FeatureFPARMv8]>;
74 def FeatureSHA2 : ExtensionWithMArch<"sha2", "SHA2", "FEAT_SHA1, FEAT_SHA256",
75   "Enable SHA1 and SHA256 support", [FeatureNEON]>;
77 def FeatureAES : ExtensionWithMArch<"aes", "AES", "FEAT_AES, FEAT_PMULL",
78   "Enable AES support", [FeatureNEON]>;
80 // Crypto has been split up and any combination is now valid (see the
81 // crypto definitions above). Also, crypto is now context sensitive:
82 // it has a different meaning for e.g. Armv8.4 than it has for Armv8.2.
83 // Therefore, we rely on Clang, the user interfacing tool, to pass on the
84 // appropriate crypto options. But here in the backend, crypto has very little
85 // meaning anymore. We kept the Crypto definition here for backward
86 // compatibility, and now imply features SHA2 and AES, which was the
87 // "traditional" meaning of Crypto.
88 def FeatureCrypto : ExtensionWithMArch<"crypto", "Crypto", "FEAT_Crypto",
89   "Enable cryptographic instructions", [FeatureNEON, FeatureSHA2, FeatureAES]>;
91 def FeatureCRC : ExtensionWithMArch<"crc", "CRC", "FEAT_CRC32",
92   "Enable Armv8.0-A CRC-32 checksum instructions">;
94 // This SubtargetFeature is special. It controls only whether codegen will turn
95 // `llvm.readcyclecounter()` into an access to a PMUv3 System Register. The
96 // `FEAT_PMUv3*` system registers are always available for assembly/disassembly.
97 let UserVisibleName = "pmuv3" in
98 def FeaturePerfMon : ExtensionWithMArch<"perfmon", "PerfMon", "FEAT_PMUv3",
99   "Enable Armv8.0-A PMUv3 Performance Monitors extension">;
101 def FeatureSpecRestrict : Extension<"specrestrict", "SpecRestrict", "FEAT_CSV2_2",
102   "Enable architectural speculation restriction">;
104 //===----------------------------------------------------------------------===//
105 //  Armv8.1 Architecture Extensions
106 //===----------------------------------------------------------------------===//
108 def FeatureLSE : ExtensionWithMArch<"lse", "LSE", "FEAT_LSE",
109   "Enable Armv8.1-A Large System Extension (LSE) atomic instructions">;
111 let UserVisibleAlias = "rdma" in
112 def FeatureRDM : ExtensionWithMArch<"rdm", "RDM", "FEAT_RDM",
113   "Enable Armv8.1-A Rounding Double Multiply Add/Subtract instructions",
114   [FeatureNEON]>;
116 def FeaturePAN : Extension<"pan", "PAN", "FEAT_PAN",
117   "Enable Armv8.1-A Privileged Access-Never extension">;
119 def FeatureLOR : Extension<"lor", "LOR", "FEAT_LOR",
120   "Enable Armv8.1-A Limited Ordering Regions extension">;
122 def FeatureCONTEXTIDREL2 : SubtargetFeature<"CONTEXTIDREL2", "HasCONTEXTIDREL2",
123   "true", "Enable RW operand CONTEXTIDR_EL2">;
125 def FeatureVH : Extension<"vh", "VH", "FEAT_VHE",
126   "Enable Armv8.1-A Virtual Host extension", [FeatureCONTEXTIDREL2]>;
128 //===----------------------------------------------------------------------===//
129 //  Armv8.2 Architecture Extensions
130 //===----------------------------------------------------------------------===//
132 def FeatureSM4 : ExtensionWithMArch<"sm4", "SM4", "FEAT_SM4, FEAT_SM3",
133   "Enable SM3 and SM4 support", [FeatureNEON]>;
135 def FeatureSHA3 : ExtensionWithMArch<"sha3", "SHA3", "FEAT_SHA3, FEAT_SHA512",
136   "Enable SHA512 and SHA3 support", [FeatureNEON, FeatureSHA2]>;
138 def FeatureRAS : ExtensionWithMArch<"ras", "RAS", "FEAT_RAS, FEAT_RASv1p1",
139   "Enable Armv8.0-A Reliability, Availability and Serviceability Extensions">;
141 let ArchExtKindSpelling = "AEK_FP16", UserVisibleName = "fp16" in
142 def FeatureFullFP16 : ExtensionWithMArch<"fullfp16", "FullFP16", "FEAT_FP16",
143   "Enable half-precision floating-point data processing", [FeatureFPARMv8]>;
145 let ArchExtKindSpelling = "AEK_PROFILE", UserVisibleName = "profile" in
146 def FeatureSPE : ExtensionWithMArch<"spe", "SPE", "FEAT_SPE",
147   "Enable Statistical Profiling extension">;
149 def FeaturePAN_RWV : Extension<"pan-rwv", "PAN_RWV", "FEAT_PAN2",
150   "Enable Armv8.2-A PAN s1e1R and s1e1W Variants", [FeaturePAN]>;
152 def FeaturePsUAO : Extension<"uaops", "PsUAO", "FEAT_UAO",
153   "Enable Armv8.2-A UAO PState">;
155 def FeatureCCPP : Extension<"ccpp", "CCPP", "FEAT_DPB",
156   "Enable Armv8.2-A data Cache Clean to Point of Persistence">;
158 def FeatureSVE : ExtensionWithMArch<"sve", "SVE", "FEAT_SVE",
159   "Enable Scalable Vector Extension (SVE) instructions", [FeatureFullFP16]>;
161 let ArchExtKindSpelling = "AEK_I8MM" in
162 def FeatureMatMulInt8 : ExtensionWithMArch<"i8mm", "MatMulInt8", "FEAT_I8MM",
163   "Enable Matrix Multiply Int8 Extension", [FeatureNEON]>;
165 let ArchExtKindSpelling = "AEK_F32MM" in
166 def FeatureMatMulFP32 : ExtensionWithMArch<"f32mm", "MatMulFP32", "FEAT_F32MM",
167   "Enable Matrix Multiply FP32 Extension", [FeatureSVE]>;
169 let ArchExtKindSpelling = "AEK_F64MM" in
170 def FeatureMatMulFP64 : ExtensionWithMArch<"f64mm", "MatMulFP64", "FEAT_F64MM",
171   "Enable Matrix Multiply FP64 Extension", [FeatureSVE]>;
173 //===----------------------------------------------------------------------===//
174 //  Armv8.3 Architecture Extensions
175 //===----------------------------------------------------------------------===//
177 def FeatureRCPC : ExtensionWithMArch<"rcpc", "RCPC", "FEAT_LRCPC",
178   "Enable support for RCPC extension">;
180 def FeaturePAuth : ExtensionWithMArch<"pauth", "PAuth", "FEAT_PAuth",
181   "Enable Armv8.3-A Pointer Authentication extension">;
183 let ArchExtKindSpelling = "AEK_JSCVT", UserVisibleName = "jscvt" in
184 def FeatureJS : ExtensionWithMArch<"jsconv", "JS", "FEAT_JSCVT",
185   "Enable Armv8.3-A JavaScript FP conversion instructions",
186   [FeatureFPARMv8]>;
188 def FeatureFPAC : Extension<"fpac", "FPAC", "FEAT_FPAC",
189   "Enable Armv8.3-A Pointer Authentication Faulting enhancement">;
191 def FeatureCCIDX : Extension<"ccidx", "CCIDX", "FEAT_CCIDX",
192   "Enable Armv8.3-A Extend of the CCSIDR number of sets">;
194 let ArchExtKindSpelling = "AEK_FCMA", UserVisibleName = "fcma" in
195 def FeatureComplxNum : ExtensionWithMArch<"complxnum", "ComplxNum", "FEAT_FCMA",
196   "Enable Armv8.3-A Floating-point complex number support",
197   [FeatureNEON]>;
199 def FeatureNV : Extension<"nv", "NV", "FEAT_NV, FEAT_NV2",
200   "Enable Armv8.4-A Nested Virtualization Enchancement">;
202 //===----------------------------------------------------------------------===//
203 //  Armv8.4 Architecture Extensions
204 //===----------------------------------------------------------------------===//
206 def FeatureLSE2 : Extension<"lse2", "LSE2", "FEAT_LSE2",
207   "Enable Armv8.4-A Large System Extension 2 (LSE2) atomicity rules">;
209 def FeatureFP16FML : ExtensionWithMArch<"fp16fml", "FP16FML", "FEAT_FHM",
210   "Enable FP16 FML instructions", [FeatureFullFP16, FeatureNEON]>;
212 def FeatureDotProd : ExtensionWithMArch<"dotprod", "DotProd", "FEAT_DotProd",
213   "Enable dot product support", [FeatureNEON]>;
215 def FeatureMPAM : Extension<"mpam", "MPAM", "FEAT_MPAM",
216   "Enable Armv8.4-A Memory system Partitioning and Monitoring extension">;
218 def FeatureDIT : ExtensionWithMArch<"dit", "DIT", "FEAT_DIT",
219   "Enable Armv8.4-A Data Independent Timing instructions">;
221 def FeatureTRACEV8_4 : Extension<"tracev8.4", "TRACEV8_4", "FEAT_TRF",
222   "Enable Armv8.4-A Trace extension">;
224 def FeatureAM : Extension<"am", "AM", "FEAT_AMUv1",
225   "Enable Armv8.4-A Activity Monitors extension">;
227 def FeatureSEL2 : Extension<"sel2", "SEL2", "FEAT_SEL2",
228   "Enable Armv8.4-A Secure Exception Level 2 extension">;
230 def FeatureTLB_RMI : Extension<"tlb-rmi", "TLB_RMI",
231   "FEAT_TLBIOS, FEAT_TLBIRANGE",
232   "Enable Armv8.4-A TLB Range and Maintenance instructions">;
234 def FeatureFlagM : ExtensionWithMArch<"flagm", "FlagM", "FEAT_FlagM",
235   "Enable Armv8.4-A Flag Manipulation instructions">;
237 def FeatureRCPC_IMMO : Extension<"rcpc-immo", "RCPC_IMMO", "FEAT_LRCPC2",
238   "Enable Armv8.4-A RCPC instructions with Immediate Offsets",
239   [FeatureRCPC]>;
241 //===----------------------------------------------------------------------===//
242 //  Armv8.5 Architecture Extensions
243 //===----------------------------------------------------------------------===//
245 def FeatureAltFPCmp : Extension<"altnzcv", "AlternativeNZCV", "FEAT_FlagM2",
246   "Enable alternative NZCV format for floating point comparisons", [FeatureFlagM]>;
248 def FeatureFRInt3264 : Extension<"fptoint", "FRInt3264", "FEAT_FRINTTS",
249   "Enable FRInt[32|64][Z|X] instructions that round a floating-point number to "
250   "an integer (in FP format) forcing it to fit into a 32- or 64-bit int",
251   [FeatureFPARMv8]>;
253 def FeatureSB : ExtensionWithMArch<"sb", "SB", "FEAT_SB",
254   "Enable Armv8.5-A Speculation Barrier">;
256 def FeatureSSBS : ExtensionWithMArch<"ssbs", "SSBS", "FEAT_SSBS, FEAT_SSBS2",
257   "Enable Speculative Store Bypass Safe bit">;
259 def FeaturePredRes : ExtensionWithMArch<"predres", "PredRes", "FEAT_SPECRES",
260   "Enable Armv8.5-A execution and data prediction invalidation instructions">;
262 def FeatureCacheDeepPersist : Extension<"ccdp", "CCDP", "FEAT_DPB2",
263   "Enable Armv8.5-A Cache Clean to Point of Deep Persistence", [FeatureCCPP]>;
265 def FeatureBranchTargetId : ExtensionWithMArch<"bti", "BTI", "FEAT_BTI",
266   "Enable Branch Target Identification">;
268 let ArchExtKindSpelling = "AEK_RAND", UserVisibleName = "rng" in
269 def FeatureRandGen : ExtensionWithMArch<"rand", "RandGen", "FEAT_RNG",
270   "Enable Random Number generation instructions">;
272 // NOTE: "memtag" means FEAT_MTE + FEAT_MTE2 for -march or
273 // __attribute((target(...))), but only FEAT_MTE for FMV.
274 let UserVisibleName = "memtag" in
275 def FeatureMTE : ExtensionWithMArch<"mte", "MTE", "FEAT_MTE, FEAT_MTE2",
276   "Enable Memory Tagging Extension">;
278 //===----------------------------------------------------------------------===//
279 //  Armv8.6 Architecture Extensions
280 //===----------------------------------------------------------------------===//
282 def FeatureBF16 : ExtensionWithMArch<"bf16", "BF16", "FEAT_BF16",
283   "Enable BFloat16 Extension", [FeatureNEON]>;
285 def FeatureAMVS : Extension<"amvs", "AMVS", "FEAT_AMUv1p1",
286   "Enable Armv8.6-A Activity Monitors Virtualization support",
287   [FeatureAM]>;
289 def FeatureFineGrainedTraps : Extension<"fgt", "FineGrainedTraps", "FEAT_FGT",
290   "Enable fine grained virtualization traps extension">;
292 def FeatureEnhancedCounterVirtualization :
293     Extension<"ecv", "EnhancedCounterVirtualization", "FEAT_ECV",
294       "Enable enhanced counter virtualization extension">;
296 //===----------------------------------------------------------------------===//
297 //  Armv8.7 Architecture Extensions
298 //===----------------------------------------------------------------------===//
300 def FeatureXS : Extension<"xs", "XS", "FEAT_XS",
301   "Enable Armv8.7-A limited-TLB-maintenance instruction">;
303 def FeatureWFxT : ExtensionWithMArch<"wfxt", "WFxT", "FEAT_WFxT",
304   "Enable Armv8.7-A WFET and WFIT instruction">;
306 def FeatureHCX : Extension<"hcx", "HCX", "FEAT_HCX",
307   "Enable Armv8.7-A HCRX_EL2 system register">;
309 def FeatureLS64 : ExtensionWithMArch<"ls64", "LS64",
310   "FEAT_LS64, FEAT_LS64_V, FEAT_LS64_ACCDATA",
311   "Enable Armv8.7-A LD64B/ST64B Accelerator Extension">;
313 def FeatureSPE_EEF : Extension<"spe-eef", "SPE_EEF", "FEAT_SPEv1p2",
314   "Enable extra register in the Statistical Profiling Extension">;
316 //===----------------------------------------------------------------------===//
317 //  Armv8.8 Architecture Extensions
318 //===----------------------------------------------------------------------===//
320 def FeatureHBC : ExtensionWithMArch<"hbc", "HBC", "FEAT_HBC",
321     "Enable Armv8.8-A Hinted Conditional Branches Extension">;
323 def FeatureMOPS : ExtensionWithMArch<"mops", "MOPS", "FEAT_MOPS",
324     "Enable Armv8.8-A memcpy and memset acceleration instructions">;
326 def FeatureNMI : Extension<"nmi", "NMI", "FEAT_NMI, FEAT_GICv3_NMI",
327   "Enable Armv8.8-A Non-maskable Interrupts">;
329 //===----------------------------------------------------------------------===//
330 //  Armv8.9 Architecture Extensions
331 //===----------------------------------------------------------------------===//
333 def FeatureRASv2 : ExtensionWithMArch<"rasv2", "RASv2", "FEAT_RASv2",
334   "Enable Armv8.9-A Reliability, Availability and Serviceability Extensions",
335   [FeatureRAS]>;
337 def FeatureCSSC : ExtensionWithMArch<"cssc", "CSSC", "FEAT_CSSC",
338   "Enable Common Short Sequence Compression (CSSC) instructions">;
340 def FeatureCLRBHB : Extension<"clrbhb", "CLRBHB", "FEAT_CLRBHB",
341   "Enable Clear BHB instruction">;
343 def FeaturePRFM_SLC : Extension<"prfm-slc-target", "PRFM_SLC", "FEAT_PRFMSLC",
344   "Enable SLC target for PRFM instruction">;
346 let UserVisibleName = "predres2" in
347 def FeatureSPECRES2 : ExtensionWithMArch<"specres2", "SPECRES2", "FEAT_SPECRES2",
348   "Enable Speculation Restriction Instruction",
349   [FeaturePredRes]>;
351 def FeatureRCPC3 : ExtensionWithMArch<"rcpc3", "RCPC3", "FEAT_LRCPC3",
352   "Enable Armv8.9-A RCPC instructions for A64 and Advanced SIMD and floating-point instruction set",
353   [FeatureRCPC_IMMO]>;
355 def FeatureTHE : ExtensionWithMArch<"the", "THE", "FEAT_THE",
356   "Enable Armv8.9-A Translation Hardening Extension">;
358 //===----------------------------------------------------------------------===//
359 //  Armv9.0 Architecture Extensions
360 //===----------------------------------------------------------------------===//
362 def FeatureSVE2 : ExtensionWithMArch<"sve2", "SVE2", "FEAT_SVE2",
363   "Enable Scalable Vector Extension 2 (SVE2) instructions",
364   [FeatureSVE]>;
366 def FeatureSVEAES : ExtensionWithMArch<"sve-aes", "SVEAES",
367   "FEAT_SVE_AES, FEAT_SVE_PMULL128",
368   "Enable SVE AES and quadword SVE polynomial multiply instructions", [FeatureAES]>;
370 def FeatureAliasSVE2AES : ExtensionWithMArch<"sve2-aes", "SVE2AES",
371   "", "Shorthand for +sve2+sve-aes", [FeatureSVE2, FeatureSVEAES]>;
373 def FeatureSVE2SM4 : ExtensionWithMArch<"sve2-sm4", "SVE2SM4", "FEAT_SVE_SM4",
374   "Enable SM4 SVE2 instructions", [FeatureSVE2, FeatureSM4]>;
376 def FeatureSVE2SHA3 : ExtensionWithMArch<"sve2-sha3", "SVE2SHA3", "FEAT_SVE_SHA3",
377   "Enable SHA3 SVE2 instructions", [FeatureSVE2, FeatureSHA3]>;
379 def FeatureSVEBitPerm : ExtensionWithMArch<"sve-bitperm", "SVEBitPerm",
380   "FEAT_SVE_BitPerm",  "Enable bit permutation SVE2 instructions">;
382 def FeatureAliasSVE2BitPerm : ExtensionWithMArch<"sve2-bitperm", "SVE2BitPerm",
383   "",  "Shorthand for +sve2+sve-bitperm", [FeatureSVE2, FeatureSVEBitPerm]>;
385 def FeatureTRBE : Extension<"trbe", "TRBE", "FEAT_TRBE",
386   "Enable Trace Buffer Extension">;
388 def FeatureETE : Extension<"ete", "ETE", "FEAT_ETE",
389   "Enable Embedded Trace Extension", [FeatureTRBE]>;
391 def FeatureTME : ExtensionWithMArch<"tme", "TME", "FEAT_TME",
392   "Enable Transactional Memory Extension">;
394 //===----------------------------------------------------------------------===//
395 //  Armv9.1 Architecture Extensions
396 //===----------------------------------------------------------------------===//
398 //===----------------------------------------------------------------------===//
399 //  Armv9.2 Architecture Extensions
400 //===----------------------------------------------------------------------===//
402 def FeatureBRBE : ExtensionWithMArch<"brbe", "BRBE", "FEAT_BRBE",
403   "Enable Branch Record Buffer Extension">;
405 def FeatureRME : Extension<"rme", "RME", "FEAT_RME",
406   "Enable Realm Management Extension">;
408 def FeatureSME : ExtensionWithMArch<"sme", "SME", "FEAT_SME",
409   "Enable Scalable Matrix Extension (SME)", [FeatureBF16, FeatureFullFP16]>;
411 def FeatureSMEF64F64 : ExtensionWithMArch<"sme-f64f64", "SMEF64F64", "FEAT_SME_F64F64",
412   "Enable Scalable Matrix Extension (SME) F64F64 instructions", [FeatureSME]>;
414 def FeatureSMEI16I64 : ExtensionWithMArch<"sme-i16i64", "SMEI16I64", "FEAT_SME_I16I64",
415   "Enable Scalable Matrix Extension (SME) I16I64 instructions", [FeatureSME]>;
417 def FeatureSMEFA64 : ExtensionWithMArch<"sme-fa64", "SMEFA64", "FEAT_SME_FA64",
418   "Enable the full A64 instruction set in streaming SVE mode", [FeatureSME, FeatureSVE2]>;
420 //===----------------------------------------------------------------------===//
421 //  Armv9.3 Architecture Extensions
422 //===----------------------------------------------------------------------===//
424 def FeatureSME2 : ExtensionWithMArch<"sme2", "SME2", "FEAT_SME2",
425   "Enable Scalable Matrix Extension 2 (SME2) instructions", [FeatureSME]>;
427 def FeatureMEC : Extension<"mec", "MEC", "FEAT_MEC",
428   "Enable Memory Encryption Contexts Extension", [FeatureRME]>;
430 //===----------------------------------------------------------------------===//
431 //  Armv9.4 Architecture Extensions
432 //===----------------------------------------------------------------------===//
434 def FeatureSVE2p1: ExtensionWithMArch<"sve2p1", "SVE2p1", "FEAT_SVE2p1",
435   "Enable Scalable Vector Extension 2.1 instructions", [FeatureSVE2]>;
437 def FeatureSVEB16B16: ExtensionWithMArch<"sve-b16b16", "SVEB16B16", "FEAT_SVE_B16B16",
438   "Enable SVE2 non-widening and SME2 Z-targeting non-widening BFloat16 instructions">;
440 def FeatureSMEB16B16 : ExtensionWithMArch<"sme-b16b16", "SMEB16B16", "FEAT_SME_B16B16",
441   "Enable SME2.1 ZA-targeting non-widening BFloat16 instructions",
442   [FeatureSME2, FeatureSVEB16B16]>;
444 def FeatureSMEF16F16 : ExtensionWithMArch<"sme-f16f16", "SMEF16F16", "FEAT_SME_F16F16",
445   "Enable SME non-widening Float16 instructions", [FeatureSME2]>;
447 def FeatureSME2p1 : ExtensionWithMArch<"sme2p1", "SME2p1", "FEAT_SME2p1",
448   "Enable Scalable Matrix Extension 2.1 instructions", [FeatureSME2]>;
450 def FeatureCHK : Extension<"chk", "CHK", "FEAT_CHK",
451   "Enable Armv8.0-A Check Feature Status Extension">;
453 def FeatureGCS : ExtensionWithMArch<"gcs", "GCS", "FEAT_GCS",
454   "Enable Armv9.4-A Guarded Call Stack Extension", [FeatureCHK]>;
456 def FeatureITE : ExtensionWithMArch<"ite", "ITE", "FEAT_ITE",
457   "Enable Armv9.4-A Instrumentation Extension", [FeatureETE, FeatureTRBE]>;
459 def FeatureLSE128 : ExtensionWithMArch<"lse128", "LSE128", "FEAT_LSE128",
460   "Enable Armv9.4-A 128-bit Atomic instructions",
461   [FeatureLSE]>;
463 // FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, and FEAT_SYSINSTR128 are mutually implicit.
464 // Therefore group them all under a single feature flag, d128:
465 def FeatureD128 : ExtensionWithMArch<"d128", "D128",
466   "FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, FEAT_SYSINSTR128",
467   "Enable Armv9.4-A 128-bit Page Table Descriptors, System Registers "
468   "and instructions",
469   [FeatureLSE128]>;
471 //===----------------------------------------------------------------------===//
472 //  Armv9.5 Architecture Extensions
473 //===----------------------------------------------------------------------===//
475 def FeatureFAMINMAX: ExtensionWithMArch<"faminmax", "FAMINMAX", "FEAT_FAMINMAX",
476  "Enable FAMIN and FAMAX instructions">;
478 def FeatureLUT: ExtensionWithMArch<"lut", "LUT", "FEAT_LUT",
479  "Enable Lookup Table instructions">;
481 def FeatureFP8 : ExtensionWithMArch<"fp8", "FP8", "FEAT_FP8",
482   "Enable FP8 instructions", [FeatureFAMINMAX, FeatureLUT, FeatureBF16]>;
484 def FeatureFP8FMA : ExtensionWithMArch<"fp8fma", "FP8FMA", "FEAT_FP8FMA",
485   "Enable Armv9.5-A FP8 multiply-add instructions", [FeatureFP8]>;
487 def FeatureSSVE_FP8FMA : ExtensionWithMArch<"ssve-fp8fma", "SSVE_FP8FMA", "FEAT_SSVE_FP8FMA",
488   "Enable SVE2 FP8 multiply-add instructions", [FeatureSME2, FeatureFP8]>;
490 def FeatureFP8DOT4: ExtensionWithMArch<"fp8dot4", "FP8DOT4", "FEAT_FP8DOT4",
491   "Enable FP8 4-way dot instructions", [FeatureNEON, FeatureFP8]>;
493 def FeatureFP8DOT2: ExtensionWithMArch<"fp8dot2", "FP8DOT2", "FEAT_FP8DOT2",
494   "Enable FP8 2-way dot instructions", [FeatureNEON, FeatureFP8]>;
496 def FeatureSSVE_FP8DOT4 : ExtensionWithMArch<"ssve-fp8dot4", "SSVE_FP8DOT4", "FEAT_SSVE_FP8DOT4",
497   "Enable SVE2 FP8 4-way dot product instructions", [FeatureSME2, FeatureFP8]>;
499 def FeatureSSVE_FP8DOT2 : ExtensionWithMArch<"ssve-fp8dot2", "SSVE_FP8DOT2", "FEAT_SSVE_FP8DOT2",
500   "Enable SVE2 FP8 2-way dot product instructions", [FeatureSME2, FeatureFP8]>;
502 def FeatureSME_LUTv2 : ExtensionWithMArch<"sme-lutv2", "SME_LUTv2", "FEAT_SME_LUTv2",
503   "Enable Scalable Matrix Extension (SME) LUTv2 instructions", [FeatureSME2]>;
505 def FeatureSMEF8F32 : ExtensionWithMArch<"sme-f8f32", "SMEF8F32", "FEAT_SME_F8F32",
506   "Enable Scalable Matrix Extension (SME) F8F32 instructions", [FeatureSME2, FeatureFP8]>;
508 def FeatureSMEF8F16 : ExtensionWithMArch<"sme-f8f16", "SMEF8F16", "FEAT_SME_F8F16",
509   "Enable Scalable Matrix Extension (SME) F8F16 instructions", [FeatureSME2, FeatureFP8]>;
511 def FeatureCPA : ExtensionWithMArch<"cpa", "CPA", "FEAT_CPA",
512   "Enable Armv9.5-A Checked Pointer Arithmetic">;
514 def FeaturePAuthLR : ExtensionWithMArch<"pauth-lr", "PAuthLR", "FEAT_PAuth_LR",
515   "Enable Armv9.5-A PAC enhancements">;
517 def FeatureTLBIW : ExtensionWithMArch<"tlbiw", "TLBIW", "FEAT_TLBIW",
518   "Enable Armv9.5-A TLBI VMALL for Dirty State">;
520 //===----------------------------------------------------------------------===//
521 //  Armv9.6 Architecture Extensions
522 //===----------------------------------------------------------------------===//
524 def FeatureCMPBR : ExtensionWithMArch<"cmpbr", "CMPBR", "FEAT_CMPBR",
525   "Enable Armv9.6-A base compare and branch instructions">;
527 def FeatureF8F32MM: ExtensionWithMArch<"f8f32mm", "F8F32MM", "FEAT_F8F32MM",
528   "Enable Armv9.6-A FP8 to Single-Precision Matrix Multiplication", [FeatureNEON, FeatureFP8]>;
530 def FeatureF8F16MM: ExtensionWithMArch<"f8f16mm", "F8F16MM", "FEAT_F8F16MM",
531   "Enable Armv9.6-A FP8 to Half-Precision Matrix Multiplication", [FeatureNEON, FeatureFP8]>;
533 def FeatureFPRCVT: ExtensionWithMArch<"fprcvt", "FPRCVT", "FEAT_FPRCVT",
534   "Enable Armv9.6-A base convert instructions for SIMD&FP scalar register operands of"
535   " different input and output sizes", [FeatureFPARMv8]>;
537 def FeatureLSFE : ExtensionWithMArch<"lsfe", "LSFE", "FEAT_LSFE",
538   "Enable Armv9.6-A base Atomic floating-point in-memory instructions", [FeatureFPARMv8]>;
540 def FeatureSME2p2: ExtensionWithMArch<"sme2p2", "SME2p2", "FEAT_SME2p2",
541   "Enable Armv9.6-A Scalable Matrix Extension 2.2 instructions", [FeatureSME2p1]>;
543 def FeatureSSVE_AES : ExtensionWithMArch<"ssve-aes", "SSVE_AES", "FEAT_SSVE_AES",
544   "Enable Armv9.6-A SVE AES support in streaming SVE mode", [FeatureSME2, FeatureSVEAES]>;
546 def FeatureSVE2p2 : ExtensionWithMArch<"sve2p2", "SVE2p2", "FEAT_SVE2p2",
547   "Enable Armv9.6-A Scalable Vector Extension 2.2 instructions", [FeatureSVE2p1]>;
549 def FeatureSVEAES2: ExtensionWithMArch<"sve-aes2", "SVE_AES2", "FEAT_SVE_AES2",
550   "Enable Armv9.6-A SVE multi-vector AES and multi-vector quadword polynomial multiply instructions">;
552 def FeatureSVEBFSCALE: ExtensionWithMArch<"sve-bfscale", "SVE_BFSCALE", "FEAT_SVE_BFSCALE",
553   "Enable Armv9.6-A SVE BFloat16 scaling instructions">;
555 def FeatureSVE_F16F32MM: ExtensionWithMArch<"sve-f16f32mm", "SVE_F16F32MM", "FEAT_SVE_F16F32MM",
556   "Enable Armv9.6-A FP16 to FP32 Matrix Multiply instructions", [FeatureSVE]>;
558 def FeatureLSUI: ExtensionWithMArch<"lsui", "LSUI", "FEAT_LSUI",
559   "Enable Armv9.6-A unprivileged load/store instructions">;
561 def FeatureOCCMO: ExtensionWithMArch<"occmo", "OCCMO", "FEAT_OCCMO",
562   "Enable Armv9.6-A Outer cacheable cache maintenance operations">;
564 def FeaturePCDPHINT: ExtensionWithMArch<"pcdphint", "PCDPHINT", "FEAT_PCDPHINT",
565   "Enable Armv9.6-A Producer Consumer Data Placement hints">;
567 def FeaturePoPS: ExtensionWithMArch<"pops", "PoPS", "FEAT_PoPS",
568   "Enable Armv9.6-A Point Of Physical Storage (PoPS) DC instructions">;
570 def FeatureSSVE_BitPerm : ExtensionWithMArch<"ssve-bitperm", "SSVE_BitPerm", "FEAT_SSVE_BitPerm",
571   "Enable Armv9.6-A SVE BitPerm support in streaming SVE mode", [FeatureSME2, FeatureSVEBitPerm]>;
573 def FeatureSME_MOP4: ExtensionWithMArch<"sme-mop4", "SME_MOP4", "FEAT_SME_MOP4",
574   "Enable SME Quarter-tile outer product instructions", [FeatureSME2]>;
576 def FeatureSME_TMOP: ExtensionWithMArch<"sme-tmop", "SME_TMOP", "FEAT_SME_TMOP",
577   "Enable SME Structured sparsity outer product instructions.", [FeatureSME2]>;
579 //===----------------------------------------------------------------------===//
580 //  Other Features
581 //===----------------------------------------------------------------------===//
583 def FeatureOutlineAtomics : SubtargetFeature<"outline-atomics", "OutlineAtomics", "true",
584   "Enable out of line atomics to support LSE instructions">;
586 def FeatureFMV : SubtargetFeature<"fmv", "HasFMV", "true",
587   "Enable Function Multi Versioning support.">;
589 // This flag is currently still labeled as Experimental, but when fully
590 // implemented this should tell the compiler to use the zeroing pseudos to
591 // benefit from the reverse instructions (e.g. SUB vs SUBR) if the inactive
592 // lanes are known to be zero. The pseudos will then be expanded using the
593 // MOVPRFX instruction to zero the inactive lanes. This feature should only be
594 // enabled if MOVPRFX instructions are known to merge with the destructive
595 // operations they prefix.
597 // This feature could similarly be extended to support cheap merging of _any_
598 // value into the inactive lanes using the MOVPRFX instruction that uses
599 // merging-predication.
600 def FeatureExperimentalZeroingPseudos
601     : SubtargetFeature<"use-experimental-zeroing-pseudos",
602                        "UseExperimentalZeroingPseudos", "true",
603                        "Hint to the compiler that the MOVPRFX instruction is "
604                        "merged with destructive operations",
605                        []>;
607 def FeatureNoSVEFPLD1R : SubtargetFeature<"no-sve-fp-ld1r",
608   "NoSVEFPLD1R", "true", "Avoid using LD1RX instructions for FP">;
610 def FeatureZCRegMove : SubtargetFeature<"zcm", "HasZeroCycleRegMove", "true",
611                                         "Has zero-cycle register moves">;
613 def FeatureZCZeroingGP : SubtargetFeature<"zcz-gp", "HasZeroCycleZeroingGP", "true",
614                                         "Has zero-cycle zeroing instructions for generic registers">;
616 // It is generally beneficial to rewrite "fmov s0, wzr" to "movi d0, #0".
617 // as movi is more efficient across all cores. Newer cores can eliminate
618 // fmovs early and there is no difference with movi, but this not true for
619 // all implementations.
620 def FeatureNoZCZeroingFP : SubtargetFeature<"no-zcz-fp", "HasZeroCycleZeroingFP", "false",
621                                         "Has no zero-cycle zeroing instructions for FP registers">;
623 def FeatureZCZeroing : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
624                                         "Has zero-cycle zeroing instructions",
625                                         [FeatureZCZeroingGP]>;
627 /// ... but the floating-point version doesn't quite work in rare cases on older
628 /// CPUs.
629 def FeatureZCZeroingFPWorkaround : SubtargetFeature<"zcz-fp-workaround",
630     "HasZeroCycleZeroingFPWorkaround", "true",
631     "The zero-cycle floating-point zeroing instruction has a bug">;
633 def FeatureStrictAlign : SubtargetFeature<"strict-align",
634                                           "RequiresStrictAlign", "true",
635                                           "Disallow all unaligned memory "
636                                           "access">;
638 foreach i = {1-7,9-15,18,20-28} in
639     def FeatureReserveX#i : SubtargetFeature<"reserve-x"#i, "ReserveXRegister["#i#"]", "true",
640                                              "Reserve X"#i#", making it unavailable "
641                                              "as a GPR">;
643 def FeatureReserveLRForRA : SubtargetFeature<"reserve-lr-for-ra",
644                                              "ReserveLRForRA", "true",
645                                              "Reserve LR for call use only">;
647 foreach i = {8-15,18} in
648     def FeatureCallSavedX#i : SubtargetFeature<"call-saved-x"#i,
649          "CustomCallSavedXRegs["#i#"]", "true", "Make X"#i#" callee saved.">;
651 def FeatureBalanceFPOps : SubtargetFeature<"balance-fp-ops", "BalanceFPOps",
652     "true",
653     "balance mix of odd and even D-registers for fp multiply(-accumulate) ops">;
655 def FeaturePredictableSelectIsExpensive : SubtargetFeature<
656     "predictable-select-expensive", "PredictableSelectIsExpensive", "true",
657     "Prefer likely predicted branches over selects">;
659 def FeatureEnableSelectOptimize : SubtargetFeature<
660     "enable-select-opt", "EnableSelectOptimize", "true",
661     "Enable the select optimize pass for select loop heuristics">;
663 def FeatureExynosCheapAsMoveHandling : SubtargetFeature<"exynos-cheap-as-move",
664     "HasExynosCheapAsMoveHandling", "true",
665     "Use Exynos specific handling of cheap instructions">;
667 def FeaturePostRAScheduler : SubtargetFeature<"use-postra-scheduler",
668     "UsePostRAScheduler", "true", "Schedule again after register allocation">;
670 def FeatureSlowMisaligned128Store : SubtargetFeature<"slow-misaligned-128store",
671     "IsMisaligned128StoreSlow", "true", "Misaligned 128 bit stores are slow">;
673 def FeatureSlowPaired128 : SubtargetFeature<"slow-paired-128",
674     "IsPaired128Slow", "true", "Paired 128 bit loads and stores are slow">;
676 def FeatureAscendStoreAddress : SubtargetFeature<"ascend-store-address",
677     "IsStoreAddressAscend", "true",
678     "Schedule vector stores by ascending address">;
680 def FeatureSlowSTRQro : SubtargetFeature<"slow-strqro-store", "IsSTRQroSlow",
681     "true", "STR of Q register with register offset is slow">;
683 def FeatureAlternateSExtLoadCVTF32Pattern : SubtargetFeature<
684     "alternate-sextload-cvt-f32-pattern", "UseAlternateSExtLoadCVTF32Pattern",
685     "true", "Use alternative pattern for sextload convert to f32">;
687 def FeatureArithmeticBccFusion : SubtargetFeature<
688     "arith-bcc-fusion", "HasArithmeticBccFusion", "true",
689     "CPU fuses arithmetic+bcc operations">;
691 def FeatureArithmeticCbzFusion : SubtargetFeature<
692     "arith-cbz-fusion", "HasArithmeticCbzFusion", "true",
693     "CPU fuses arithmetic + cbz/cbnz operations">;
695 def FeatureCmpBccFusion : SubtargetFeature<
696     "cmp-bcc-fusion", "HasCmpBccFusion", "true",
697     "CPU fuses cmp+bcc operations">;
699 def FeatureFuseAddress : SubtargetFeature<
700     "fuse-address", "HasFuseAddress", "true",
701     "CPU fuses address generation and memory operations">;
703 def FeatureFuseAES : SubtargetFeature<
704     "fuse-aes", "HasFuseAES", "true",
705     "CPU fuses AES crypto operations">;
707 def FeatureFuseArithmeticLogic : SubtargetFeature<
708     "fuse-arith-logic", "HasFuseArithmeticLogic", "true",
709     "CPU fuses arithmetic and logic operations">;
711 def FeatureFuseCCSelect : SubtargetFeature<
712     "fuse-csel", "HasFuseCCSelect", "true",
713     "CPU fuses conditional select operations">;
715 def FeatureFuseCryptoEOR : SubtargetFeature<
716     "fuse-crypto-eor", "HasFuseCryptoEOR", "true",
717     "CPU fuses AES/PMULL and EOR operations">;
719 def FeatureFuseAdrpAdd : SubtargetFeature<
720     "fuse-adrp-add", "HasFuseAdrpAdd", "true",
721     "CPU fuses adrp+add operations">;
723 def FeatureFuseLiterals : SubtargetFeature<
724     "fuse-literals", "HasFuseLiterals", "true",
725     "CPU fuses literal generation operations">;
727 def FeatureFuseAddSub2RegAndConstOne : SubtargetFeature<
728    "fuse-addsub-2reg-const1", "HasFuseAddSub2RegAndConstOne", "true",
729    "CPU fuses (a + b + 1) and (a - b - 1)">;
731 def FeatureDisableLatencySchedHeuristic : SubtargetFeature<
732     "disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
733     "Disable latency scheduling heuristic">;
735 def FeatureStorePairSuppress : SubtargetFeature<
736     "store-pair-suppress", "EnableStorePairSuppress", "true",
737     "Enable Store Pair Suppression heuristics">;
739 def FeatureForce32BitJumpTables
740    : SubtargetFeature<"force-32bit-jump-tables", "Force32BitJumpTables", "true",
741                       "Force jump table entries to be 32-bits wide except at MinSize">;
743 def FeatureUseRSqrt : SubtargetFeature<
744     "use-reciprocal-square-root", "UseRSqrt", "true",
745     "Use the reciprocal square root approximation">;
747 def FeatureNoNegativeImmediates : SubtargetFeature<"no-neg-immediates",
748                                         "NegativeImmediates", "false",
749                                         "Convert immediates and instructions "
750                                         "to their negated or complemented "
751                                         "equivalent when the immediate does "
752                                         "not fit in the encoding.">;
754 // Address operands with shift amount 2 or 3 are fast on all Arm chips except
755 // some old Apple cores (A7-A10?) which handle all shifts slowly. Cortex-A57
756 // and derived designs through Cortex-X1 take an extra micro-op for shifts
757 // of 1 or 4. Other Arm chips handle all shifted operands at the same speed
758 // as unshifted operands.
760 // We don't try to model the behavior of the old Apple cores because new code
761 // targeting A7 is very unlikely to actually run on an A7. The Cortex cores
762 // are modeled by FeatureAddrLSLSlow14.
763 def FeatureAddrLSLSlow14 : SubtargetFeature<
764     "addr-lsl-slow-14", "HasAddrLSLSlow14", "true",
765     "Address operands with shift amount of 1 or 4 are slow">;
767 def FeatureALULSLFast : SubtargetFeature<
768     "alu-lsl-fast", "HasALULSLFast", "true",
769     "Add/Sub operations with lsl shift <= 4 are cheap">;
771 def FeatureAggressiveFMA :
772   SubtargetFeature<"aggressive-fma",
773                    "HasAggressiveFMA",
774                    "true",
775                    "Enable Aggressive FMA for floating-point.">;
777 def FeatureTaggedGlobals : SubtargetFeature<"tagged-globals",
778     "AllowTaggedGlobals",
779     "true", "Use an instruction sequence for taking the address of a global "
780     "that allows a memory tag in the upper address bits">;
782 def FeatureEL2VMSA : SubtargetFeature<"el2vmsa", "HasEL2VMSA", "true",
783   "Enable Exception Level 2 Virtual Memory System Architecture">;
785 def FeatureEL3 : SubtargetFeature<"el3", "HasEL3", "true",
786   "Enable Exception Level 3">;
788 def FeatureFixCortexA53_835769 : SubtargetFeature<"fix-cortex-a53-835769",
789   "FixCortexA53_835769", "true", "Mitigate Cortex-A53 Erratum 835769">;
791 def FeatureNoBTIAtReturnTwice : SubtargetFeature<"no-bti-at-return-twice",
792                                                  "NoBTIAtReturnTwice", "true",
793                                                  "Don't place a BTI instruction "
794                                                  "after a return-twice">;
796 def FeatureDisableLdp : SubtargetFeature<"disable-ldp", "HasDisableLdp",
797     "true", "Do not emit ldp">;
799 def FeatureDisableStp : SubtargetFeature<"disable-stp", "HasDisableStp",
800     "true", "Do not emit stp">;
802 def FeatureLdpAlignedOnly : SubtargetFeature<"ldp-aligned-only", "HasLdpAlignedOnly",
803     "true", "In order to emit ldp, first check if the load will be aligned to 2 * element_size">;
805 def FeatureStpAlignedOnly : SubtargetFeature<"stp-aligned-only", "HasStpAlignedOnly",
806     "true", "In order to emit stp, first check if the store will be aligned to 2 * element_size">;
808 def FeatureUseFixedOverScalableIfEqualCost : SubtargetFeature<"use-fixed-over-scalable-if-equal-cost",
809   "UseFixedOverScalableIfEqualCost", "true",
810   "Prefer fixed width loop vectorization over scalable if the cost-model assigns equal costs">;
812 // For performance reasons we prefer to use ldapr to ldapur on certain cores.
813 def FeatureAvoidLDAPUR : SubtargetFeature<"avoid-ldapur", "AvoidLDAPUR", "true",
814   "Prefer add+ldapr to offset ldapur">;
816 //===----------------------------------------------------------------------===//
817 // Architectures.
819 class Architecture64<
820   int major, int minor, string profile,
821   string target_feature_name,
822   list<SubtargetFeature> implied_features,
823   list<Extension> default_extensions
824 > : SubtargetFeature<target_feature_name,
825     "HasV" # major # "_" # minor # profile # "Ops", "true",
826     "Support ARM " # target_feature_name # " architecture",
827     implied_features
828 > {
829   int Major = major;
830   int Minor = minor;
831   string Profile = profile;
833   // Extensions enabled by default. Not the same as implied SubtargetFeatures.
834   list<Extension> DefaultExts = default_extensions;
837 def HasV8_0aOps : Architecture64<8, 0, "a", "v8a",
838   [FeatureEL2VMSA, FeatureEL3],
839   [FeatureFPARMv8, FeatureNEON]>;
840 def HasV8_1aOps : Architecture64<8, 1, "a", "v8.1a",
841   [HasV8_0aOps, FeatureCRC, FeatureLSE, FeatureRDM, FeaturePAN, FeatureLOR,
842    FeatureVH],
843   !listconcat(HasV8_0aOps.DefaultExts, [FeatureCRC, FeatureLSE, FeatureRDM])>;
844 def HasV8_2aOps : Architecture64<8, 2, "a", "v8.2a",
845   [HasV8_1aOps, FeaturePsUAO, FeaturePAN_RWV, FeatureRAS, FeatureCCPP],
846   !listconcat(HasV8_1aOps.DefaultExts, [FeatureRAS])>;
847 def HasV8_3aOps : Architecture64<8, 3, "a", "v8.3a",
848   [HasV8_2aOps, FeatureRCPC, FeaturePAuth, FeatureJS, FeatureComplxNum],
849   !listconcat(HasV8_2aOps.DefaultExts, [FeatureComplxNum, FeatureJS,
850     FeaturePAuth, FeatureRCPC,  FeatureCCIDX])>;
851 def HasV8_4aOps : Architecture64<8, 4, "a", "v8.4a",
852   [HasV8_3aOps, FeatureDotProd, FeatureNV, FeatureMPAM, FeatureDIT,
853     FeatureTRACEV8_4, FeatureAM, FeatureSEL2, FeatureTLB_RMI, FeatureFlagM,
854     FeatureRCPC_IMMO, FeatureLSE2],
855   !listconcat(HasV8_3aOps.DefaultExts, [FeatureDotProd, FeatureDIT, FeatureFlagM])>;
856 def HasV8_5aOps : Architecture64<8, 5, "a", "v8.5a",
857   [HasV8_4aOps, FeatureAltFPCmp, FeatureFRInt3264, FeatureSpecRestrict,
858     FeatureSB, FeaturePredRes, FeatureCacheDeepPersist,
859     FeatureBranchTargetId],
860   !listconcat(HasV8_4aOps.DefaultExts, [FeaturePredRes, FeatureSSBS, FeatureBranchTargetId, FeatureSB])>;
861 def HasV8_6aOps : Architecture64<8, 6, "a", "v8.6a",
862   [HasV8_5aOps, FeatureAMVS, FeatureBF16, FeatureFineGrainedTraps,
863     FeatureEnhancedCounterVirtualization, FeatureMatMulInt8],
864   !listconcat(HasV8_5aOps.DefaultExts, [FeatureBF16, FeatureMatMulInt8])>;
865 def HasV8_7aOps : Architecture64<8, 7, "a", "v8.7a",
866   [HasV8_6aOps, FeatureXS, FeatureWFxT, FeatureHCX],
867   !listconcat(HasV8_6aOps.DefaultExts, [FeatureWFxT, FeatureSPE_EEF])>;
868 def HasV8_8aOps : Architecture64<8, 8, "a", "v8.8a",
869   [HasV8_7aOps, FeatureHBC, FeatureMOPS, FeatureNMI],
870   !listconcat(HasV8_7aOps.DefaultExts, [FeatureMOPS, FeatureHBC])>;
871 def HasV8_9aOps : Architecture64<8, 9, "a", "v8.9a",
872   [HasV8_8aOps, FeatureCLRBHB, FeaturePRFM_SLC, FeatureSPECRES2,
873    FeatureCSSC, FeatureRASv2, FeatureCHK],
874   !listconcat(HasV8_8aOps.DefaultExts, [FeatureSPECRES2, FeatureCSSC,
875     FeatureRASv2])>;
876 def HasV9_0aOps : Architecture64<9, 0, "a", "v9a",
877   [HasV8_5aOps],
878   !listconcat(HasV8_5aOps.DefaultExts, [FeatureFullFP16, FeatureSVE,
879     FeatureSVE2])>;
880 def HasV9_1aOps : Architecture64<9, 1, "a", "v9.1a",
881   [HasV8_6aOps, HasV9_0aOps],
882   !listconcat(HasV9_0aOps.DefaultExts, HasV8_6aOps.DefaultExts,
883               [FeatureRME])>;
884 def HasV9_2aOps : Architecture64<9, 2, "a", "v9.2a",
885   [HasV8_7aOps, HasV9_1aOps],
886   !listconcat(HasV9_1aOps.DefaultExts, HasV8_7aOps.DefaultExts,
887               [FeatureMEC])>;
888 def HasV9_3aOps : Architecture64<9, 3, "a", "v9.3a",
889   [HasV8_8aOps, HasV9_2aOps],
890   !listconcat(HasV9_2aOps.DefaultExts, HasV8_8aOps.DefaultExts, [])>;
891 def HasV9_4aOps : Architecture64<9, 4, "a", "v9.4a",
892   [HasV8_9aOps, HasV9_3aOps],
893   !listconcat(HasV9_3aOps.DefaultExts, HasV8_9aOps.DefaultExts,
894               [FeatureSVE2p1])>;
895 def HasV9_5aOps : Architecture64<9, 5, "a", "v9.5a",
896   [HasV9_4aOps, FeatureCPA],
897   !listconcat(HasV9_4aOps.DefaultExts, [FeatureCPA,  FeatureLUT, FeatureFAMINMAX])>;
898 def HasV9_6aOps : Architecture64<9, 6, "a", "v9.6a",
899   [HasV9_5aOps, FeatureCMPBR, FeatureFPRCVT, FeatureSVE2p2, FeatureLSUI, FeatureOCCMO],
900   !listconcat(HasV9_5aOps.DefaultExts, [FeatureCMPBR, FeatureFPRCVT, FeatureSVE2p2,
901     FeatureLSUI, FeatureOCCMO])>;
902 def HasV8_0rOps : Architecture64<8, 0, "r", "v8r",
903   [ //v8.1
904     FeatureCRC, FeaturePAN, FeatureLSE, FeatureCONTEXTIDREL2,
905     //v8.2
906     FeatureRAS, FeaturePsUAO, FeatureCCPP, FeaturePAN_RWV,
907     //v8.3
908     FeaturePAuth, FeatureRCPC,
909     //v8.4
910     FeatureTRACEV8_4, FeatureTLB_RMI, FeatureFlagM, FeatureDIT, FeatureSEL2,
911     FeatureRCPC_IMMO,
912     // Not mandatory in v8.0-R, but included here on the grounds that it
913     // only enables names of system registers
914     FeatureSpecRestrict
915   ],
916   // For v8-R, we do not enable crypto and align with GCC that enables a more
917   // minimal set of optional architecture extensions.
918   !listconcat(
919     !listremove(HasV8_5aOps.DefaultExts, [FeatureBranchTargetId, FeaturePredRes]),
920     [FeatureSSBS, FeatureFullFP16, FeatureFP16FML, FeatureSB]
921   )>;
923 //===----------------------------------------------------------------------===//
924 // Access to privileged registers
925 //===----------------------------------------------------------------------===//
927 foreach i = 1-3 in
928 def FeatureUseEL#i#ForTP : SubtargetFeature<"tpidr-el"#i, "UseEL"#i#"ForTP",
929   "true", "Permit use of TPIDR_EL"#i#" for the TLS base">;
930 def FeatureUseROEL0ForTP : SubtargetFeature<"tpidrro-el0", "UseROEL0ForTP",
931   "true", "Permit use of TPIDRRO_EL0 for the TLS base">;
933 //===----------------------------------------------------------------------===//
934 // Control codegen mitigation against Straight Line Speculation vulnerability.
935 //===----------------------------------------------------------------------===//
937 def FeatureHardenSlsRetBr : SubtargetFeature<"harden-sls-retbr",
938   "HardenSlsRetBr", "true",
939   "Harden against straight line speculation across RET and BR instructions">;
940 def FeatureHardenSlsBlr : SubtargetFeature<"harden-sls-blr",
941   "HardenSlsBlr", "true",
942   "Harden against straight line speculation across BLR instructions">;
943 def FeatureHardenSlsNoComdat : SubtargetFeature<"harden-sls-nocomdat",
944   "HardenSlsNoComdat", "true",
945   "Generate thunk code for SLS mitigation in the normal text section">;
948 // Only intended to be used by disassemblers.
949 def FeatureAll
950     : SubtargetFeature<"all", "IsAll", "true", "Enable all instructions">;