xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SystemOperands.td (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1//===- AArch64SystemOperands.td ----------------------------*- 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// This file defines the symbolic operands permitted for various kinds of
10// AArch64 system instruction.
11//
12//===----------------------------------------------------------------------===//
13
14include "llvm/TableGen/SearchableTable.td"
15
16//===----------------------------------------------------------------------===//
17// Features that, for the compiler, only enable system operands and PStates
18//===----------------------------------------------------------------------===//
19
20def HasCCPP    : Predicate<"Subtarget->hasCCPP()">,
21                 AssemblerPredicateWithAll<(all_of FeatureCCPP), "ccpp">;
22
23def HasPAN     : Predicate<"Subtarget->hasPAN()">,
24                 AssemblerPredicateWithAll<(all_of FeaturePAN),
25                 "ARM v8.1  Privileged Access-Never extension">;
26
27def HasPsUAO   : Predicate<"Subtarget->hasPsUAO()">,
28                 AssemblerPredicateWithAll<(all_of FeaturePsUAO),
29                 "ARM v8.2 UAO PState extension (psuao)">;
30
31def HasPAN_RWV : Predicate<"Subtarget->hasPAN_RWV()">,
32                 AssemblerPredicateWithAll<(all_of FeaturePAN_RWV),
33                 "ARM v8.2 PAN AT S1E1R and AT S1E1W Variation">;
34
35def HasCONTEXTIDREL2
36               : Predicate<"Subtarget->hasCONTEXTIDREL2()">,
37                 AssemblerPredicateWithAll<(all_of FeatureCONTEXTIDREL2),
38                 "Target contains CONTEXTIDR_EL2 RW operand">;
39
40//===----------------------------------------------------------------------===//
41// AT (address translate) instruction options.
42//===----------------------------------------------------------------------===//
43
44class AT<string name, bits<3> op1, bits<4> crn, bits<4> crm,
45         bits<3> op2> : SearchableTable {
46  let SearchableFields = ["Name", "Encoding"];
47  let EnumValueField = "Encoding";
48
49  string Name = name;
50  bits<14> Encoding;
51  let Encoding{13-11} = op1;
52  let Encoding{10-7} = crn;
53  let Encoding{6-3} = crm;
54  let Encoding{2-0} = op2;
55  code Requires = [{ {} }];
56}
57
58def : AT<"S1E1R",  0b000, 0b0111, 0b1000, 0b000>;
59def : AT<"S1E2R",  0b100, 0b0111, 0b1000, 0b000>;
60def : AT<"S1E3R",  0b110, 0b0111, 0b1000, 0b000>;
61def : AT<"S1E1W",  0b000, 0b0111, 0b1000, 0b001>;
62def : AT<"S1E2W",  0b100, 0b0111, 0b1000, 0b001>;
63def : AT<"S1E3W",  0b110, 0b0111, 0b1000, 0b001>;
64def : AT<"S1E0R",  0b000, 0b0111, 0b1000, 0b010>;
65def : AT<"S1E0W",  0b000, 0b0111, 0b1000, 0b011>;
66def : AT<"S12E1R", 0b100, 0b0111, 0b1000, 0b100>;
67def : AT<"S12E1W", 0b100, 0b0111, 0b1000, 0b101>;
68def : AT<"S12E0R", 0b100, 0b0111, 0b1000, 0b110>;
69def : AT<"S12E0W", 0b100, 0b0111, 0b1000, 0b111>;
70
71let Requires = [{ {AArch64::FeaturePAN_RWV} }] in {
72def : AT<"S1E1RP", 0b000, 0b0111, 0b1001, 0b000>;
73def : AT<"S1E1WP", 0b000, 0b0111, 0b1001, 0b001>;
74}
75
76// v8.9a/v9.4a FEAT_ATS1A
77def : AT<"S1E1A", 0b000, 0b0111, 0b1001, 0b010>;
78def : AT<"S1E2A", 0b100, 0b0111, 0b1001, 0b010>;
79def : AT<"S1E3A", 0b110, 0b0111, 0b1001, 0b010>;
80
81//===----------------------------------------------------------------------===//
82// DMB/DSB (data barrier) instruction options.
83//===----------------------------------------------------------------------===//
84
85class DB<string name, bits<4> encoding> : SearchableTable {
86  let SearchableFields = ["Name", "Encoding"];
87  let EnumValueField = "Encoding";
88
89  string Name = name;
90  bits<4> Encoding = encoding;
91}
92
93def : DB<"oshld", 0x1>;
94def : DB<"oshst", 0x2>;
95def : DB<"osh",   0x3>;
96def : DB<"nshld", 0x5>;
97def : DB<"nshst", 0x6>;
98def : DB<"nsh",   0x7>;
99def : DB<"ishld", 0x9>;
100def : DB<"ishst", 0xa>;
101def : DB<"ish",   0xb>;
102def : DB<"ld",    0xd>;
103def : DB<"st",    0xe>;
104def : DB<"sy",    0xf>;
105
106class DBnXS<string name, bits<4> encoding, bits<5> immValue> : SearchableTable {
107  let SearchableFields = ["Name", "Encoding", "ImmValue"];
108  let EnumValueField = "Encoding";
109
110  string Name = name;
111  bits<4> Encoding = encoding;
112  bits<5> ImmValue = immValue;
113  code Requires = [{ {AArch64::FeatureXS} }];
114}
115
116def : DBnXS<"oshnxs", 0x3, 0x10>;
117def : DBnXS<"nshnxs", 0x7, 0x14>;
118def : DBnXS<"ishnxs", 0xb, 0x18>;
119def : DBnXS<"synxs",  0xf, 0x1c>;
120
121//===----------------------------------------------------------------------===//
122// DC (data cache maintenance) instruction options.
123//===----------------------------------------------------------------------===//
124
125class DC<string name, bits<3> op1, bits<4> crn, bits<4> crm,
126         bits<3> op2> : SearchableTable {
127  let SearchableFields = ["Name", "Encoding"];
128  let EnumValueField = "Encoding";
129
130  string Name = name;
131  bits<14> Encoding;
132  let Encoding{13-11} = op1;
133  let Encoding{10-7} = crn;
134  let Encoding{6-3} = crm;
135  let Encoding{2-0} = op2;
136  code Requires = [{ {} }];
137}
138
139def : DC<"ZVA",   0b011, 0b0111, 0b0100, 0b001>;
140def : DC<"IVAC",  0b000, 0b0111, 0b0110, 0b001>;
141def : DC<"ISW",   0b000, 0b0111, 0b0110, 0b010>;
142def : DC<"CVAC",  0b011, 0b0111, 0b1010, 0b001>;
143def : DC<"CSW",   0b000, 0b0111, 0b1010, 0b010>;
144def : DC<"CVAU",  0b011, 0b0111, 0b1011, 0b001>;
145def : DC<"CIVAC", 0b011, 0b0111, 0b1110, 0b001>;
146def : DC<"CISW",  0b000, 0b0111, 0b1110, 0b010>;
147
148let Requires = [{ {AArch64::FeatureCCPP} }] in
149def : DC<"CVAP",  0b011, 0b0111, 0b1100, 0b001>;
150
151let Requires = [{ {AArch64::FeatureCacheDeepPersist} }] in
152def : DC<"CVADP",  0b011, 0b0111, 0b1101, 0b001>;
153
154let Requires = [{ {AArch64::FeatureMTE} }] in {
155def : DC<"IGVAC",   0b000, 0b0111, 0b0110, 0b011>;
156def : DC<"IGSW",    0b000, 0b0111, 0b0110, 0b100>;
157def : DC<"CGSW",    0b000, 0b0111, 0b1010, 0b100>;
158def : DC<"CIGSW",   0b000, 0b0111, 0b1110, 0b100>;
159def : DC<"CGVAC",   0b011, 0b0111, 0b1010, 0b011>;
160def : DC<"CGVAP",   0b011, 0b0111, 0b1100, 0b011>;
161def : DC<"CGVADP",  0b011, 0b0111, 0b1101, 0b011>;
162def : DC<"CIGVAC",  0b011, 0b0111, 0b1110, 0b011>;
163def : DC<"GVA",     0b011, 0b0111, 0b0100, 0b011>;
164def : DC<"IGDVAC",  0b000, 0b0111, 0b0110, 0b101>;
165def : DC<"IGDSW",   0b000, 0b0111, 0b0110, 0b110>;
166def : DC<"CGDSW",   0b000, 0b0111, 0b1010, 0b110>;
167def : DC<"CIGDSW",  0b000, 0b0111, 0b1110, 0b110>;
168def : DC<"CGDVAC",  0b011, 0b0111, 0b1010, 0b101>;
169def : DC<"CGDVAP",  0b011, 0b0111, 0b1100, 0b101>;
170def : DC<"CGDVADP", 0b011, 0b0111, 0b1101, 0b101>;
171def : DC<"CIGDVAC", 0b011, 0b0111, 0b1110, 0b101>;
172def : DC<"GZVA",    0b011, 0b0111, 0b0100, 0b100>;
173}
174
175let Requires = [{ {AArch64::FeatureMEC} }] in {
176def : DC<"CIPAE",   0b100, 0b0111, 0b1110, 0b000>;
177def : DC<"CIGDPAE", 0b100, 0b0111, 0b1110, 0b111>;
178}
179
180//===----------------------------------------------------------------------===//
181// IC (instruction cache maintenance) instruction options.
182//===----------------------------------------------------------------------===//
183
184class IC<string name, bits<3> op1, bits<4> crn, bits<4> crm, bits<3> op2,
185         bit needsreg> : SearchableTable {
186  let SearchableFields = ["Name", "Encoding"];
187  let EnumValueField = "Encoding";
188
189  string Name = name;
190  bits<14> Encoding;
191  let Encoding{13-11} = op1;
192  let Encoding{10-7} = crn;
193  let Encoding{6-3} = crm;
194  let Encoding{2-0} = op2;
195  bit NeedsReg = needsreg;
196}
197
198def : IC<"IALLUIS", 0b000, 0b0111, 0b0001, 0b000, 0>;
199def : IC<"IALLU",   0b000, 0b0111, 0b0101, 0b000, 0>;
200def : IC<"IVAU",    0b011, 0b0111, 0b0101, 0b001, 1>;
201
202//===----------------------------------------------------------------------===//
203// ISB (instruction-fetch barrier) instruction options.
204//===----------------------------------------------------------------------===//
205
206class ISB<string name, bits<4> encoding> : SearchableTable{
207  let SearchableFields = ["Name", "Encoding"];
208  let EnumValueField = "Encoding";
209
210  string Name = name;
211  bits<4> Encoding;
212  let Encoding = encoding;
213}
214
215def : ISB<"sy", 0xf>;
216
217//===----------------------------------------------------------------------===//
218// TSB (Trace synchronization barrier) instruction options.
219//===----------------------------------------------------------------------===//
220
221class TSB<string name, bits<4> encoding> : SearchableTable{
222  let SearchableFields = ["Name", "Encoding"];
223  let EnumValueField = "Encoding";
224
225  string Name = name;
226  bits<4> Encoding;
227  let Encoding = encoding;
228
229  code Requires = [{ {AArch64::FeatureTRACEV8_4} }];
230}
231
232def : TSB<"csync", 0>;
233
234//===----------------------------------------------------------------------===//
235// PRFM (prefetch) instruction options.
236//===----------------------------------------------------------------------===//
237
238class PRFM<string type,   bits<2> type_encoding,
239           string target, bits<2> target_encoding,
240           string policy, bits<1> policy_encoding> : SearchableTable {
241  let SearchableFields = ["Name", "Encoding"];
242  let EnumValueField = "Encoding";
243
244  string Name = type # target # policy;
245  bits<5> Encoding;
246  let Encoding{4-3} = type_encoding;
247  let Encoding{2-1} = target_encoding;
248  let Encoding{0} = policy_encoding;
249
250  code Requires = [{ {} }];
251}
252
253def : PRFM<"pld", 0b00, "l1",  0b00, "keep", 0b0>;
254def : PRFM<"pld", 0b00, "l1",  0b00, "strm", 0b1>;
255def : PRFM<"pld", 0b00, "l2",  0b01, "keep", 0b0>;
256def : PRFM<"pld", 0b00, "l2",  0b01, "strm", 0b1>;
257def : PRFM<"pld", 0b00, "l3",  0b10, "keep", 0b0>;
258def : PRFM<"pld", 0b00, "l3",  0b10, "strm", 0b1>;
259let Requires = [{ {AArch64::FeaturePRFM_SLC} }] in {
260def : PRFM<"pld", 0b00, "slc", 0b11, "keep", 0b0>;
261def : PRFM<"pld", 0b00, "slc", 0b11, "strm", 0b1>;
262}
263def : PRFM<"pli", 0b01, "l1",  0b00, "keep", 0b0>;
264def : PRFM<"pli", 0b01, "l1",  0b00, "strm", 0b1>;
265def : PRFM<"pli", 0b01, "l2",  0b01, "keep", 0b0>;
266def : PRFM<"pli", 0b01, "l2",  0b01, "strm", 0b1>;
267def : PRFM<"pli", 0b01, "l3",  0b10, "keep", 0b0>;
268def : PRFM<"pli", 0b01, "l3",  0b10, "strm", 0b1>;
269let Requires = [{ {AArch64::FeaturePRFM_SLC} }] in {
270def : PRFM<"pli", 0b01, "slc", 0b11, "keep", 0b0>;
271def : PRFM<"pli", 0b01, "slc", 0b11, "strm", 0b1>;
272}
273def : PRFM<"pst", 0b10, "l1",  0b00, "keep", 0b0>;
274def : PRFM<"pst", 0b10, "l1",  0b00, "strm", 0b1>;
275def : PRFM<"pst", 0b10, "l2",  0b01, "keep", 0b0>;
276def : PRFM<"pst", 0b10, "l2",  0b01, "strm", 0b1>;
277def : PRFM<"pst", 0b10, "l3",  0b10, "keep", 0b0>;
278def : PRFM<"pst", 0b10, "l3",  0b10, "strm", 0b1>;
279let Requires = [{ {AArch64::FeaturePRFM_SLC} }] in {
280def : PRFM<"pst", 0b10, "slc", 0b11, "keep", 0b0>;
281def : PRFM<"pst", 0b10, "slc", 0b11, "strm", 0b1>;
282}
283
284//===----------------------------------------------------------------------===//
285// SVE Prefetch instruction options.
286//===----------------------------------------------------------------------===//
287
288class SVEPRFM<string name, bits<4> encoding> : SearchableTable {
289  let SearchableFields = ["Name", "Encoding"];
290  let EnumValueField = "Encoding";
291
292  string Name = name;
293  bits<4> Encoding;
294  let Encoding = encoding;
295  code Requires = [{ {} }];
296}
297
298let Requires = [{ {AArch64::FeatureSVE} }] in {
299def : SVEPRFM<"pldl1keep", 0x00>;
300def : SVEPRFM<"pldl1strm", 0x01>;
301def : SVEPRFM<"pldl2keep", 0x02>;
302def : SVEPRFM<"pldl2strm", 0x03>;
303def : SVEPRFM<"pldl3keep", 0x04>;
304def : SVEPRFM<"pldl3strm", 0x05>;
305def : SVEPRFM<"pstl1keep", 0x08>;
306def : SVEPRFM<"pstl1strm", 0x09>;
307def : SVEPRFM<"pstl2keep", 0x0a>;
308def : SVEPRFM<"pstl2strm", 0x0b>;
309def : SVEPRFM<"pstl3keep", 0x0c>;
310def : SVEPRFM<"pstl3strm", 0x0d>;
311}
312
313//===----------------------------------------------------------------------===//
314// RPRFM (prefetch) instruction options.
315//===----------------------------------------------------------------------===//
316
317class RPRFM<string name, bits<1> type_encoding, bits<5> policy_encoding> : SearchableTable {
318  let SearchableFields = ["Name", "Encoding"];
319  let EnumValueField = "Encoding";
320
321  string Name = name;
322  bits<6> Encoding;
323  let Encoding{0} = type_encoding;
324  let Encoding{5-1} = policy_encoding;
325  code Requires = [{ {} }];
326}
327
328def : RPRFM<"pldkeep", 0b0, 0b00000>;
329def : RPRFM<"pstkeep", 0b1, 0b00000>;
330def : RPRFM<"pldstrm", 0b0, 0b00010>;
331def : RPRFM<"pststrm", 0b1, 0b00010>;
332
333//===----------------------------------------------------------------------===//
334// SVE Predicate patterns
335//===----------------------------------------------------------------------===//
336
337class SVEPREDPAT<string name, bits<5> encoding> : SearchableTable {
338  let SearchableFields = ["Name", "Encoding"];
339  let EnumValueField = "Encoding";
340
341  string Name = name;
342  bits<5> Encoding;
343  let Encoding = encoding;
344}
345
346def : SVEPREDPAT<"pow2",  0x00>;
347def : SVEPREDPAT<"vl1",   0x01>;
348def : SVEPREDPAT<"vl2",   0x02>;
349def : SVEPREDPAT<"vl3",   0x03>;
350def : SVEPREDPAT<"vl4",   0x04>;
351def : SVEPREDPAT<"vl5",   0x05>;
352def : SVEPREDPAT<"vl6",   0x06>;
353def : SVEPREDPAT<"vl7",   0x07>;
354def : SVEPREDPAT<"vl8",   0x08>;
355def : SVEPREDPAT<"vl16",  0x09>;
356def : SVEPREDPAT<"vl32",  0x0a>;
357def : SVEPREDPAT<"vl64",  0x0b>;
358def : SVEPREDPAT<"vl128", 0x0c>;
359def : SVEPREDPAT<"vl256", 0x0d>;
360def : SVEPREDPAT<"mul4",  0x1d>;
361def : SVEPREDPAT<"mul3",  0x1e>;
362def : SVEPREDPAT<"all",   0x1f>;
363
364//===----------------------------------------------------------------------===//
365// SVE Predicate-as-counter patterns
366//===----------------------------------------------------------------------===//
367
368class SVEVECLENSPECIFIER<string name, bits<1> encoding> : SearchableTable {
369  let SearchableFields = ["Name", "Encoding"];
370  let EnumValueField = "Encoding";
371
372  string Name = name;
373  bits<1> Encoding;
374  let Encoding = encoding;
375}
376
377def : SVEVECLENSPECIFIER<"vlx2", 0x0>;
378def : SVEVECLENSPECIFIER<"vlx4", 0x1>;
379
380//===----------------------------------------------------------------------===//
381// Exact FP Immediates.
382//
383// These definitions are used to create a lookup table with FP Immediates that
384// is used for a few instructions that only accept a limited set of exact FP
385// immediates values.
386//===----------------------------------------------------------------------===//
387class ExactFPImm<string name, string repr, bits<4> enum > : SearchableTable {
388  let SearchableFields = ["Enum", "Repr"];
389  let EnumValueField = "Enum";
390
391  string Name = name;
392  bits<4> Enum = enum;
393  string Repr = repr;
394}
395
396def : ExactFPImm<"zero", "0.0", 0x0>;
397def : ExactFPImm<"half", "0.5", 0x1>;
398def : ExactFPImm<"one",  "1.0", 0x2>;
399def : ExactFPImm<"two",  "2.0", 0x3>;
400
401//===----------------------------------------------------------------------===//
402// PState instruction options.
403//===----------------------------------------------------------------------===//
404
405class PStateImm0_15<string name, bits<3> op1, bits<3> op2> : SearchableTable {
406  let SearchableFields = ["Name", "Encoding"];
407  let EnumValueField = "Encoding";
408
409  string Name = name;
410  bits<6> Encoding;
411  let Encoding{5-3} = op1;
412  let Encoding{2-0} = op2;
413  code Requires = [{ {} }];
414}
415
416class PStateImm0_1<string name, bits<3> op1, bits<3> op2, bits<3> crm_high> : SearchableTable {
417  let SearchableFields = ["Name", "Encoding"];
418  let EnumValueField = "Encoding";
419
420  string Name = name;
421  bits<9> Encoding;
422  let Encoding{8-6} = crm_high;
423  let Encoding{5-3} = op1;
424  let Encoding{2-0} = op2;
425  code Requires = [{ {} }];
426}
427
428//                   Name,     Op1,   Op2
429def : PStateImm0_15<"SPSel",   0b000, 0b101>;
430def : PStateImm0_15<"DAIFSet", 0b011, 0b110>;
431def : PStateImm0_15<"DAIFClr", 0b011, 0b111>;
432// v8.1a "Privileged Access Never" extension-specific PStates
433let Requires = [{ {AArch64::FeaturePAN} }] in
434def : PStateImm0_15<"PAN",     0b000, 0b100>;
435
436// v8.2a "User Access Override" extension-specific PStates
437let Requires = [{ {AArch64::FeaturePsUAO} }] in
438def : PStateImm0_15<"UAO",     0b000, 0b011>;
439// v8.4a timing insensitivity of data processing instructions
440let Requires = [{ {AArch64::FeatureDIT} }] in
441def : PStateImm0_15<"DIT",     0b011, 0b010>;
442// v8.5a Spectre Mitigation
443let Requires = [{ {AArch64::FeatureSSBS} }] in
444def : PStateImm0_15<"SSBS",    0b011, 0b001>;
445// v8.5a Memory Tagging Extension
446let Requires = [{ {AArch64::FeatureMTE} }] in
447def : PStateImm0_15<"TCO",     0b011, 0b100>;
448// v8.8a Non-Maskable Interrupts
449let Requires = [{ {AArch64::FeatureNMI} }] in
450def : PStateImm0_1<"ALLINT",   0b001, 0b000, 0b000>;
451// v9.4a Exception-based event profiling
452//                  Name,      Op1,   Op2,   Crm_high
453def : PStateImm0_1<"PM",       0b001, 0b000, 0b001>;
454
455//===----------------------------------------------------------------------===//
456// SVCR instruction options.
457//===----------------------------------------------------------------------===//
458
459class SVCR<string name, bits<3> encoding> : SearchableTable {
460  let SearchableFields = ["Name", "Encoding"];
461  let EnumValueField = "Encoding";
462
463  string Name = name;
464  bits<3> Encoding;
465  let Encoding = encoding;
466  code Requires = [{ {} }];
467}
468
469let Requires = [{ {AArch64::FeatureSME} }] in {
470def : SVCR<"SVCRSM",   0b001>;
471def : SVCR<"SVCRZA",   0b010>;
472def : SVCR<"SVCRSMZA", 0b011>;
473}
474
475//===----------------------------------------------------------------------===//
476// PSB instruction options.
477//===----------------------------------------------------------------------===//
478
479class PSB<string name, bits<5> encoding> : SearchableTable {
480  let SearchableFields = ["Name", "Encoding"];
481  let EnumValueField = "Encoding";
482
483  string Name = name;
484  bits<5> Encoding;
485  let Encoding = encoding;
486}
487
488def : PSB<"csync", 0x11>;
489
490//===----------------------------------------------------------------------===//
491// BTI instruction options.
492//===----------------------------------------------------------------------===//
493
494class BTI<string name, bits<3> encoding> : SearchableTable {
495  let SearchableFields = ["Name", "Encoding"];
496  let EnumValueField = "Encoding";
497
498  string Name = name;
499  bits<3> Encoding;
500  let Encoding = encoding;
501}
502
503def : BTI<"c",  0b010>;
504def : BTI<"j",  0b100>;
505def : BTI<"jc", 0b110>;
506
507//===----------------------------------------------------------------------===//
508// TLBI (translation lookaside buffer invalidate) instruction options.
509//===----------------------------------------------------------------------===//
510
511class TLBIEntry<string name, bits<3> op1, bits<4> crn, bits<4> crm,
512             bits<3> op2, bit needsreg> {
513  string Name = name;
514  bits<14> Encoding;
515  let Encoding{13-11} = op1;
516  let Encoding{10-7} = crn;
517  let Encoding{6-3} = crm;
518  let Encoding{2-0} = op2;
519  bit NeedsReg = needsreg;
520  list<string> Requires = [];
521  list<string> ExtraRequires = [];
522  code RequiresStr = [{ { }] # !interleave(Requires # ExtraRequires, [{, }]) # [{ } }];
523}
524
525def TLBITable : GenericTable {
526  let FilterClass = "TLBIEntry";
527  let CppTypeName = "TLBI";
528  let Fields = ["Name", "Encoding", "NeedsReg", "RequiresStr"];
529}
530
531def lookupTLBIByName : SearchIndex {
532  let Table = TLBITable;
533  let Key = ["Name"];
534}
535
536def lookupTLBIByEncoding : SearchIndex {
537  let Table = TLBITable;
538  let Key = ["Encoding"];
539}
540
541multiclass TLBI<string name, bits<3> op1, bits<4> crn, bits<4> crm,
542             bits<3> op2, bit needsreg = 1> {
543  def : TLBIEntry<name, op1, crn, crm, op2, needsreg>;
544  def : TLBIEntry<!strconcat(name, "nXS"), op1, crn, crm, op2, needsreg> {
545    let Encoding{7} = 1;
546    let ExtraRequires = ["AArch64::FeatureXS"];
547  }
548}
549
550defm : TLBI<"IPAS2E1IS",    0b100, 0b1000, 0b0000, 0b001>;
551defm : TLBI<"IPAS2LE1IS",   0b100, 0b1000, 0b0000, 0b101>;
552defm : TLBI<"VMALLE1IS",    0b000, 0b1000, 0b0011, 0b000, 0>;
553defm : TLBI<"ALLE2IS",      0b100, 0b1000, 0b0011, 0b000, 0>;
554defm : TLBI<"ALLE3IS",      0b110, 0b1000, 0b0011, 0b000, 0>;
555defm : TLBI<"VAE1IS",       0b000, 0b1000, 0b0011, 0b001>;
556defm : TLBI<"VAE2IS",       0b100, 0b1000, 0b0011, 0b001>;
557defm : TLBI<"VAE3IS",       0b110, 0b1000, 0b0011, 0b001>;
558defm : TLBI<"ASIDE1IS",     0b000, 0b1000, 0b0011, 0b010>;
559defm : TLBI<"VAAE1IS",      0b000, 0b1000, 0b0011, 0b011>;
560defm : TLBI<"ALLE1IS",      0b100, 0b1000, 0b0011, 0b100, 0>;
561defm : TLBI<"VALE1IS",      0b000, 0b1000, 0b0011, 0b101>;
562defm : TLBI<"VALE2IS",      0b100, 0b1000, 0b0011, 0b101>;
563defm : TLBI<"VALE3IS",      0b110, 0b1000, 0b0011, 0b101>;
564defm : TLBI<"VMALLS12E1IS", 0b100, 0b1000, 0b0011, 0b110, 0>;
565defm : TLBI<"VAALE1IS",     0b000, 0b1000, 0b0011, 0b111>;
566defm : TLBI<"IPAS2E1",      0b100, 0b1000, 0b0100, 0b001>;
567defm : TLBI<"IPAS2LE1",     0b100, 0b1000, 0b0100, 0b101>;
568defm : TLBI<"VMALLE1",      0b000, 0b1000, 0b0111, 0b000, 0>;
569defm : TLBI<"ALLE2",        0b100, 0b1000, 0b0111, 0b000, 0>;
570defm : TLBI<"ALLE3",        0b110, 0b1000, 0b0111, 0b000, 0>;
571defm : TLBI<"VAE1",         0b000, 0b1000, 0b0111, 0b001>;
572defm : TLBI<"VAE2",         0b100, 0b1000, 0b0111, 0b001>;
573defm : TLBI<"VAE3",         0b110, 0b1000, 0b0111, 0b001>;
574defm : TLBI<"ASIDE1",       0b000, 0b1000, 0b0111, 0b010>;
575defm : TLBI<"VAAE1",        0b000, 0b1000, 0b0111, 0b011>;
576defm : TLBI<"ALLE1",        0b100, 0b1000, 0b0111, 0b100, 0>;
577defm : TLBI<"VALE1",        0b000, 0b1000, 0b0111, 0b101>;
578defm : TLBI<"VALE2",        0b100, 0b1000, 0b0111, 0b101>;
579defm : TLBI<"VALE3",        0b110, 0b1000, 0b0111, 0b101>;
580defm : TLBI<"VMALLS12E1",   0b100, 0b1000, 0b0111, 0b110, 0>;
581defm : TLBI<"VAALE1",       0b000, 0b1000, 0b0111, 0b111>;
582
583// Armv8.4-A Translation Lookaside Buffer Instructions (TLBI)
584let Requires = ["AArch64::FeatureTLB_RMI"] in {
585// Armv8.4-A Outer Sharable TLB Maintenance instructions:
586//                         op1    CRn     CRm     op2
587defm : TLBI<"VMALLE1OS",    0b000, 0b1000, 0b0001, 0b000, 0>;
588defm : TLBI<"VAE1OS",       0b000, 0b1000, 0b0001, 0b001>;
589defm : TLBI<"ASIDE1OS",     0b000, 0b1000, 0b0001, 0b010>;
590defm : TLBI<"VAAE1OS",      0b000, 0b1000, 0b0001, 0b011>;
591defm : TLBI<"VALE1OS",      0b000, 0b1000, 0b0001, 0b101>;
592defm : TLBI<"VAALE1OS",     0b000, 0b1000, 0b0001, 0b111>;
593defm : TLBI<"IPAS2E1OS",    0b100, 0b1000, 0b0100, 0b000>;
594defm : TLBI<"IPAS2LE1OS",   0b100, 0b1000, 0b0100, 0b100>;
595defm : TLBI<"VAE2OS",       0b100, 0b1000, 0b0001, 0b001>;
596defm : TLBI<"VALE2OS",      0b100, 0b1000, 0b0001, 0b101>;
597defm : TLBI<"VMALLS12E1OS", 0b100, 0b1000, 0b0001, 0b110, 0>;
598defm : TLBI<"VAE3OS",       0b110, 0b1000, 0b0001, 0b001>;
599defm : TLBI<"VALE3OS",      0b110, 0b1000, 0b0001, 0b101>;
600defm : TLBI<"ALLE2OS",      0b100, 0b1000, 0b0001, 0b000, 0>;
601defm : TLBI<"ALLE1OS",      0b100, 0b1000, 0b0001, 0b100, 0>;
602defm : TLBI<"ALLE3OS",      0b110, 0b1000, 0b0001, 0b000, 0>;
603
604// Armv8.4-A TLB Range Maintenance instructions:
605//                         op1    CRn     CRm     op2
606defm : TLBI<"RVAE1",        0b000, 0b1000, 0b0110, 0b001>;
607defm : TLBI<"RVAAE1",       0b000, 0b1000, 0b0110, 0b011>;
608defm : TLBI<"RVALE1",       0b000, 0b1000, 0b0110, 0b101>;
609defm : TLBI<"RVAALE1",      0b000, 0b1000, 0b0110, 0b111>;
610defm : TLBI<"RVAE1IS",      0b000, 0b1000, 0b0010, 0b001>;
611defm : TLBI<"RVAAE1IS",     0b000, 0b1000, 0b0010, 0b011>;
612defm : TLBI<"RVALE1IS",     0b000, 0b1000, 0b0010, 0b101>;
613defm : TLBI<"RVAALE1IS",    0b000, 0b1000, 0b0010, 0b111>;
614defm : TLBI<"RVAE1OS",      0b000, 0b1000, 0b0101, 0b001>;
615defm : TLBI<"RVAAE1OS",     0b000, 0b1000, 0b0101, 0b011>;
616defm : TLBI<"RVALE1OS",     0b000, 0b1000, 0b0101, 0b101>;
617defm : TLBI<"RVAALE1OS",    0b000, 0b1000, 0b0101, 0b111>;
618defm : TLBI<"RIPAS2E1IS",   0b100, 0b1000, 0b0000, 0b010>;
619defm : TLBI<"RIPAS2LE1IS",  0b100, 0b1000, 0b0000, 0b110>;
620defm : TLBI<"RIPAS2E1",     0b100, 0b1000, 0b0100, 0b010>;
621defm : TLBI<"RIPAS2LE1",    0b100, 0b1000, 0b0100, 0b110>;
622defm : TLBI<"RIPAS2E1OS",   0b100, 0b1000, 0b0100, 0b011>;
623defm : TLBI<"RIPAS2LE1OS",  0b100, 0b1000, 0b0100, 0b111>;
624defm : TLBI<"RVAE2",        0b100, 0b1000, 0b0110, 0b001>;
625defm : TLBI<"RVALE2",       0b100, 0b1000, 0b0110, 0b101>;
626defm : TLBI<"RVAE2IS",      0b100, 0b1000, 0b0010, 0b001>;
627defm : TLBI<"RVALE2IS",     0b100, 0b1000, 0b0010, 0b101>;
628defm : TLBI<"RVAE2OS",      0b100, 0b1000, 0b0101, 0b001>;
629defm : TLBI<"RVALE2OS",     0b100, 0b1000, 0b0101, 0b101>;
630defm : TLBI<"RVAE3",        0b110, 0b1000, 0b0110, 0b001>;
631defm : TLBI<"RVALE3",       0b110, 0b1000, 0b0110, 0b101>;
632defm : TLBI<"RVAE3IS",      0b110, 0b1000, 0b0010, 0b001>;
633defm : TLBI<"RVALE3IS",     0b110, 0b1000, 0b0010, 0b101>;
634defm : TLBI<"RVAE3OS",      0b110, 0b1000, 0b0101, 0b001>;
635defm : TLBI<"RVALE3OS",     0b110, 0b1000, 0b0101, 0b101>;
636} //FeatureTLB_RMI
637
638// Armv9-A Realm Management Extention TLBI Instructions
639let Requires = ["AArch64::FeatureRME"] in {
640defm : TLBI<"RPAOS",        0b110, 0b1000, 0b0100, 0b011>;
641defm : TLBI<"RPALOS",       0b110, 0b1000, 0b0100, 0b111>;
642defm : TLBI<"PAALLOS",      0b110, 0b1000, 0b0001, 0b100, 0>;
643defm : TLBI<"PAALL",        0b110, 0b1000, 0b0111, 0b100, 0>;
644}
645
646//===----------------------------------------------------------------------===//
647// MRS/MSR (system register read/write) instruction options.
648//===----------------------------------------------------------------------===//
649
650class SysReg<string name, bits<2> op0, bits<3> op1, bits<4> crn, bits<4> crm,
651             bits<3> op2> : SearchableTable {
652  let SearchableFields = ["Name", "Encoding"];
653  let EnumValueField = "Encoding";
654
655  string Name = name;
656  string AltName = name;
657  bits<16> Encoding;
658  let Encoding{15-14} = op0;
659  let Encoding{13-11} = op1;
660  let Encoding{10-7} = crn;
661  let Encoding{6-3} = crm;
662  let Encoding{2-0} = op2;
663  bit Readable = ?;
664  bit Writeable = ?;
665  code Requires = [{ {} }];
666}
667
668class RWSysReg<string name, bits<2> op0, bits<3> op1, bits<4> crn, bits<4> crm,
669               bits<3> op2>
670    : SysReg<name, op0, op1, crn, crm, op2> {
671  let Readable = 1;
672  let Writeable = 1;
673}
674
675class ROSysReg<string name, bits<2> op0, bits<3> op1, bits<4> crn, bits<4> crm,
676               bits<3> op2>
677    : SysReg<name, op0, op1, crn, crm, op2> {
678  let Readable = 1;
679  let Writeable = 0;
680}
681
682class WOSysReg<string name, bits<2> op0, bits<3> op1, bits<4> crn, bits<4> crm,
683               bits<3> op2>
684    : SysReg<name, op0, op1, crn, crm, op2> {
685  let Readable = 0;
686  let Writeable = 1;
687}
688
689//===----------------------
690// Read-only regs
691//===----------------------
692
693//                                    Op0    Op1     CRn     CRm    Op2
694def : ROSysReg<"MDCCSR_EL0",         0b10, 0b011, 0b0000, 0b0001, 0b000>;
695def : ROSysReg<"DBGDTRRX_EL0",       0b10, 0b011, 0b0000, 0b0101, 0b000>;
696def : ROSysReg<"MDRAR_EL1",          0b10, 0b000, 0b0001, 0b0000, 0b000>;
697def : ROSysReg<"OSLSR_EL1",          0b10, 0b000, 0b0001, 0b0001, 0b100>;
698def : ROSysReg<"DBGAUTHSTATUS_EL1",  0b10, 0b000, 0b0111, 0b1110, 0b110>;
699def : ROSysReg<"PMCEID0_EL0",        0b11, 0b011, 0b1001, 0b1100, 0b110>;
700def : ROSysReg<"PMCEID1_EL0",        0b11, 0b011, 0b1001, 0b1100, 0b111>;
701def : ROSysReg<"PMMIR_EL1",          0b11, 0b000, 0b1001, 0b1110, 0b110>;
702def : ROSysReg<"MIDR_EL1",           0b11, 0b000, 0b0000, 0b0000, 0b000>;
703def : ROSysReg<"CCSIDR_EL1",         0b11, 0b001, 0b0000, 0b0000, 0b000>;
704
705//v8.3 CCIDX - extending the CCsIDr number of sets
706def : ROSysReg<"CCSIDR2_EL1",        0b11, 0b001, 0b0000, 0b0000, 0b010> {
707  let Requires = [{ {AArch64::FeatureCCIDX} }];
708}
709def : ROSysReg<"CLIDR_EL1",          0b11, 0b001, 0b0000, 0b0000, 0b001>;
710def : ROSysReg<"CTR_EL0",            0b11, 0b011, 0b0000, 0b0000, 0b001>;
711def : ROSysReg<"MPIDR_EL1",          0b11, 0b000, 0b0000, 0b0000, 0b101>;
712def : ROSysReg<"REVIDR_EL1",         0b11, 0b000, 0b0000, 0b0000, 0b110>;
713def : ROSysReg<"AIDR_EL1",           0b11, 0b001, 0b0000, 0b0000, 0b111>;
714def : ROSysReg<"DCZID_EL0",          0b11, 0b011, 0b0000, 0b0000, 0b111>;
715def : ROSysReg<"ID_PFR0_EL1",        0b11, 0b000, 0b0000, 0b0001, 0b000>;
716def : ROSysReg<"ID_PFR1_EL1",        0b11, 0b000, 0b0000, 0b0001, 0b001>;
717def : ROSysReg<"ID_PFR2_EL1",        0b11, 0b000, 0b0000, 0b0011, 0b100> {
718    let Requires = [{ {AArch64::FeatureSpecRestrict} }];
719}
720def : ROSysReg<"ID_DFR0_EL1",        0b11, 0b000, 0b0000, 0b0001, 0b010>;
721def : ROSysReg<"ID_DFR1_EL1",        0b11, 0b000, 0b0000, 0b0011, 0b101>;
722def : ROSysReg<"ID_AFR0_EL1",        0b11, 0b000, 0b0000, 0b0001, 0b011>;
723def : ROSysReg<"ID_MMFR0_EL1",       0b11, 0b000, 0b0000, 0b0001, 0b100>;
724def : ROSysReg<"ID_MMFR1_EL1",       0b11, 0b000, 0b0000, 0b0001, 0b101>;
725def : ROSysReg<"ID_MMFR2_EL1",       0b11, 0b000, 0b0000, 0b0001, 0b110>;
726def : ROSysReg<"ID_MMFR3_EL1",       0b11, 0b000, 0b0000, 0b0001, 0b111>;
727def : ROSysReg<"ID_ISAR0_EL1",       0b11, 0b000, 0b0000, 0b0010, 0b000>;
728def : ROSysReg<"ID_ISAR1_EL1",       0b11, 0b000, 0b0000, 0b0010, 0b001>;
729def : ROSysReg<"ID_ISAR2_EL1",       0b11, 0b000, 0b0000, 0b0010, 0b010>;
730def : ROSysReg<"ID_ISAR3_EL1",       0b11, 0b000, 0b0000, 0b0010, 0b011>;
731def : ROSysReg<"ID_ISAR4_EL1",       0b11, 0b000, 0b0000, 0b0010, 0b100>;
732def : ROSysReg<"ID_ISAR5_EL1",       0b11, 0b000, 0b0000, 0b0010, 0b101>;
733def : ROSysReg<"ID_ISAR6_EL1",       0b11, 0b000, 0b0000, 0b0010, 0b111> {
734  let Requires = [{ {AArch64::HasV8_2aOps} }];
735}
736def : ROSysReg<"ID_AA64PFR0_EL1",     0b11, 0b000, 0b0000, 0b0100, 0b000>;
737def : ROSysReg<"ID_AA64PFR1_EL1",     0b11, 0b000, 0b0000, 0b0100, 0b001>;
738def : ROSysReg<"ID_AA64PFR2_EL1",     0b11, 0b000, 0b0000, 0b0100, 0b010>;
739def : ROSysReg<"ID_AA64DFR0_EL1",     0b11, 0b000, 0b0000, 0b0101, 0b000>;
740def : ROSysReg<"ID_AA64DFR1_EL1",     0b11, 0b000, 0b0000, 0b0101, 0b001>;
741def : ROSysReg<"ID_AA64AFR0_EL1",     0b11, 0b000, 0b0000, 0b0101, 0b100>;
742def : ROSysReg<"ID_AA64AFR1_EL1",     0b11, 0b000, 0b0000, 0b0101, 0b101>;
743def : ROSysReg<"ID_AA64ISAR0_EL1",    0b11, 0b000, 0b0000, 0b0110, 0b000>;
744def : ROSysReg<"ID_AA64ISAR1_EL1",    0b11, 0b000, 0b0000, 0b0110, 0b001>;
745def : ROSysReg<"ID_AA64ISAR2_EL1",    0b11, 0b000, 0b0000, 0b0110, 0b010>;
746def : ROSysReg<"ID_AA64MMFR0_EL1",    0b11, 0b000, 0b0000, 0b0111, 0b000>;
747def : ROSysReg<"ID_AA64MMFR1_EL1",    0b11, 0b000, 0b0000, 0b0111, 0b001>;
748def : ROSysReg<"ID_AA64MMFR2_EL1",    0b11, 0b000, 0b0000, 0b0111, 0b010>;
749def : ROSysReg<"ID_AA64MMFR3_EL1",    0b11, 0b000, 0b0000, 0b0111, 0b011>;
750def : ROSysReg<"ID_AA64MMFR4_EL1",    0b11, 0b000, 0b0000, 0b0111, 0b100>;
751def : ROSysReg<"MVFR0_EL1",           0b11, 0b000, 0b0000, 0b0011, 0b000>;
752def : ROSysReg<"MVFR1_EL1",           0b11, 0b000, 0b0000, 0b0011, 0b001>;
753def : ROSysReg<"MVFR2_EL1",           0b11, 0b000, 0b0000, 0b0011, 0b010>;
754def : ROSysReg<"RVBAR_EL1",           0b11, 0b000, 0b1100, 0b0000, 0b001>;
755def : ROSysReg<"RVBAR_EL2",           0b11, 0b100, 0b1100, 0b0000, 0b001>;
756def : ROSysReg<"RVBAR_EL3",           0b11, 0b110, 0b1100, 0b0000, 0b001>;
757def : ROSysReg<"ISR_EL1",             0b11, 0b000, 0b1100, 0b0001, 0b000>;
758def : ROSysReg<"CNTPCT_EL0",          0b11, 0b011, 0b1110, 0b0000, 0b001>;
759def : ROSysReg<"CNTVCT_EL0",          0b11, 0b011, 0b1110, 0b0000, 0b010>;
760def : ROSysReg<"ID_MMFR4_EL1",        0b11, 0b000, 0b0000, 0b0010, 0b110>;
761def : ROSysReg<"ID_MMFR5_EL1",        0b11, 0b000, 0b0000, 0b0011, 0b110>;
762
763// Trace registers
764//                                   Op0    Op1     CRn     CRm    Op2
765def : ROSysReg<"TRCSTATR",           0b10, 0b001, 0b0000, 0b0011, 0b000>;
766def : ROSysReg<"TRCIDR8",            0b10, 0b001, 0b0000, 0b0000, 0b110>;
767def : ROSysReg<"TRCIDR9",            0b10, 0b001, 0b0000, 0b0001, 0b110>;
768def : ROSysReg<"TRCIDR10",           0b10, 0b001, 0b0000, 0b0010, 0b110>;
769def : ROSysReg<"TRCIDR11",           0b10, 0b001, 0b0000, 0b0011, 0b110>;
770def : ROSysReg<"TRCIDR12",           0b10, 0b001, 0b0000, 0b0100, 0b110>;
771def : ROSysReg<"TRCIDR13",           0b10, 0b001, 0b0000, 0b0101, 0b110>;
772def : ROSysReg<"TRCIDR0",            0b10, 0b001, 0b0000, 0b1000, 0b111>;
773def : ROSysReg<"TRCIDR1",            0b10, 0b001, 0b0000, 0b1001, 0b111>;
774def : ROSysReg<"TRCIDR2",            0b10, 0b001, 0b0000, 0b1010, 0b111>;
775def : ROSysReg<"TRCIDR3",            0b10, 0b001, 0b0000, 0b1011, 0b111>;
776def : ROSysReg<"TRCIDR4",            0b10, 0b001, 0b0000, 0b1100, 0b111>;
777def : ROSysReg<"TRCIDR5",            0b10, 0b001, 0b0000, 0b1101, 0b111>;
778def : ROSysReg<"TRCIDR6",            0b10, 0b001, 0b0000, 0b1110, 0b111>;
779def : ROSysReg<"TRCIDR7",            0b10, 0b001, 0b0000, 0b1111, 0b111>;
780def : ROSysReg<"TRCOSLSR",           0b10, 0b001, 0b0001, 0b0001, 0b100>;
781def : ROSysReg<"TRCPDSR",            0b10, 0b001, 0b0001, 0b0101, 0b100>;
782def : ROSysReg<"TRCDEVAFF0",         0b10, 0b001, 0b0111, 0b1010, 0b110>;
783def : ROSysReg<"TRCDEVAFF1",         0b10, 0b001, 0b0111, 0b1011, 0b110>;
784def : ROSysReg<"TRCLSR",             0b10, 0b001, 0b0111, 0b1101, 0b110>;
785def : ROSysReg<"TRCAUTHSTATUS",      0b10, 0b001, 0b0111, 0b1110, 0b110>;
786def : ROSysReg<"TRCDEVARCH",         0b10, 0b001, 0b0111, 0b1111, 0b110>;
787def : ROSysReg<"TRCDEVID",           0b10, 0b001, 0b0111, 0b0010, 0b111>;
788def : ROSysReg<"TRCDEVTYPE",         0b10, 0b001, 0b0111, 0b0011, 0b111>;
789def : ROSysReg<"TRCPIDR4",           0b10, 0b001, 0b0111, 0b0100, 0b111>;
790def : ROSysReg<"TRCPIDR5",           0b10, 0b001, 0b0111, 0b0101, 0b111>;
791def : ROSysReg<"TRCPIDR6",           0b10, 0b001, 0b0111, 0b0110, 0b111>;
792def : ROSysReg<"TRCPIDR7",           0b10, 0b001, 0b0111, 0b0111, 0b111>;
793def : ROSysReg<"TRCPIDR0",           0b10, 0b001, 0b0111, 0b1000, 0b111>;
794def : ROSysReg<"TRCPIDR1",           0b10, 0b001, 0b0111, 0b1001, 0b111>;
795def : ROSysReg<"TRCPIDR2",           0b10, 0b001, 0b0111, 0b1010, 0b111>;
796def : ROSysReg<"TRCPIDR3",           0b10, 0b001, 0b0111, 0b1011, 0b111>;
797def : ROSysReg<"TRCCIDR0",           0b10, 0b001, 0b0111, 0b1100, 0b111>;
798def : ROSysReg<"TRCCIDR1",           0b10, 0b001, 0b0111, 0b1101, 0b111>;
799def : ROSysReg<"TRCCIDR2",           0b10, 0b001, 0b0111, 0b1110, 0b111>;
800def : ROSysReg<"TRCCIDR3",           0b10, 0b001, 0b0111, 0b1111, 0b111>;
801
802// GICv3 registers
803//                                 Op0    Op1     CRn     CRm    Op2
804def : ROSysReg<"ICC_IAR1_EL1",       0b11, 0b000, 0b1100, 0b1100, 0b000>;
805def : ROSysReg<"ICC_IAR0_EL1",       0b11, 0b000, 0b1100, 0b1000, 0b000>;
806def : ROSysReg<"ICC_HPPIR1_EL1",     0b11, 0b000, 0b1100, 0b1100, 0b010>;
807def : ROSysReg<"ICC_HPPIR0_EL1",     0b11, 0b000, 0b1100, 0b1000, 0b010>;
808def : ROSysReg<"ICC_RPR_EL1",        0b11, 0b000, 0b1100, 0b1011, 0b011>;
809def : ROSysReg<"ICH_VTR_EL2",        0b11, 0b100, 0b1100, 0b1011, 0b001>;
810def : ROSysReg<"ICH_EISR_EL2",       0b11, 0b100, 0b1100, 0b1011, 0b011>;
811def : ROSysReg<"ICH_ELRSR_EL2",      0b11, 0b100, 0b1100, 0b1011, 0b101>;
812
813// SVE control registers
814//                                   Op0   Op1    CRn     CRm     Op2
815let Requires = [{ {AArch64::FeatureSVE} }] in {
816def : ROSysReg<"ID_AA64ZFR0_EL1",    0b11, 0b000, 0b0000, 0b0100, 0b100>;
817}
818
819// v8.1a "Limited Ordering Regions" extension-specific system register
820//                         Op0    Op1     CRn     CRm    Op2
821let Requires = [{ {AArch64::FeatureLOR} }] in
822def : ROSysReg<"LORID_EL1",  0b11, 0b000, 0b1010, 0b0100, 0b111>;
823
824// v8.2a "RAS extension" registers
825//                         Op0    Op1     CRn     CRm    Op2
826let Requires = [{ {AArch64::FeatureRAS} }] in {
827def : ROSysReg<"ERRIDR_EL1", 0b11, 0b000, 0b0101, 0b0011, 0b000>;
828def : ROSysReg<"ERXFR_EL1",  0b11, 0b000, 0b0101, 0b0100, 0b000>;
829}
830
831// v8.5a "random number" registers
832//                       Op0   Op1    CRn     CRm     Op2
833let Requires = [{ {AArch64::FeatureRandGen} }] in {
834def : ROSysReg<"RNDR",   0b11, 0b011, 0b0010, 0b0100, 0b000>;
835def : ROSysReg<"RNDRRS", 0b11, 0b011, 0b0010, 0b0100, 0b001>;
836}
837
838// v8.5a Software Context Number registers
839let Requires = [{ {AArch64::FeatureSpecRestrict} }] in {
840def : RWSysReg<"SCXTNUM_EL0", 0b11, 0b011, 0b1101, 0b0000, 0b111>;
841def : RWSysReg<"SCXTNUM_EL1", 0b11, 0b000, 0b1101, 0b0000, 0b111>;
842def : RWSysReg<"SCXTNUM_EL2", 0b11, 0b100, 0b1101, 0b0000, 0b111>;
843def : RWSysReg<"SCXTNUM_EL3", 0b11, 0b110, 0b1101, 0b0000, 0b111>;
844def : RWSysReg<"SCXTNUM_EL12", 0b11, 0b101, 0b1101, 0b0000, 0b111>;
845}
846
847// v9a Realm Management Extension registers
848let Requires = [{ {AArch64::FeatureRME} }] in {
849def : RWSysReg<"GPCCR_EL3", 0b11, 0b110, 0b0010, 0b0001, 0b110>;
850def : RWSysReg<"GPTBR_EL3", 0b11, 0b110, 0b0010, 0b0001, 0b100>;
851}
852// MFAR_EL3 is part of both FEAT_RME and FEAT_PFAR (further below). The latter
853// is unconditional so this register has to be too.
854def : RWSysReg<"MFAR_EL3",  0b11, 0b110, 0b0110, 0b0000, 0b101>;
855
856// v9a Memory Encryption Contexts Extension registers
857let Requires = [{ {AArch64::FeatureMEC} }] in {
858def : ROSysReg<"MECIDR_EL2",     0b11, 0b100, 0b1010, 0b1000, 0b111>;
859def : RWSysReg<"MECID_P0_EL2",   0b11, 0b100, 0b1010, 0b1000, 0b000>;
860def : RWSysReg<"MECID_A0_EL2",   0b11, 0b100, 0b1010, 0b1000, 0b001>;
861def : RWSysReg<"MECID_P1_EL2",   0b11, 0b100, 0b1010, 0b1000, 0b010>;
862def : RWSysReg<"MECID_A1_EL2",   0b11, 0b100, 0b1010, 0b1000, 0b011>;
863def : RWSysReg<"VMECID_P_EL2",   0b11, 0b100, 0b1010, 0b1001, 0b000>;
864def : RWSysReg<"VMECID_A_EL2",   0b11, 0b100, 0b1010, 0b1001, 0b001>;
865def : RWSysReg<"MECID_RL_A_EL3", 0b11, 0b110, 0b1010, 0b1010, 0b001>;
866}
867
868// v9-a Scalable Matrix Extension (SME) registers
869//                                 Op0   Op1    CRn     CRm     Op2
870let Requires = [{ {AArch64::FeatureSME} }] in {
871def : ROSysReg<"ID_AA64SMFR0_EL1", 0b11, 0b000, 0b0000, 0b0100, 0b101>;
872}
873
874//===----------------------
875// Write-only regs
876//===----------------------
877
878//                                 Op0    Op1     CRn     CRm    Op2
879def : WOSysReg<"DBGDTRTX_EL0",       0b10, 0b011, 0b0000, 0b0101, 0b000>;
880def : WOSysReg<"OSLAR_EL1",          0b10, 0b000, 0b0001, 0b0000, 0b100>;
881def : WOSysReg<"PMSWINC_EL0",        0b11, 0b011, 0b1001, 0b1100, 0b100>;
882
883// Trace Registers
884//                                 Op0    Op1     CRn     CRm    Op2
885def : WOSysReg<"TRCOSLAR",           0b10, 0b001, 0b0001, 0b0000, 0b100>;
886def : WOSysReg<"TRCLAR",             0b10, 0b001, 0b0111, 0b1100, 0b110>;
887
888// GICv3 registers
889//                                 Op0    Op1     CRn     CRm    Op2
890def : WOSysReg<"ICC_EOIR1_EL1",      0b11, 0b000, 0b1100, 0b1100, 0b001>;
891def : WOSysReg<"ICC_EOIR0_EL1",      0b11, 0b000, 0b1100, 0b1000, 0b001>;
892def : WOSysReg<"ICC_DIR_EL1",        0b11, 0b000, 0b1100, 0b1011, 0b001>;
893def : WOSysReg<"ICC_SGI1R_EL1",      0b11, 0b000, 0b1100, 0b1011, 0b101>;
894def : WOSysReg<"ICC_ASGI1R_EL1",     0b11, 0b000, 0b1100, 0b1011, 0b110>;
895def : WOSysReg<"ICC_SGI0R_EL1",      0b11, 0b000, 0b1100, 0b1011, 0b111>;
896
897//===----------------------
898// Read-write regs
899//===----------------------
900
901//                                   Op0   Op1    CRn     CRm     Op2
902def : RWSysReg<"OSDTRRX_EL1",        0b10, 0b000, 0b0000, 0b0000, 0b010>;
903def : RWSysReg<"OSDTRTX_EL1",        0b10, 0b000, 0b0000, 0b0011, 0b010>;
904def : RWSysReg<"TEECR32_EL1",        0b10, 0b010, 0b0000, 0b0000, 0b000>;
905def : RWSysReg<"MDCCINT_EL1",        0b10, 0b000, 0b0000, 0b0010, 0b000>;
906def : RWSysReg<"MDSCR_EL1",          0b10, 0b000, 0b0000, 0b0010, 0b010>;
907def : RWSysReg<"DBGDTR_EL0",         0b10, 0b011, 0b0000, 0b0100, 0b000>;
908def : RWSysReg<"OSECCR_EL1",         0b10, 0b000, 0b0000, 0b0110, 0b010>;
909def : RWSysReg<"DBGVCR32_EL2",       0b10, 0b100, 0b0000, 0b0111, 0b000>;
910foreach n = 0-15 in {
911  defvar nb = !cast<bits<4>>(n);
912  //                                 Op0   Op1    CRn     CRm Op2
913  def : RWSysReg<"DBGBVR"#n#"_EL1",  0b10, 0b000, 0b0000, nb, 0b100>;
914  def : RWSysReg<"DBGBCR"#n#"_EL1",  0b10, 0b000, 0b0000, nb, 0b101>;
915  def : RWSysReg<"DBGWVR"#n#"_EL1",  0b10, 0b000, 0b0000, nb, 0b110>;
916  def : RWSysReg<"DBGWCR"#n#"_EL1",  0b10, 0b000, 0b0000, nb, 0b111>;
917}
918//                                   Op0   Op1    CRn     CRm     Op2
919def : RWSysReg<"TEEHBR32_EL1",       0b10, 0b010, 0b0001, 0b0000, 0b000>;
920def : RWSysReg<"OSDLR_EL1",          0b10, 0b000, 0b0001, 0b0011, 0b100>;
921def : RWSysReg<"DBGPRCR_EL1",        0b10, 0b000, 0b0001, 0b0100, 0b100>;
922def : RWSysReg<"DBGCLAIMSET_EL1",    0b10, 0b000, 0b0111, 0b1000, 0b110>;
923def : RWSysReg<"DBGCLAIMCLR_EL1",    0b10, 0b000, 0b0111, 0b1001, 0b110>;
924def : RWSysReg<"CSSELR_EL1",         0b11, 0b010, 0b0000, 0b0000, 0b000>;
925def : RWSysReg<"VPIDR_EL2",          0b11, 0b100, 0b0000, 0b0000, 0b000>;
926def : RWSysReg<"VMPIDR_EL2",         0b11, 0b100, 0b0000, 0b0000, 0b101>;
927def : RWSysReg<"CPACR_EL1",          0b11, 0b000, 0b0001, 0b0000, 0b010>;
928def : RWSysReg<"SCTLR_EL1",          0b11, 0b000, 0b0001, 0b0000, 0b000>;
929def : RWSysReg<"SCTLR_EL2",          0b11, 0b100, 0b0001, 0b0000, 0b000>;
930def : RWSysReg<"SCTLR_EL3",          0b11, 0b110, 0b0001, 0b0000, 0b000>;
931def : RWSysReg<"ACTLR_EL1",          0b11, 0b000, 0b0001, 0b0000, 0b001>;
932def : RWSysReg<"ACTLR_EL2",          0b11, 0b100, 0b0001, 0b0000, 0b001>;
933def : RWSysReg<"ACTLR_EL3",          0b11, 0b110, 0b0001, 0b0000, 0b001>;
934def : RWSysReg<"HCR_EL2",            0b11, 0b100, 0b0001, 0b0001, 0b000>;
935def : RWSysReg<"HCRX_EL2",           0b11, 0b100, 0b0001, 0b0010, 0b010> {
936  let Requires = [{ {AArch64::FeatureHCX} }];
937}
938def : RWSysReg<"SCR_EL3",            0b11, 0b110, 0b0001, 0b0001, 0b000>;
939def : RWSysReg<"MDCR_EL2",           0b11, 0b100, 0b0001, 0b0001, 0b001>;
940def : RWSysReg<"SDER32_EL3",         0b11, 0b110, 0b0001, 0b0001, 0b001>;
941def : RWSysReg<"CPTR_EL2",           0b11, 0b100, 0b0001, 0b0001, 0b010>;
942def : RWSysReg<"CPTR_EL3",           0b11, 0b110, 0b0001, 0b0001, 0b010>;
943def : RWSysReg<"HSTR_EL2",           0b11, 0b100, 0b0001, 0b0001, 0b011>;
944def : RWSysReg<"HACR_EL2",           0b11, 0b100, 0b0001, 0b0001, 0b111>;
945def : RWSysReg<"MDCR_EL3",           0b11, 0b110, 0b0001, 0b0011, 0b001>;
946def : RWSysReg<"TTBR0_EL1",          0b11, 0b000, 0b0010, 0b0000, 0b000>;
947def : RWSysReg<"TTBR0_EL3",          0b11, 0b110, 0b0010, 0b0000, 0b000>;
948
949let Requires = [{ {AArch64::FeatureEL2VMSA} }] in {
950def : RWSysReg<"TTBR0_EL2",          0b11, 0b100, 0b0010, 0b0000, 0b000> {
951  let AltName = "VSCTLR_EL2";
952}
953def : RWSysReg<"VTTBR_EL2",          0b11, 0b100, 0b0010, 0b0001, 0b000>;
954}
955
956def : RWSysReg<"TTBR1_EL1",          0b11, 0b000, 0b0010, 0b0000, 0b001>;
957def : RWSysReg<"TCR_EL1",            0b11, 0b000, 0b0010, 0b0000, 0b010>;
958def : RWSysReg<"TCR_EL2",            0b11, 0b100, 0b0010, 0b0000, 0b010>;
959def : RWSysReg<"TCR_EL3",            0b11, 0b110, 0b0010, 0b0000, 0b010>;
960def : RWSysReg<"VTCR_EL2",           0b11, 0b100, 0b0010, 0b0001, 0b010>;
961def : RWSysReg<"DACR32_EL2",         0b11, 0b100, 0b0011, 0b0000, 0b000>;
962def : RWSysReg<"SPSR_EL1",           0b11, 0b000, 0b0100, 0b0000, 0b000>;
963def : RWSysReg<"SPSR_EL2",           0b11, 0b100, 0b0100, 0b0000, 0b000>;
964def : RWSysReg<"SPSR_EL3",           0b11, 0b110, 0b0100, 0b0000, 0b000>;
965def : RWSysReg<"ELR_EL1",            0b11, 0b000, 0b0100, 0b0000, 0b001>;
966def : RWSysReg<"ELR_EL2",            0b11, 0b100, 0b0100, 0b0000, 0b001>;
967def : RWSysReg<"ELR_EL3",            0b11, 0b110, 0b0100, 0b0000, 0b001>;
968def : RWSysReg<"SP_EL0",             0b11, 0b000, 0b0100, 0b0001, 0b000>;
969def : RWSysReg<"SP_EL1",             0b11, 0b100, 0b0100, 0b0001, 0b000>;
970def : RWSysReg<"SP_EL2",             0b11, 0b110, 0b0100, 0b0001, 0b000>;
971def : RWSysReg<"SPSel",              0b11, 0b000, 0b0100, 0b0010, 0b000>;
972def : RWSysReg<"NZCV",               0b11, 0b011, 0b0100, 0b0010, 0b000>;
973def : RWSysReg<"DAIF",               0b11, 0b011, 0b0100, 0b0010, 0b001>;
974def : ROSysReg<"CurrentEL",          0b11, 0b000, 0b0100, 0b0010, 0b010>;
975def : RWSysReg<"SPSR_irq",           0b11, 0b100, 0b0100, 0b0011, 0b000>;
976def : RWSysReg<"SPSR_abt",           0b11, 0b100, 0b0100, 0b0011, 0b001>;
977def : RWSysReg<"SPSR_und",           0b11, 0b100, 0b0100, 0b0011, 0b010>;
978def : RWSysReg<"SPSR_fiq",           0b11, 0b100, 0b0100, 0b0011, 0b011>;
979def : RWSysReg<"FPCR",               0b11, 0b011, 0b0100, 0b0100, 0b000>;
980def : RWSysReg<"FPSR",               0b11, 0b011, 0b0100, 0b0100, 0b001>;
981def : RWSysReg<"DSPSR_EL0",          0b11, 0b011, 0b0100, 0b0101, 0b000>;
982def : RWSysReg<"DLR_EL0",            0b11, 0b011, 0b0100, 0b0101, 0b001>;
983def : RWSysReg<"IFSR32_EL2",         0b11, 0b100, 0b0101, 0b0000, 0b001>;
984def : RWSysReg<"AFSR0_EL1",          0b11, 0b000, 0b0101, 0b0001, 0b000>;
985def : RWSysReg<"AFSR0_EL2",          0b11, 0b100, 0b0101, 0b0001, 0b000>;
986def : RWSysReg<"AFSR0_EL3",          0b11, 0b110, 0b0101, 0b0001, 0b000>;
987def : RWSysReg<"AFSR1_EL1",          0b11, 0b000, 0b0101, 0b0001, 0b001>;
988def : RWSysReg<"AFSR1_EL2",          0b11, 0b100, 0b0101, 0b0001, 0b001>;
989def : RWSysReg<"AFSR1_EL3",          0b11, 0b110, 0b0101, 0b0001, 0b001>;
990def : RWSysReg<"ESR_EL1",            0b11, 0b000, 0b0101, 0b0010, 0b000>;
991def : RWSysReg<"ESR_EL2",            0b11, 0b100, 0b0101, 0b0010, 0b000>;
992def : RWSysReg<"ESR_EL3",            0b11, 0b110, 0b0101, 0b0010, 0b000>;
993def : RWSysReg<"FPEXC32_EL2",        0b11, 0b100, 0b0101, 0b0011, 0b000>;
994def : RWSysReg<"FAR_EL1",            0b11, 0b000, 0b0110, 0b0000, 0b000>;
995def : RWSysReg<"FAR_EL2",            0b11, 0b100, 0b0110, 0b0000, 0b000>;
996def : RWSysReg<"FAR_EL3",            0b11, 0b110, 0b0110, 0b0000, 0b000>;
997def : RWSysReg<"HPFAR_EL2",          0b11, 0b100, 0b0110, 0b0000, 0b100>;
998def : RWSysReg<"PAR_EL1",            0b11, 0b000, 0b0111, 0b0100, 0b000>;
999def : RWSysReg<"PMCR_EL0",           0b11, 0b011, 0b1001, 0b1100, 0b000>;
1000def : RWSysReg<"PMCNTENSET_EL0",     0b11, 0b011, 0b1001, 0b1100, 0b001>;
1001def : RWSysReg<"PMCNTENCLR_EL0",     0b11, 0b011, 0b1001, 0b1100, 0b010>;
1002def : RWSysReg<"PMOVSCLR_EL0",       0b11, 0b011, 0b1001, 0b1100, 0b011>;
1003def : RWSysReg<"PMSELR_EL0",         0b11, 0b011, 0b1001, 0b1100, 0b101>;
1004def : RWSysReg<"PMCCNTR_EL0",        0b11, 0b011, 0b1001, 0b1101, 0b000>;
1005def : RWSysReg<"PMXEVTYPER_EL0",     0b11, 0b011, 0b1001, 0b1101, 0b001>;
1006def : RWSysReg<"PMXEVCNTR_EL0",      0b11, 0b011, 0b1001, 0b1101, 0b010>;
1007def : RWSysReg<"PMUSERENR_EL0",      0b11, 0b011, 0b1001, 0b1110, 0b000>;
1008def : RWSysReg<"PMINTENSET_EL1",     0b11, 0b000, 0b1001, 0b1110, 0b001>;
1009def : RWSysReg<"PMINTENCLR_EL1",     0b11, 0b000, 0b1001, 0b1110, 0b010>;
1010def : RWSysReg<"PMOVSSET_EL0",       0b11, 0b011, 0b1001, 0b1110, 0b011>;
1011def : RWSysReg<"MAIR_EL1",           0b11, 0b000, 0b1010, 0b0010, 0b000>;
1012def : RWSysReg<"MAIR_EL2",           0b11, 0b100, 0b1010, 0b0010, 0b000>;
1013def : RWSysReg<"MAIR_EL3",           0b11, 0b110, 0b1010, 0b0010, 0b000>;
1014def : RWSysReg<"AMAIR_EL1",          0b11, 0b000, 0b1010, 0b0011, 0b000>;
1015def : RWSysReg<"AMAIR_EL2",          0b11, 0b100, 0b1010, 0b0011, 0b000>;
1016def : RWSysReg<"AMAIR_EL3",          0b11, 0b110, 0b1010, 0b0011, 0b000>;
1017def : RWSysReg<"VBAR_EL1",           0b11, 0b000, 0b1100, 0b0000, 0b000>;
1018def : RWSysReg<"VBAR_EL2",           0b11, 0b100, 0b1100, 0b0000, 0b000>;
1019def : RWSysReg<"VBAR_EL3",           0b11, 0b110, 0b1100, 0b0000, 0b000>;
1020def : RWSysReg<"RMR_EL1",            0b11, 0b000, 0b1100, 0b0000, 0b010>;
1021def : RWSysReg<"RMR_EL2",            0b11, 0b100, 0b1100, 0b0000, 0b010>;
1022def : RWSysReg<"RMR_EL3",            0b11, 0b110, 0b1100, 0b0000, 0b010>;
1023def : RWSysReg<"CONTEXTIDR_EL1",     0b11, 0b000, 0b1101, 0b0000, 0b001>;
1024def : RWSysReg<"TPIDR_EL0",          0b11, 0b011, 0b1101, 0b0000, 0b010>;
1025def : RWSysReg<"TPIDR_EL2",          0b11, 0b100, 0b1101, 0b0000, 0b010>;
1026def : RWSysReg<"TPIDR_EL3",          0b11, 0b110, 0b1101, 0b0000, 0b010>;
1027def : RWSysReg<"TPIDRRO_EL0",        0b11, 0b011, 0b1101, 0b0000, 0b011>;
1028def : RWSysReg<"TPIDR_EL1",          0b11, 0b000, 0b1101, 0b0000, 0b100>;
1029def : RWSysReg<"CNTFRQ_EL0",         0b11, 0b011, 0b1110, 0b0000, 0b000>;
1030def : RWSysReg<"CNTVOFF_EL2",        0b11, 0b100, 0b1110, 0b0000, 0b011>;
1031def : RWSysReg<"CNTKCTL_EL1",        0b11, 0b000, 0b1110, 0b0001, 0b000>;
1032def : RWSysReg<"CNTHCTL_EL2",        0b11, 0b100, 0b1110, 0b0001, 0b000>;
1033def : RWSysReg<"CNTP_TVAL_EL0",      0b11, 0b011, 0b1110, 0b0010, 0b000>;
1034def : RWSysReg<"CNTHP_TVAL_EL2",     0b11, 0b100, 0b1110, 0b0010, 0b000>;
1035def : RWSysReg<"CNTPS_TVAL_EL1",     0b11, 0b111, 0b1110, 0b0010, 0b000>;
1036def : RWSysReg<"CNTP_CTL_EL0",       0b11, 0b011, 0b1110, 0b0010, 0b001>;
1037def : RWSysReg<"CNTHP_CTL_EL2",      0b11, 0b100, 0b1110, 0b0010, 0b001>;
1038def : RWSysReg<"CNTPS_CTL_EL1",      0b11, 0b111, 0b1110, 0b0010, 0b001>;
1039def : RWSysReg<"CNTP_CVAL_EL0",      0b11, 0b011, 0b1110, 0b0010, 0b010>;
1040def : RWSysReg<"CNTHP_CVAL_EL2",     0b11, 0b100, 0b1110, 0b0010, 0b010>;
1041def : RWSysReg<"CNTPS_CVAL_EL1",     0b11, 0b111, 0b1110, 0b0010, 0b010>;
1042def : RWSysReg<"CNTV_TVAL_EL0",      0b11, 0b011, 0b1110, 0b0011, 0b000>;
1043def : RWSysReg<"CNTV_CTL_EL0",       0b11, 0b011, 0b1110, 0b0011, 0b001>;
1044def : RWSysReg<"CNTV_CVAL_EL0",      0b11, 0b011, 0b1110, 0b0011, 0b010>;
1045def : RWSysReg<"PMEVCNTR0_EL0",      0b11, 0b011, 0b1110, 0b1000, 0b000>;
1046def : RWSysReg<"PMEVCNTR1_EL0",      0b11, 0b011, 0b1110, 0b1000, 0b001>;
1047def : RWSysReg<"PMEVCNTR2_EL0",      0b11, 0b011, 0b1110, 0b1000, 0b010>;
1048def : RWSysReg<"PMEVCNTR3_EL0",      0b11, 0b011, 0b1110, 0b1000, 0b011>;
1049def : RWSysReg<"PMEVCNTR4_EL0",      0b11, 0b011, 0b1110, 0b1000, 0b100>;
1050def : RWSysReg<"PMEVCNTR5_EL0",      0b11, 0b011, 0b1110, 0b1000, 0b101>;
1051def : RWSysReg<"PMEVCNTR6_EL0",      0b11, 0b011, 0b1110, 0b1000, 0b110>;
1052def : RWSysReg<"PMEVCNTR7_EL0",      0b11, 0b011, 0b1110, 0b1000, 0b111>;
1053def : RWSysReg<"PMEVCNTR8_EL0",      0b11, 0b011, 0b1110, 0b1001, 0b000>;
1054def : RWSysReg<"PMEVCNTR9_EL0",      0b11, 0b011, 0b1110, 0b1001, 0b001>;
1055def : RWSysReg<"PMEVCNTR10_EL0",     0b11, 0b011, 0b1110, 0b1001, 0b010>;
1056def : RWSysReg<"PMEVCNTR11_EL0",     0b11, 0b011, 0b1110, 0b1001, 0b011>;
1057def : RWSysReg<"PMEVCNTR12_EL0",     0b11, 0b011, 0b1110, 0b1001, 0b100>;
1058def : RWSysReg<"PMEVCNTR13_EL0",     0b11, 0b011, 0b1110, 0b1001, 0b101>;
1059def : RWSysReg<"PMEVCNTR14_EL0",     0b11, 0b011, 0b1110, 0b1001, 0b110>;
1060def : RWSysReg<"PMEVCNTR15_EL0",     0b11, 0b011, 0b1110, 0b1001, 0b111>;
1061def : RWSysReg<"PMEVCNTR16_EL0",     0b11, 0b011, 0b1110, 0b1010, 0b000>;
1062def : RWSysReg<"PMEVCNTR17_EL0",     0b11, 0b011, 0b1110, 0b1010, 0b001>;
1063def : RWSysReg<"PMEVCNTR18_EL0",     0b11, 0b011, 0b1110, 0b1010, 0b010>;
1064def : RWSysReg<"PMEVCNTR19_EL0",     0b11, 0b011, 0b1110, 0b1010, 0b011>;
1065def : RWSysReg<"PMEVCNTR20_EL0",     0b11, 0b011, 0b1110, 0b1010, 0b100>;
1066def : RWSysReg<"PMEVCNTR21_EL0",     0b11, 0b011, 0b1110, 0b1010, 0b101>;
1067def : RWSysReg<"PMEVCNTR22_EL0",     0b11, 0b011, 0b1110, 0b1010, 0b110>;
1068def : RWSysReg<"PMEVCNTR23_EL0",     0b11, 0b011, 0b1110, 0b1010, 0b111>;
1069def : RWSysReg<"PMEVCNTR24_EL0",     0b11, 0b011, 0b1110, 0b1011, 0b000>;
1070def : RWSysReg<"PMEVCNTR25_EL0",     0b11, 0b011, 0b1110, 0b1011, 0b001>;
1071def : RWSysReg<"PMEVCNTR26_EL0",     0b11, 0b011, 0b1110, 0b1011, 0b010>;
1072def : RWSysReg<"PMEVCNTR27_EL0",     0b11, 0b011, 0b1110, 0b1011, 0b011>;
1073def : RWSysReg<"PMEVCNTR28_EL0",     0b11, 0b011, 0b1110, 0b1011, 0b100>;
1074def : RWSysReg<"PMEVCNTR29_EL0",     0b11, 0b011, 0b1110, 0b1011, 0b101>;
1075def : RWSysReg<"PMEVCNTR30_EL0",     0b11, 0b011, 0b1110, 0b1011, 0b110>;
1076def : RWSysReg<"PMCCFILTR_EL0",      0b11, 0b011, 0b1110, 0b1111, 0b111>;
1077def : RWSysReg<"PMEVTYPER0_EL0",     0b11, 0b011, 0b1110, 0b1100, 0b000>;
1078def : RWSysReg<"PMEVTYPER1_EL0",     0b11, 0b011, 0b1110, 0b1100, 0b001>;
1079def : RWSysReg<"PMEVTYPER2_EL0",     0b11, 0b011, 0b1110, 0b1100, 0b010>;
1080def : RWSysReg<"PMEVTYPER3_EL0",     0b11, 0b011, 0b1110, 0b1100, 0b011>;
1081def : RWSysReg<"PMEVTYPER4_EL0",     0b11, 0b011, 0b1110, 0b1100, 0b100>;
1082def : RWSysReg<"PMEVTYPER5_EL0",     0b11, 0b011, 0b1110, 0b1100, 0b101>;
1083def : RWSysReg<"PMEVTYPER6_EL0",     0b11, 0b011, 0b1110, 0b1100, 0b110>;
1084def : RWSysReg<"PMEVTYPER7_EL0",     0b11, 0b011, 0b1110, 0b1100, 0b111>;
1085def : RWSysReg<"PMEVTYPER8_EL0",     0b11, 0b011, 0b1110, 0b1101, 0b000>;
1086def : RWSysReg<"PMEVTYPER9_EL0",     0b11, 0b011, 0b1110, 0b1101, 0b001>;
1087def : RWSysReg<"PMEVTYPER10_EL0",    0b11, 0b011, 0b1110, 0b1101, 0b010>;
1088def : RWSysReg<"PMEVTYPER11_EL0",    0b11, 0b011, 0b1110, 0b1101, 0b011>;
1089def : RWSysReg<"PMEVTYPER12_EL0",    0b11, 0b011, 0b1110, 0b1101, 0b100>;
1090def : RWSysReg<"PMEVTYPER13_EL0",    0b11, 0b011, 0b1110, 0b1101, 0b101>;
1091def : RWSysReg<"PMEVTYPER14_EL0",    0b11, 0b011, 0b1110, 0b1101, 0b110>;
1092def : RWSysReg<"PMEVTYPER15_EL0",    0b11, 0b011, 0b1110, 0b1101, 0b111>;
1093def : RWSysReg<"PMEVTYPER16_EL0",    0b11, 0b011, 0b1110, 0b1110, 0b000>;
1094def : RWSysReg<"PMEVTYPER17_EL0",    0b11, 0b011, 0b1110, 0b1110, 0b001>;
1095def : RWSysReg<"PMEVTYPER18_EL0",    0b11, 0b011, 0b1110, 0b1110, 0b010>;
1096def : RWSysReg<"PMEVTYPER19_EL0",    0b11, 0b011, 0b1110, 0b1110, 0b011>;
1097def : RWSysReg<"PMEVTYPER20_EL0",    0b11, 0b011, 0b1110, 0b1110, 0b100>;
1098def : RWSysReg<"PMEVTYPER21_EL0",    0b11, 0b011, 0b1110, 0b1110, 0b101>;
1099def : RWSysReg<"PMEVTYPER22_EL0",    0b11, 0b011, 0b1110, 0b1110, 0b110>;
1100def : RWSysReg<"PMEVTYPER23_EL0",    0b11, 0b011, 0b1110, 0b1110, 0b111>;
1101def : RWSysReg<"PMEVTYPER24_EL0",    0b11, 0b011, 0b1110, 0b1111, 0b000>;
1102def : RWSysReg<"PMEVTYPER25_EL0",    0b11, 0b011, 0b1110, 0b1111, 0b001>;
1103def : RWSysReg<"PMEVTYPER26_EL0",    0b11, 0b011, 0b1110, 0b1111, 0b010>;
1104def : RWSysReg<"PMEVTYPER27_EL0",    0b11, 0b011, 0b1110, 0b1111, 0b011>;
1105def : RWSysReg<"PMEVTYPER28_EL0",    0b11, 0b011, 0b1110, 0b1111, 0b100>;
1106def : RWSysReg<"PMEVTYPER29_EL0",    0b11, 0b011, 0b1110, 0b1111, 0b101>;
1107def : RWSysReg<"PMEVTYPER30_EL0",    0b11, 0b011, 0b1110, 0b1111, 0b110>;
1108
1109// Trace registers
1110//                                 Op0    Op1     CRn     CRm    Op2
1111def : RWSysReg<"TRCPRGCTLR",         0b10, 0b001, 0b0000, 0b0001, 0b000>;
1112def : RWSysReg<"TRCPROCSELR",        0b10, 0b001, 0b0000, 0b0010, 0b000>;
1113def : RWSysReg<"TRCCONFIGR",         0b10, 0b001, 0b0000, 0b0100, 0b000>;
1114def : RWSysReg<"TRCAUXCTLR",         0b10, 0b001, 0b0000, 0b0110, 0b000>;
1115def : RWSysReg<"TRCEVENTCTL0R",      0b10, 0b001, 0b0000, 0b1000, 0b000>;
1116def : RWSysReg<"TRCEVENTCTL1R",      0b10, 0b001, 0b0000, 0b1001, 0b000>;
1117def : RWSysReg<"TRCSTALLCTLR",       0b10, 0b001, 0b0000, 0b1011, 0b000>;
1118def : RWSysReg<"TRCTSCTLR",          0b10, 0b001, 0b0000, 0b1100, 0b000>;
1119def : RWSysReg<"TRCSYNCPR",          0b10, 0b001, 0b0000, 0b1101, 0b000>;
1120def : RWSysReg<"TRCCCCTLR",          0b10, 0b001, 0b0000, 0b1110, 0b000>;
1121def : RWSysReg<"TRCBBCTLR",          0b10, 0b001, 0b0000, 0b1111, 0b000>;
1122def : RWSysReg<"TRCTRACEIDR",        0b10, 0b001, 0b0000, 0b0000, 0b001>;
1123def : RWSysReg<"TRCQCTLR",           0b10, 0b001, 0b0000, 0b0001, 0b001>;
1124def : RWSysReg<"TRCVICTLR",          0b10, 0b001, 0b0000, 0b0000, 0b010>;
1125def : RWSysReg<"TRCVIIECTLR",        0b10, 0b001, 0b0000, 0b0001, 0b010>;
1126def : RWSysReg<"TRCVISSCTLR",        0b10, 0b001, 0b0000, 0b0010, 0b010>;
1127def : RWSysReg<"TRCVIPCSSCTLR",      0b10, 0b001, 0b0000, 0b0011, 0b010>;
1128def : RWSysReg<"TRCVDCTLR",          0b10, 0b001, 0b0000, 0b1000, 0b010>;
1129def : RWSysReg<"TRCVDSACCTLR",       0b10, 0b001, 0b0000, 0b1001, 0b010>;
1130def : RWSysReg<"TRCVDARCCTLR",       0b10, 0b001, 0b0000, 0b1010, 0b010>;
1131def : RWSysReg<"TRCSEQEVR0",         0b10, 0b001, 0b0000, 0b0000, 0b100>;
1132def : RWSysReg<"TRCSEQEVR1",         0b10, 0b001, 0b0000, 0b0001, 0b100>;
1133def : RWSysReg<"TRCSEQEVR2",         0b10, 0b001, 0b0000, 0b0010, 0b100>;
1134def : RWSysReg<"TRCSEQRSTEVR",       0b10, 0b001, 0b0000, 0b0110, 0b100>;
1135def : RWSysReg<"TRCSEQSTR",          0b10, 0b001, 0b0000, 0b0111, 0b100>;
1136def : RWSysReg<"TRCEXTINSELR",       0b10, 0b001, 0b0000, 0b1000, 0b100>;
1137def : RWSysReg<"TRCCNTRLDVR0",       0b10, 0b001, 0b0000, 0b0000, 0b101>;
1138def : RWSysReg<"TRCCNTRLDVR1",       0b10, 0b001, 0b0000, 0b0001, 0b101>;
1139def : RWSysReg<"TRCCNTRLDVR2",       0b10, 0b001, 0b0000, 0b0010, 0b101>;
1140def : RWSysReg<"TRCCNTRLDVR3",       0b10, 0b001, 0b0000, 0b0011, 0b101>;
1141def : RWSysReg<"TRCCNTCTLR0",        0b10, 0b001, 0b0000, 0b0100, 0b101>;
1142def : RWSysReg<"TRCCNTCTLR1",        0b10, 0b001, 0b0000, 0b0101, 0b101>;
1143def : RWSysReg<"TRCCNTCTLR2",        0b10, 0b001, 0b0000, 0b0110, 0b101>;
1144def : RWSysReg<"TRCCNTCTLR3",        0b10, 0b001, 0b0000, 0b0111, 0b101>;
1145def : RWSysReg<"TRCCNTVR0",          0b10, 0b001, 0b0000, 0b1000, 0b101>;
1146def : RWSysReg<"TRCCNTVR1",          0b10, 0b001, 0b0000, 0b1001, 0b101>;
1147def : RWSysReg<"TRCCNTVR2",          0b10, 0b001, 0b0000, 0b1010, 0b101>;
1148def : RWSysReg<"TRCCNTVR3",          0b10, 0b001, 0b0000, 0b1011, 0b101>;
1149def : RWSysReg<"TRCIMSPEC0",         0b10, 0b001, 0b0000, 0b0000, 0b111>;
1150def : RWSysReg<"TRCIMSPEC1",         0b10, 0b001, 0b0000, 0b0001, 0b111>;
1151def : RWSysReg<"TRCIMSPEC2",         0b10, 0b001, 0b0000, 0b0010, 0b111>;
1152def : RWSysReg<"TRCIMSPEC3",         0b10, 0b001, 0b0000, 0b0011, 0b111>;
1153def : RWSysReg<"TRCIMSPEC4",         0b10, 0b001, 0b0000, 0b0100, 0b111>;
1154def : RWSysReg<"TRCIMSPEC5",         0b10, 0b001, 0b0000, 0b0101, 0b111>;
1155def : RWSysReg<"TRCIMSPEC6",         0b10, 0b001, 0b0000, 0b0110, 0b111>;
1156def : RWSysReg<"TRCIMSPEC7",         0b10, 0b001, 0b0000, 0b0111, 0b111>;
1157def : RWSysReg<"TRCRSCTLR2",         0b10, 0b001, 0b0001, 0b0010, 0b000>;
1158def : RWSysReg<"TRCRSCTLR3",         0b10, 0b001, 0b0001, 0b0011, 0b000>;
1159def : RWSysReg<"TRCRSCTLR4",         0b10, 0b001, 0b0001, 0b0100, 0b000>;
1160def : RWSysReg<"TRCRSCTLR5",         0b10, 0b001, 0b0001, 0b0101, 0b000>;
1161def : RWSysReg<"TRCRSCTLR6",         0b10, 0b001, 0b0001, 0b0110, 0b000>;
1162def : RWSysReg<"TRCRSCTLR7",         0b10, 0b001, 0b0001, 0b0111, 0b000>;
1163def : RWSysReg<"TRCRSCTLR8",         0b10, 0b001, 0b0001, 0b1000, 0b000>;
1164def : RWSysReg<"TRCRSCTLR9",         0b10, 0b001, 0b0001, 0b1001, 0b000>;
1165def : RWSysReg<"TRCRSCTLR10",        0b10, 0b001, 0b0001, 0b1010, 0b000>;
1166def : RWSysReg<"TRCRSCTLR11",        0b10, 0b001, 0b0001, 0b1011, 0b000>;
1167def : RWSysReg<"TRCRSCTLR12",        0b10, 0b001, 0b0001, 0b1100, 0b000>;
1168def : RWSysReg<"TRCRSCTLR13",        0b10, 0b001, 0b0001, 0b1101, 0b000>;
1169def : RWSysReg<"TRCRSCTLR14",        0b10, 0b001, 0b0001, 0b1110, 0b000>;
1170def : RWSysReg<"TRCRSCTLR15",        0b10, 0b001, 0b0001, 0b1111, 0b000>;
1171def : RWSysReg<"TRCRSCTLR16",        0b10, 0b001, 0b0001, 0b0000, 0b001>;
1172def : RWSysReg<"TRCRSCTLR17",        0b10, 0b001, 0b0001, 0b0001, 0b001>;
1173def : RWSysReg<"TRCRSCTLR18",        0b10, 0b001, 0b0001, 0b0010, 0b001>;
1174def : RWSysReg<"TRCRSCTLR19",        0b10, 0b001, 0b0001, 0b0011, 0b001>;
1175def : RWSysReg<"TRCRSCTLR20",        0b10, 0b001, 0b0001, 0b0100, 0b001>;
1176def : RWSysReg<"TRCRSCTLR21",        0b10, 0b001, 0b0001, 0b0101, 0b001>;
1177def : RWSysReg<"TRCRSCTLR22",        0b10, 0b001, 0b0001, 0b0110, 0b001>;
1178def : RWSysReg<"TRCRSCTLR23",        0b10, 0b001, 0b0001, 0b0111, 0b001>;
1179def : RWSysReg<"TRCRSCTLR24",        0b10, 0b001, 0b0001, 0b1000, 0b001>;
1180def : RWSysReg<"TRCRSCTLR25",        0b10, 0b001, 0b0001, 0b1001, 0b001>;
1181def : RWSysReg<"TRCRSCTLR26",        0b10, 0b001, 0b0001, 0b1010, 0b001>;
1182def : RWSysReg<"TRCRSCTLR27",        0b10, 0b001, 0b0001, 0b1011, 0b001>;
1183def : RWSysReg<"TRCRSCTLR28",        0b10, 0b001, 0b0001, 0b1100, 0b001>;
1184def : RWSysReg<"TRCRSCTLR29",        0b10, 0b001, 0b0001, 0b1101, 0b001>;
1185def : RWSysReg<"TRCRSCTLR30",        0b10, 0b001, 0b0001, 0b1110, 0b001>;
1186def : RWSysReg<"TRCRSCTLR31",        0b10, 0b001, 0b0001, 0b1111, 0b001>;
1187def : RWSysReg<"TRCSSCCR0",          0b10, 0b001, 0b0001, 0b0000, 0b010>;
1188def : RWSysReg<"TRCSSCCR1",          0b10, 0b001, 0b0001, 0b0001, 0b010>;
1189def : RWSysReg<"TRCSSCCR2",          0b10, 0b001, 0b0001, 0b0010, 0b010>;
1190def : RWSysReg<"TRCSSCCR3",          0b10, 0b001, 0b0001, 0b0011, 0b010>;
1191def : RWSysReg<"TRCSSCCR4",          0b10, 0b001, 0b0001, 0b0100, 0b010>;
1192def : RWSysReg<"TRCSSCCR5",          0b10, 0b001, 0b0001, 0b0101, 0b010>;
1193def : RWSysReg<"TRCSSCCR6",          0b10, 0b001, 0b0001, 0b0110, 0b010>;
1194def : RWSysReg<"TRCSSCCR7",          0b10, 0b001, 0b0001, 0b0111, 0b010>;
1195def : RWSysReg<"TRCSSCSR0",          0b10, 0b001, 0b0001, 0b1000, 0b010>;
1196def : RWSysReg<"TRCSSCSR1",          0b10, 0b001, 0b0001, 0b1001, 0b010>;
1197def : RWSysReg<"TRCSSCSR2",          0b10, 0b001, 0b0001, 0b1010, 0b010>;
1198def : RWSysReg<"TRCSSCSR3",          0b10, 0b001, 0b0001, 0b1011, 0b010>;
1199def : RWSysReg<"TRCSSCSR4",          0b10, 0b001, 0b0001, 0b1100, 0b010>;
1200def : RWSysReg<"TRCSSCSR5",          0b10, 0b001, 0b0001, 0b1101, 0b010>;
1201def : RWSysReg<"TRCSSCSR6",          0b10, 0b001, 0b0001, 0b1110, 0b010>;
1202def : RWSysReg<"TRCSSCSR7",          0b10, 0b001, 0b0001, 0b1111, 0b010>;
1203def : RWSysReg<"TRCSSPCICR0",        0b10, 0b001, 0b0001, 0b0000, 0b011>;
1204def : RWSysReg<"TRCSSPCICR1",        0b10, 0b001, 0b0001, 0b0001, 0b011>;
1205def : RWSysReg<"TRCSSPCICR2",        0b10, 0b001, 0b0001, 0b0010, 0b011>;
1206def : RWSysReg<"TRCSSPCICR3",        0b10, 0b001, 0b0001, 0b0011, 0b011>;
1207def : RWSysReg<"TRCSSPCICR4",        0b10, 0b001, 0b0001, 0b0100, 0b011>;
1208def : RWSysReg<"TRCSSPCICR5",        0b10, 0b001, 0b0001, 0b0101, 0b011>;
1209def : RWSysReg<"TRCSSPCICR6",        0b10, 0b001, 0b0001, 0b0110, 0b011>;
1210def : RWSysReg<"TRCSSPCICR7",        0b10, 0b001, 0b0001, 0b0111, 0b011>;
1211def : RWSysReg<"TRCPDCR",            0b10, 0b001, 0b0001, 0b0100, 0b100>;
1212def : RWSysReg<"TRCACVR0",           0b10, 0b001, 0b0010, 0b0000, 0b000>;
1213def : RWSysReg<"TRCACVR1",           0b10, 0b001, 0b0010, 0b0010, 0b000>;
1214def : RWSysReg<"TRCACVR2",           0b10, 0b001, 0b0010, 0b0100, 0b000>;
1215def : RWSysReg<"TRCACVR3",           0b10, 0b001, 0b0010, 0b0110, 0b000>;
1216def : RWSysReg<"TRCACVR4",           0b10, 0b001, 0b0010, 0b1000, 0b000>;
1217def : RWSysReg<"TRCACVR5",           0b10, 0b001, 0b0010, 0b1010, 0b000>;
1218def : RWSysReg<"TRCACVR6",           0b10, 0b001, 0b0010, 0b1100, 0b000>;
1219def : RWSysReg<"TRCACVR7",           0b10, 0b001, 0b0010, 0b1110, 0b000>;
1220def : RWSysReg<"TRCACVR8",           0b10, 0b001, 0b0010, 0b0000, 0b001>;
1221def : RWSysReg<"TRCACVR9",           0b10, 0b001, 0b0010, 0b0010, 0b001>;
1222def : RWSysReg<"TRCACVR10",          0b10, 0b001, 0b0010, 0b0100, 0b001>;
1223def : RWSysReg<"TRCACVR11",          0b10, 0b001, 0b0010, 0b0110, 0b001>;
1224def : RWSysReg<"TRCACVR12",          0b10, 0b001, 0b0010, 0b1000, 0b001>;
1225def : RWSysReg<"TRCACVR13",          0b10, 0b001, 0b0010, 0b1010, 0b001>;
1226def : RWSysReg<"TRCACVR14",          0b10, 0b001, 0b0010, 0b1100, 0b001>;
1227def : RWSysReg<"TRCACVR15",          0b10, 0b001, 0b0010, 0b1110, 0b001>;
1228def : RWSysReg<"TRCACATR0",          0b10, 0b001, 0b0010, 0b0000, 0b010>;
1229def : RWSysReg<"TRCACATR1",          0b10, 0b001, 0b0010, 0b0010, 0b010>;
1230def : RWSysReg<"TRCACATR2",          0b10, 0b001, 0b0010, 0b0100, 0b010>;
1231def : RWSysReg<"TRCACATR3",          0b10, 0b001, 0b0010, 0b0110, 0b010>;
1232def : RWSysReg<"TRCACATR4",          0b10, 0b001, 0b0010, 0b1000, 0b010>;
1233def : RWSysReg<"TRCACATR5",          0b10, 0b001, 0b0010, 0b1010, 0b010>;
1234def : RWSysReg<"TRCACATR6",          0b10, 0b001, 0b0010, 0b1100, 0b010>;
1235def : RWSysReg<"TRCACATR7",          0b10, 0b001, 0b0010, 0b1110, 0b010>;
1236def : RWSysReg<"TRCACATR8",          0b10, 0b001, 0b0010, 0b0000, 0b011>;
1237def : RWSysReg<"TRCACATR9",          0b10, 0b001, 0b0010, 0b0010, 0b011>;
1238def : RWSysReg<"TRCACATR10",         0b10, 0b001, 0b0010, 0b0100, 0b011>;
1239def : RWSysReg<"TRCACATR11",         0b10, 0b001, 0b0010, 0b0110, 0b011>;
1240def : RWSysReg<"TRCACATR12",         0b10, 0b001, 0b0010, 0b1000, 0b011>;
1241def : RWSysReg<"TRCACATR13",         0b10, 0b001, 0b0010, 0b1010, 0b011>;
1242def : RWSysReg<"TRCACATR14",         0b10, 0b001, 0b0010, 0b1100, 0b011>;
1243def : RWSysReg<"TRCACATR15",         0b10, 0b001, 0b0010, 0b1110, 0b011>;
1244def : RWSysReg<"TRCDVCVR0",          0b10, 0b001, 0b0010, 0b0000, 0b100>;
1245def : RWSysReg<"TRCDVCVR1",          0b10, 0b001, 0b0010, 0b0100, 0b100>;
1246def : RWSysReg<"TRCDVCVR2",          0b10, 0b001, 0b0010, 0b1000, 0b100>;
1247def : RWSysReg<"TRCDVCVR3",          0b10, 0b001, 0b0010, 0b1100, 0b100>;
1248def : RWSysReg<"TRCDVCVR4",          0b10, 0b001, 0b0010, 0b0000, 0b101>;
1249def : RWSysReg<"TRCDVCVR5",          0b10, 0b001, 0b0010, 0b0100, 0b101>;
1250def : RWSysReg<"TRCDVCVR6",          0b10, 0b001, 0b0010, 0b1000, 0b101>;
1251def : RWSysReg<"TRCDVCVR7",          0b10, 0b001, 0b0010, 0b1100, 0b101>;
1252def : RWSysReg<"TRCDVCMR0",          0b10, 0b001, 0b0010, 0b0000, 0b110>;
1253def : RWSysReg<"TRCDVCMR1",          0b10, 0b001, 0b0010, 0b0100, 0b110>;
1254def : RWSysReg<"TRCDVCMR2",          0b10, 0b001, 0b0010, 0b1000, 0b110>;
1255def : RWSysReg<"TRCDVCMR3",          0b10, 0b001, 0b0010, 0b1100, 0b110>;
1256def : RWSysReg<"TRCDVCMR4",          0b10, 0b001, 0b0010, 0b0000, 0b111>;
1257def : RWSysReg<"TRCDVCMR5",          0b10, 0b001, 0b0010, 0b0100, 0b111>;
1258def : RWSysReg<"TRCDVCMR6",          0b10, 0b001, 0b0010, 0b1000, 0b111>;
1259def : RWSysReg<"TRCDVCMR7",          0b10, 0b001, 0b0010, 0b1100, 0b111>;
1260def : RWSysReg<"TRCCIDCVR0",         0b10, 0b001, 0b0011, 0b0000, 0b000>;
1261def : RWSysReg<"TRCCIDCVR1",         0b10, 0b001, 0b0011, 0b0010, 0b000>;
1262def : RWSysReg<"TRCCIDCVR2",         0b10, 0b001, 0b0011, 0b0100, 0b000>;
1263def : RWSysReg<"TRCCIDCVR3",         0b10, 0b001, 0b0011, 0b0110, 0b000>;
1264def : RWSysReg<"TRCCIDCVR4",         0b10, 0b001, 0b0011, 0b1000, 0b000>;
1265def : RWSysReg<"TRCCIDCVR5",         0b10, 0b001, 0b0011, 0b1010, 0b000>;
1266def : RWSysReg<"TRCCIDCVR6",         0b10, 0b001, 0b0011, 0b1100, 0b000>;
1267def : RWSysReg<"TRCCIDCVR7",         0b10, 0b001, 0b0011, 0b1110, 0b000>;
1268def : RWSysReg<"TRCVMIDCVR0",        0b10, 0b001, 0b0011, 0b0000, 0b001>;
1269def : RWSysReg<"TRCVMIDCVR1",        0b10, 0b001, 0b0011, 0b0010, 0b001>;
1270def : RWSysReg<"TRCVMIDCVR2",        0b10, 0b001, 0b0011, 0b0100, 0b001>;
1271def : RWSysReg<"TRCVMIDCVR3",        0b10, 0b001, 0b0011, 0b0110, 0b001>;
1272def : RWSysReg<"TRCVMIDCVR4",        0b10, 0b001, 0b0011, 0b1000, 0b001>;
1273def : RWSysReg<"TRCVMIDCVR5",        0b10, 0b001, 0b0011, 0b1010, 0b001>;
1274def : RWSysReg<"TRCVMIDCVR6",        0b10, 0b001, 0b0011, 0b1100, 0b001>;
1275def : RWSysReg<"TRCVMIDCVR7",        0b10, 0b001, 0b0011, 0b1110, 0b001>;
1276def : RWSysReg<"TRCCIDCCTLR0",       0b10, 0b001, 0b0011, 0b0000, 0b010>;
1277def : RWSysReg<"TRCCIDCCTLR1",       0b10, 0b001, 0b0011, 0b0001, 0b010>;
1278def : RWSysReg<"TRCVMIDCCTLR0",      0b10, 0b001, 0b0011, 0b0010, 0b010>;
1279def : RWSysReg<"TRCVMIDCCTLR1",      0b10, 0b001, 0b0011, 0b0011, 0b010>;
1280def : RWSysReg<"TRCITCTRL",          0b10, 0b001, 0b0111, 0b0000, 0b100>;
1281def : RWSysReg<"TRCCLAIMSET",        0b10, 0b001, 0b0111, 0b1000, 0b110>;
1282def : RWSysReg<"TRCCLAIMCLR",        0b10, 0b001, 0b0111, 0b1001, 0b110>;
1283
1284// GICv3 registers
1285//                                 Op0    Op1     CRn     CRm    Op2
1286def : RWSysReg<"ICC_BPR1_EL1",       0b11, 0b000, 0b1100, 0b1100, 0b011>;
1287def : RWSysReg<"ICC_BPR0_EL1",       0b11, 0b000, 0b1100, 0b1000, 0b011>;
1288def : RWSysReg<"ICC_PMR_EL1",        0b11, 0b000, 0b0100, 0b0110, 0b000>;
1289def : RWSysReg<"ICC_CTLR_EL1",       0b11, 0b000, 0b1100, 0b1100, 0b100>;
1290def : RWSysReg<"ICC_CTLR_EL3",       0b11, 0b110, 0b1100, 0b1100, 0b100>;
1291def : RWSysReg<"ICC_SRE_EL1",        0b11, 0b000, 0b1100, 0b1100, 0b101>;
1292def : RWSysReg<"ICC_SRE_EL2",        0b11, 0b100, 0b1100, 0b1001, 0b101>;
1293def : RWSysReg<"ICC_SRE_EL3",        0b11, 0b110, 0b1100, 0b1100, 0b101>;
1294def : RWSysReg<"ICC_IGRPEN0_EL1",    0b11, 0b000, 0b1100, 0b1100, 0b110>;
1295def : RWSysReg<"ICC_IGRPEN1_EL1",    0b11, 0b000, 0b1100, 0b1100, 0b111>;
1296def : RWSysReg<"ICC_IGRPEN1_EL3",    0b11, 0b110, 0b1100, 0b1100, 0b111>;
1297def : RWSysReg<"ICC_AP0R0_EL1",      0b11, 0b000, 0b1100, 0b1000, 0b100>;
1298def : RWSysReg<"ICC_AP0R1_EL1",      0b11, 0b000, 0b1100, 0b1000, 0b101>;
1299def : RWSysReg<"ICC_AP0R2_EL1",      0b11, 0b000, 0b1100, 0b1000, 0b110>;
1300def : RWSysReg<"ICC_AP0R3_EL1",      0b11, 0b000, 0b1100, 0b1000, 0b111>;
1301def : RWSysReg<"ICC_AP1R0_EL1",      0b11, 0b000, 0b1100, 0b1001, 0b000>;
1302def : RWSysReg<"ICC_AP1R1_EL1",      0b11, 0b000, 0b1100, 0b1001, 0b001>;
1303def : RWSysReg<"ICC_AP1R2_EL1",      0b11, 0b000, 0b1100, 0b1001, 0b010>;
1304def : RWSysReg<"ICC_AP1R3_EL1",      0b11, 0b000, 0b1100, 0b1001, 0b011>;
1305def : RWSysReg<"ICH_AP0R0_EL2",      0b11, 0b100, 0b1100, 0b1000, 0b000>;
1306def : RWSysReg<"ICH_AP0R1_EL2",      0b11, 0b100, 0b1100, 0b1000, 0b001>;
1307def : RWSysReg<"ICH_AP0R2_EL2",      0b11, 0b100, 0b1100, 0b1000, 0b010>;
1308def : RWSysReg<"ICH_AP0R3_EL2",      0b11, 0b100, 0b1100, 0b1000, 0b011>;
1309def : RWSysReg<"ICH_AP1R0_EL2",      0b11, 0b100, 0b1100, 0b1001, 0b000>;
1310def : RWSysReg<"ICH_AP1R1_EL2",      0b11, 0b100, 0b1100, 0b1001, 0b001>;
1311def : RWSysReg<"ICH_AP1R2_EL2",      0b11, 0b100, 0b1100, 0b1001, 0b010>;
1312def : RWSysReg<"ICH_AP1R3_EL2",      0b11, 0b100, 0b1100, 0b1001, 0b011>;
1313def : RWSysReg<"ICH_HCR_EL2",        0b11, 0b100, 0b1100, 0b1011, 0b000>;
1314def : ROSysReg<"ICH_MISR_EL2",       0b11, 0b100, 0b1100, 0b1011, 0b010>;
1315def : RWSysReg<"ICH_VMCR_EL2",       0b11, 0b100, 0b1100, 0b1011, 0b111>;
1316def : RWSysReg<"ICH_LR0_EL2",        0b11, 0b100, 0b1100, 0b1100, 0b000>;
1317def : RWSysReg<"ICH_LR1_EL2",        0b11, 0b100, 0b1100, 0b1100, 0b001>;
1318def : RWSysReg<"ICH_LR2_EL2",        0b11, 0b100, 0b1100, 0b1100, 0b010>;
1319def : RWSysReg<"ICH_LR3_EL2",        0b11, 0b100, 0b1100, 0b1100, 0b011>;
1320def : RWSysReg<"ICH_LR4_EL2",        0b11, 0b100, 0b1100, 0b1100, 0b100>;
1321def : RWSysReg<"ICH_LR5_EL2",        0b11, 0b100, 0b1100, 0b1100, 0b101>;
1322def : RWSysReg<"ICH_LR6_EL2",        0b11, 0b100, 0b1100, 0b1100, 0b110>;
1323def : RWSysReg<"ICH_LR7_EL2",        0b11, 0b100, 0b1100, 0b1100, 0b111>;
1324def : RWSysReg<"ICH_LR8_EL2",        0b11, 0b100, 0b1100, 0b1101, 0b000>;
1325def : RWSysReg<"ICH_LR9_EL2",        0b11, 0b100, 0b1100, 0b1101, 0b001>;
1326def : RWSysReg<"ICH_LR10_EL2",       0b11, 0b100, 0b1100, 0b1101, 0b010>;
1327def : RWSysReg<"ICH_LR11_EL2",       0b11, 0b100, 0b1100, 0b1101, 0b011>;
1328def : RWSysReg<"ICH_LR12_EL2",       0b11, 0b100, 0b1100, 0b1101, 0b100>;
1329def : RWSysReg<"ICH_LR13_EL2",       0b11, 0b100, 0b1100, 0b1101, 0b101>;
1330def : RWSysReg<"ICH_LR14_EL2",       0b11, 0b100, 0b1100, 0b1101, 0b110>;
1331def : RWSysReg<"ICH_LR15_EL2",       0b11, 0b100, 0b1100, 0b1101, 0b111>;
1332
1333// v8r system registers
1334let Requires = [{ {AArch64::HasV8_0rOps} }] in {
1335//Virtualization System Control Register
1336//                                 Op0   Op1    CRn     CRm     Op2
1337def : RWSysReg<"VSCTLR_EL2",       0b11, 0b100, 0b0010, 0b0000, 0b000> {
1338  let AltName = "TTBR0_EL2";
1339}
1340
1341//MPU Type Register
1342//                                 Op0   Op1    CRn     CRm     Op2
1343def : RWSysReg<"MPUIR_EL1",        0b11, 0b000, 0b0000, 0b0000, 0b100>;
1344def : RWSysReg<"MPUIR_EL2",        0b11, 0b100, 0b0000, 0b0000, 0b100>;
1345
1346//Protection Region Enable Register
1347//                                 Op0   Op1    CRn     CRm     Op2
1348def : RWSysReg<"PRENR_EL1",        0b11, 0b000, 0b0110, 0b0001, 0b001>;
1349def : RWSysReg<"PRENR_EL2",        0b11, 0b100, 0b0110, 0b0001, 0b001>;
1350
1351//Protection Region Selection Register
1352//                                 Op0   Op1    CRn     CRm     Op2
1353def : RWSysReg<"PRSELR_EL1",       0b11, 0b000, 0b0110, 0b0010, 0b001>;
1354def : RWSysReg<"PRSELR_EL2",       0b11, 0b100, 0b0110, 0b0010, 0b001>;
1355
1356//Protection Region Base Address Register
1357//                                 Op0   Op1    CRn     CRm     Op2
1358def : RWSysReg<"PRBAR_EL1",        0b11, 0b000, 0b0110, 0b1000, 0b000>;
1359def : RWSysReg<"PRBAR_EL2",        0b11, 0b100, 0b0110, 0b1000, 0b000>;
1360
1361//Protection Region Limit Address Register
1362//                                 Op0   Op1    CRn     CRm     Op2
1363def : RWSysReg<"PRLAR_EL1",        0b11, 0b000, 0b0110, 0b1000, 0b001>;
1364def : RWSysReg<"PRLAR_EL2",        0b11, 0b100, 0b0110, 0b1000, 0b001>;
1365
1366foreach n = 1-15 in {
1367foreach x = 1-2 in {
1368//Direct acces to Protection Region Base Address Register for n th MPU region
1369  def : RWSysReg<!strconcat("PRBAR"#n, "_EL"#x),
1370    0b11, 0b000, 0b0110, 0b1000, 0b000>{
1371    let Encoding{5-2} = n;
1372    let Encoding{13} = !add(x,-1);
1373  }
1374
1375  def : RWSysReg<!strconcat("PRLAR"#n, "_EL"#x),
1376    0b11, 0b000, 0b0110, 0b1000, 0b001>{
1377    let Encoding{5-2} = n;
1378    let Encoding{13} = !add(x,-1);
1379  }
1380} //foreach x = 1-2 in
1381} //foreach n = 1-15 in
1382} //let Requires = [{ {AArch64::HasV8_0rOps} }] in
1383
1384// v8.1a "Privileged Access Never" extension-specific system registers
1385let Requires = [{ {AArch64::FeaturePAN} }] in
1386def : RWSysReg<"PAN", 0b11, 0b000, 0b0100, 0b0010, 0b011>;
1387
1388// v8.1a "Limited Ordering Regions" extension-specific system registers
1389//                         Op0    Op1     CRn     CRm    Op2
1390let Requires = [{ {AArch64::FeatureLOR} }] in {
1391def : RWSysReg<"LORSA_EL1",  0b11, 0b000, 0b1010, 0b0100, 0b000>;
1392def : RWSysReg<"LOREA_EL1",  0b11, 0b000, 0b1010, 0b0100, 0b001>;
1393def : RWSysReg<"LORN_EL1",   0b11, 0b000, 0b1010, 0b0100, 0b010>;
1394def : RWSysReg<"LORC_EL1",   0b11, 0b000, 0b1010, 0b0100, 0b011>;
1395}
1396
1397// v8.1a "Virtualization Host extensions" system registers
1398//                              Op0    Op1     CRn     CRm    Op2
1399let Requires = [{ {AArch64::FeatureVH} }] in {
1400def : RWSysReg<"TTBR1_EL2",       0b11, 0b100, 0b0010, 0b0000, 0b001>;
1401def : RWSysReg<"CNTHV_TVAL_EL2",  0b11, 0b100, 0b1110, 0b0011, 0b000>;
1402def : RWSysReg<"CNTHV_CVAL_EL2",  0b11, 0b100, 0b1110, 0b0011, 0b010>;
1403def : RWSysReg<"CNTHV_CTL_EL2",   0b11, 0b100, 0b1110, 0b0011, 0b001>;
1404def : RWSysReg<"SCTLR_EL12",      0b11, 0b101, 0b0001, 0b0000, 0b000>;
1405def : RWSysReg<"CPACR_EL12",      0b11, 0b101, 0b0001, 0b0000, 0b010>;
1406def : RWSysReg<"TTBR0_EL12",      0b11, 0b101, 0b0010, 0b0000, 0b000>;
1407def : RWSysReg<"TTBR1_EL12",      0b11, 0b101, 0b0010, 0b0000, 0b001>;
1408def : RWSysReg<"TCR_EL12",        0b11, 0b101, 0b0010, 0b0000, 0b010>;
1409def : RWSysReg<"AFSR0_EL12",      0b11, 0b101, 0b0101, 0b0001, 0b000>;
1410def : RWSysReg<"AFSR1_EL12",      0b11, 0b101, 0b0101, 0b0001, 0b001>;
1411def : RWSysReg<"ESR_EL12",        0b11, 0b101, 0b0101, 0b0010, 0b000>;
1412def : RWSysReg<"FAR_EL12",        0b11, 0b101, 0b0110, 0b0000, 0b000>;
1413def : RWSysReg<"MAIR_EL12",       0b11, 0b101, 0b1010, 0b0010, 0b000>;
1414def : RWSysReg<"AMAIR_EL12",      0b11, 0b101, 0b1010, 0b0011, 0b000>;
1415def : RWSysReg<"VBAR_EL12",       0b11, 0b101, 0b1100, 0b0000, 0b000>;
1416def : RWSysReg<"CONTEXTIDR_EL12", 0b11, 0b101, 0b1101, 0b0000, 0b001>;
1417def : RWSysReg<"CNTKCTL_EL12",    0b11, 0b101, 0b1110, 0b0001, 0b000>;
1418def : RWSysReg<"CNTP_TVAL_EL02",  0b11, 0b101, 0b1110, 0b0010, 0b000>;
1419def : RWSysReg<"CNTP_CTL_EL02",   0b11, 0b101, 0b1110, 0b0010, 0b001>;
1420def : RWSysReg<"CNTP_CVAL_EL02",  0b11, 0b101, 0b1110, 0b0010, 0b010>;
1421def : RWSysReg<"CNTV_TVAL_EL02",  0b11, 0b101, 0b1110, 0b0011, 0b000>;
1422def : RWSysReg<"CNTV_CTL_EL02",   0b11, 0b101, 0b1110, 0b0011, 0b001>;
1423def : RWSysReg<"CNTV_CVAL_EL02",  0b11, 0b101, 0b1110, 0b0011, 0b010>;
1424def : RWSysReg<"SPSR_EL12",       0b11, 0b101, 0b0100, 0b0000, 0b000>;
1425def : RWSysReg<"ELR_EL12",        0b11, 0b101, 0b0100, 0b0000, 0b001>;
1426let Requires = [{ {AArch64::FeatureCONTEXTIDREL2} }] in {
1427  def : RWSysReg<"CONTEXTIDR_EL2",  0b11, 0b100, 0b1101, 0b0000, 0b001>;
1428}
1429}
1430// v8.2a registers
1431//                  Op0    Op1     CRn     CRm    Op2
1432let Requires = [{ {AArch64::FeaturePsUAO} }] in
1433def : RWSysReg<"UAO", 0b11, 0b000, 0b0100, 0b0010, 0b100>;
1434
1435// v8.2a "Statistical Profiling extension" registers
1436//                            Op0    Op1     CRn     CRm    Op2
1437let Requires = [{ {AArch64::FeatureSPE} }] in {
1438def : RWSysReg<"PMBLIMITR_EL1", 0b11, 0b000, 0b1001, 0b1010, 0b000>;
1439def : RWSysReg<"PMBPTR_EL1",    0b11, 0b000, 0b1001, 0b1010, 0b001>;
1440def : RWSysReg<"PMBSR_EL1",     0b11, 0b000, 0b1001, 0b1010, 0b011>;
1441def : ROSysReg<"PMBIDR_EL1",    0b11, 0b000, 0b1001, 0b1010, 0b111>;
1442def : RWSysReg<"PMSCR_EL2",     0b11, 0b100, 0b1001, 0b1001, 0b000>;
1443def : RWSysReg<"PMSCR_EL12",    0b11, 0b101, 0b1001, 0b1001, 0b000>;
1444def : RWSysReg<"PMSCR_EL1",     0b11, 0b000, 0b1001, 0b1001, 0b000>;
1445def : RWSysReg<"PMSICR_EL1",    0b11, 0b000, 0b1001, 0b1001, 0b010>;
1446def : RWSysReg<"PMSIRR_EL1",    0b11, 0b000, 0b1001, 0b1001, 0b011>;
1447def : RWSysReg<"PMSFCR_EL1",    0b11, 0b000, 0b1001, 0b1001, 0b100>;
1448def : RWSysReg<"PMSEVFR_EL1",   0b11, 0b000, 0b1001, 0b1001, 0b101>;
1449def : RWSysReg<"PMSLATFR_EL1",  0b11, 0b000, 0b1001, 0b1001, 0b110>;
1450def : ROSysReg<"PMSIDR_EL1",    0b11, 0b000, 0b1001, 0b1001, 0b111>;
1451}
1452
1453// v8.2a "RAS extension" registers
1454//                         Op0    Op1     CRn     CRm    Op2
1455let Requires = [{ {AArch64::FeatureRAS} }] in {
1456def : RWSysReg<"ERRSELR_EL1",   0b11, 0b000, 0b0101, 0b0011, 0b001>;
1457def : RWSysReg<"ERXCTLR_EL1",   0b11, 0b000, 0b0101, 0b0100, 0b001>;
1458def : RWSysReg<"ERXSTATUS_EL1", 0b11, 0b000, 0b0101, 0b0100, 0b010>;
1459def : RWSysReg<"ERXADDR_EL1",   0b11, 0b000, 0b0101, 0b0100, 0b011>;
1460def : RWSysReg<"ERXMISC0_EL1",  0b11, 0b000, 0b0101, 0b0101, 0b000>;
1461def : RWSysReg<"ERXMISC1_EL1",  0b11, 0b000, 0b0101, 0b0101, 0b001>;
1462def : RWSysReg<"DISR_EL1",      0b11, 0b000, 0b1100, 0b0001, 0b001>;
1463def : RWSysReg<"VDISR_EL2",     0b11, 0b100, 0b1100, 0b0001, 0b001>;
1464def : RWSysReg<"VSESR_EL2",     0b11, 0b100, 0b0101, 0b0010, 0b011>;
1465}
1466
1467// v8.3a "Pointer authentication extension" registers
1468//                              Op0    Op1     CRn     CRm    Op2
1469let Requires = [{ {AArch64::FeaturePAuth} }] in {
1470def : RWSysReg<"APIAKeyLo_EL1", 0b11, 0b000, 0b0010, 0b0001, 0b000>;
1471def : RWSysReg<"APIAKeyHi_EL1", 0b11, 0b000, 0b0010, 0b0001, 0b001>;
1472def : RWSysReg<"APIBKeyLo_EL1", 0b11, 0b000, 0b0010, 0b0001, 0b010>;
1473def : RWSysReg<"APIBKeyHi_EL1", 0b11, 0b000, 0b0010, 0b0001, 0b011>;
1474def : RWSysReg<"APDAKeyLo_EL1", 0b11, 0b000, 0b0010, 0b0010, 0b000>;
1475def : RWSysReg<"APDAKeyHi_EL1", 0b11, 0b000, 0b0010, 0b0010, 0b001>;
1476def : RWSysReg<"APDBKeyLo_EL1", 0b11, 0b000, 0b0010, 0b0010, 0b010>;
1477def : RWSysReg<"APDBKeyHi_EL1", 0b11, 0b000, 0b0010, 0b0010, 0b011>;
1478def : RWSysReg<"APGAKeyLo_EL1", 0b11, 0b000, 0b0010, 0b0011, 0b000>;
1479def : RWSysReg<"APGAKeyHi_EL1", 0b11, 0b000, 0b0010, 0b0011, 0b001>;
1480}
1481
1482// v8.4 "Secure Exception Level 2 extension"
1483let Requires = [{ {AArch64::FeatureSEL2} }] in {
1484// v8.4a "Virtualization secure second stage translation" registers
1485//                           Op0   Op1    CRn     CRm     Op2
1486def : RWSysReg<"VSTCR_EL2" , 0b11, 0b100, 0b0010, 0b0110, 0b010>;
1487def : RWSysReg<"VSTTBR_EL2", 0b11, 0b100, 0b0010, 0b0110, 0b000> {
1488  let Requires = [{ {AArch64::HasV8_0aOps} }];
1489}
1490
1491// v8.4a "Virtualization timer" registers
1492//                                Op0   Op1    CRn     CRm     Op2
1493def : RWSysReg<"CNTHVS_TVAL_EL2", 0b11, 0b100, 0b1110, 0b0100, 0b000>;
1494def : RWSysReg<"CNTHVS_CVAL_EL2", 0b11, 0b100, 0b1110, 0b0100, 0b010>;
1495def : RWSysReg<"CNTHVS_CTL_EL2",  0b11, 0b100, 0b1110, 0b0100, 0b001>;
1496def : RWSysReg<"CNTHPS_TVAL_EL2", 0b11, 0b100, 0b1110, 0b0101, 0b000>;
1497def : RWSysReg<"CNTHPS_CVAL_EL2", 0b11, 0b100, 0b1110, 0b0101, 0b010>;
1498def : RWSysReg<"CNTHPS_CTL_EL2",  0b11, 0b100, 0b1110, 0b0101, 0b001>;
1499
1500// v8.4a "Virtualization debug state" registers
1501//                           Op0   Op1    CRn     CRm     Op2
1502def : RWSysReg<"SDER32_EL2", 0b11, 0b100, 0b0001, 0b0011, 0b001>;
1503} // FeatureSEL2
1504
1505// v8.4a RAS registers
1506//                              Op0   Op1    CRn     CRm     Op2
1507def : RWSysReg<"ERXPFGCTL_EL1", 0b11, 0b000, 0b0101, 0b0100, 0b101>;
1508def : RWSysReg<"ERXPFGCDN_EL1", 0b11, 0b000, 0b0101, 0b0100, 0b110>;
1509def : RWSysReg<"ERXMISC2_EL1",  0b11, 0b000, 0b0101, 0b0101, 0b010>;
1510def : RWSysReg<"ERXMISC3_EL1",  0b11, 0b000, 0b0101, 0b0101, 0b011>;
1511def : ROSysReg<"ERXPFGF_EL1",   0b11, 0b000, 0b0101, 0b0100, 0b100>;
1512
1513// v8.4a MPAM registers
1514//                             Op0   Op1    CRn     CRm     Op2
1515let Requires = [{ {AArch64::FeatureMPAM} }] in {
1516def : RWSysReg<"MPAM0_EL1",    0b11, 0b000, 0b1010, 0b0101, 0b001>;
1517def : RWSysReg<"MPAM1_EL1",    0b11, 0b000, 0b1010, 0b0101, 0b000>;
1518def : RWSysReg<"MPAM2_EL2",    0b11, 0b100, 0b1010, 0b0101, 0b000>;
1519def : RWSysReg<"MPAM3_EL3",    0b11, 0b110, 0b1010, 0b0101, 0b000>;
1520def : RWSysReg<"MPAM1_EL12",   0b11, 0b101, 0b1010, 0b0101, 0b000>;
1521def : RWSysReg<"MPAMHCR_EL2",  0b11, 0b100, 0b1010, 0b0100, 0b000>;
1522def : RWSysReg<"MPAMVPMV_EL2", 0b11, 0b100, 0b1010, 0b0100, 0b001>;
1523def : RWSysReg<"MPAMVPM0_EL2", 0b11, 0b100, 0b1010, 0b0110, 0b000>;
1524def : RWSysReg<"MPAMVPM1_EL2", 0b11, 0b100, 0b1010, 0b0110, 0b001>;
1525def : RWSysReg<"MPAMVPM2_EL2", 0b11, 0b100, 0b1010, 0b0110, 0b010>;
1526def : RWSysReg<"MPAMVPM3_EL2", 0b11, 0b100, 0b1010, 0b0110, 0b011>;
1527def : RWSysReg<"MPAMVPM4_EL2", 0b11, 0b100, 0b1010, 0b0110, 0b100>;
1528def : RWSysReg<"MPAMVPM5_EL2", 0b11, 0b100, 0b1010, 0b0110, 0b101>;
1529def : RWSysReg<"MPAMVPM6_EL2", 0b11, 0b100, 0b1010, 0b0110, 0b110>;
1530def : RWSysReg<"MPAMVPM7_EL2", 0b11, 0b100, 0b1010, 0b0110, 0b111>;
1531def : ROSysReg<"MPAMIDR_EL1",  0b11, 0b000, 0b1010, 0b0100, 0b100>;
1532} //FeatureMPAM
1533
1534// v8.4a Activity Monitor registers
1535//                                 Op0   Op1    CRn     CRm     Op2
1536let Requires = [{ {AArch64::FeatureAM} }] in {
1537def : RWSysReg<"AMCR_EL0",         0b11, 0b011, 0b1101, 0b0010, 0b000>;
1538def : ROSysReg<"AMCFGR_EL0",       0b11, 0b011, 0b1101, 0b0010, 0b001>;
1539def : ROSysReg<"AMCGCR_EL0",       0b11, 0b011, 0b1101, 0b0010, 0b010>;
1540def : RWSysReg<"AMUSERENR_EL0",    0b11, 0b011, 0b1101, 0b0010, 0b011>;
1541def : RWSysReg<"AMCNTENCLR0_EL0",  0b11, 0b011, 0b1101, 0b0010, 0b100>;
1542def : RWSysReg<"AMCNTENSET0_EL0",  0b11, 0b011, 0b1101, 0b0010, 0b101>;
1543def : RWSysReg<"AMEVCNTR00_EL0",   0b11, 0b011, 0b1101, 0b0100, 0b000>;
1544def : RWSysReg<"AMEVCNTR01_EL0",   0b11, 0b011, 0b1101, 0b0100, 0b001>;
1545def : RWSysReg<"AMEVCNTR02_EL0",   0b11, 0b011, 0b1101, 0b0100, 0b010>;
1546def : RWSysReg<"AMEVCNTR03_EL0",   0b11, 0b011, 0b1101, 0b0100, 0b011>;
1547def : ROSysReg<"AMEVTYPER00_EL0",  0b11, 0b011, 0b1101, 0b0110, 0b000>;
1548def : ROSysReg<"AMEVTYPER01_EL0",  0b11, 0b011, 0b1101, 0b0110, 0b001>;
1549def : ROSysReg<"AMEVTYPER02_EL0",  0b11, 0b011, 0b1101, 0b0110, 0b010>;
1550def : ROSysReg<"AMEVTYPER03_EL0",  0b11, 0b011, 0b1101, 0b0110, 0b011>;
1551def : RWSysReg<"AMCNTENCLR1_EL0",  0b11, 0b011, 0b1101, 0b0011, 0b000>;
1552def : RWSysReg<"AMCNTENSET1_EL0",  0b11, 0b011, 0b1101, 0b0011, 0b001>;
1553def : RWSysReg<"AMEVCNTR10_EL0",   0b11, 0b011, 0b1101, 0b1100, 0b000>;
1554def : RWSysReg<"AMEVCNTR11_EL0",   0b11, 0b011, 0b1101, 0b1100, 0b001>;
1555def : RWSysReg<"AMEVCNTR12_EL0",   0b11, 0b011, 0b1101, 0b1100, 0b010>;
1556def : RWSysReg<"AMEVCNTR13_EL0",   0b11, 0b011, 0b1101, 0b1100, 0b011>;
1557def : RWSysReg<"AMEVCNTR14_EL0",   0b11, 0b011, 0b1101, 0b1100, 0b100>;
1558def : RWSysReg<"AMEVCNTR15_EL0",   0b11, 0b011, 0b1101, 0b1100, 0b101>;
1559def : RWSysReg<"AMEVCNTR16_EL0",   0b11, 0b011, 0b1101, 0b1100, 0b110>;
1560def : RWSysReg<"AMEVCNTR17_EL0",   0b11, 0b011, 0b1101, 0b1100, 0b111>;
1561def : RWSysReg<"AMEVCNTR18_EL0",   0b11, 0b011, 0b1101, 0b1101, 0b000>;
1562def : RWSysReg<"AMEVCNTR19_EL0",   0b11, 0b011, 0b1101, 0b1101, 0b001>;
1563def : RWSysReg<"AMEVCNTR110_EL0",  0b11, 0b011, 0b1101, 0b1101, 0b010>;
1564def : RWSysReg<"AMEVCNTR111_EL0",  0b11, 0b011, 0b1101, 0b1101, 0b011>;
1565def : RWSysReg<"AMEVCNTR112_EL0",  0b11, 0b011, 0b1101, 0b1101, 0b100>;
1566def : RWSysReg<"AMEVCNTR113_EL0",  0b11, 0b011, 0b1101, 0b1101, 0b101>;
1567def : RWSysReg<"AMEVCNTR114_EL0",  0b11, 0b011, 0b1101, 0b1101, 0b110>;
1568def : RWSysReg<"AMEVCNTR115_EL0",  0b11, 0b011, 0b1101, 0b1101, 0b111>;
1569def : RWSysReg<"AMEVTYPER10_EL0",  0b11, 0b011, 0b1101, 0b1110, 0b000>;
1570def : RWSysReg<"AMEVTYPER11_EL0",  0b11, 0b011, 0b1101, 0b1110, 0b001>;
1571def : RWSysReg<"AMEVTYPER12_EL0",  0b11, 0b011, 0b1101, 0b1110, 0b010>;
1572def : RWSysReg<"AMEVTYPER13_EL0",  0b11, 0b011, 0b1101, 0b1110, 0b011>;
1573def : RWSysReg<"AMEVTYPER14_EL0",  0b11, 0b011, 0b1101, 0b1110, 0b100>;
1574def : RWSysReg<"AMEVTYPER15_EL0",  0b11, 0b011, 0b1101, 0b1110, 0b101>;
1575def : RWSysReg<"AMEVTYPER16_EL0",  0b11, 0b011, 0b1101, 0b1110, 0b110>;
1576def : RWSysReg<"AMEVTYPER17_EL0",  0b11, 0b011, 0b1101, 0b1110, 0b111>;
1577def : RWSysReg<"AMEVTYPER18_EL0",  0b11, 0b011, 0b1101, 0b1111, 0b000>;
1578def : RWSysReg<"AMEVTYPER19_EL0",  0b11, 0b011, 0b1101, 0b1111, 0b001>;
1579def : RWSysReg<"AMEVTYPER110_EL0", 0b11, 0b011, 0b1101, 0b1111, 0b010>;
1580def : RWSysReg<"AMEVTYPER111_EL0", 0b11, 0b011, 0b1101, 0b1111, 0b011>;
1581def : RWSysReg<"AMEVTYPER112_EL0", 0b11, 0b011, 0b1101, 0b1111, 0b100>;
1582def : RWSysReg<"AMEVTYPER113_EL0", 0b11, 0b011, 0b1101, 0b1111, 0b101>;
1583def : RWSysReg<"AMEVTYPER114_EL0", 0b11, 0b011, 0b1101, 0b1111, 0b110>;
1584def : RWSysReg<"AMEVTYPER115_EL0", 0b11, 0b011, 0b1101, 0b1111, 0b111>;
1585} //FeatureAM
1586
1587// v8.4a Trace Extension registers
1588//
1589// Please note that the 8.4 spec also defines these registers:
1590// TRCIDR1, ID_DFR0_EL1, ID_AA64DFR0_EL1, MDSCR_EL1, MDCR_EL2, and MDCR_EL3,
1591// but they are already defined above.
1592//
1593//                                 Op0   Op1    CRn     CRm     Op2
1594let Requires = [{ {AArch64::FeatureTRACEV8_4} }] in {
1595def : RWSysReg<"TRFCR_EL1",        0b11, 0b000, 0b0001, 0b0010, 0b001>;
1596def : RWSysReg<"TRFCR_EL2",        0b11, 0b100, 0b0001, 0b0010, 0b001>;
1597def : RWSysReg<"TRFCR_EL12",       0b11, 0b101, 0b0001, 0b0010, 0b001>;
1598} //FeatureTRACEV8_4
1599
1600// v8.4a Timing insensitivity of data processing instructions
1601// DIT: Data Independent Timing instructions
1602//                                 Op0   Op1    CRn     CRm     Op2
1603let Requires = [{ {AArch64::FeatureDIT} }] in {
1604def : RWSysReg<"DIT",              0b11, 0b011, 0b0100, 0b0010, 0b101>;
1605} //FeatureDIT
1606
1607// v8.4a Enhanced Support for Nested Virtualization
1608//                                 Op0   Op1    CRn     CRm     Op2
1609let Requires = [{ {AArch64::FeatureNV} }] in {
1610def : RWSysReg<"VNCR_EL2",         0b11, 0b100, 0b0010, 0b0010, 0b000>;
1611} //FeatureNV
1612
1613// SVE control registers
1614//                                 Op0   Op1    CRn     CRm     Op2
1615let Requires = [{ {AArch64::FeatureSVE} }] in {
1616def : RWSysReg<"ZCR_EL1",          0b11, 0b000, 0b0001, 0b0010, 0b000>;
1617def : RWSysReg<"ZCR_EL2",          0b11, 0b100, 0b0001, 0b0010, 0b000>;
1618def : RWSysReg<"ZCR_EL3",          0b11, 0b110, 0b0001, 0b0010, 0b000>;
1619def : RWSysReg<"ZCR_EL12",         0b11, 0b101, 0b0001, 0b0010, 0b000>;
1620}
1621
1622// V8.5a Spectre mitigation SSBS register
1623//                     Op0   Op1    CRn     CRm     Op2
1624let Requires = [{ {AArch64::FeatureSSBS} }] in
1625def : RWSysReg<"SSBS", 0b11, 0b011, 0b0100, 0b0010, 0b110>;
1626
1627// v8.5a Memory Tagging Extension
1628//                                 Op0   Op1    CRn     CRm     Op2
1629let Requires = [{ {AArch64::FeatureMTE} }] in {
1630def : RWSysReg<"TCO",              0b11, 0b011, 0b0100, 0b0010, 0b111>;
1631def : RWSysReg<"GCR_EL1",          0b11, 0b000, 0b0001, 0b0000, 0b110>;
1632def : RWSysReg<"RGSR_EL1",         0b11, 0b000, 0b0001, 0b0000, 0b101>;
1633def : RWSysReg<"TFSR_EL1",         0b11, 0b000, 0b0101, 0b0110, 0b000>;
1634def : RWSysReg<"TFSR_EL2",         0b11, 0b100, 0b0101, 0b0110, 0b000>;
1635def : RWSysReg<"TFSR_EL3",         0b11, 0b110, 0b0101, 0b0110, 0b000>;
1636def : RWSysReg<"TFSR_EL12",        0b11, 0b101, 0b0101, 0b0110, 0b000>;
1637def : RWSysReg<"TFSRE0_EL1",       0b11, 0b000, 0b0101, 0b0110, 0b001>;
1638def : ROSysReg<"GMID_EL1",         0b11, 0b001, 0b0000, 0b0000, 0b100>;
1639} // HasMTE
1640
1641// Embedded Trace Extension R/W System registers
1642let Requires = [{ {AArch64::FeatureETE} }] in {
1643//              Name            Op0   Op1    CRn     CRm     Op2
1644def : RWSysReg<"TRCRSR",        0b10, 0b001, 0b0000, 0b1010, 0b000>;
1645//  TRCEXTINSELR0 has the same encoding as ETM TRCEXTINSELR
1646def : RWSysReg<"TRCEXTINSELR0", 0b10, 0b001, 0b0000, 0b1000, 0b100>;
1647def : RWSysReg<"TRCEXTINSELR1", 0b10, 0b001, 0b0000, 0b1001, 0b100>;
1648def : RWSysReg<"TRCEXTINSELR2", 0b10, 0b001, 0b0000, 0b1010, 0b100>;
1649def : RWSysReg<"TRCEXTINSELR3", 0b10, 0b001, 0b0000, 0b1011, 0b100>;
1650} // FeatureETE
1651
1652// Trace Buffer Extension System registers
1653let Requires = [{ {AArch64::FeatureTRBE} }] in {
1654//                   Name       Op0   Op1    CRn     CRm     Op2
1655def : RWSysReg<"TRBLIMITR_EL1", 0b11, 0b000, 0b1001, 0b1011, 0b000>;
1656def : RWSysReg<"TRBPTR_EL1",    0b11, 0b000, 0b1001, 0b1011, 0b001>;
1657def : RWSysReg<"TRBBASER_EL1",  0b11, 0b000, 0b1001, 0b1011, 0b010>;
1658def : RWSysReg<"TRBSR_EL1",     0b11, 0b000, 0b1001, 0b1011, 0b011>;
1659def : RWSysReg<"TRBMAR_EL1",    0b11, 0b000, 0b1001, 0b1011, 0b100>;
1660def : RWSysReg<"TRBTRG_EL1",    0b11, 0b000, 0b1001, 0b1011, 0b110>;
1661def : ROSysReg<"TRBIDR_EL1",    0b11, 0b000, 0b1001, 0b1011, 0b111>;
1662} // FeatureTRBE
1663
1664
1665// v8.6a Activity Monitors Virtualization Support
1666let Requires = [{ {AArch64::FeatureAMVS} }] in {
1667//              Name            Op0   Op1    CRn     CRm     Op2
1668def : ROSysReg<"AMCG1IDR_EL0",  0b11, 0b011, 0b1101, 0b0010, 0b110>;
1669foreach n = 0-15 in {
1670  foreach x = 0-1 in {
1671  def : RWSysReg<"AMEVCNTVOFF"#x#n#"_EL2",
1672    0b11, 0b100, 0b1101, 0b1000, 0b000>{
1673      let Encoding{4} = x;
1674      let Encoding{3-0} = n;
1675    }
1676  }
1677}
1678}
1679
1680// v8.6a Fine Grained Virtualization Traps
1681//                                 Op0   Op1    CRn     CRm     Op2
1682let Requires = [{ {AArch64::FeatureFineGrainedTraps} }] in {
1683def : RWSysReg<"HFGRTR_EL2",       0b11, 0b100, 0b0001, 0b0001, 0b100>;
1684def : RWSysReg<"HFGWTR_EL2",       0b11, 0b100, 0b0001, 0b0001, 0b101>;
1685def : RWSysReg<"HFGITR_EL2",       0b11, 0b100, 0b0001, 0b0001, 0b110>;
1686def : RWSysReg<"HDFGRTR_EL2",      0b11, 0b100, 0b0011, 0b0001, 0b100>;
1687def : RWSysReg<"HDFGWTR_EL2",      0b11, 0b100, 0b0011, 0b0001, 0b101>;
1688def : RWSysReg<"HAFGRTR_EL2",      0b11, 0b100, 0b0011, 0b0001, 0b110>;
1689
1690// v8.9a/v9.4a additions to Fine Grained Traps (FEAT_FGT2)
1691//                                 Op0   Op1    CRn     CRm     Op2
1692def : RWSysReg<"HDFGRTR2_EL2",     0b11, 0b100, 0b0011, 0b0001, 0b000>;
1693def : RWSysReg<"HDFGWTR2_EL2",     0b11, 0b100, 0b0011, 0b0001, 0b001>;
1694def : RWSysReg<"HFGRTR2_EL2",      0b11, 0b100, 0b0011, 0b0001, 0b010>;
1695def : RWSysReg<"HFGWTR2_EL2",      0b11, 0b100, 0b0011, 0b0001, 0b011>;
1696def : RWSysReg<"HFGITR2_EL2",      0b11, 0b100, 0b0011, 0b0001, 0b111>;
1697}
1698
1699// v8.6a Enhanced Counter Virtualization
1700//                                 Op0   Op1    CRn     CRm     Op2
1701let Requires = [{ {AArch64::FeatureEnhancedCounterVirtualization} }] in {
1702def : RWSysReg<"CNTSCALE_EL2",     0b11, 0b100, 0b1110, 0b0000, 0b100>;
1703def : RWSysReg<"CNTISCALE_EL2",    0b11, 0b100, 0b1110, 0b0000, 0b101>;
1704def : RWSysReg<"CNTPOFF_EL2",      0b11, 0b100, 0b1110, 0b0000, 0b110>;
1705def : RWSysReg<"CNTVFRQ_EL2",      0b11, 0b100, 0b1110, 0b0000, 0b111>;
1706def : ROSysReg<"CNTPCTSS_EL0",     0b11, 0b011, 0b1110, 0b0000, 0b101>;
1707def : ROSysReg<"CNTVCTSS_EL0",     0b11, 0b011, 0b1110, 0b0000, 0b110>;
1708}
1709
1710// v8.7a LD64B/ST64B Accelerator Extension system register
1711let Requires = [{ {AArch64::FeatureLS64} }] in
1712def : RWSysReg<"ACCDATA_EL1",       0b11, 0b000, 0b1101, 0b0000, 0b101>;
1713
1714// Branch Record Buffer system registers
1715let Requires = [{ {AArch64::FeatureBRBE} }] in {
1716def : RWSysReg<"BRBCR_EL1",         0b10, 0b001, 0b1001, 0b0000, 0b000>;
1717def : RWSysReg<"BRBCR_EL12",        0b10, 0b101, 0b1001, 0b0000, 0b000>;
1718def : RWSysReg<"BRBCR_EL2",         0b10, 0b100, 0b1001, 0b0000, 0b000>;
1719def : RWSysReg<"BRBFCR_EL1",        0b10, 0b001, 0b1001, 0b0000, 0b001>;
1720def : ROSysReg<"BRBIDR0_EL1",       0b10, 0b001, 0b1001, 0b0010, 0b000>;
1721def : RWSysReg<"BRBINFINJ_EL1",     0b10, 0b001, 0b1001, 0b0001, 0b000>;
1722def : RWSysReg<"BRBSRCINJ_EL1",     0b10, 0b001, 0b1001, 0b0001, 0b001>;
1723def : RWSysReg<"BRBTGTINJ_EL1",     0b10, 0b001, 0b1001, 0b0001, 0b010>;
1724def : RWSysReg<"BRBTS_EL1",         0b10, 0b001, 0b1001, 0b0000, 0b010>;
1725foreach n = 0-31 in {
1726  defvar nb = !cast<bits<5>>(n);
1727  def : ROSysReg<"BRBINF"#n#"_EL1", 0b10, 0b001, 0b1000, nb{3-0}, {nb{4},0b00}>;
1728  def : ROSysReg<"BRBSRC"#n#"_EL1", 0b10, 0b001, 0b1000, nb{3-0}, {nb{4},0b01}>;
1729  def : ROSysReg<"BRBTGT"#n#"_EL1", 0b10, 0b001, 0b1000, nb{3-0}, {nb{4},0b10}>;
1730}
1731}
1732
1733// Statistical Profiling Extension system register
1734let Requires = [{ {AArch64::FeatureSPE_EEF} }] in
1735def : RWSysReg<"PMSNEVFR_EL1",      0b11, 0b000, 0b1001, 0b1001, 0b001>;
1736
1737// Cyclone specific system registers
1738//                                 Op0    Op1     CRn     CRm    Op2
1739let Requires = [{ {AArch64::FeatureAppleA7SysReg} }] in
1740def : RWSysReg<"CPM_IOACC_CTL_EL3", 0b11, 0b111, 0b1111, 0b0010, 0b000>;
1741
1742// Scalable Matrix Extension (SME)
1743//                                 Op0   Op1    CRn     CRm     Op2
1744let Requires = [{ {AArch64::FeatureSME} }] in {
1745def : RWSysReg<"SMCR_EL1",         0b11, 0b000, 0b0001, 0b0010, 0b110>;
1746def : RWSysReg<"SMCR_EL2",         0b11, 0b100, 0b0001, 0b0010, 0b110>;
1747def : RWSysReg<"SMCR_EL3",         0b11, 0b110, 0b0001, 0b0010, 0b110>;
1748def : RWSysReg<"SMCR_EL12",        0b11, 0b101, 0b0001, 0b0010, 0b110>;
1749def : RWSysReg<"SVCR",             0b11, 0b011, 0b0100, 0b0010, 0b010>;
1750def : RWSysReg<"SMPRI_EL1",        0b11, 0b000, 0b0001, 0b0010, 0b100>;
1751def : RWSysReg<"SMPRIMAP_EL2",     0b11, 0b100, 0b0001, 0b0010, 0b101>;
1752def : ROSysReg<"SMIDR_EL1",        0b11, 0b001, 0b0000, 0b0000, 0b110>;
1753def : RWSysReg<"TPIDR2_EL0",       0b11, 0b011, 0b1101, 0b0000, 0b101>;
1754} // HasSME
1755
1756// v8.4a MPAM and SME registers
1757//                              Op0   Op1    CRn     CRm     Op2
1758let Requires = [{ {AArch64::FeatureMPAM, AArch64::FeatureSME} }] in {
1759def : RWSysReg<"MPAMSM_EL1",    0b11, 0b000, 0b1010, 0b0101, 0b011>;
1760} // HasMPAM, HasSME
1761
1762// v8.8a Non-Maskable Interrupts
1763let Requires = [{ {AArch64::FeatureNMI} }] in {
1764  //                               Op0   Op1    CRn     CRm     Op2
1765  def : RWSysReg<"ALLINT",         0b11, 0b000, 0b0100, 0b0011, 0b000>;
1766  def : ROSysReg<"ICC_NMIAR1_EL1", 0b11, 0b000, 0b1100, 0b1001, 0b101>; // FEAT_GICv3_NMI
1767}
1768
1769// v9.4a Guarded Control Stack Extension (GCS)
1770//                            Op0   Op1    CRn     CRm     Op2
1771def : RWSysReg<"GCSCR_EL1",   0b11, 0b000, 0b0010, 0b0101, 0b000>;
1772def : RWSysReg<"GCSPR_EL1",   0b11, 0b000, 0b0010, 0b0101, 0b001>;
1773def : RWSysReg<"GCSCRE0_EL1", 0b11, 0b000, 0b0010, 0b0101, 0b010>;
1774def : RWSysReg<"GCSPR_EL0",   0b11, 0b011, 0b0010, 0b0101, 0b001>;
1775def : RWSysReg<"GCSCR_EL2",   0b11, 0b100, 0b0010, 0b0101, 0b000>;
1776def : RWSysReg<"GCSPR_EL2",   0b11, 0b100, 0b0010, 0b0101, 0b001>;
1777def : RWSysReg<"GCSCR_EL12",  0b11, 0b101, 0b0010, 0b0101, 0b000>;
1778def : RWSysReg<"GCSPR_EL12",  0b11, 0b101, 0b0010, 0b0101, 0b001>;
1779def : RWSysReg<"GCSCR_EL3",   0b11, 0b110, 0b0010, 0b0101, 0b000>;
1780def : RWSysReg<"GCSPR_EL3",   0b11, 0b110, 0b0010, 0b0101, 0b001>;
1781
1782// v8.9a/v9.4a Memory Attribute Index Enhancement (FEAT_AIE)
1783//                            Op0   Op1    CRn     CRm     Op2
1784def : RWSysReg<"AMAIR2_EL1",  0b11, 0b000, 0b1010, 0b0011, 0b001>;
1785def : RWSysReg<"AMAIR2_EL12", 0b11, 0b101, 0b1010, 0b0011, 0b001>;
1786def : RWSysReg<"AMAIR2_EL2",  0b11, 0b100, 0b1010, 0b0011, 0b001>;
1787def : RWSysReg<"AMAIR2_EL3",  0b11, 0b110, 0b1010, 0b0011, 0b001>;
1788def : RWSysReg<"MAIR2_EL1",   0b11, 0b000, 0b1010, 0b0010, 0b001>;
1789def : RWSysReg<"MAIR2_EL12",  0b11, 0b101, 0b1010, 0b0010, 0b001>;
1790def : RWSysReg<"MAIR2_EL2",   0b11, 0b100, 0b1010, 0b0001, 0b001>;
1791def : RWSysReg<"MAIR2_EL3",   0b11, 0b110, 0b1010, 0b0001, 0b001>;
1792
1793// v8.9a/9.4a Stage 1 Permission Indirection Extension (FEAT_S1PIE)
1794//                            Op0   Op1    CRn     CRm     Op2
1795def : RWSysReg<"PIRE0_EL1",   0b11, 0b000, 0b1010, 0b0010, 0b010>;
1796def : RWSysReg<"PIRE0_EL12",  0b11, 0b101, 0b1010, 0b0010, 0b010>;
1797def : RWSysReg<"PIRE0_EL2",   0b11, 0b100, 0b1010, 0b0010, 0b010>;
1798def : RWSysReg<"PIR_EL1",     0b11, 0b000, 0b1010, 0b0010, 0b011>;
1799def : RWSysReg<"PIR_EL12",    0b11, 0b101, 0b1010, 0b0010, 0b011>;
1800def : RWSysReg<"PIR_EL2",     0b11, 0b100, 0b1010, 0b0010, 0b011>;
1801def : RWSysReg<"PIR_EL3",     0b11, 0b110, 0b1010, 0b0010, 0b011>;
1802
1803// v8.9a/v9.4a Stage 2 Permission Indirection Extension (FEAT_S2PIE)
1804//                            Op0   Op1    CRn     CRm     Op2
1805def : RWSysReg<"S2PIR_EL2",   0b11, 0b100, 0b1010, 0b0010, 0b101>;
1806
1807// v8.9a/v9.4a Stage 1 Permission Overlay Extension (FEAT_S1POE)
1808//                            Op0   Op1    CRn     CRm     Op2
1809def : RWSysReg<"POR_EL0",     0b11, 0b011, 0b1010, 0b0010, 0b100>;
1810def : RWSysReg<"POR_EL1",     0b11, 0b000, 0b1010, 0b0010, 0b100>;
1811def : RWSysReg<"POR_EL12",    0b11, 0b101, 0b1010, 0b0010, 0b100>;
1812def : RWSysReg<"POR_EL2",     0b11, 0b100, 0b1010, 0b0010, 0b100>;
1813def : RWSysReg<"POR_EL3",     0b11, 0b110, 0b1010, 0b0010, 0b100>;
1814
1815// v8.9a/v9.4a Stage 2 Permission Overlay Extension (FEAT_S2POE)
1816//                            Op0   Op1    CRn     CRm     Op2
1817def : RWSysReg<"S2POR_EL1",   0b11, 0b000, 0b1010, 0b0010, 0b101>;
1818
1819// v8.9a/v9.4a Extension to System Control Registers (FEAT_SCTLR2)
1820//                            Op0   Op1    CRn     CRm     Op2
1821def : RWSysReg<"SCTLR2_EL1",  0b11, 0b000, 0b0001, 0b0000, 0b011>;
1822def : RWSysReg<"SCTLR2_EL12", 0b11, 0b101, 0b0001, 0b0000, 0b011>;
1823def : RWSysReg<"SCTLR2_EL2",  0b11, 0b100, 0b0001, 0b0000, 0b011>;
1824def : RWSysReg<"SCTLR2_EL3",  0b11, 0b110, 0b0001, 0b0000, 0b011>;
1825
1826// v8.9a/v9.4a Extension to Translation Control Registers (FEAT_TCR2)
1827//                            Op0   Op1    CRn     CRm     Op2
1828def : RWSysReg<"TCR2_EL1",    0b11, 0b000, 0b0010, 0b0000, 0b011>;
1829def : RWSysReg<"TCR2_EL12",   0b11, 0b101, 0b0010, 0b0000, 0b011>;
1830def : RWSysReg<"TCR2_EL2",    0b11, 0b100, 0b0010, 0b0000, 0b011>;
1831
1832// v8.9a/9.4a Translation Hardening Extension (FEAT_THE)
1833//                             Op0   Op1    CRn     CRm     Op2
1834let Requires = [{ {AArch64::FeatureTHE} }] in {
1835def : RWSysReg<"RCWMASK_EL1",  0b11, 0b000, 0b1101, 0b0000, 0b110>;
1836def : RWSysReg<"RCWSMASK_EL1", 0b11, 0b000, 0b1101, 0b0000, 0b011>;
1837}
1838
1839// v8.9a/9.4a new Debug feature (FEAT_DEBUGv8p9)
1840//                            Op0   Op1    CRn     CRm     Op2
1841def : RWSysReg<"MDSELR_EL1", 0b10, 0b000, 0b0000, 0b0100, 0b010>;
1842
1843// v8.9a/9.4a new Performance Monitors Extension (FEAT_PMUv3p9)
1844//                            Op0   Op1    CRn     CRm     Op2
1845def : RWSysReg<"PMUACR_EL1", 0b11, 0b000, 0b1001, 0b1110, 0b100>;
1846
1847// v8.9a/9.4a PMU Snapshot Extension (FEAT_PMUv3_SS)
1848//                                  Op0   Op1    CRn     CRm     Op2
1849def : ROSysReg<"PMCCNTSVR_EL1",     0b10, 0b000, 0b1110, 0b1011, 0b111>;
1850def : ROSysReg<"PMICNTSVR_EL1",     0b10, 0b000, 0b1110, 0b1100, 0b000>;
1851def : RWSysReg<"PMSSCR_EL1",        0b11, 0b000, 0b1001, 0b1101, 0b011>;
1852foreach n = 0-30 in {
1853  defvar nb = !cast<bits<5>>(n);
1854  def : ROSysReg<"PMEVCNTSVR"#n#"_EL1", 0b10, 0b000, 0b1110, {0b10,nb{4-3}}, nb{2-0}>;
1855}
1856
1857// v8.9a/v9.4a PMUv3 Fixed-function instruction counter (FEAT_PMUv3_ICNTR)
1858//                                  Op0   Op1    CRn     CRm     Op2
1859def : RWSysReg<"PMICNTR_EL0",       0b11, 0b011, 0b1001, 0b0100, 0b000>;
1860def : RWSysReg<"PMICFILTR_EL0",     0b11, 0b011, 0b1001, 0b0110, 0b000>;
1861
1862// v8.9a/v9.4a PMUv3 Performance Monitors Zero with Mask (FEAT_PMUv3p9/FEAT_PMUv3_ICNTR)
1863//                                  Op0   Op1    CRn     CRm     Op2
1864def : WOSysReg<"PMZR_EL0",          0b11, 0b011, 0b1001, 0b1101, 0b100>;
1865
1866// v8.9a/9.4a Synchronous-Exception-Based Event Profiling extension (FEAT_SEBEP)
1867//                              Op0   Op1    CRn     CRm     Op2
1868def : RWSysReg<"PMECR_EL1",     0b11, 0b000, 0b1001, 0b1110, 0b101>;
1869def : RWSysReg<"PMIAR_EL1",     0b11, 0b000, 0b1001, 0b1110, 0b111>;
1870
1871// v8.9a/9.4a System Performance Monitors Extension (FEAT_SPMU)
1872//                                  Op0   Op1    CRn     CRm     Op2
1873def : RWSysReg<"SPMACCESSR_EL1",    0b10, 0b000, 0b1001, 0b1101, 0b011>;
1874def : RWSysReg<"SPMACCESSR_EL12",   0b10, 0b101, 0b1001, 0b1101, 0b011>;
1875def : RWSysReg<"SPMACCESSR_EL2",    0b10, 0b100, 0b1001, 0b1101, 0b011>;
1876def : RWSysReg<"SPMACCESSR_EL3",    0b10, 0b110, 0b1001, 0b1101, 0b011>;
1877def : RWSysReg<"SPMCNTENCLR_EL0",   0b10, 0b011, 0b1001, 0b1100, 0b010>;
1878def : RWSysReg<"SPMCNTENSET_EL0",   0b10, 0b011, 0b1001, 0b1100, 0b001>;
1879def : RWSysReg<"SPMCR_EL0",         0b10, 0b011, 0b1001, 0b1100, 0b000>;
1880def : ROSysReg<"SPMDEVAFF_EL1",     0b10, 0b000, 0b1001, 0b1101, 0b110>;
1881def : ROSysReg<"SPMDEVARCH_EL1",    0b10, 0b000, 0b1001, 0b1101, 0b101>;
1882foreach n = 0-15 in {
1883  defvar nb = !cast<bits<4>>(n);
1884  //                                     Op0   Op1    CRn     CRm            Op2
1885  def : RWSysReg<"SPMEVCNTR"#n#"_EL0",   0b10, 0b011, 0b1110, {0b000,nb{3}}, nb{2-0}>;
1886  def : RWSysReg<"SPMEVFILT2R"#n#"_EL0", 0b10, 0b011, 0b1110, {0b011,nb{3}}, nb{2-0}>;
1887  def : RWSysReg<"SPMEVFILTR"#n#"_EL0",  0b10, 0b011, 0b1110, {0b010,nb{3}}, nb{2-0}>;
1888  def : RWSysReg<"SPMEVTYPER"#n#"_EL0",  0b10, 0b011, 0b1110, {0b001,nb{3}}, nb{2-0}>;
1889}
1890//                                  Op0   Op1    CRn     CRm     Op2
1891def : ROSysReg<"SPMIIDR_EL1",       0b10, 0b000, 0b1001, 0b1101, 0b100>;
1892def : RWSysReg<"SPMINTENCLR_EL1",   0b10, 0b000, 0b1001, 0b1110, 0b010>;
1893def : RWSysReg<"SPMINTENSET_EL1",   0b10, 0b000, 0b1001, 0b1110, 0b001>;
1894def : RWSysReg<"SPMOVSCLR_EL0",     0b10, 0b011, 0b1001, 0b1100, 0b011>;
1895def : RWSysReg<"SPMOVSSET_EL0",     0b10, 0b011, 0b1001, 0b1110, 0b011>;
1896def : RWSysReg<"SPMSELR_EL0",       0b10, 0b011, 0b1001, 0b1100, 0b101>;
1897def : ROSysReg<"SPMCGCR0_EL1",      0b10, 0b000, 0b1001, 0b1101, 0b000>;
1898def : ROSysReg<"SPMCGCR1_EL1",      0b10, 0b000, 0b1001, 0b1101, 0b001>;
1899def : ROSysReg<"SPMCFGR_EL1",       0b10, 0b000, 0b1001, 0b1101, 0b111>;
1900def : RWSysReg<"SPMROOTCR_EL3",     0b10, 0b110, 0b1001, 0b1110, 0b111>;
1901def : RWSysReg<"SPMSCR_EL1",        0b10, 0b111, 0b1001, 0b1110, 0b111>;
1902
1903// v8.9a/9.4a Instrumentation Extension (FEAT_ITE)
1904//                                  Op0   Op1    CRn     CRm     Op2
1905let Requires = [{ {AArch64::FeatureITE} }] in {
1906def : RWSysReg<"TRCITEEDCR",        0b10, 0b001, 0b0000, 0b0010, 0b001>;
1907def : RWSysReg<"TRCITECR_EL1",      0b11, 0b000, 0b0001, 0b0010, 0b011>;
1908def : RWSysReg<"TRCITECR_EL12",     0b11, 0b101, 0b0001, 0b0010, 0b011>;
1909def : RWSysReg<"TRCITECR_EL2",      0b11, 0b100, 0b0001, 0b0010, 0b011>;
1910}
1911
1912// v8.9a/9.4a SPE Data Source Filtering (FEAT_SPE_FDS)
1913//                                  Op0   Op1    CRn     CRm     Op2
1914def : RWSysReg<"PMSDSFR_EL1",       0b11, 0b000, 0b1001, 0b1010, 0b100>;
1915
1916// v8.9a/9.4a RASv2 (FEAT_RASv2)
1917//                                  Op0   Op1    CRn     CRm     Op2
1918let Requires = [{ {AArch64::FeatureRASv2} }] in
1919def : ROSysReg<"ERXGSR_EL1",        0b11, 0b000, 0b0101, 0b0011, 0b010>;
1920
1921// v8.9a/9.4a Physical Fault Address (FEAT_PFAR)
1922//                                  Op0   Op1    CRn     CRm     Op2
1923def : RWSysReg<"PFAR_EL1",          0b11, 0b000, 0b0110, 0b0000, 0b101>;
1924def : RWSysReg<"PFAR_EL12",         0b11, 0b101, 0b0110, 0b0000, 0b101>;
1925def : RWSysReg<"PFAR_EL2",          0b11, 0b100, 0b0110, 0b0000, 0b101>;
1926
1927// v9.4a Exception-based event profiling (FEAT_EBEP)
1928//                                  Op0   Op1    CRn     CRm     Op2
1929def : RWSysReg<"PM",                0b11, 0b000, 0b0100, 0b0011, 0b001>;
1930