• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//=- AArch64RegisterInfo.td - Describe the AArch64 Regisers --*- tablegen -*-=//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10//
11//===----------------------------------------------------------------------===//
12
13
14class AArch64Reg<bits<16> enc, string n, list<Register> subregs = [],
15               list<string> altNames = []>
16        : Register<n, altNames> {
17  let HWEncoding = enc;
18  let Namespace = "AArch64";
19  let SubRegs = subregs;
20}
21
22let Namespace = "AArch64" in {
23  def sub_32 : SubRegIndex<32>;
24
25  def bsub : SubRegIndex<8>;
26  def hsub : SubRegIndex<16>;
27  def ssub : SubRegIndex<32>;
28  def dsub : SubRegIndex<32>;
29  def sube32 : SubRegIndex<32>;
30  def subo32 : SubRegIndex<32>;
31  def qhisub : SubRegIndex<64>;
32  def qsub : SubRegIndex<64>;
33  def sube64 : SubRegIndex<64>;
34  def subo64 : SubRegIndex<64>;
35  // Note: Code depends on these having consecutive numbers
36  def dsub0 : SubRegIndex<64>;
37  def dsub1 : SubRegIndex<64>;
38  def dsub2 : SubRegIndex<64>;
39  def dsub3 : SubRegIndex<64>;
40  // Note: Code depends on these having consecutive numbers
41  def qsub0 : SubRegIndex<128>;
42  def qsub1 : SubRegIndex<128>;
43  def qsub2 : SubRegIndex<128>;
44  def qsub3 : SubRegIndex<128>;
45}
46
47let Namespace = "AArch64" in {
48  def vreg : RegAltNameIndex;
49  def vlist1 : RegAltNameIndex;
50}
51
52//===----------------------------------------------------------------------===//
53// Registers
54//===----------------------------------------------------------------------===//
55def W0    : AArch64Reg<0,   "w0" >, DwarfRegNum<[0]>;
56def W1    : AArch64Reg<1,   "w1" >, DwarfRegNum<[1]>;
57def W2    : AArch64Reg<2,   "w2" >, DwarfRegNum<[2]>;
58def W3    : AArch64Reg<3,   "w3" >, DwarfRegNum<[3]>;
59def W4    : AArch64Reg<4,   "w4" >, DwarfRegNum<[4]>;
60def W5    : AArch64Reg<5,   "w5" >, DwarfRegNum<[5]>;
61def W6    : AArch64Reg<6,   "w6" >, DwarfRegNum<[6]>;
62def W7    : AArch64Reg<7,   "w7" >, DwarfRegNum<[7]>;
63def W8    : AArch64Reg<8,   "w8" >, DwarfRegNum<[8]>;
64def W9    : AArch64Reg<9,   "w9" >, DwarfRegNum<[9]>;
65def W10   : AArch64Reg<10, "w10">, DwarfRegNum<[10]>;
66def W11   : AArch64Reg<11, "w11">, DwarfRegNum<[11]>;
67def W12   : AArch64Reg<12, "w12">, DwarfRegNum<[12]>;
68def W13   : AArch64Reg<13, "w13">, DwarfRegNum<[13]>;
69def W14   : AArch64Reg<14, "w14">, DwarfRegNum<[14]>;
70def W15   : AArch64Reg<15, "w15">, DwarfRegNum<[15]>;
71def W16   : AArch64Reg<16, "w16">, DwarfRegNum<[16]>;
72def W17   : AArch64Reg<17, "w17">, DwarfRegNum<[17]>;
73def W18   : AArch64Reg<18, "w18">, DwarfRegNum<[18]>;
74def W19   : AArch64Reg<19, "w19">, DwarfRegNum<[19]>;
75def W20   : AArch64Reg<20, "w20">, DwarfRegNum<[20]>;
76def W21   : AArch64Reg<21, "w21">, DwarfRegNum<[21]>;
77def W22   : AArch64Reg<22, "w22">, DwarfRegNum<[22]>;
78def W23   : AArch64Reg<23, "w23">, DwarfRegNum<[23]>;
79def W24   : AArch64Reg<24, "w24">, DwarfRegNum<[24]>;
80def W25   : AArch64Reg<25, "w25">, DwarfRegNum<[25]>;
81def W26   : AArch64Reg<26, "w26">, DwarfRegNum<[26]>;
82def W27   : AArch64Reg<27, "w27">, DwarfRegNum<[27]>;
83def W28   : AArch64Reg<28, "w28">, DwarfRegNum<[28]>;
84def W29   : AArch64Reg<29, "w29">, DwarfRegNum<[29]>;
85def W30   : AArch64Reg<30, "w30">, DwarfRegNum<[30]>;
86def WSP   : AArch64Reg<31, "wsp">, DwarfRegNum<[31]>;
87def WZR   : AArch64Reg<31, "wzr">, DwarfRegAlias<WSP>;
88
89let SubRegIndices = [sub_32] in {
90def X0    : AArch64Reg<0,   "x0",  [W0]>, DwarfRegAlias<W0>;
91def X1    : AArch64Reg<1,   "x1",  [W1]>, DwarfRegAlias<W1>;
92def X2    : AArch64Reg<2,   "x2",  [W2]>, DwarfRegAlias<W2>;
93def X3    : AArch64Reg<3,   "x3",  [W3]>, DwarfRegAlias<W3>;
94def X4    : AArch64Reg<4,   "x4",  [W4]>, DwarfRegAlias<W4>;
95def X5    : AArch64Reg<5,   "x5",  [W5]>, DwarfRegAlias<W5>;
96def X6    : AArch64Reg<6,   "x6",  [W6]>, DwarfRegAlias<W6>;
97def X7    : AArch64Reg<7,   "x7",  [W7]>, DwarfRegAlias<W7>;
98def X8    : AArch64Reg<8,   "x8",  [W8]>, DwarfRegAlias<W8>;
99def X9    : AArch64Reg<9,   "x9",  [W9]>, DwarfRegAlias<W9>;
100def X10   : AArch64Reg<10, "x10", [W10]>, DwarfRegAlias<W10>;
101def X11   : AArch64Reg<11, "x11", [W11]>, DwarfRegAlias<W11>;
102def X12   : AArch64Reg<12, "x12", [W12]>, DwarfRegAlias<W12>;
103def X13   : AArch64Reg<13, "x13", [W13]>, DwarfRegAlias<W13>;
104def X14   : AArch64Reg<14, "x14", [W14]>, DwarfRegAlias<W14>;
105def X15   : AArch64Reg<15, "x15", [W15]>, DwarfRegAlias<W15>;
106def X16   : AArch64Reg<16, "x16", [W16]>, DwarfRegAlias<W16>;
107def X17   : AArch64Reg<17, "x17", [W17]>, DwarfRegAlias<W17>;
108def X18   : AArch64Reg<18, "x18", [W18]>, DwarfRegAlias<W18>;
109def X19   : AArch64Reg<19, "x19", [W19]>, DwarfRegAlias<W19>;
110def X20   : AArch64Reg<20, "x20", [W20]>, DwarfRegAlias<W20>;
111def X21   : AArch64Reg<21, "x21", [W21]>, DwarfRegAlias<W21>;
112def X22   : AArch64Reg<22, "x22", [W22]>, DwarfRegAlias<W22>;
113def X23   : AArch64Reg<23, "x23", [W23]>, DwarfRegAlias<W23>;
114def X24   : AArch64Reg<24, "x24", [W24]>, DwarfRegAlias<W24>;
115def X25   : AArch64Reg<25, "x25", [W25]>, DwarfRegAlias<W25>;
116def X26   : AArch64Reg<26, "x26", [W26]>, DwarfRegAlias<W26>;
117def X27   : AArch64Reg<27, "x27", [W27]>, DwarfRegAlias<W27>;
118def X28   : AArch64Reg<28, "x28", [W28]>, DwarfRegAlias<W28>;
119def FP    : AArch64Reg<29, "x29", [W29]>, DwarfRegAlias<W29>;
120def LR    : AArch64Reg<30, "x30", [W30]>, DwarfRegAlias<W30>;
121def SP    : AArch64Reg<31, "sp",  [WSP]>, DwarfRegAlias<WSP>;
122def XZR   : AArch64Reg<31, "xzr", [WZR]>, DwarfRegAlias<WSP>;
123}
124
125// Condition code register.
126def NZCV  : AArch64Reg<0, "nzcv">;
127
128// GPR register classes with the intersections of GPR32/GPR32sp and
129// GPR64/GPR64sp for use by the coalescer.
130def GPR32common : RegisterClass<"AArch64", [i32], 32, (sequence "W%u", 0, 30)> {
131  let AltOrders = [(rotl GPR32common, 8)];
132  let AltOrderSelect = [{ return 1; }];
133}
134def GPR64common : RegisterClass<"AArch64", [i64], 64,
135                                (add (sequence "X%u", 0, 28), FP, LR)> {
136  let AltOrders = [(rotl GPR64common, 8)];
137  let AltOrderSelect = [{ return 1; }];
138}
139// GPR register classes which exclude SP/WSP.
140def GPR32 : RegisterClass<"AArch64", [i32], 32, (add GPR32common, WZR)> {
141  let AltOrders = [(rotl GPR32, 8)];
142  let AltOrderSelect = [{ return 1; }];
143}
144def GPR64 : RegisterClass<"AArch64", [i64], 64, (add GPR64common, XZR)> {
145  let AltOrders = [(rotl GPR64, 8)];
146  let AltOrderSelect = [{ return 1; }];
147}
148
149// GPR register classes which include SP/WSP.
150def GPR32sp : RegisterClass<"AArch64", [i32], 32, (add GPR32common, WSP)> {
151  let AltOrders = [(rotl GPR32sp, 8)];
152  let AltOrderSelect = [{ return 1; }];
153}
154def GPR64sp : RegisterClass<"AArch64", [i64], 64, (add GPR64common, SP)> {
155  let AltOrders = [(rotl GPR64sp, 8)];
156  let AltOrderSelect = [{ return 1; }];
157}
158
159def GPR32sponly : RegisterClass<"AArch64", [i32], 32, (add WSP)>;
160def GPR64sponly : RegisterClass<"AArch64", [i64], 64, (add SP)>;
161
162def GPR64spPlus0Operand : AsmOperandClass {
163  let Name = "GPR64sp0";
164  let RenderMethod = "addRegOperands";
165  let ParserMethod = "tryParseGPR64sp0Operand";
166}
167
168def GPR64sp0 : RegisterOperand<GPR64sp> {
169  let ParserMatchClass = GPR64spPlus0Operand;
170}
171
172// GPR register classes which include WZR/XZR AND SP/WSP. This is not a
173// constraint used by any instructions, it is used as a common super-class.
174def GPR32all : RegisterClass<"AArch64", [i32], 32, (add GPR32common, WZR, WSP)>;
175def GPR64all : RegisterClass<"AArch64", [i64], 64, (add GPR64common, XZR, SP)>;
176
177// For tail calls, we can't use callee-saved registers, as they are restored
178// to the saved value before the tail call, which would clobber a call address.
179// This is for indirect tail calls to store the address of the destination.
180def tcGPR64 : RegisterClass<"AArch64", [i64], 64, (sub GPR64common, X19, X20, X21,
181                                                     X22, X23, X24, X25, X26,
182                                                     X27, X28, FP, LR)>;
183
184// GPR register classes for post increment amount of vector load/store that
185// has alternate printing when Rm=31 and prints a constant immediate value
186// equal to the total number of bytes transferred.
187
188// FIXME: TableGen *should* be able to do these itself now. There appears to be
189// a bug in counting how many operands a Post-indexed MCInst should have which
190// means the aliases don't trigger.
191def GPR64pi1  : RegisterOperand<GPR64, "printPostIncOperand<1>">;
192def GPR64pi2  : RegisterOperand<GPR64, "printPostIncOperand<2>">;
193def GPR64pi3  : RegisterOperand<GPR64, "printPostIncOperand<3>">;
194def GPR64pi4  : RegisterOperand<GPR64, "printPostIncOperand<4>">;
195def GPR64pi6  : RegisterOperand<GPR64, "printPostIncOperand<6>">;
196def GPR64pi8  : RegisterOperand<GPR64, "printPostIncOperand<8>">;
197def GPR64pi12 : RegisterOperand<GPR64, "printPostIncOperand<12>">;
198def GPR64pi16 : RegisterOperand<GPR64, "printPostIncOperand<16>">;
199def GPR64pi24 : RegisterOperand<GPR64, "printPostIncOperand<24>">;
200def GPR64pi32 : RegisterOperand<GPR64, "printPostIncOperand<32>">;
201def GPR64pi48 : RegisterOperand<GPR64, "printPostIncOperand<48>">;
202def GPR64pi64 : RegisterOperand<GPR64, "printPostIncOperand<64>">;
203
204// Condition code regclass.
205def CCR : RegisterClass<"AArch64", [i32], 32, (add NZCV)> {
206  let CopyCost = -1;  // Don't allow copying of status registers.
207
208  // CCR is not allocatable.
209  let isAllocatable = 0;
210}
211
212//===----------------------------------------------------------------------===//
213// Floating Point Scalar Registers
214//===----------------------------------------------------------------------===//
215
216def B0    : AArch64Reg<0,   "b0">, DwarfRegNum<[64]>;
217def B1    : AArch64Reg<1,   "b1">, DwarfRegNum<[65]>;
218def B2    : AArch64Reg<2,   "b2">, DwarfRegNum<[66]>;
219def B3    : AArch64Reg<3,   "b3">, DwarfRegNum<[67]>;
220def B4    : AArch64Reg<4,   "b4">, DwarfRegNum<[68]>;
221def B5    : AArch64Reg<5,   "b5">, DwarfRegNum<[69]>;
222def B6    : AArch64Reg<6,   "b6">, DwarfRegNum<[70]>;
223def B7    : AArch64Reg<7,   "b7">, DwarfRegNum<[71]>;
224def B8    : AArch64Reg<8,   "b8">, DwarfRegNum<[72]>;
225def B9    : AArch64Reg<9,   "b9">, DwarfRegNum<[73]>;
226def B10   : AArch64Reg<10, "b10">, DwarfRegNum<[74]>;
227def B11   : AArch64Reg<11, "b11">, DwarfRegNum<[75]>;
228def B12   : AArch64Reg<12, "b12">, DwarfRegNum<[76]>;
229def B13   : AArch64Reg<13, "b13">, DwarfRegNum<[77]>;
230def B14   : AArch64Reg<14, "b14">, DwarfRegNum<[78]>;
231def B15   : AArch64Reg<15, "b15">, DwarfRegNum<[79]>;
232def B16   : AArch64Reg<16, "b16">, DwarfRegNum<[80]>;
233def B17   : AArch64Reg<17, "b17">, DwarfRegNum<[81]>;
234def B18   : AArch64Reg<18, "b18">, DwarfRegNum<[82]>;
235def B19   : AArch64Reg<19, "b19">, DwarfRegNum<[83]>;
236def B20   : AArch64Reg<20, "b20">, DwarfRegNum<[84]>;
237def B21   : AArch64Reg<21, "b21">, DwarfRegNum<[85]>;
238def B22   : AArch64Reg<22, "b22">, DwarfRegNum<[86]>;
239def B23   : AArch64Reg<23, "b23">, DwarfRegNum<[87]>;
240def B24   : AArch64Reg<24, "b24">, DwarfRegNum<[88]>;
241def B25   : AArch64Reg<25, "b25">, DwarfRegNum<[89]>;
242def B26   : AArch64Reg<26, "b26">, DwarfRegNum<[90]>;
243def B27   : AArch64Reg<27, "b27">, DwarfRegNum<[91]>;
244def B28   : AArch64Reg<28, "b28">, DwarfRegNum<[92]>;
245def B29   : AArch64Reg<29, "b29">, DwarfRegNum<[93]>;
246def B30   : AArch64Reg<30, "b30">, DwarfRegNum<[94]>;
247def B31   : AArch64Reg<31, "b31">, DwarfRegNum<[95]>;
248
249let SubRegIndices = [bsub] in {
250def H0    : AArch64Reg<0,   "h0", [B0]>, DwarfRegAlias<B0>;
251def H1    : AArch64Reg<1,   "h1", [B1]>, DwarfRegAlias<B1>;
252def H2    : AArch64Reg<2,   "h2", [B2]>, DwarfRegAlias<B2>;
253def H3    : AArch64Reg<3,   "h3", [B3]>, DwarfRegAlias<B3>;
254def H4    : AArch64Reg<4,   "h4", [B4]>, DwarfRegAlias<B4>;
255def H5    : AArch64Reg<5,   "h5", [B5]>, DwarfRegAlias<B5>;
256def H6    : AArch64Reg<6,   "h6", [B6]>, DwarfRegAlias<B6>;
257def H7    : AArch64Reg<7,   "h7", [B7]>, DwarfRegAlias<B7>;
258def H8    : AArch64Reg<8,   "h8", [B8]>, DwarfRegAlias<B8>;
259def H9    : AArch64Reg<9,   "h9", [B9]>, DwarfRegAlias<B9>;
260def H10   : AArch64Reg<10, "h10", [B10]>, DwarfRegAlias<B10>;
261def H11   : AArch64Reg<11, "h11", [B11]>, DwarfRegAlias<B11>;
262def H12   : AArch64Reg<12, "h12", [B12]>, DwarfRegAlias<B12>;
263def H13   : AArch64Reg<13, "h13", [B13]>, DwarfRegAlias<B13>;
264def H14   : AArch64Reg<14, "h14", [B14]>, DwarfRegAlias<B14>;
265def H15   : AArch64Reg<15, "h15", [B15]>, DwarfRegAlias<B15>;
266def H16   : AArch64Reg<16, "h16", [B16]>, DwarfRegAlias<B16>;
267def H17   : AArch64Reg<17, "h17", [B17]>, DwarfRegAlias<B17>;
268def H18   : AArch64Reg<18, "h18", [B18]>, DwarfRegAlias<B18>;
269def H19   : AArch64Reg<19, "h19", [B19]>, DwarfRegAlias<B19>;
270def H20   : AArch64Reg<20, "h20", [B20]>, DwarfRegAlias<B20>;
271def H21   : AArch64Reg<21, "h21", [B21]>, DwarfRegAlias<B21>;
272def H22   : AArch64Reg<22, "h22", [B22]>, DwarfRegAlias<B22>;
273def H23   : AArch64Reg<23, "h23", [B23]>, DwarfRegAlias<B23>;
274def H24   : AArch64Reg<24, "h24", [B24]>, DwarfRegAlias<B24>;
275def H25   : AArch64Reg<25, "h25", [B25]>, DwarfRegAlias<B25>;
276def H26   : AArch64Reg<26, "h26", [B26]>, DwarfRegAlias<B26>;
277def H27   : AArch64Reg<27, "h27", [B27]>, DwarfRegAlias<B27>;
278def H28   : AArch64Reg<28, "h28", [B28]>, DwarfRegAlias<B28>;
279def H29   : AArch64Reg<29, "h29", [B29]>, DwarfRegAlias<B29>;
280def H30   : AArch64Reg<30, "h30", [B30]>, DwarfRegAlias<B30>;
281def H31   : AArch64Reg<31, "h31", [B31]>, DwarfRegAlias<B31>;
282}
283
284let SubRegIndices = [hsub] in {
285def S0    : AArch64Reg<0,   "s0", [H0]>, DwarfRegAlias<B0>;
286def S1    : AArch64Reg<1,   "s1", [H1]>, DwarfRegAlias<B1>;
287def S2    : AArch64Reg<2,   "s2", [H2]>, DwarfRegAlias<B2>;
288def S3    : AArch64Reg<3,   "s3", [H3]>, DwarfRegAlias<B3>;
289def S4    : AArch64Reg<4,   "s4", [H4]>, DwarfRegAlias<B4>;
290def S5    : AArch64Reg<5,   "s5", [H5]>, DwarfRegAlias<B5>;
291def S6    : AArch64Reg<6,   "s6", [H6]>, DwarfRegAlias<B6>;
292def S7    : AArch64Reg<7,   "s7", [H7]>, DwarfRegAlias<B7>;
293def S8    : AArch64Reg<8,   "s8", [H8]>, DwarfRegAlias<B8>;
294def S9    : AArch64Reg<9,   "s9", [H9]>, DwarfRegAlias<B9>;
295def S10   : AArch64Reg<10, "s10", [H10]>, DwarfRegAlias<B10>;
296def S11   : AArch64Reg<11, "s11", [H11]>, DwarfRegAlias<B11>;
297def S12   : AArch64Reg<12, "s12", [H12]>, DwarfRegAlias<B12>;
298def S13   : AArch64Reg<13, "s13", [H13]>, DwarfRegAlias<B13>;
299def S14   : AArch64Reg<14, "s14", [H14]>, DwarfRegAlias<B14>;
300def S15   : AArch64Reg<15, "s15", [H15]>, DwarfRegAlias<B15>;
301def S16   : AArch64Reg<16, "s16", [H16]>, DwarfRegAlias<B16>;
302def S17   : AArch64Reg<17, "s17", [H17]>, DwarfRegAlias<B17>;
303def S18   : AArch64Reg<18, "s18", [H18]>, DwarfRegAlias<B18>;
304def S19   : AArch64Reg<19, "s19", [H19]>, DwarfRegAlias<B19>;
305def S20   : AArch64Reg<20, "s20", [H20]>, DwarfRegAlias<B20>;
306def S21   : AArch64Reg<21, "s21", [H21]>, DwarfRegAlias<B21>;
307def S22   : AArch64Reg<22, "s22", [H22]>, DwarfRegAlias<B22>;
308def S23   : AArch64Reg<23, "s23", [H23]>, DwarfRegAlias<B23>;
309def S24   : AArch64Reg<24, "s24", [H24]>, DwarfRegAlias<B24>;
310def S25   : AArch64Reg<25, "s25", [H25]>, DwarfRegAlias<B25>;
311def S26   : AArch64Reg<26, "s26", [H26]>, DwarfRegAlias<B26>;
312def S27   : AArch64Reg<27, "s27", [H27]>, DwarfRegAlias<B27>;
313def S28   : AArch64Reg<28, "s28", [H28]>, DwarfRegAlias<B28>;
314def S29   : AArch64Reg<29, "s29", [H29]>, DwarfRegAlias<B29>;
315def S30   : AArch64Reg<30, "s30", [H30]>, DwarfRegAlias<B30>;
316def S31   : AArch64Reg<31, "s31", [H31]>, DwarfRegAlias<B31>;
317}
318
319let SubRegIndices = [ssub], RegAltNameIndices = [vreg, vlist1] in {
320def D0    : AArch64Reg<0,   "d0", [S0], ["v0", ""]>, DwarfRegAlias<B0>;
321def D1    : AArch64Reg<1,   "d1", [S1], ["v1", ""]>, DwarfRegAlias<B1>;
322def D2    : AArch64Reg<2,   "d2", [S2], ["v2", ""]>, DwarfRegAlias<B2>;
323def D3    : AArch64Reg<3,   "d3", [S3], ["v3", ""]>, DwarfRegAlias<B3>;
324def D4    : AArch64Reg<4,   "d4", [S4], ["v4", ""]>, DwarfRegAlias<B4>;
325def D5    : AArch64Reg<5,   "d5", [S5], ["v5", ""]>, DwarfRegAlias<B5>;
326def D6    : AArch64Reg<6,   "d6", [S6], ["v6", ""]>, DwarfRegAlias<B6>;
327def D7    : AArch64Reg<7,   "d7", [S7], ["v7", ""]>, DwarfRegAlias<B7>;
328def D8    : AArch64Reg<8,   "d8", [S8], ["v8", ""]>, DwarfRegAlias<B8>;
329def D9    : AArch64Reg<9,   "d9", [S9], ["v9", ""]>, DwarfRegAlias<B9>;
330def D10   : AArch64Reg<10, "d10", [S10], ["v10", ""]>, DwarfRegAlias<B10>;
331def D11   : AArch64Reg<11, "d11", [S11], ["v11", ""]>, DwarfRegAlias<B11>;
332def D12   : AArch64Reg<12, "d12", [S12], ["v12", ""]>, DwarfRegAlias<B12>;
333def D13   : AArch64Reg<13, "d13", [S13], ["v13", ""]>, DwarfRegAlias<B13>;
334def D14   : AArch64Reg<14, "d14", [S14], ["v14", ""]>, DwarfRegAlias<B14>;
335def D15   : AArch64Reg<15, "d15", [S15], ["v15", ""]>, DwarfRegAlias<B15>;
336def D16   : AArch64Reg<16, "d16", [S16], ["v16", ""]>, DwarfRegAlias<B16>;
337def D17   : AArch64Reg<17, "d17", [S17], ["v17", ""]>, DwarfRegAlias<B17>;
338def D18   : AArch64Reg<18, "d18", [S18], ["v18", ""]>, DwarfRegAlias<B18>;
339def D19   : AArch64Reg<19, "d19", [S19], ["v19", ""]>, DwarfRegAlias<B19>;
340def D20   : AArch64Reg<20, "d20", [S20], ["v20", ""]>, DwarfRegAlias<B20>;
341def D21   : AArch64Reg<21, "d21", [S21], ["v21", ""]>, DwarfRegAlias<B21>;
342def D22   : AArch64Reg<22, "d22", [S22], ["v22", ""]>, DwarfRegAlias<B22>;
343def D23   : AArch64Reg<23, "d23", [S23], ["v23", ""]>, DwarfRegAlias<B23>;
344def D24   : AArch64Reg<24, "d24", [S24], ["v24", ""]>, DwarfRegAlias<B24>;
345def D25   : AArch64Reg<25, "d25", [S25], ["v25", ""]>, DwarfRegAlias<B25>;
346def D26   : AArch64Reg<26, "d26", [S26], ["v26", ""]>, DwarfRegAlias<B26>;
347def D27   : AArch64Reg<27, "d27", [S27], ["v27", ""]>, DwarfRegAlias<B27>;
348def D28   : AArch64Reg<28, "d28", [S28], ["v28", ""]>, DwarfRegAlias<B28>;
349def D29   : AArch64Reg<29, "d29", [S29], ["v29", ""]>, DwarfRegAlias<B29>;
350def D30   : AArch64Reg<30, "d30", [S30], ["v30", ""]>, DwarfRegAlias<B30>;
351def D31   : AArch64Reg<31, "d31", [S31], ["v31", ""]>, DwarfRegAlias<B31>;
352}
353
354let SubRegIndices = [dsub], RegAltNameIndices = [vreg, vlist1] in {
355def Q0    : AArch64Reg<0,   "q0", [D0], ["v0", ""]>, DwarfRegAlias<B0>;
356def Q1    : AArch64Reg<1,   "q1", [D1], ["v1", ""]>, DwarfRegAlias<B1>;
357def Q2    : AArch64Reg<2,   "q2", [D2], ["v2", ""]>, DwarfRegAlias<B2>;
358def Q3    : AArch64Reg<3,   "q3", [D3], ["v3", ""]>, DwarfRegAlias<B3>;
359def Q4    : AArch64Reg<4,   "q4", [D4], ["v4", ""]>, DwarfRegAlias<B4>;
360def Q5    : AArch64Reg<5,   "q5", [D5], ["v5", ""]>, DwarfRegAlias<B5>;
361def Q6    : AArch64Reg<6,   "q6", [D6], ["v6", ""]>, DwarfRegAlias<B6>;
362def Q7    : AArch64Reg<7,   "q7", [D7], ["v7", ""]>, DwarfRegAlias<B7>;
363def Q8    : AArch64Reg<8,   "q8", [D8], ["v8", ""]>, DwarfRegAlias<B8>;
364def Q9    : AArch64Reg<9,   "q9", [D9], ["v9", ""]>, DwarfRegAlias<B9>;
365def Q10   : AArch64Reg<10, "q10", [D10], ["v10", ""]>, DwarfRegAlias<B10>;
366def Q11   : AArch64Reg<11, "q11", [D11], ["v11", ""]>, DwarfRegAlias<B11>;
367def Q12   : AArch64Reg<12, "q12", [D12], ["v12", ""]>, DwarfRegAlias<B12>;
368def Q13   : AArch64Reg<13, "q13", [D13], ["v13", ""]>, DwarfRegAlias<B13>;
369def Q14   : AArch64Reg<14, "q14", [D14], ["v14", ""]>, DwarfRegAlias<B14>;
370def Q15   : AArch64Reg<15, "q15", [D15], ["v15", ""]>, DwarfRegAlias<B15>;
371def Q16   : AArch64Reg<16, "q16", [D16], ["v16", ""]>, DwarfRegAlias<B16>;
372def Q17   : AArch64Reg<17, "q17", [D17], ["v17", ""]>, DwarfRegAlias<B17>;
373def Q18   : AArch64Reg<18, "q18", [D18], ["v18", ""]>, DwarfRegAlias<B18>;
374def Q19   : AArch64Reg<19, "q19", [D19], ["v19", ""]>, DwarfRegAlias<B19>;
375def Q20   : AArch64Reg<20, "q20", [D20], ["v20", ""]>, DwarfRegAlias<B20>;
376def Q21   : AArch64Reg<21, "q21", [D21], ["v21", ""]>, DwarfRegAlias<B21>;
377def Q22   : AArch64Reg<22, "q22", [D22], ["v22", ""]>, DwarfRegAlias<B22>;
378def Q23   : AArch64Reg<23, "q23", [D23], ["v23", ""]>, DwarfRegAlias<B23>;
379def Q24   : AArch64Reg<24, "q24", [D24], ["v24", ""]>, DwarfRegAlias<B24>;
380def Q25   : AArch64Reg<25, "q25", [D25], ["v25", ""]>, DwarfRegAlias<B25>;
381def Q26   : AArch64Reg<26, "q26", [D26], ["v26", ""]>, DwarfRegAlias<B26>;
382def Q27   : AArch64Reg<27, "q27", [D27], ["v27", ""]>, DwarfRegAlias<B27>;
383def Q28   : AArch64Reg<28, "q28", [D28], ["v28", ""]>, DwarfRegAlias<B28>;
384def Q29   : AArch64Reg<29, "q29", [D29], ["v29", ""]>, DwarfRegAlias<B29>;
385def Q30   : AArch64Reg<30, "q30", [D30], ["v30", ""]>, DwarfRegAlias<B30>;
386def Q31   : AArch64Reg<31, "q31", [D31], ["v31", ""]>, DwarfRegAlias<B31>;
387}
388
389def FPR8  : RegisterClass<"AArch64", [untyped], 8, (sequence "B%u", 0, 31)> {
390  let Size = 8;
391}
392def FPR16 : RegisterClass<"AArch64", [f16], 16, (sequence "H%u", 0, 31)> {
393  let Size = 16;
394}
395def FPR32 : RegisterClass<"AArch64", [f32, i32], 32,(sequence "S%u", 0, 31)>;
396def FPR64 : RegisterClass<"AArch64", [f64, i64, v2f32, v1f64, v8i8, v4i16, v2i32,
397                                    v1i64, v4f16],
398                                    64, (sequence "D%u", 0, 31)>;
399// We don't (yet) have an f128 legal type, so don't use that here. We
400// normalize 128-bit vectors to v2f64 for arg passing and such, so use
401// that here.
402def FPR128 : RegisterClass<"AArch64",
403                           [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64, f128,
404                            v8f16],
405                           128, (sequence "Q%u", 0, 31)>;
406
407// The lower 16 vector registers.  Some instructions can only take registers
408// in this range.
409def FPR128_lo : RegisterClass<"AArch64",
410                              [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64, v8f16],
411                              128, (trunc FPR128, 16)>;
412
413// Pairs, triples, and quads of 64-bit vector registers.
414def DSeqPairs : RegisterTuples<[dsub0, dsub1], [(rotl FPR64, 0), (rotl FPR64, 1)]>;
415def DSeqTriples : RegisterTuples<[dsub0, dsub1, dsub2],
416                                 [(rotl FPR64, 0), (rotl FPR64, 1),
417                                  (rotl FPR64, 2)]>;
418def DSeqQuads : RegisterTuples<[dsub0, dsub1, dsub2, dsub3],
419                               [(rotl FPR64, 0), (rotl FPR64, 1),
420                                (rotl FPR64, 2), (rotl FPR64, 3)]>;
421def DD   : RegisterClass<"AArch64", [untyped], 64, (add DSeqPairs)> {
422  let Size = 128;
423}
424def DDD  : RegisterClass<"AArch64", [untyped], 64, (add DSeqTriples)> {
425  let Size = 196;
426}
427def DDDD : RegisterClass<"AArch64", [untyped], 64, (add DSeqQuads)> {
428  let Size = 256;
429}
430
431// Pairs, triples, and quads of 128-bit vector registers.
432def QSeqPairs : RegisterTuples<[qsub0, qsub1], [(rotl FPR128, 0), (rotl FPR128, 1)]>;
433def QSeqTriples : RegisterTuples<[qsub0, qsub1, qsub2],
434                                 [(rotl FPR128, 0), (rotl FPR128, 1),
435                                  (rotl FPR128, 2)]>;
436def QSeqQuads : RegisterTuples<[qsub0, qsub1, qsub2, qsub3],
437                               [(rotl FPR128, 0), (rotl FPR128, 1),
438                                (rotl FPR128, 2), (rotl FPR128, 3)]>;
439def QQ   : RegisterClass<"AArch64", [untyped], 128, (add QSeqPairs)> {
440  let Size = 256;
441}
442def QQQ  : RegisterClass<"AArch64", [untyped], 128, (add QSeqTriples)> {
443  let Size = 384;
444}
445def QQQQ : RegisterClass<"AArch64", [untyped], 128, (add QSeqQuads)> {
446  let Size = 512;
447}
448
449
450// Vector operand versions of the FP registers. Alternate name printing and
451// assmebler matching.
452def VectorReg64AsmOperand : AsmOperandClass {
453  let Name = "VectorReg64";
454  let PredicateMethod = "isVectorReg";
455}
456def VectorReg128AsmOperand : AsmOperandClass {
457  let Name = "VectorReg128";
458  let PredicateMethod = "isVectorReg";
459}
460
461def V64  : RegisterOperand<FPR64, "printVRegOperand"> {
462  let ParserMatchClass = VectorReg64AsmOperand;
463}
464
465def V128 : RegisterOperand<FPR128, "printVRegOperand"> {
466  let ParserMatchClass = VectorReg128AsmOperand;
467}
468
469def VectorRegLoAsmOperand : AsmOperandClass { let Name = "VectorRegLo"; }
470def V128_lo : RegisterOperand<FPR128_lo, "printVRegOperand"> {
471  let ParserMatchClass = VectorRegLoAsmOperand;
472}
473
474class TypedVecListAsmOperand<int count, int regsize, int lanes, string kind>
475    : AsmOperandClass {
476  let Name = "TypedVectorList" # count # "_" # lanes # kind;
477
478  let PredicateMethod
479      = "isTypedVectorList<" # count # ", " # lanes # ", '" # kind # "'>";
480  let RenderMethod = "addVectorList" # regsize # "Operands<" # count # ">";
481}
482
483class TypedVecListRegOperand<RegisterClass Reg, int lanes, string kind>
484    : RegisterOperand<Reg, "printTypedVectorList<" # lanes # ", '"
485                                                   # kind # "'>">;
486
487multiclass VectorList<int count, RegisterClass Reg64, RegisterClass Reg128> {
488  // With implicit types (probably on instruction instead). E.g. { v0, v1 }
489  def _64AsmOperand : AsmOperandClass {
490    let Name = NAME # "64";
491    let PredicateMethod = "isImplicitlyTypedVectorList<" # count # ">";
492    let RenderMethod = "addVectorList64Operands<" # count # ">";
493  }
494
495  def "64" : RegisterOperand<Reg64, "printImplicitlyTypedVectorList"> {
496    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_64AsmOperand");
497  }
498
499  def _128AsmOperand : AsmOperandClass {
500    let Name = NAME # "128";
501    let PredicateMethod = "isImplicitlyTypedVectorList<" # count # ">";
502    let RenderMethod = "addVectorList128Operands<" # count # ">";
503  }
504
505  def "128" : RegisterOperand<Reg128, "printImplicitlyTypedVectorList"> {
506    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_128AsmOperand");
507  }
508
509  // 64-bit register lists with explicit type.
510
511  // { v0.8b, v1.8b }
512  def _8bAsmOperand : TypedVecListAsmOperand<count, 64, 8, "b">;
513  def "8b" : TypedVecListRegOperand<Reg64, 8, "b"> {
514    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_8bAsmOperand");
515  }
516
517  // { v0.4h, v1.4h }
518  def _4hAsmOperand : TypedVecListAsmOperand<count, 64, 4, "h">;
519  def "4h" : TypedVecListRegOperand<Reg64, 4, "h"> {
520    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_4hAsmOperand");
521  }
522
523  // { v0.2s, v1.2s }
524  def _2sAsmOperand : TypedVecListAsmOperand<count, 64, 2, "s">;
525  def "2s" : TypedVecListRegOperand<Reg64, 2, "s"> {
526    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_2sAsmOperand");
527  }
528
529  // { v0.1d, v1.1d }
530  def _1dAsmOperand : TypedVecListAsmOperand<count, 64, 1, "d">;
531  def "1d" : TypedVecListRegOperand<Reg64, 1, "d"> {
532    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_1dAsmOperand");
533  }
534
535  // 128-bit register lists with explicit type
536
537  // { v0.16b, v1.16b }
538  def _16bAsmOperand : TypedVecListAsmOperand<count, 128, 16, "b">;
539  def "16b" : TypedVecListRegOperand<Reg128, 16, "b"> {
540    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_16bAsmOperand");
541  }
542
543  // { v0.8h, v1.8h }
544  def _8hAsmOperand : TypedVecListAsmOperand<count, 128, 8, "h">;
545  def "8h" : TypedVecListRegOperand<Reg128, 8, "h"> {
546    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_8hAsmOperand");
547  }
548
549  // { v0.4s, v1.4s }
550  def _4sAsmOperand : TypedVecListAsmOperand<count, 128, 4, "s">;
551  def "4s" : TypedVecListRegOperand<Reg128, 4, "s"> {
552    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_4sAsmOperand");
553  }
554
555  // { v0.2d, v1.2d }
556  def _2dAsmOperand : TypedVecListAsmOperand<count, 128, 2, "d">;
557  def "2d" : TypedVecListRegOperand<Reg128, 2, "d"> {
558    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_2dAsmOperand");
559  }
560
561  // { v0.b, v1.b }
562  def _bAsmOperand : TypedVecListAsmOperand<count, 128, 0, "b">;
563  def "b" : TypedVecListRegOperand<Reg128, 0, "b"> {
564    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_bAsmOperand");
565  }
566
567  // { v0.h, v1.h }
568  def _hAsmOperand : TypedVecListAsmOperand<count, 128, 0, "h">;
569  def "h" : TypedVecListRegOperand<Reg128, 0, "h"> {
570    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_hAsmOperand");
571  }
572
573  // { v0.s, v1.s }
574  def _sAsmOperand : TypedVecListAsmOperand<count, 128, 0, "s">;
575  def "s" : TypedVecListRegOperand<Reg128, 0, "s"> {
576    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_sAsmOperand");
577  }
578
579  // { v0.d, v1.d }
580  def _dAsmOperand : TypedVecListAsmOperand<count, 128, 0, "d">;
581  def "d" : TypedVecListRegOperand<Reg128, 0, "d"> {
582    let ParserMatchClass = !cast<AsmOperandClass>(NAME # "_dAsmOperand");
583  }
584
585
586}
587
588defm VecListOne   : VectorList<1, FPR64, FPR128>;
589defm VecListTwo   : VectorList<2, DD,    QQ>;
590defm VecListThree : VectorList<3, DDD,   QQQ>;
591defm VecListFour  : VectorList<4, DDDD,  QQQQ>;
592
593
594// Register operand versions of the scalar FP registers.
595def FPR16Op : RegisterOperand<FPR16, "printOperand">;
596def FPR32Op : RegisterOperand<FPR32, "printOperand">;
597def FPR64Op : RegisterOperand<FPR64, "printOperand">;
598def FPR128Op : RegisterOperand<FPR128, "printOperand">;
599
600
601//===----------------------------------------------------------------------===//
602// ARMv8.1a atomic CASP register operands
603
604
605def WSeqPairs : RegisterTuples<[sube32, subo32],
606                               [(rotl GPR32, 0), (rotl GPR32, 1)]>;
607def XSeqPairs : RegisterTuples<[sube64, subo64],
608                               [(rotl GPR64, 0), (rotl GPR64, 1)]>;
609
610def WSeqPairsClass   : RegisterClass<"AArch64", [untyped], 32,
611                                     (add WSeqPairs)>{
612  let Size = 64;
613}
614def XSeqPairsClass   : RegisterClass<"AArch64", [untyped], 64,
615                                     (add XSeqPairs)>{
616  let Size = 128;
617}
618
619
620let RenderMethod = "addRegOperands", ParserMethod="tryParseGPRSeqPair" in {
621  def WSeqPairsAsmOperandClass : AsmOperandClass { let Name = "WSeqPair"; }
622  def XSeqPairsAsmOperandClass : AsmOperandClass { let Name = "XSeqPair"; }
623}
624
625def WSeqPairClassOperand :
626    RegisterOperand<WSeqPairsClass, "printGPRSeqPairsClassOperand<32>"> {
627  let ParserMatchClass = WSeqPairsAsmOperandClass;
628}
629def XSeqPairClassOperand :
630    RegisterOperand<XSeqPairsClass, "printGPRSeqPairsClassOperand<64>"> {
631  let ParserMatchClass = XSeqPairsAsmOperandClass;
632}
633
634
635//===----- END: v8.1a atomic CASP register operands -----------------------===//
636