xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64Features.td (revision 62987288060ff68c817b7056815aa9fb8ba8ecd7)
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//===----------------------------------------------------------------------===//
11
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.
16class 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>
23{
24    string ArchExtKindSpelling = "AEK_" # Spelling; // ArchExtKind enum name.
25
26    string ArchFeatureName = ArchitectureFeatureName;
27
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 = "";
31
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 = "";
35}
36
37// An Extension that can be toggled via a '-march'/'-mcpu' modifier or a target
38// attribute, e.g. '+sm4".
39class 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;
51}
52
53
54
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.
60
61
62//===----------------------------------------------------------------------===//
63//  Armv8.0 Architecture Extensions
64//===----------------------------------------------------------------------===//
65
66let ArchExtKindSpelling = "AEK_FP", UserVisibleName = "fp" in
67def FeatureFPARMv8 : ExtensionWithMArch<"fp-armv8", "FPARMv8", "FEAT_FP",
68  "Enable Armv8.0-A Floating Point Extensions">;
69
70let ArchExtKindSpelling = "AEK_SIMD", UserVisibleName = "simd" in
71def FeatureNEON : ExtensionWithMArch<"neon", "NEON", "FEAT_AdvSIMD",
72  "Enable Advanced SIMD instructions", [FeatureFPARMv8]>;
73
74def FeatureSHA2 : ExtensionWithMArch<"sha2", "SHA2", "FEAT_SHA1, FEAT_SHA256",
75  "Enable SHA1 and SHA256 support", [FeatureNEON]>;
76
77def FeatureAES : ExtensionWithMArch<"aes", "AES", "FEAT_AES, FEAT_PMULL",
78  "Enable AES support", [FeatureNEON]>;
79
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.
88def FeatureCrypto : ExtensionWithMArch<"crypto", "Crypto", "FEAT_Crypto",
89  "Enable cryptographic instructions", [FeatureNEON, FeatureSHA2, FeatureAES]>;
90
91def FeatureCRC : ExtensionWithMArch<"crc", "CRC", "FEAT_CRC32",
92  "Enable Armv8.0-A CRC-32 checksum instructions">;
93
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.
97let UserVisibleName = "pmuv3" in
98def FeaturePerfMon : ExtensionWithMArch<"perfmon", "PerfMon", "FEAT_PMUv3",
99  "Enable Armv8.0-A PMUv3 Performance Monitors extension">;
100
101def FeatureSpecRestrict : Extension<"specrestrict", "SpecRestrict", "FEAT_CSV2_2",
102  "Enable architectural speculation restriction">;
103
104//===----------------------------------------------------------------------===//
105//  Armv8.1 Architecture Extensions
106//===----------------------------------------------------------------------===//
107
108def FeatureLSE : ExtensionWithMArch<"lse", "LSE", "FEAT_LSE",
109  "Enable Armv8.1-A Large System Extension (LSE) atomic instructions">;
110
111let UserVisibleAlias = "rdma" in
112def FeatureRDM : ExtensionWithMArch<"rdm", "RDM", "FEAT_RDM",
113  "Enable Armv8.1-A Rounding Double Multiply Add/Subtract instructions",
114  [FeatureNEON]>;
115
116def FeaturePAN : Extension<"pan", "PAN", "FEAT_PAN",
117  "Enable Armv8.1-A Privileged Access-Never extension">;
118
119def FeatureLOR : Extension<"lor", "LOR", "FEAT_LOR",
120  "Enable Armv8.1-A Limited Ordering Regions extension">;
121
122def FeatureCONTEXTIDREL2 : SubtargetFeature<"CONTEXTIDREL2", "HasCONTEXTIDREL2",
123  "true", "Enable RW operand CONTEXTIDR_EL2">;
124
125def FeatureVH : Extension<"vh", "VH", "FEAT_VHE",
126  "Enable Armv8.1-A Virtual Host extension", [FeatureCONTEXTIDREL2]>;
127
128//===----------------------------------------------------------------------===//
129//  Armv8.2 Architecture Extensions
130//===----------------------------------------------------------------------===//
131
132def FeatureSM4 : ExtensionWithMArch<"sm4", "SM4", "FEAT_SM4, FEAT_SM3",
133  "Enable SM3 and SM4 support", [FeatureNEON]>;
134
135def FeatureSHA3 : ExtensionWithMArch<"sha3", "SHA3", "FEAT_SHA3, FEAT_SHA512",
136  "Enable SHA512 and SHA3 support", [FeatureNEON, FeatureSHA2]>;
137
138def FeatureRAS : ExtensionWithMArch<"ras", "RAS", "FEAT_RAS, FEAT_RASv1p1",
139  "Enable Armv8.0-A Reliability, Availability and Serviceability Extensions">;
140
141let ArchExtKindSpelling = "AEK_FP16", UserVisibleName = "fp16" in
142def FeatureFullFP16 : ExtensionWithMArch<"fullfp16", "FullFP16", "FEAT_FP16",
143  "Enable half-precision floating-point data processing", [FeatureFPARMv8]>;
144
145let ArchExtKindSpelling = "AEK_PROFILE", UserVisibleName = "profile" in
146def FeatureSPE : ExtensionWithMArch<"spe", "SPE", "FEAT_SPE",
147  "Enable Statistical Profiling extension">;
148
149def FeaturePAN_RWV : Extension<"pan-rwv", "PAN_RWV", "FEAT_PAN2",
150  "Enable Armv8.2-A PAN s1e1R and s1e1W Variants", [FeaturePAN]>;
151
152def FeaturePsUAO : Extension<"uaops", "PsUAO", "FEAT_UAO",
153  "Enable Armv8.2-A UAO PState">;
154
155def FeatureCCPP : Extension<"ccpp", "CCPP", "FEAT_DPB",
156  "Enable Armv8.2-A data Cache Clean to Point of Persistence">;
157
158def FeatureSVE : ExtensionWithMArch<"sve", "SVE", "FEAT_SVE",
159  "Enable Scalable Vector Extension (SVE) instructions", [FeatureFullFP16]>;
160
161let ArchExtKindSpelling = "AEK_I8MM" in
162def FeatureMatMulInt8 : ExtensionWithMArch<"i8mm", "MatMulInt8", "FEAT_I8MM",
163  "Enable Matrix Multiply Int8 Extension">;
164
165let ArchExtKindSpelling = "AEK_F32MM" in
166def FeatureMatMulFP32 : ExtensionWithMArch<"f32mm", "MatMulFP32", "FEAT_F32MM",
167  "Enable Matrix Multiply FP32 Extension", [FeatureSVE]>;
168
169let ArchExtKindSpelling = "AEK_F64MM" in
170def FeatureMatMulFP64 : ExtensionWithMArch<"f64mm", "MatMulFP64", "FEAT_F64MM",
171  "Enable Matrix Multiply FP64 Extension", [FeatureSVE]>;
172
173//===----------------------------------------------------------------------===//
174//  Armv8.3 Architecture Extensions
175//===----------------------------------------------------------------------===//
176
177def FeatureRCPC : ExtensionWithMArch<"rcpc", "RCPC", "FEAT_LRCPC",
178  "Enable support for RCPC extension">;
179
180def FeaturePAuth : ExtensionWithMArch<"pauth", "PAuth", "FEAT_PAuth",
181  "Enable Armv8.3-A Pointer Authentication extension">;
182
183let ArchExtKindSpelling = "AEK_JSCVT", UserVisibleName = "jscvt" in
184def FeatureJS : ExtensionWithMArch<"jsconv", "JS", "FEAT_JSCVT",
185  "Enable Armv8.3-A JavaScript FP conversion instructions",
186  [FeatureFPARMv8]>;
187
188def FeatureFPAC : Extension<"fpac", "FPAC", "FEAT_FPAC",
189  "Enable v8.3-A Pointer Authentication Faulting enhancement">;
190
191def FeatureCCIDX : Extension<"ccidx", "CCIDX", "FEAT_CCIDX",
192  "Enable Armv8.3-A Extend of the CCSIDR number of sets">;
193
194let ArchExtKindSpelling = "AEK_FCMA", UserVisibleName = "fcma" in
195def FeatureComplxNum : ExtensionWithMArch<"complxnum", "ComplxNum", "FEAT_FCMA",
196  "Enable Armv8.3-A Floating-point complex number support",
197  [FeatureNEON]>;
198
199def FeatureNV : Extension<"nv", "NV", "FEAT_NV, FEAT_NV2",
200  "Enable Armv8.4-A Nested Virtualization Enchancement">;
201
202//===----------------------------------------------------------------------===//
203//  Armv8.4 Architecture Extensions
204//===----------------------------------------------------------------------===//
205
206def FeatureLSE2 : Extension<"lse2", "LSE2", "FEAT_LSE2",
207  "Enable Armv8.4-A Large System Extension 2 (LSE2) atomicity rules">;
208
209def FeatureFP16FML : ExtensionWithMArch<"fp16fml", "FP16FML", "FEAT_FHM",
210  "Enable FP16 FML instructions", [FeatureFullFP16]>;
211
212def FeatureDotProd : ExtensionWithMArch<"dotprod", "DotProd", "FEAT_DotProd",
213  "Enable dot product support", [FeatureNEON]>;
214
215def FeatureMPAM : Extension<"mpam", "MPAM", "FEAT_MPAM",
216  "Enable Armv8.4-A Memory system Partitioning and Monitoring extension">;
217
218def FeatureDIT : ExtensionWithMArch<"dit", "DIT", "FEAT_DIT",
219  "Enable Armv8.4-A Data Independent Timing instructions">;
220
221def FeatureTRACEV8_4 : Extension<"tracev8.4", "TRACEV8_4", "FEAT_TRF",
222  "Enable Armv8.4-A Trace extension">;
223
224def FeatureAM : Extension<"am", "AM", "FEAT_AMUv1",
225  "Enable Armv8.4-A Activity Monitors extension">;
226
227def FeatureSEL2 : Extension<"sel2", "SEL2", "FEAT_SEL2",
228  "Enable Armv8.4-A Secure Exception Level 2 extension">;
229
230def FeatureTLB_RMI : Extension<"tlb-rmi", "TLB_RMI",
231  "FEAT_TLBIOS, FEAT_TLBIRANGE",
232  "Enable Armv8.4-A TLB Range and Maintenance instructions">;
233
234def FeatureFlagM : ExtensionWithMArch<"flagm", "FlagM", "FEAT_FlagM",
235  "Enable Armv8.4-A Flag Manipulation instructions">;
236
237def FeatureRCPC_IMMO : Extension<"rcpc-immo", "RCPC_IMMO", "FEAT_LRCPC2",
238  "Enable Armv8.4-A RCPC instructions with Immediate Offsets",
239  [FeatureRCPC]>;
240
241//===----------------------------------------------------------------------===//
242//  Armv8.5 Architecture Extensions
243//===----------------------------------------------------------------------===//
244
245def FeatureAltFPCmp : Extension<"altnzcv", "AlternativeNZCV", "FEAT_FlagM2",
246  "Enable alternative NZCV format for floating point comparisons">;
247
248def 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
252def FeatureSB : ExtensionWithMArch<"sb", "SB", "FEAT_SB",
253  "Enable Armv8.5-A Speculation Barrier">;
254
255def FeatureSSBS : ExtensionWithMArch<"ssbs", "SSBS", "FEAT_SSBS, FEAT_SSBS2",
256  "Enable Speculative Store Bypass Safe bit">;
257
258def FeaturePredRes : ExtensionWithMArch<"predres", "PredRes", "FEAT_SPECRES",
259  "Enable Armv8.5-A execution and data prediction invalidation instructions">;
260
261def FeatureCacheDeepPersist : Extension<"ccdp", "CCDP", "FEAT_DPB2",
262  "Enable Armv8.5-A Cache Clean to Point of Deep Persistence">;
263
264def FeatureBranchTargetId : ExtensionWithMArch<"bti", "BTI", "FEAT_BTI",
265  "Enable Branch Target Identification">;
266
267let ArchExtKindSpelling = "AEK_RAND", UserVisibleName = "rng" in
268def FeatureRandGen : ExtensionWithMArch<"rand", "RandGen", "FEAT_RNG",
269  "Enable Random Number generation instructions">;
270
271// NOTE: "memtag" means FEAT_MTE + FEAT_MTE2 for -march or
272// __attribute((target(...))), but only FEAT_MTE for FMV.
273let UserVisibleName = "memtag" in
274def FeatureMTE : ExtensionWithMArch<"mte", "MTE", "FEAT_MTE, FEAT_MTE2",
275  "Enable Memory Tagging Extension">;
276
277//===----------------------------------------------------------------------===//
278//  Armv8.6 Architecture Extensions
279//===----------------------------------------------------------------------===//
280
281def FeatureBF16 : ExtensionWithMArch<"bf16", "BF16", "FEAT_BF16",
282  "Enable BFloat16 Extension">;
283
284def FeatureAMVS : Extension<"amvs", "AMVS", "FEAT_AMUv1p1",
285  "Enable Armv8.6-A Activity Monitors Virtualization support",
286  [FeatureAM]>;
287
288def FeatureFineGrainedTraps : Extension<"fgt", "FineGrainedTraps", "FEAT_FGT",
289  "Enable fine grained virtualization traps extension">;
290
291def FeatureEnhancedCounterVirtualization :
292    Extension<"ecv", "EnhancedCounterVirtualization", "FEAT_ECV",
293      "Enable enhanced counter virtualization extension">;
294
295//===----------------------------------------------------------------------===//
296//  Armv8.7 Architecture Extensions
297//===----------------------------------------------------------------------===//
298
299def FeatureXS : Extension<"xs", "XS", "FEAT_XS",
300  "Enable Armv8.7-A limited-TLB-maintenance instruction">;
301
302def FeatureWFxT : ExtensionWithMArch<"wfxt", "WFxT", "FEAT_WFxT",
303  "Enable Armv8.7-A WFET and WFIT instruction">;
304
305def FeatureHCX : Extension<"hcx", "HCX", "FEAT_HCX",
306  "Enable Armv8.7-A HCRX_EL2 system register">;
307
308def FeatureLS64 : ExtensionWithMArch<"ls64", "LS64",
309  "FEAT_LS64, FEAT_LS64_V, FEAT_LS64_ACCDATA",
310  "Enable Armv8.7-A LD64B/ST64B Accelerator Extension">;
311
312def FeatureSPE_EEF : Extension<"spe-eef", "SPE_EEF", "FEAT_SPEv1p2",
313  "Enable extra register in the Statistical Profiling Extension">;
314
315//===----------------------------------------------------------------------===//
316//  Armv8.8 Architecture Extensions
317//===----------------------------------------------------------------------===//
318
319def FeatureHBC : ExtensionWithMArch<"hbc", "HBC", "FEAT_HBC",
320    "Enable Armv8.8-A Hinted Conditional Branches Extension">;
321
322def FeatureMOPS : ExtensionWithMArch<"mops", "MOPS", "FEAT_MOPS",
323    "Enable Armv8.8-A memcpy and memset acceleration instructions">;
324
325def FeatureNMI : Extension<"nmi", "NMI", "FEAT_NMI, FEAT_GICv3_NMI",
326  "Enable Armv8.8-A Non-maskable Interrupts">;
327
328//===----------------------------------------------------------------------===//
329//  Armv8.9 Architecture Extensions
330//===----------------------------------------------------------------------===//
331
332def FeatureRASv2 : ExtensionWithMArch<"rasv2", "RASv2", "FEAT_RASv2",
333  "Enable Armv8.9-A Reliability, Availability and Serviceability Extensions",
334  [FeatureRAS]>;
335
336def FeatureCSSC : ExtensionWithMArch<"cssc", "CSSC", "FEAT_CSSC",
337  "Enable Common Short Sequence Compression (CSSC) instructions">;
338
339def FeatureCLRBHB : Extension<"clrbhb", "CLRBHB", "FEAT_CLRBHB",
340  "Enable Clear BHB instruction">;
341
342def FeaturePRFM_SLC : Extension<"prfm-slc-target", "PRFM_SLC", "FEAT_PRFMSLC",
343  "Enable SLC target for PRFM instruction">;
344
345let UserVisibleName = "predres2" in
346def FeatureSPECRES2 : ExtensionWithMArch<"specres2", "SPECRES2", "FEAT_SPECRES2",
347  "Enable Speculation Restriction Instruction",
348  [FeaturePredRes]>;
349
350def FeatureRCPC3 : ExtensionWithMArch<"rcpc3", "RCPC3", "FEAT_LRCPC3",
351  "Enable Armv8.9-A RCPC instructions for A64 and Advanced SIMD and floating-point instruction set",
352  [FeatureRCPC_IMMO]>;
353
354def FeatureTHE : ExtensionWithMArch<"the", "THE", "FEAT_THE",
355  "Enable Armv8.9-A Translation Hardening Extension">;
356
357//===----------------------------------------------------------------------===//
358//  Armv9.0 Architecture Extensions
359//===----------------------------------------------------------------------===//
360
361def FeatureUseFixedOverScalableIfEqualCost: SubtargetFeature<"use-fixed-over-scalable-if-equal-cost",
362  "UseFixedOverScalableIfEqualCost", "true",
363  "Prefer fixed width loop vectorization over scalable if the cost-model assigns equal costs">;
364
365def FeatureUseScalarIncVL : SubtargetFeature<"use-scalar-inc-vl",
366  "UseScalarIncVL", "true", "Prefer inc/dec over add+cnt">;
367
368def FeatureSVE2 : ExtensionWithMArch<"sve2", "SVE2", "FEAT_SVE2",
369  "Enable Scalable Vector Extension 2 (SVE2) instructions",
370  [FeatureSVE, FeatureUseScalarIncVL]>;
371
372def FeatureSVE2AES : ExtensionWithMArch<"sve2-aes", "SVE2AES",
373  "FEAT_SVE_AES, FEAT_SVE_PMULL128",
374  "Enable AES SVE2 instructions", [FeatureSVE2, FeatureAES]>;
375
376def FeatureSVE2SM4 : ExtensionWithMArch<"sve2-sm4", "SVE2SM4", "FEAT_SVE_SM4",
377  "Enable SM4 SVE2 instructions", [FeatureSVE2, FeatureSM4]>;
378
379def FeatureSVE2SHA3 : ExtensionWithMArch<"sve2-sha3", "SVE2SHA3", "FEAT_SVE_SHA3",
380  "Enable SHA3 SVE2 instructions", [FeatureSVE2, FeatureSHA3]>;
381
382def FeatureSVE2BitPerm : ExtensionWithMArch<"sve2-bitperm", "SVE2BitPerm",
383  "FEAT_SVE_BitPerm",
384  "Enable bit permutation SVE2 instructions", [FeatureSVE2]>;
385
386def FeatureTRBE : Extension<"trbe", "TRBE", "FEAT_TRBE",
387  "Enable Trace Buffer Extension">;
388
389def FeatureETE : Extension<"ete", "ETE", "FEAT_ETE",
390  "Enable Embedded Trace Extension", [FeatureTRBE]>;
391
392def FeatureTME : ExtensionWithMArch<"tme", "TME", "FEAT_TME",
393  "Enable Transactional Memory Extension">;
394
395//===----------------------------------------------------------------------===//
396//  Armv9.1 Architecture Extensions
397//===----------------------------------------------------------------------===//
398
399//===----------------------------------------------------------------------===//
400//  Armv9.2 Architecture Extensions
401//===----------------------------------------------------------------------===//
402
403def FeatureBRBE : ExtensionWithMArch<"brbe", "BRBE", "FEAT_BRBE",
404  "Enable Branch Record Buffer Extension">;
405
406def FeatureRME : Extension<"rme", "RME", "FEAT_RME",
407  "Enable Realm Management Extension">;
408
409def FeatureSME : ExtensionWithMArch<"sme", "SME", "FEAT_SME",
410  "Enable Scalable Matrix Extension (SME)", [FeatureBF16, FeatureUseScalarIncVL]>;
411
412def FeatureSMEF64F64 : ExtensionWithMArch<"sme-f64f64", "SMEF64F64", "FEAT_SME_F64F64",
413  "Enable Scalable Matrix Extension (SME) F64F64 instructions", [FeatureSME]>;
414
415def FeatureSMEI16I64 : ExtensionWithMArch<"sme-i16i64", "SMEI16I64", "FEAT_SME_I16I64",
416  "Enable Scalable Matrix Extension (SME) I16I64 instructions", [FeatureSME]>;
417
418def FeatureSMEFA64 : ExtensionWithMArch<"sme-fa64", "SMEFA64", "FEAT_SME_FA64",
419  "Enable the full A64 instruction set in streaming SVE mode", [FeatureSME, FeatureSVE2]>;
420
421//===----------------------------------------------------------------------===//
422//  Armv9.3 Architecture Extensions
423//===----------------------------------------------------------------------===//
424
425def FeatureSME2 : ExtensionWithMArch<"sme2", "SME2", "FEAT_SME2",
426  "Enable Scalable Matrix Extension 2 (SME2) instructions", [FeatureSME]>;
427
428def FeatureMEC : Extension<"mec", "MEC", "FEAT_MEC",
429  "Enable Memory Encryption Contexts Extension", [FeatureRME]>;
430
431//===----------------------------------------------------------------------===//
432//  Armv9.4 Architecture Extensions
433//===----------------------------------------------------------------------===//
434
435def FeatureSVE2p1: ExtensionWithMArch<"sve2p1", "SVE2p1", "FEAT_SVE2p1",
436  "Enable Scalable Vector Extension 2.1 instructions", [FeatureSVE2]>;
437
438def FeatureB16B16 : ExtensionWithMArch<"b16b16", "B16B16", "FEAT_SVE_B16B16",
439  "Enable SVE2.1 or SME2.1 non-widening BFloat16 to BFloat16 instructions", [FeatureBF16]>;
440
441// FeatureSVEB16B16 and FeatureSMEB16B16 act as aliases for {FeatureB16B16}, and
442// {FeatureB16B16, FeatureSME2} respectively. This allows LLVM-20 interfacing programs
443// that use '+sve-b16b16' and '+sme-b16b16' to compile in LLVM-19.
444def FeatureSVEB16B16 : ExtensionWithMArch<"sve-b16b16", "SVEB16B16", "FEAT_SVE_B16B16",
445  "Enable SVE2 non-widening and SME2 Z-targeting non-widening BFloat16 instructions", [FeatureB16B16]>;
446
447def FeatureSMEB16B16 : ExtensionWithMArch<"sme-b16b16", "SMEB16B16", "FEAT_SME_B16B16",
448  "Enable SME2.1 ZA-targeting non-widening BFloat16 instructions", [FeatureSME2, FeatureB16B16]>;
449
450def FeatureSMEF16F16 : ExtensionWithMArch<"sme-f16f16", "SMEF16F16", "FEAT_SME_F16F16",
451  "Enable SME non-widening Float16 instructions", [FeatureSME2]>;
452
453def FeatureSME2p1 : ExtensionWithMArch<"sme2p1", "SME2p1", "FEAT_SME2p1",
454  "Enable Scalable Matrix Extension 2.1 instructions", [FeatureSME2]>;
455
456def FeatureCHK : Extension<"chk", "CHK", "FEAT_CHK",
457  "Enable Armv8.0-A Check Feature Status Extension">;
458
459def FeatureGCS : ExtensionWithMArch<"gcs", "GCS", "FEAT_GCS",
460  "Enable Armv9.4-A Guarded Call Stack Extension", [FeatureCHK]>;
461
462def FeatureITE : ExtensionWithMArch<"ite", "ITE", "FEAT_ITE",
463  "Enable Armv9.4-A Instrumentation Extension", [FeatureETE, FeatureTRBE]>;
464
465def FeatureLSE128 : ExtensionWithMArch<"lse128", "LSE128", "FEAT_LSE128",
466  "Enable Armv9.4-A 128-bit Atomic instructions",
467  [FeatureLSE]>;
468
469// FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, and FEAT_SYSINSTR128 are mutually implicit.
470// Therefore group them all under a single feature flag, d128:
471def FeatureD128 : ExtensionWithMArch<"d128", "D128",
472  "FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, FEAT_SYSINSTR128",
473  "Enable Armv9.4-A 128-bit Page Table Descriptors, System Registers "
474  "and instructions",
475  [FeatureLSE128]>;
476
477//===----------------------------------------------------------------------===//
478//  Armv9.5 Architecture Extensions
479//===----------------------------------------------------------------------===//
480
481def FeatureFAMINMAX: ExtensionWithMArch<"faminmax", "FAMINMAX", "FEAT_FAMINMAX",
482 "Enable FAMIN and FAMAX instructions">;
483
484def FeatureLUT: ExtensionWithMArch<"lut", "LUT", "FEAT_LUT",
485 "Enable Lookup Table instructions">;
486
487def FeatureFP8 : ExtensionWithMArch<"fp8", "FP8", "FEAT_FP8",
488  "Enable FP8 instructions", [FeatureFAMINMAX, FeatureLUT, FeatureBF16]>;
489
490def FeatureFP8FMA : ExtensionWithMArch<"fp8fma", "FP8FMA", "FEAT_FP8FMA",
491  "Enable Armv9.5-A FP8 multiply-add instructions", [FeatureFP8]>;
492
493def FeatureSSVE_FP8FMA : ExtensionWithMArch<"ssve-fp8fma", "SSVE_FP8FMA", "FEAT_SSVE_FP8FMA",
494  "Enable SVE2 FP8 multiply-add instructions", [FeatureSME2, FeatureFP8]>;
495
496def FeatureFP8DOT4: ExtensionWithMArch<"fp8dot4", "FP8DOT4", "FEAT_FP8DOT4",
497  "Enable FP8 4-way dot instructions", [FeatureFP8FMA]>;
498
499def FeatureFP8DOT2: ExtensionWithMArch<"fp8dot2", "FP8DOT2", "FEAT_FP8DOT2",
500  "Enable FP8 2-way dot instructions", [FeatureFP8DOT4]>;
501
502def FeatureSSVE_FP8DOT4 : ExtensionWithMArch<"ssve-fp8dot4", "SSVE_FP8DOT4", "FEAT_SSVE_FP8DOT4",
503  "Enable SVE2 FP8 4-way dot product instructions", [FeatureSSVE_FP8FMA]>;
504
505def FeatureSSVE_FP8DOT2 : ExtensionWithMArch<"ssve-fp8dot2", "SSVE_FP8DOT2", "FEAT_SSVE_FP8DOT2",
506  "Enable SVE2 FP8 2-way dot product instructions", [FeatureSSVE_FP8DOT4]>;
507
508def FeatureSME_LUTv2 : ExtensionWithMArch<"sme-lutv2", "SME_LUTv2", "FEAT_SME_LUTv2",
509  "Enable Scalable Matrix Extension (SME) LUTv2 instructions">;
510
511def FeatureSMEF8F32 : ExtensionWithMArch<"sme-f8f32", "SMEF8F32", "FEAT_SME_F8F32",
512  "Enable Scalable Matrix Extension (SME) F8F32 instructions", [FeatureSME2, FeatureFP8]>;
513
514def FeatureSMEF8F16 : ExtensionWithMArch<"sme-f8f16", "SMEF8F16", "FEAT_SME_F8F16",
515  "Enable Scalable Matrix Extension (SME) F8F16 instructions", [FeatureSMEF8F32]>;
516
517def FeatureCPA : ExtensionWithMArch<"cpa", "CPA", "FEAT_CPA",
518  "Enable Armv9.5-A Checked Pointer Arithmetic">;
519
520def FeaturePAuthLR : ExtensionWithMArch<"pauth-lr", "PAuthLR", "FEAT_PAuth_LR",
521  "Enable Armv9.5-A PAC enhancements">;
522
523def FeatureTLBIW : ExtensionWithMArch<"tlbiw", "TLBIW", "FEAT_TLBIW",
524  "Enable Armv9.5-A TLBI VMALL for Dirty State">;
525
526//===----------------------------------------------------------------------===//
527//  Other Features
528//===----------------------------------------------------------------------===//
529
530def FeatureOutlineAtomics : SubtargetFeature<"outline-atomics", "OutlineAtomics", "true",
531  "Enable out of line atomics to support LSE instructions">;
532
533def FeatureFMV : SubtargetFeature<"fmv", "HasFMV", "true",
534  "Enable Function Multi Versioning support.">;
535
536// This flag is currently still labeled as Experimental, but when fully
537// implemented this should tell the compiler to use the zeroing pseudos to
538// benefit from the reverse instructions (e.g. SUB vs SUBR) if the inactive
539// lanes are known to be zero. The pseudos will then be expanded using the
540// MOVPRFX instruction to zero the inactive lanes. This feature should only be
541// enabled if MOVPRFX instructions are known to merge with the destructive
542// operations they prefix.
543//
544// This feature could similarly be extended to support cheap merging of _any_
545// value into the inactive lanes using the MOVPRFX instruction that uses
546// merging-predication.
547def FeatureExperimentalZeroingPseudos
548    : SubtargetFeature<"use-experimental-zeroing-pseudos",
549                       "UseExperimentalZeroingPseudos", "true",
550                       "Hint to the compiler that the MOVPRFX instruction is "
551                       "merged with destructive operations",
552                       []>;
553
554def FeatureNoSVEFPLD1R : SubtargetFeature<"no-sve-fp-ld1r",
555  "NoSVEFPLD1R", "true", "Avoid using LD1RX instructions for FP">;
556
557def FeatureZCRegMove : SubtargetFeature<"zcm", "HasZeroCycleRegMove", "true",
558                                        "Has zero-cycle register moves">;
559
560def FeatureZCZeroingGP : SubtargetFeature<"zcz-gp", "HasZeroCycleZeroingGP", "true",
561                                        "Has zero-cycle zeroing instructions for generic registers">;
562
563// It is generally beneficial to rewrite "fmov s0, wzr" to "movi d0, #0".
564// as movi is more efficient across all cores. Newer cores can eliminate
565// fmovs early and there is no difference with movi, but this not true for
566// all implementations.
567def FeatureNoZCZeroingFP : SubtargetFeature<"no-zcz-fp", "HasZeroCycleZeroingFP", "false",
568                                        "Has no zero-cycle zeroing instructions for FP registers">;
569
570def FeatureZCZeroing : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
571                                        "Has zero-cycle zeroing instructions",
572                                        [FeatureZCZeroingGP]>;
573
574/// ... but the floating-point version doesn't quite work in rare cases on older
575/// CPUs.
576def FeatureZCZeroingFPWorkaround : SubtargetFeature<"zcz-fp-workaround",
577    "HasZeroCycleZeroingFPWorkaround", "true",
578    "The zero-cycle floating-point zeroing instruction has a bug">;
579
580def FeatureStrictAlign : SubtargetFeature<"strict-align",
581                                          "RequiresStrictAlign", "true",
582                                          "Disallow all unaligned memory "
583                                          "access">;
584
585foreach i = {1-7,9-15,18,20-28} in
586    def FeatureReserveX#i : SubtargetFeature<"reserve-x"#i, "ReserveXRegister["#i#"]", "true",
587                                             "Reserve X"#i#", making it unavailable "
588                                             "as a GPR">;
589
590def FeatureReserveLRForRA : SubtargetFeature<"reserve-lr-for-ra",
591                                             "ReserveLRForRA", "true",
592                                             "Reserve LR for call use only">;
593
594foreach i = {8-15,18} in
595    def FeatureCallSavedX#i : SubtargetFeature<"call-saved-x"#i,
596         "CustomCallSavedXRegs["#i#"]", "true", "Make X"#i#" callee saved.">;
597
598def FeatureBalanceFPOps : SubtargetFeature<"balance-fp-ops", "BalanceFPOps",
599    "true",
600    "balance mix of odd and even D-registers for fp multiply(-accumulate) ops">;
601
602def FeaturePredictableSelectIsExpensive : SubtargetFeature<
603    "predictable-select-expensive", "PredictableSelectIsExpensive", "true",
604    "Prefer likely predicted branches over selects">;
605
606def FeatureEnableSelectOptimize : SubtargetFeature<
607    "enable-select-opt", "EnableSelectOptimize", "true",
608    "Enable the select optimize pass for select loop heuristics">;
609
610def FeatureExynosCheapAsMoveHandling : SubtargetFeature<"exynos-cheap-as-move",
611    "HasExynosCheapAsMoveHandling", "true",
612    "Use Exynos specific handling of cheap instructions">;
613
614def FeaturePostRAScheduler : SubtargetFeature<"use-postra-scheduler",
615    "UsePostRAScheduler", "true", "Schedule again after register allocation">;
616
617def FeatureSlowMisaligned128Store : SubtargetFeature<"slow-misaligned-128store",
618    "IsMisaligned128StoreSlow", "true", "Misaligned 128 bit stores are slow">;
619
620def FeatureSlowPaired128 : SubtargetFeature<"slow-paired-128",
621    "IsPaired128Slow", "true", "Paired 128 bit loads and stores are slow">;
622
623def FeatureAscendStoreAddress : SubtargetFeature<"ascend-store-address",
624    "IsStoreAddressAscend", "true",
625    "Schedule vector stores by ascending address">;
626
627def FeatureSlowSTRQro : SubtargetFeature<"slow-strqro-store", "IsSTRQroSlow",
628    "true", "STR of Q register with register offset is slow">;
629
630def FeatureAlternateSExtLoadCVTF32Pattern : SubtargetFeature<
631    "alternate-sextload-cvt-f32-pattern", "UseAlternateSExtLoadCVTF32Pattern",
632    "true", "Use alternative pattern for sextload convert to f32">;
633
634def FeatureArithmeticBccFusion : SubtargetFeature<
635    "arith-bcc-fusion", "HasArithmeticBccFusion", "true",
636    "CPU fuses arithmetic+bcc operations">;
637
638def FeatureArithmeticCbzFusion : SubtargetFeature<
639    "arith-cbz-fusion", "HasArithmeticCbzFusion", "true",
640    "CPU fuses arithmetic + cbz/cbnz operations">;
641
642def FeatureCmpBccFusion : SubtargetFeature<
643    "cmp-bcc-fusion", "HasCmpBccFusion", "true",
644    "CPU fuses cmp+bcc operations">;
645
646def FeatureFuseAddress : SubtargetFeature<
647    "fuse-address", "HasFuseAddress", "true",
648    "CPU fuses address generation and memory operations">;
649
650def FeatureFuseAES : SubtargetFeature<
651    "fuse-aes", "HasFuseAES", "true",
652    "CPU fuses AES crypto operations">;
653
654def FeatureFuseArithmeticLogic : SubtargetFeature<
655    "fuse-arith-logic", "HasFuseArithmeticLogic", "true",
656    "CPU fuses arithmetic and logic operations">;
657
658def FeatureFuseCCSelect : SubtargetFeature<
659    "fuse-csel", "HasFuseCCSelect", "true",
660    "CPU fuses conditional select operations">;
661
662def FeatureFuseCryptoEOR : SubtargetFeature<
663    "fuse-crypto-eor", "HasFuseCryptoEOR", "true",
664    "CPU fuses AES/PMULL and EOR operations">;
665
666def FeatureFuseAdrpAdd : SubtargetFeature<
667    "fuse-adrp-add", "HasFuseAdrpAdd", "true",
668    "CPU fuses adrp+add operations">;
669
670def FeatureFuseLiterals : SubtargetFeature<
671    "fuse-literals", "HasFuseLiterals", "true",
672    "CPU fuses literal generation operations">;
673
674def FeatureFuseAddSub2RegAndConstOne : SubtargetFeature<
675   "fuse-addsub-2reg-const1", "HasFuseAddSub2RegAndConstOne", "true",
676   "CPU fuses (a + b + 1) and (a - b - 1)">;
677
678def FeatureDisableLatencySchedHeuristic : SubtargetFeature<
679    "disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
680    "Disable latency scheduling heuristic">;
681
682def FeatureStorePairSuppress : SubtargetFeature<
683    "store-pair-suppress", "EnableStorePairSuppress", "true",
684    "Enable Store Pair Suppression heuristics">;
685
686def FeatureForce32BitJumpTables
687   : SubtargetFeature<"force-32bit-jump-tables", "Force32BitJumpTables", "true",
688                      "Force jump table entries to be 32-bits wide except at MinSize">;
689
690def FeatureUseRSqrt : SubtargetFeature<
691    "use-reciprocal-square-root", "UseRSqrt", "true",
692    "Use the reciprocal square root approximation">;
693
694def FeatureNoNegativeImmediates : SubtargetFeature<"no-neg-immediates",
695                                        "NegativeImmediates", "false",
696                                        "Convert immediates and instructions "
697                                        "to their negated or complemented "
698                                        "equivalent when the immediate does "
699                                        "not fit in the encoding.">;
700
701// Address operands with shift amount 2 or 3 are fast on all Arm chips except
702// some old Apple cores (A7-A10?) which handle all shifts slowly. Cortex-A57
703// and derived designs through Cortex-X1 take an extra micro-op for shifts
704// of 1 or 4. Other Arm chips handle all shifted operands at the same speed
705// as unshifted operands.
706//
707// We don't try to model the behavior of the old Apple cores because new code
708// targeting A7 is very unlikely to actually run on an A7. The Cortex cores
709// are modeled by FeatureAddrLSLSlow14.
710def FeatureAddrLSLSlow14 : SubtargetFeature<
711    "addr-lsl-slow-14", "HasAddrLSLSlow14", "true",
712    "Address operands with shift amount of 1 or 4 are slow">;
713
714def FeatureALULSLFast : SubtargetFeature<
715    "alu-lsl-fast", "HasALULSLFast", "true",
716    "Add/Sub operations with lsl shift <= 4 are cheap">;
717
718def FeatureAggressiveFMA :
719  SubtargetFeature<"aggressive-fma",
720                   "HasAggressiveFMA",
721                   "true",
722                   "Enable Aggressive FMA for floating-point.">;
723
724def FeatureTaggedGlobals : SubtargetFeature<"tagged-globals",
725    "AllowTaggedGlobals",
726    "true", "Use an instruction sequence for taking the address of a global "
727    "that allows a memory tag in the upper address bits">;
728
729def FeatureAppleA7SysReg  : SubtargetFeature<"apple-a7-sysreg", "HasAppleA7SysReg", "true",
730  "Apple A7 (the CPU formerly known as Cyclone)">;
731
732def FeatureEL2VMSA : SubtargetFeature<"el2vmsa", "HasEL2VMSA", "true",
733  "Enable Exception Level 2 Virtual Memory System Architecture">;
734
735def FeatureEL3 : SubtargetFeature<"el3", "HasEL3", "true",
736  "Enable Exception Level 3">;
737
738def FeatureFixCortexA53_835769 : SubtargetFeature<"fix-cortex-a53-835769",
739  "FixCortexA53_835769", "true", "Mitigate Cortex-A53 Erratum 835769">;
740
741def FeatureNoBTIAtReturnTwice : SubtargetFeature<"no-bti-at-return-twice",
742                                                 "NoBTIAtReturnTwice", "true",
743                                                 "Don't place a BTI instruction "
744                                                 "after a return-twice">;
745
746def FeatureDisableLdp : SubtargetFeature<"disable-ldp", "HasDisableLdp",
747    "true", "Do not emit ldp">;
748
749def FeatureDisableStp : SubtargetFeature<"disable-stp", "HasDisableStp",
750    "true", "Do not emit stp">;
751
752def FeatureLdpAlignedOnly : SubtargetFeature<"ldp-aligned-only", "HasLdpAlignedOnly",
753    "true", "In order to emit ldp, first check if the load will be aligned to 2 * element_size">;
754
755def FeatureStpAlignedOnly : SubtargetFeature<"stp-aligned-only", "HasStpAlignedOnly",
756    "true", "In order to emit stp, first check if the store will be aligned to 2 * element_size">;
757
758//===----------------------------------------------------------------------===//
759// Architectures.
760//
761class Architecture64<
762  int major, int minor, string profile,
763  string target_feature_name,
764  list<SubtargetFeature> implied_features,
765  list<Extension> default_extensions
766> : SubtargetFeature<target_feature_name,
767    "HasV" # major # "_" # minor # profile # "Ops", "true",
768    "Support ARM " # target_feature_name # " architecture",
769    implied_features
770> {
771  int Major = major;
772  int Minor = minor;
773  string Profile = profile;
774
775  // Extensions enabled by default. Not the same as implied SubtargetFeatures.
776  list<Extension> DefaultExts = default_extensions;
777}
778
779def HasV8_0aOps : Architecture64<8, 0, "a", "v8a",
780  [FeatureEL2VMSA, FeatureEL3],
781  [FeatureFPARMv8, FeatureNEON]>;
782def HasV8_1aOps : Architecture64<8, 1, "a", "v8.1a",
783  [HasV8_0aOps, FeatureCRC, FeatureLSE, FeatureRDM, FeaturePAN, FeatureLOR,
784   FeatureVH],
785  !listconcat(HasV8_0aOps.DefaultExts, [FeatureCRC, FeatureLSE, FeatureRDM])>;
786def HasV8_2aOps : Architecture64<8, 2, "a", "v8.2a",
787  [HasV8_1aOps, FeaturePsUAO, FeaturePAN_RWV, FeatureRAS, FeatureCCPP],
788  !listconcat(HasV8_1aOps.DefaultExts, [FeatureRAS])>;
789def HasV8_3aOps : Architecture64<8, 3, "a", "v8.3a",
790  [HasV8_2aOps, FeatureRCPC, FeaturePAuth, FeatureJS, FeatureComplxNum],
791  !listconcat(HasV8_2aOps.DefaultExts, [FeatureComplxNum, FeatureJS,
792    FeaturePAuth, FeatureRCPC,  FeatureCCIDX])>;
793def HasV8_4aOps : Architecture64<8, 4, "a", "v8.4a",
794  [HasV8_3aOps, FeatureDotProd, FeatureNV, FeatureMPAM, FeatureDIT,
795    FeatureTRACEV8_4, FeatureAM, FeatureSEL2, FeatureTLB_RMI, FeatureFlagM,
796    FeatureRCPC_IMMO, FeatureLSE2],
797  !listconcat(HasV8_3aOps.DefaultExts, [FeatureDotProd, FeatureDIT, FeatureFlagM])>;
798def HasV8_5aOps : Architecture64<8, 5, "a", "v8.5a",
799  [HasV8_4aOps, FeatureAltFPCmp, FeatureFRInt3264, FeatureSpecRestrict,
800    FeatureSB, FeaturePredRes, FeatureCacheDeepPersist,
801    FeatureBranchTargetId],
802  !listconcat(HasV8_4aOps.DefaultExts, [FeaturePredRes, FeatureSSBS, FeatureBranchTargetId, FeatureSB])>;
803def HasV8_6aOps : Architecture64<8, 6, "a", "v8.6a",
804  [HasV8_5aOps, FeatureAMVS, FeatureBF16, FeatureFineGrainedTraps,
805    FeatureEnhancedCounterVirtualization, FeatureMatMulInt8],
806  !listconcat(HasV8_5aOps.DefaultExts, [FeatureBF16, FeatureMatMulInt8])>;
807def HasV8_7aOps : Architecture64<8, 7, "a", "v8.7a",
808  [HasV8_6aOps, FeatureXS, FeatureWFxT, FeatureHCX],
809  !listconcat(HasV8_6aOps.DefaultExts, [FeatureWFxT])>;
810def HasV8_8aOps : Architecture64<8, 8, "a", "v8.8a",
811  [HasV8_7aOps, FeatureHBC, FeatureMOPS, FeatureNMI],
812  !listconcat(HasV8_7aOps.DefaultExts, [FeatureMOPS, FeatureHBC])>;
813def HasV8_9aOps : Architecture64<8, 9, "a", "v8.9a",
814  [HasV8_8aOps, FeatureCLRBHB, FeaturePRFM_SLC, FeatureSPECRES2,
815   FeatureCSSC, FeatureRASv2, FeatureCHK],
816  !listconcat(HasV8_8aOps.DefaultExts, [FeatureSPECRES2, FeatureCSSC,
817    FeatureRASv2])>;
818def HasV9_0aOps : Architecture64<9, 0, "a", "v9a",
819  [HasV8_5aOps],
820  !listconcat(HasV8_5aOps.DefaultExts, [FeatureFullFP16, FeatureSVE,
821    FeatureSVE2])>;
822def HasV9_1aOps : Architecture64<9, 1, "a", "v9.1a",
823  [HasV8_6aOps, HasV9_0aOps],
824  !listconcat(HasV9_0aOps.DefaultExts, [FeatureBF16, FeatureMatMulInt8, FeatureRME])>;
825def HasV9_2aOps : Architecture64<9, 2, "a", "v9.2a",
826  [HasV8_7aOps, HasV9_1aOps],
827  !listconcat(HasV9_1aOps.DefaultExts, [FeatureMEC, FeatureWFxT])>;
828def HasV9_3aOps : Architecture64<9, 3, "a", "v9.3a",
829  [HasV8_8aOps, HasV9_2aOps],
830  !listconcat(HasV9_2aOps.DefaultExts, [FeatureMOPS, FeatureHBC])>;
831def HasV9_4aOps : Architecture64<9, 4, "a", "v9.4a",
832  [HasV8_9aOps, HasV9_3aOps],
833  !listconcat(HasV9_3aOps.DefaultExts, [FeatureSPECRES2, FeatureCSSC,
834    FeatureRASv2])>;
835def HasV9_5aOps : Architecture64<9, 5, "a", "v9.5a",
836  [HasV9_4aOps, FeatureCPA],
837  !listconcat(HasV9_4aOps.DefaultExts, [FeatureCPA,  FeatureLUT, FeatureFAMINMAX])>;
838def HasV8_0rOps : Architecture64<8, 0, "r", "v8r",
839  [ //v8.1
840    FeatureCRC, FeaturePAN, FeatureLSE, FeatureCONTEXTIDREL2,
841    //v8.2
842    FeatureRAS, FeaturePsUAO, FeatureCCPP, FeaturePAN_RWV,
843    //v8.3
844    FeaturePAuth, FeatureRCPC,
845    //v8.4
846    FeatureTRACEV8_4, FeatureTLB_RMI, FeatureFlagM, FeatureDIT, FeatureSEL2,
847    FeatureRCPC_IMMO,
848    // Not mandatory in v8.0-R, but included here on the grounds that it
849    // only enables names of system registers
850    FeatureSpecRestrict
851  ],
852  // For v8-R, we do not enable crypto and align with GCC that enables a more
853  // minimal set of optional architecture extensions.
854  !listconcat(
855    !listremove(HasV8_5aOps.DefaultExts, [FeatureBranchTargetId, FeaturePredRes]),
856    [FeatureSSBS, FeatureFullFP16, FeatureFP16FML, FeatureSB]
857  )>;
858
859//===----------------------------------------------------------------------===//
860// Access to privileged registers
861//===----------------------------------------------------------------------===//
862
863foreach i = 1-3 in
864def FeatureUseEL#i#ForTP : SubtargetFeature<"tpidr-el"#i, "UseEL"#i#"ForTP",
865  "true", "Permit use of TPIDR_EL"#i#" for the TLS base">;
866def FeatureUseROEL0ForTP : SubtargetFeature<"tpidrro-el0", "UseROEL0ForTP",
867  "true", "Permit use of TPIDRRO_EL0 for the TLS base">;
868
869//===----------------------------------------------------------------------===//
870// Control codegen mitigation against Straight Line Speculation vulnerability.
871//===----------------------------------------------------------------------===//
872
873def FeatureHardenSlsRetBr : SubtargetFeature<"harden-sls-retbr",
874  "HardenSlsRetBr", "true",
875  "Harden against straight line speculation across RET and BR instructions">;
876def FeatureHardenSlsBlr : SubtargetFeature<"harden-sls-blr",
877  "HardenSlsBlr", "true",
878  "Harden against straight line speculation across BLR instructions">;
879def FeatureHardenSlsNoComdat : SubtargetFeature<"harden-sls-nocomdat",
880  "HardenSlsNoComdat", "true",
881  "Generate thunk code for SLS mitigation in the normal text section">;
882
883
884// Only intended to be used by disassemblers.
885def FeatureAll
886    : SubtargetFeature<"all", "IsAll", "true", "Enable all instructions">;
887