xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/ARMRegisterInfo.td (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric//===-- ARMRegisterInfo.td - ARM Register defs -------------*- tablegen -*-===//
2*0b57cec5SDimitry Andric//
3*0b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric//
7*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric
9*0b57cec5SDimitry Andricinclude "ARMSystemRegister.td"
10*0b57cec5SDimitry Andric
11*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
12*0b57cec5SDimitry Andric//  Declarations that describe the ARM register file
13*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
14*0b57cec5SDimitry Andric
15*0b57cec5SDimitry Andric// Registers are identified with 4-bit ID numbers.
16*0b57cec5SDimitry Andricclass ARMReg<bits<16> Enc, string n, list<Register> subregs = [],
17*0b57cec5SDimitry Andric             list<string> altNames = []> : Register<n, altNames> {
18*0b57cec5SDimitry Andric  let HWEncoding = Enc;
19*0b57cec5SDimitry Andric  let Namespace = "ARM";
20*0b57cec5SDimitry Andric  let SubRegs = subregs;
21*0b57cec5SDimitry Andric  // All bits of ARM registers with sub-registers are covered by sub-registers.
22*0b57cec5SDimitry Andric  let CoveredBySubRegs = 1;
23*0b57cec5SDimitry Andric}
24*0b57cec5SDimitry Andric
25*0b57cec5SDimitry Andricclass ARMFReg<bits<16> Enc, string n> : Register<n> {
26*0b57cec5SDimitry Andric  let HWEncoding = Enc;
27*0b57cec5SDimitry Andric  let Namespace = "ARM";
28*0b57cec5SDimitry Andric}
29*0b57cec5SDimitry Andric
30*0b57cec5SDimitry Andriclet Namespace = "ARM",
31*0b57cec5SDimitry Andric    FallbackRegAltNameIndex = NoRegAltName in {
32*0b57cec5SDimitry Andric  def RegNamesRaw : RegAltNameIndex;
33*0b57cec5SDimitry Andric}
34*0b57cec5SDimitry Andric
35*0b57cec5SDimitry Andric// Subregister indices.
36*0b57cec5SDimitry Andriclet Namespace = "ARM" in {
37*0b57cec5SDimitry Andricdef qqsub_0 : SubRegIndex<256>;
38*0b57cec5SDimitry Andricdef qqsub_1 : SubRegIndex<256, 256>;
39*0b57cec5SDimitry Andric
40*0b57cec5SDimitry Andric// Note: Code depends on these having consecutive numbers.
41*0b57cec5SDimitry Andricdef qsub_0 : SubRegIndex<128>;
42*0b57cec5SDimitry Andricdef qsub_1 : SubRegIndex<128, 128>;
43*0b57cec5SDimitry Andricdef qsub_2 : ComposedSubRegIndex<qqsub_1, qsub_0>;
44*0b57cec5SDimitry Andricdef qsub_3 : ComposedSubRegIndex<qqsub_1, qsub_1>;
45*0b57cec5SDimitry Andric
46*0b57cec5SDimitry Andricdef dsub_0 : SubRegIndex<64>;
47*0b57cec5SDimitry Andricdef dsub_1 : SubRegIndex<64, 64>;
48*0b57cec5SDimitry Andricdef dsub_2 : ComposedSubRegIndex<qsub_1, dsub_0>;
49*0b57cec5SDimitry Andricdef dsub_3 : ComposedSubRegIndex<qsub_1, dsub_1>;
50*0b57cec5SDimitry Andricdef dsub_4 : ComposedSubRegIndex<qsub_2, dsub_0>;
51*0b57cec5SDimitry Andricdef dsub_5 : ComposedSubRegIndex<qsub_2, dsub_1>;
52*0b57cec5SDimitry Andricdef dsub_6 : ComposedSubRegIndex<qsub_3, dsub_0>;
53*0b57cec5SDimitry Andricdef dsub_7 : ComposedSubRegIndex<qsub_3, dsub_1>;
54*0b57cec5SDimitry Andric
55*0b57cec5SDimitry Andricdef ssub_0  : SubRegIndex<32>;
56*0b57cec5SDimitry Andricdef ssub_1  : SubRegIndex<32, 32>;
57*0b57cec5SDimitry Andricdef ssub_2  : ComposedSubRegIndex<dsub_1, ssub_0>;
58*0b57cec5SDimitry Andricdef ssub_3  : ComposedSubRegIndex<dsub_1, ssub_1>;
59*0b57cec5SDimitry Andricdef ssub_4  : ComposedSubRegIndex<dsub_2, ssub_0>;
60*0b57cec5SDimitry Andricdef ssub_5  : ComposedSubRegIndex<dsub_2, ssub_1>;
61*0b57cec5SDimitry Andricdef ssub_6  : ComposedSubRegIndex<dsub_3, ssub_0>;
62*0b57cec5SDimitry Andricdef ssub_7  : ComposedSubRegIndex<dsub_3, ssub_1>;
63*0b57cec5SDimitry Andricdef ssub_8  : ComposedSubRegIndex<dsub_4, ssub_0>;
64*0b57cec5SDimitry Andricdef ssub_9  : ComposedSubRegIndex<dsub_4, ssub_1>;
65*0b57cec5SDimitry Andricdef ssub_10 : ComposedSubRegIndex<dsub_5, ssub_0>;
66*0b57cec5SDimitry Andricdef ssub_11 : ComposedSubRegIndex<dsub_5, ssub_1>;
67*0b57cec5SDimitry Andricdef ssub_12 : ComposedSubRegIndex<dsub_6, ssub_0>;
68*0b57cec5SDimitry Andricdef ssub_13 : ComposedSubRegIndex<dsub_6, ssub_1>;
69*0b57cec5SDimitry Andric
70*0b57cec5SDimitry Andricdef gsub_0 : SubRegIndex<32>;
71*0b57cec5SDimitry Andricdef gsub_1 : SubRegIndex<32, 32>;
72*0b57cec5SDimitry Andric// Let TableGen synthesize the remaining 12 ssub_* indices.
73*0b57cec5SDimitry Andric// We don't need to name them.
74*0b57cec5SDimitry Andric}
75*0b57cec5SDimitry Andric
76*0b57cec5SDimitry Andric// Integer registers
77*0b57cec5SDimitry Andricdef R0  : ARMReg< 0, "r0">,  DwarfRegNum<[0]>;
78*0b57cec5SDimitry Andricdef R1  : ARMReg< 1, "r1">,  DwarfRegNum<[1]>;
79*0b57cec5SDimitry Andricdef R2  : ARMReg< 2, "r2">,  DwarfRegNum<[2]>;
80*0b57cec5SDimitry Andricdef R3  : ARMReg< 3, "r3">,  DwarfRegNum<[3]>;
81*0b57cec5SDimitry Andricdef R4  : ARMReg< 4, "r4">,  DwarfRegNum<[4]>;
82*0b57cec5SDimitry Andricdef R5  : ARMReg< 5, "r5">,  DwarfRegNum<[5]>;
83*0b57cec5SDimitry Andricdef R6  : ARMReg< 6, "r6">,  DwarfRegNum<[6]>;
84*0b57cec5SDimitry Andricdef R7  : ARMReg< 7, "r7">,  DwarfRegNum<[7]>;
85*0b57cec5SDimitry Andric// These require 32-bit instructions.
86*0b57cec5SDimitry Andriclet CostPerUse = 1 in {
87*0b57cec5SDimitry Andricdef R8  : ARMReg< 8, "r8">,  DwarfRegNum<[8]>;
88*0b57cec5SDimitry Andricdef R9  : ARMReg< 9, "r9">,  DwarfRegNum<[9]>;
89*0b57cec5SDimitry Andricdef R10 : ARMReg<10, "r10">, DwarfRegNum<[10]>;
90*0b57cec5SDimitry Andricdef R11 : ARMReg<11, "r11">, DwarfRegNum<[11]>;
91*0b57cec5SDimitry Andricdef R12 : ARMReg<12, "r12">, DwarfRegNum<[12]>;
92*0b57cec5SDimitry Andriclet RegAltNameIndices = [RegNamesRaw] in {
93*0b57cec5SDimitry Andricdef SP  : ARMReg<13, "sp", [], ["r13"]>,  DwarfRegNum<[13]>;
94*0b57cec5SDimitry Andricdef LR  : ARMReg<14, "lr", [], ["r14"]>,  DwarfRegNum<[14]>;
95*0b57cec5SDimitry Andricdef PC  : ARMReg<15, "pc", [], ["r15"]>,  DwarfRegNum<[15]>;
96*0b57cec5SDimitry Andric}
97*0b57cec5SDimitry Andric}
98*0b57cec5SDimitry Andric
99*0b57cec5SDimitry Andric// Float registers
100*0b57cec5SDimitry Andricdef S0  : ARMFReg< 0, "s0">;  def S1  : ARMFReg< 1, "s1">;
101*0b57cec5SDimitry Andricdef S2  : ARMFReg< 2, "s2">;  def S3  : ARMFReg< 3, "s3">;
102*0b57cec5SDimitry Andricdef S4  : ARMFReg< 4, "s4">;  def S5  : ARMFReg< 5, "s5">;
103*0b57cec5SDimitry Andricdef S6  : ARMFReg< 6, "s6">;  def S7  : ARMFReg< 7, "s7">;
104*0b57cec5SDimitry Andricdef S8  : ARMFReg< 8, "s8">;  def S9  : ARMFReg< 9, "s9">;
105*0b57cec5SDimitry Andricdef S10 : ARMFReg<10, "s10">; def S11 : ARMFReg<11, "s11">;
106*0b57cec5SDimitry Andricdef S12 : ARMFReg<12, "s12">; def S13 : ARMFReg<13, "s13">;
107*0b57cec5SDimitry Andricdef S14 : ARMFReg<14, "s14">; def S15 : ARMFReg<15, "s15">;
108*0b57cec5SDimitry Andricdef S16 : ARMFReg<16, "s16">; def S17 : ARMFReg<17, "s17">;
109*0b57cec5SDimitry Andricdef S18 : ARMFReg<18, "s18">; def S19 : ARMFReg<19, "s19">;
110*0b57cec5SDimitry Andricdef S20 : ARMFReg<20, "s20">; def S21 : ARMFReg<21, "s21">;
111*0b57cec5SDimitry Andricdef S22 : ARMFReg<22, "s22">; def S23 : ARMFReg<23, "s23">;
112*0b57cec5SDimitry Andricdef S24 : ARMFReg<24, "s24">; def S25 : ARMFReg<25, "s25">;
113*0b57cec5SDimitry Andricdef S26 : ARMFReg<26, "s26">; def S27 : ARMFReg<27, "s27">;
114*0b57cec5SDimitry Andricdef S28 : ARMFReg<28, "s28">; def S29 : ARMFReg<29, "s29">;
115*0b57cec5SDimitry Andricdef S30 : ARMFReg<30, "s30">; def S31 : ARMFReg<31, "s31">;
116*0b57cec5SDimitry Andric
117*0b57cec5SDimitry Andric// Aliases of the F* registers used to hold 64-bit fp values (doubles)
118*0b57cec5SDimitry Andriclet SubRegIndices = [ssub_0, ssub_1] in {
119*0b57cec5SDimitry Andricdef D0  : ARMReg< 0,  "d0", [S0,   S1]>, DwarfRegNum<[256]>;
120*0b57cec5SDimitry Andricdef D1  : ARMReg< 1,  "d1", [S2,   S3]>, DwarfRegNum<[257]>;
121*0b57cec5SDimitry Andricdef D2  : ARMReg< 2,  "d2", [S4,   S5]>, DwarfRegNum<[258]>;
122*0b57cec5SDimitry Andricdef D3  : ARMReg< 3,  "d3", [S6,   S7]>, DwarfRegNum<[259]>;
123*0b57cec5SDimitry Andricdef D4  : ARMReg< 4,  "d4", [S8,   S9]>, DwarfRegNum<[260]>;
124*0b57cec5SDimitry Andricdef D5  : ARMReg< 5,  "d5", [S10, S11]>, DwarfRegNum<[261]>;
125*0b57cec5SDimitry Andricdef D6  : ARMReg< 6,  "d6", [S12, S13]>, DwarfRegNum<[262]>;
126*0b57cec5SDimitry Andricdef D7  : ARMReg< 7,  "d7", [S14, S15]>, DwarfRegNum<[263]>;
127*0b57cec5SDimitry Andricdef D8  : ARMReg< 8,  "d8", [S16, S17]>, DwarfRegNum<[264]>;
128*0b57cec5SDimitry Andricdef D9  : ARMReg< 9,  "d9", [S18, S19]>, DwarfRegNum<[265]>;
129*0b57cec5SDimitry Andricdef D10 : ARMReg<10, "d10", [S20, S21]>, DwarfRegNum<[266]>;
130*0b57cec5SDimitry Andricdef D11 : ARMReg<11, "d11", [S22, S23]>, DwarfRegNum<[267]>;
131*0b57cec5SDimitry Andricdef D12 : ARMReg<12, "d12", [S24, S25]>, DwarfRegNum<[268]>;
132*0b57cec5SDimitry Andricdef D13 : ARMReg<13, "d13", [S26, S27]>, DwarfRegNum<[269]>;
133*0b57cec5SDimitry Andricdef D14 : ARMReg<14, "d14", [S28, S29]>, DwarfRegNum<[270]>;
134*0b57cec5SDimitry Andricdef D15 : ARMReg<15, "d15", [S30, S31]>, DwarfRegNum<[271]>;
135*0b57cec5SDimitry Andric}
136*0b57cec5SDimitry Andric
137*0b57cec5SDimitry Andric// VFP3 defines 16 additional double registers
138*0b57cec5SDimitry Andricdef D16 : ARMFReg<16, "d16">, DwarfRegNum<[272]>;
139*0b57cec5SDimitry Andricdef D17 : ARMFReg<17, "d17">, DwarfRegNum<[273]>;
140*0b57cec5SDimitry Andricdef D18 : ARMFReg<18, "d18">, DwarfRegNum<[274]>;
141*0b57cec5SDimitry Andricdef D19 : ARMFReg<19, "d19">, DwarfRegNum<[275]>;
142*0b57cec5SDimitry Andricdef D20 : ARMFReg<20, "d20">, DwarfRegNum<[276]>;
143*0b57cec5SDimitry Andricdef D21 : ARMFReg<21, "d21">, DwarfRegNum<[277]>;
144*0b57cec5SDimitry Andricdef D22 : ARMFReg<22, "d22">, DwarfRegNum<[278]>;
145*0b57cec5SDimitry Andricdef D23 : ARMFReg<23, "d23">, DwarfRegNum<[279]>;
146*0b57cec5SDimitry Andricdef D24 : ARMFReg<24, "d24">, DwarfRegNum<[280]>;
147*0b57cec5SDimitry Andricdef D25 : ARMFReg<25, "d25">, DwarfRegNum<[281]>;
148*0b57cec5SDimitry Andricdef D26 : ARMFReg<26, "d26">, DwarfRegNum<[282]>;
149*0b57cec5SDimitry Andricdef D27 : ARMFReg<27, "d27">, DwarfRegNum<[283]>;
150*0b57cec5SDimitry Andricdef D28 : ARMFReg<28, "d28">, DwarfRegNum<[284]>;
151*0b57cec5SDimitry Andricdef D29 : ARMFReg<29, "d29">, DwarfRegNum<[285]>;
152*0b57cec5SDimitry Andricdef D30 : ARMFReg<30, "d30">, DwarfRegNum<[286]>;
153*0b57cec5SDimitry Andricdef D31 : ARMFReg<31, "d31">, DwarfRegNum<[287]>;
154*0b57cec5SDimitry Andric
155*0b57cec5SDimitry Andric// Advanced SIMD (NEON) defines 16 quad-word aliases
156*0b57cec5SDimitry Andriclet SubRegIndices = [dsub_0, dsub_1] in {
157*0b57cec5SDimitry Andricdef Q0  : ARMReg< 0,  "q0", [D0,   D1]>;
158*0b57cec5SDimitry Andricdef Q1  : ARMReg< 1,  "q1", [D2,   D3]>;
159*0b57cec5SDimitry Andricdef Q2  : ARMReg< 2,  "q2", [D4,   D5]>;
160*0b57cec5SDimitry Andricdef Q3  : ARMReg< 3,  "q3", [D6,   D7]>;
161*0b57cec5SDimitry Andricdef Q4  : ARMReg< 4,  "q4", [D8,   D9]>;
162*0b57cec5SDimitry Andricdef Q5  : ARMReg< 5,  "q5", [D10, D11]>;
163*0b57cec5SDimitry Andricdef Q6  : ARMReg< 6,  "q6", [D12, D13]>;
164*0b57cec5SDimitry Andricdef Q7  : ARMReg< 7,  "q7", [D14, D15]>;
165*0b57cec5SDimitry Andric}
166*0b57cec5SDimitry Andriclet SubRegIndices = [dsub_0, dsub_1] in {
167*0b57cec5SDimitry Andricdef Q8  : ARMReg< 8,  "q8", [D16, D17]>;
168*0b57cec5SDimitry Andricdef Q9  : ARMReg< 9,  "q9", [D18, D19]>;
169*0b57cec5SDimitry Andricdef Q10 : ARMReg<10, "q10", [D20, D21]>;
170*0b57cec5SDimitry Andricdef Q11 : ARMReg<11, "q11", [D22, D23]>;
171*0b57cec5SDimitry Andricdef Q12 : ARMReg<12, "q12", [D24, D25]>;
172*0b57cec5SDimitry Andricdef Q13 : ARMReg<13, "q13", [D26, D27]>;
173*0b57cec5SDimitry Andricdef Q14 : ARMReg<14, "q14", [D28, D29]>;
174*0b57cec5SDimitry Andricdef Q15 : ARMReg<15, "q15", [D30, D31]>;
175*0b57cec5SDimitry Andric}
176*0b57cec5SDimitry Andric
177*0b57cec5SDimitry Andric// Current Program Status Register.
178*0b57cec5SDimitry Andric// We model fpscr with two registers: FPSCR models the control bits and will be
179*0b57cec5SDimitry Andric// reserved. FPSCR_NZCV models the flag bits and will be unreserved. APSR_NZCV
180*0b57cec5SDimitry Andric// models the APSR when it's accessed by some special instructions. In such cases
181*0b57cec5SDimitry Andric// it has the same encoding as PC.
182*0b57cec5SDimitry Andricdef CPSR       : ARMReg<0,  "cpsr">;
183*0b57cec5SDimitry Andricdef APSR       : ARMReg<1,  "apsr">;
184*0b57cec5SDimitry Andricdef APSR_NZCV  : ARMReg<15, "apsr_nzcv">;
185*0b57cec5SDimitry Andricdef SPSR       : ARMReg<2,  "spsr">;
186*0b57cec5SDimitry Andricdef FPSCR      : ARMReg<3,  "fpscr">;
187*0b57cec5SDimitry Andricdef FPSCR_NZCV : ARMReg<3,  "fpscr_nzcv"> {
188*0b57cec5SDimitry Andric  let Aliases = [FPSCR];
189*0b57cec5SDimitry Andric}
190*0b57cec5SDimitry Andricdef ITSTATE    : ARMReg<4, "itstate">;
191*0b57cec5SDimitry Andric
192*0b57cec5SDimitry Andric// Special Registers - only available in privileged mode.
193*0b57cec5SDimitry Andricdef FPSID   : ARMReg<0,  "fpsid">;
194*0b57cec5SDimitry Andricdef MVFR2   : ARMReg<5,  "mvfr2">;
195*0b57cec5SDimitry Andricdef MVFR1   : ARMReg<6,  "mvfr1">;
196*0b57cec5SDimitry Andricdef MVFR0   : ARMReg<7,  "mvfr0">;
197*0b57cec5SDimitry Andricdef FPEXC   : ARMReg<8,  "fpexc">;
198*0b57cec5SDimitry Andricdef FPINST  : ARMReg<9,  "fpinst">;
199*0b57cec5SDimitry Andricdef FPINST2 : ARMReg<10, "fpinst2">;
200*0b57cec5SDimitry Andric// These encodings aren't actual instruction encodings, their encoding depends
201*0b57cec5SDimitry Andric// on the instruction they are used in and for VPR 32 was chosen such that it
202*0b57cec5SDimitry Andric// always comes last in spr_reglist_with_vpr.
203*0b57cec5SDimitry Andricdef VPR     : ARMReg<32, "vpr">;
204*0b57cec5SDimitry Andricdef FPSCR_NZCVQC
205*0b57cec5SDimitry Andric            : ARMReg<2, "fpscr_nzcvqc">;
206*0b57cec5SDimitry Andricdef P0      : ARMReg<13, "p0">;
207*0b57cec5SDimitry Andricdef FPCXTNS : ARMReg<14, "fpcxtns">;
208*0b57cec5SDimitry Andricdef FPCXTS  : ARMReg<15, "fpcxts">;
209*0b57cec5SDimitry Andric
210*0b57cec5SDimitry Andricdef ZR  : ARMReg<15, "zr">,  DwarfRegNum<[15]>;
211*0b57cec5SDimitry Andric
212*0b57cec5SDimitry Andric// Register classes.
213*0b57cec5SDimitry Andric//
214*0b57cec5SDimitry Andric// pc  == Program Counter
215*0b57cec5SDimitry Andric// lr  == Link Register
216*0b57cec5SDimitry Andric// sp  == Stack Pointer
217*0b57cec5SDimitry Andric// r12 == ip (scratch)
218*0b57cec5SDimitry Andric// r7  == Frame Pointer (thumb-style backtraces)
219*0b57cec5SDimitry Andric// r9  == May be reserved as Thread Register
220*0b57cec5SDimitry Andric// r11 == Frame Pointer (arm-style backtraces)
221*0b57cec5SDimitry Andric// r10 == Stack Limit
222*0b57cec5SDimitry Andric//
223*0b57cec5SDimitry Andricdef GPR : RegisterClass<"ARM", [i32], 32, (add (sequence "R%u", 0, 12),
224*0b57cec5SDimitry Andric                                               SP, LR, PC)> {
225*0b57cec5SDimitry Andric  // Allocate LR as the first CSR since it is always saved anyway.
226*0b57cec5SDimitry Andric  // For Thumb1 mode, we don't want to allocate hi regs at all, as we don't
227*0b57cec5SDimitry Andric  // know how to spill them. If we make our prologue/epilogue code smarter at
228*0b57cec5SDimitry Andric  // some point, we can go back to using the above allocation orders for the
229*0b57cec5SDimitry Andric  // Thumb1 instructions that know how to use hi regs.
230*0b57cec5SDimitry Andric  let AltOrders = [(add LR, GPR), (trunc GPR, 8),
231*0b57cec5SDimitry Andric                   (add (trunc GPR, 8), R12, LR, (shl GPR, 8))];
232*0b57cec5SDimitry Andric  let AltOrderSelect = [{
233*0b57cec5SDimitry Andric      return MF.getSubtarget<ARMSubtarget>().getGPRAllocationOrder(MF);
234*0b57cec5SDimitry Andric  }];
235*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [r0, r15]";
236*0b57cec5SDimitry Andric}
237*0b57cec5SDimitry Andric
238*0b57cec5SDimitry Andric// GPRs without the PC.  Some ARM instructions do not allow the PC in
239*0b57cec5SDimitry Andric// certain operand slots, particularly as the destination.  Primarily
240*0b57cec5SDimitry Andric// useful for disassembly.
241*0b57cec5SDimitry Andricdef GPRnopc : RegisterClass<"ARM", [i32], 32, (sub GPR, PC)> {
242*0b57cec5SDimitry Andric  let AltOrders = [(add LR, GPRnopc), (trunc GPRnopc, 8),
243*0b57cec5SDimitry Andric                   (add (trunc GPRnopc, 8), R12, LR, (shl GPRnopc, 8))];
244*0b57cec5SDimitry Andric  let AltOrderSelect = [{
245*0b57cec5SDimitry Andric      return MF.getSubtarget<ARMSubtarget>().getGPRAllocationOrder(MF);
246*0b57cec5SDimitry Andric  }];
247*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [r0, r14]";
248*0b57cec5SDimitry Andric}
249*0b57cec5SDimitry Andric
250*0b57cec5SDimitry Andric// GPRs without the PC but with APSR. Some instructions allow accessing the
251*0b57cec5SDimitry Andric// APSR, while actually encoding PC in the register field. This is useful
252*0b57cec5SDimitry Andric// for assembly and disassembly only.
253*0b57cec5SDimitry Andricdef GPRwithAPSR : RegisterClass<"ARM", [i32], 32, (add (sub GPR, PC), APSR_NZCV)> {
254*0b57cec5SDimitry Andric  let AltOrders = [(add LR, GPRnopc), (trunc GPRnopc, 8)];
255*0b57cec5SDimitry Andric  let AltOrderSelect = [{
256*0b57cec5SDimitry Andric      return 1 + MF.getSubtarget<ARMSubtarget>().isThumb1Only();
257*0b57cec5SDimitry Andric  }];
258*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [r0, r14] or apsr_nzcv";
259*0b57cec5SDimitry Andric}
260*0b57cec5SDimitry Andric
261*0b57cec5SDimitry Andric// GPRs without the PC and SP registers but with APSR. Used by CLRM instruction.
262*0b57cec5SDimitry Andricdef GPRwithAPSRnosp : RegisterClass<"ARM", [i32], 32, (add (sequence "R%u", 0, 12), LR, APSR)> {
263*0b57cec5SDimitry Andric  let isAllocatable = 0;
264*0b57cec5SDimitry Andric}
265*0b57cec5SDimitry Andric
266*0b57cec5SDimitry Andricdef GPRwithZR : RegisterClass<"ARM", [i32], 32, (add (sub GPR, PC), ZR)> {
267*0b57cec5SDimitry Andric  let AltOrders = [(add LR, GPRwithZR), (trunc GPRwithZR, 8)];
268*0b57cec5SDimitry Andric  let AltOrderSelect = [{
269*0b57cec5SDimitry Andric      return 1 + MF.getSubtarget<ARMSubtarget>().isThumb1Only();
270*0b57cec5SDimitry Andric  }];
271*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [r0, r14] or zr";
272*0b57cec5SDimitry Andric}
273*0b57cec5SDimitry Andric
274*0b57cec5SDimitry Andricdef GPRwithZRnosp : RegisterClass<"ARM", [i32], 32, (sub GPRwithZR, SP)> {
275*0b57cec5SDimitry Andric  let AltOrders = [(add LR, GPRwithZRnosp), (trunc GPRwithZRnosp, 8)];
276*0b57cec5SDimitry Andric  let AltOrderSelect = [{
277*0b57cec5SDimitry Andric      return 1 + MF.getSubtarget<ARMSubtarget>().isThumb1Only();
278*0b57cec5SDimitry Andric  }];
279*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [r0, r12] or r14 or zr";
280*0b57cec5SDimitry Andric}
281*0b57cec5SDimitry Andric
282*0b57cec5SDimitry Andric// GPRsp - Only the SP is legal. Used by Thumb1 instructions that want the
283*0b57cec5SDimitry Andric// implied SP argument list.
284*0b57cec5SDimitry Andric// FIXME: It would be better to not use this at all and refactor the
285*0b57cec5SDimitry Andric// instructions to not have SP an an explicit argument. That makes
286*0b57cec5SDimitry Andric// frame index resolution a bit trickier, though.
287*0b57cec5SDimitry Andricdef GPRsp : RegisterClass<"ARM", [i32], 32, (add SP)> {
288*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register sp";
289*0b57cec5SDimitry Andric}
290*0b57cec5SDimitry Andric
291*0b57cec5SDimitry Andric// GPRlr - Only LR is legal. Used by ARMv8.1-M Low Overhead Loop instructions
292*0b57cec5SDimitry Andric// where LR is the only legal loop counter register.
293*0b57cec5SDimitry Andricdef GPRlr : RegisterClass<"ARM", [i32], 32, (add LR)>;
294*0b57cec5SDimitry Andric
295*0b57cec5SDimitry Andric// restricted GPR register class. Many Thumb2 instructions allow the full
296*0b57cec5SDimitry Andric// register range for operands, but have undefined behaviours when PC
297*0b57cec5SDimitry Andric// or SP (R13 or R15) are used. The ARM ISA refers to these operands
298*0b57cec5SDimitry Andric// via the BadReg() pseudo-code description.
299*0b57cec5SDimitry Andricdef rGPR : RegisterClass<"ARM", [i32], 32, (sub GPR, SP, PC)> {
300*0b57cec5SDimitry Andric  let AltOrders = [(add LR, rGPR), (trunc rGPR, 8),
301*0b57cec5SDimitry Andric                   (add (trunc rGPR, 8), R12, LR, (shl rGPR, 8))];
302*0b57cec5SDimitry Andric  let AltOrderSelect = [{
303*0b57cec5SDimitry Andric      return MF.getSubtarget<ARMSubtarget>().getGPRAllocationOrder(MF);
304*0b57cec5SDimitry Andric  }];
305*0b57cec5SDimitry Andric  let DiagnosticType = "rGPR";
306*0b57cec5SDimitry Andric}
307*0b57cec5SDimitry Andric
308*0b57cec5SDimitry Andric// Thumb registers are R0-R7 normally. Some instructions can still use
309*0b57cec5SDimitry Andric// the general GPR register class above (MOV, e.g.)
310*0b57cec5SDimitry Andricdef tGPR : RegisterClass<"ARM", [i32], 32, (trunc GPR, 8)> {
311*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [r0, r7]";
312*0b57cec5SDimitry Andric}
313*0b57cec5SDimitry Andric
314*0b57cec5SDimitry Andric// Thumb registers R0-R7 and the PC. Some instructions like TBB or THH allow
315*0b57cec5SDimitry Andric// the PC to be used as a destination operand as well.
316*0b57cec5SDimitry Andricdef tGPRwithpc : RegisterClass<"ARM", [i32], 32, (add tGPR, PC)>;
317*0b57cec5SDimitry Andric
318*0b57cec5SDimitry Andric// The high registers in thumb mode, R8-R15.
319*0b57cec5SDimitry Andricdef hGPR : RegisterClass<"ARM", [i32], 32, (sub GPR, tGPR)> {
320*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [r8, r15]";
321*0b57cec5SDimitry Andric}
322*0b57cec5SDimitry Andric
323*0b57cec5SDimitry Andric// For tail calls, we can't use callee-saved registers, as they are restored
324*0b57cec5SDimitry Andric// to the saved value before the tail call, which would clobber a call address.
325*0b57cec5SDimitry Andric// Note, getMinimalPhysRegClass(R0) returns tGPR because of the names of
326*0b57cec5SDimitry Andric// this class and the preceding one(!)  This is what we want.
327*0b57cec5SDimitry Andricdef tcGPR : RegisterClass<"ARM", [i32], 32, (add R0, R1, R2, R3, R12)> {
328*0b57cec5SDimitry Andric  let AltOrders = [(and tcGPR, tGPR)];
329*0b57cec5SDimitry Andric  let AltOrderSelect = [{
330*0b57cec5SDimitry Andric      return MF.getSubtarget<ARMSubtarget>().isThumb1Only();
331*0b57cec5SDimitry Andric  }];
332*0b57cec5SDimitry Andric}
333*0b57cec5SDimitry Andric
334*0b57cec5SDimitry Andricdef tGPROdd : RegisterClass<"ARM", [i32], 32, (add R1, R3, R5, R7, R9, R11)> {
335*0b57cec5SDimitry Andric  let AltOrders = [(and tGPROdd, tGPR)];
336*0b57cec5SDimitry Andric  let AltOrderSelect = [{
337*0b57cec5SDimitry Andric      return MF.getSubtarget<ARMSubtarget>().isThumb1Only();
338*0b57cec5SDimitry Andric  }];
339*0b57cec5SDimitry Andric  let DiagnosticString =
340*0b57cec5SDimitry Andric    "operand must be an odd-numbered register in range [r1,r11]";
341*0b57cec5SDimitry Andric}
342*0b57cec5SDimitry Andric
343*0b57cec5SDimitry Andricdef tGPREven : RegisterClass<"ARM", [i32], 32, (add R0, R2, R4, R6, R8, R10, R12, LR)> {
344*0b57cec5SDimitry Andric  let AltOrders = [(and tGPREven, tGPR)];
345*0b57cec5SDimitry Andric  let AltOrderSelect = [{
346*0b57cec5SDimitry Andric      return MF.getSubtarget<ARMSubtarget>().isThumb1Only();
347*0b57cec5SDimitry Andric  }];
348*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be an even-numbered register";
349*0b57cec5SDimitry Andric}
350*0b57cec5SDimitry Andric
351*0b57cec5SDimitry Andric// Condition code registers.
352*0b57cec5SDimitry Andricdef CCR : RegisterClass<"ARM", [i32], 32, (add CPSR)> {
353*0b57cec5SDimitry Andric  let CopyCost = -1;  // Don't allow copying of status registers.
354*0b57cec5SDimitry Andric  let isAllocatable = 0;
355*0b57cec5SDimitry Andric}
356*0b57cec5SDimitry Andric
357*0b57cec5SDimitry Andric// MVE Condition code register.
358*0b57cec5SDimitry Andricdef VCCR : RegisterClass<"ARM", [i32, v16i1, v8i1, v4i1], 32, (add VPR)> {
359*0b57cec5SDimitry Andric//  let CopyCost = -1;  // Don't allow copying of status registers.
360*0b57cec5SDimitry Andric}
361*0b57cec5SDimitry Andric
362*0b57cec5SDimitry Andric// FPSCR, when the flags at the top of it are used as the input or
363*0b57cec5SDimitry Andric// output to an instruction such as MVE VADC.
364*0b57cec5SDimitry Andricdef cl_FPSCR_NZCV : RegisterClass<"ARM", [i32], 32, (add FPSCR_NZCV)>;
365*0b57cec5SDimitry Andric
366*0b57cec5SDimitry Andric// Scalar single precision floating point register class..
367*0b57cec5SDimitry Andric// FIXME: Allocation order changed to s0, s2, ... or s0, s4, ... as a quick hack
368*0b57cec5SDimitry Andric// to avoid partial-write dependencies on D or Q (depending on platform)
369*0b57cec5SDimitry Andric// registers (S registers are renamed as portions of D/Q registers).
370*0b57cec5SDimitry Andricdef SPR : RegisterClass<"ARM", [f32], 32, (sequence "S%u", 0, 31)> {
371*0b57cec5SDimitry Andric  let AltOrders = [(add (decimate SPR, 2), SPR),
372*0b57cec5SDimitry Andric                   (add (decimate SPR, 4),
373*0b57cec5SDimitry Andric                        (decimate SPR, 2),
374*0b57cec5SDimitry Andric                        (decimate (rotl SPR, 1), 4),
375*0b57cec5SDimitry Andric                        (decimate (rotl SPR, 1), 2))];
376*0b57cec5SDimitry Andric  let AltOrderSelect = [{
377*0b57cec5SDimitry Andric    return 1 + MF.getSubtarget<ARMSubtarget>().useStride4VFPs();
378*0b57cec5SDimitry Andric  }];
379*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [s0, s31]";
380*0b57cec5SDimitry Andric}
381*0b57cec5SDimitry Andric
382*0b57cec5SDimitry Andricdef HPR : RegisterClass<"ARM", [f16], 32, (sequence "S%u", 0, 31)> {
383*0b57cec5SDimitry Andric  let AltOrders = [(add (decimate HPR, 2), SPR),
384*0b57cec5SDimitry Andric                   (add (decimate HPR, 4),
385*0b57cec5SDimitry Andric                        (decimate HPR, 2),
386*0b57cec5SDimitry Andric                        (decimate (rotl HPR, 1), 4),
387*0b57cec5SDimitry Andric                        (decimate (rotl HPR, 1), 2))];
388*0b57cec5SDimitry Andric  let AltOrderSelect = [{
389*0b57cec5SDimitry Andric    return 1 + MF.getSubtarget<ARMSubtarget>().useStride4VFPs();
390*0b57cec5SDimitry Andric  }];
391*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [s0, s31]";
392*0b57cec5SDimitry Andric}
393*0b57cec5SDimitry Andric
394*0b57cec5SDimitry Andric// Subset of SPR which can be used as a source of NEON scalars for 16-bit
395*0b57cec5SDimitry Andric// operations
396*0b57cec5SDimitry Andricdef SPR_8 : RegisterClass<"ARM", [f32], 32, (sequence "S%u", 0, 15)> {
397*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [s0, s15]";
398*0b57cec5SDimitry Andric}
399*0b57cec5SDimitry Andric
400*0b57cec5SDimitry Andric// Scalar double precision floating point / generic 64-bit vector register
401*0b57cec5SDimitry Andric// class.
402*0b57cec5SDimitry Andric// ARM requires only word alignment for double. It's more performant if it
403*0b57cec5SDimitry Andric// is double-word alignment though.
404*0b57cec5SDimitry Andricdef DPR : RegisterClass<"ARM", [f64, v8i8, v4i16, v2i32, v1i64, v2f32, v4f16], 64,
405*0b57cec5SDimitry Andric                        (sequence "D%u", 0, 31)> {
406*0b57cec5SDimitry Andric  // Allocate non-VFP2 registers D16-D31 first, and prefer even registers on
407*0b57cec5SDimitry Andric  // Darwin platforms.
408*0b57cec5SDimitry Andric  let AltOrders = [(rotl DPR, 16),
409*0b57cec5SDimitry Andric                   (add (decimate (rotl DPR, 16), 2), (rotl DPR, 16))];
410*0b57cec5SDimitry Andric  let AltOrderSelect = [{
411*0b57cec5SDimitry Andric    return 1 + MF.getSubtarget<ARMSubtarget>().useStride4VFPs();
412*0b57cec5SDimitry Andric  }];
413*0b57cec5SDimitry Andric  let DiagnosticType = "DPR";
414*0b57cec5SDimitry Andric}
415*0b57cec5SDimitry Andric
416*0b57cec5SDimitry Andric// Scalar single and double precision floating point and VPR register class,
417*0b57cec5SDimitry Andric// this is only used for parsing, don't use it anywhere else as the size and
418*0b57cec5SDimitry Andric// types don't match!
419*0b57cec5SDimitry Andricdef FPWithVPR : RegisterClass<"ARM", [f32], 32, (add SPR, DPR, VPR)> {
420*0b57cec5SDimitry Andric    let isAllocatable = 0;
421*0b57cec5SDimitry Andric}
422*0b57cec5SDimitry Andric
423*0b57cec5SDimitry Andric// Subset of DPR that are accessible with VFP2 (and so that also have
424*0b57cec5SDimitry Andric// 32-bit SPR subregs).
425*0b57cec5SDimitry Andricdef DPR_VFP2 : RegisterClass<"ARM", [f64, v8i8, v4i16, v2i32, v1i64, v2f32, v4f16], 64,
426*0b57cec5SDimitry Andric                             (trunc DPR, 16)> {
427*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [d0, d15]";
428*0b57cec5SDimitry Andric}
429*0b57cec5SDimitry Andric
430*0b57cec5SDimitry Andric// Subset of DPR which can be used as a source of NEON scalars for 16-bit
431*0b57cec5SDimitry Andric// operations
432*0b57cec5SDimitry Andricdef DPR_8 : RegisterClass<"ARM", [f64, v8i8, v4i16, v2i32, v1i64, v2f32, v4f16], 64,
433*0b57cec5SDimitry Andric                          (trunc DPR, 8)> {
434*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [d0, d7]";
435*0b57cec5SDimitry Andric}
436*0b57cec5SDimitry Andric
437*0b57cec5SDimitry Andric// Generic 128-bit vector register class.
438*0b57cec5SDimitry Andricdef QPR : RegisterClass<"ARM", [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64, v8f16], 128,
439*0b57cec5SDimitry Andric                        (sequence "Q%u", 0, 15)> {
440*0b57cec5SDimitry Andric  // Allocate non-VFP2 aliases Q8-Q15 first.
441*0b57cec5SDimitry Andric  let AltOrders = [(rotl QPR, 8), (trunc QPR, 8)];
442*0b57cec5SDimitry Andric  let AltOrderSelect = [{
443*0b57cec5SDimitry Andric    return 1 + MF.getSubtarget<ARMSubtarget>().hasMVEIntegerOps();
444*0b57cec5SDimitry Andric  }];
445*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [q0, q15]";
446*0b57cec5SDimitry Andric}
447*0b57cec5SDimitry Andric
448*0b57cec5SDimitry Andric// Subset of QPR that have 32-bit SPR subregs.
449*0b57cec5SDimitry Andricdef QPR_VFP2 : RegisterClass<"ARM", [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
450*0b57cec5SDimitry Andric                             128, (trunc QPR, 8)> {
451*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [q0, q7]";
452*0b57cec5SDimitry Andric}
453*0b57cec5SDimitry Andric
454*0b57cec5SDimitry Andric// Subset of QPR that have DPR_8 and SPR_8 subregs.
455*0b57cec5SDimitry Andricdef QPR_8 : RegisterClass<"ARM", [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
456*0b57cec5SDimitry Andric                           128, (trunc QPR, 4)> {
457*0b57cec5SDimitry Andric  let DiagnosticString = "operand must be a register in range [q0, q3]";
458*0b57cec5SDimitry Andric}
459*0b57cec5SDimitry Andric
460*0b57cec5SDimitry Andric// MVE 128-bit vector register class. This class is only really needed for
461*0b57cec5SDimitry Andric// parsing assembly, since we still have to truncate the register set in the QPR
462*0b57cec5SDimitry Andric// class anyway.
463*0b57cec5SDimitry Andricdef MQPR : RegisterClass<"ARM", [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64, v8f16],
464*0b57cec5SDimitry Andric                         128, (trunc QPR, 8)>;
465*0b57cec5SDimitry Andric
466*0b57cec5SDimitry Andric// Pseudo-registers representing odd-even pairs of D registers. The even-odd
467*0b57cec5SDimitry Andric// pairs are already represented by the Q registers.
468*0b57cec5SDimitry Andric// These are needed by NEON instructions requiring two consecutive D registers.
469*0b57cec5SDimitry Andric// There is no D31_D0 register as that is always an UNPREDICTABLE encoding.
470*0b57cec5SDimitry Andricdef TuplesOE2D : RegisterTuples<[dsub_0, dsub_1],
471*0b57cec5SDimitry Andric                                [(decimate (shl DPR, 1), 2),
472*0b57cec5SDimitry Andric                                 (decimate (shl DPR, 2), 2)]>;
473*0b57cec5SDimitry Andric
474*0b57cec5SDimitry Andric// Register class representing a pair of consecutive D registers.
475*0b57cec5SDimitry Andric// Use the Q registers for the even-odd pairs.
476*0b57cec5SDimitry Andricdef DPair : RegisterClass<"ARM", [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
477*0b57cec5SDimitry Andric                          128, (interleave QPR, TuplesOE2D)> {
478*0b57cec5SDimitry Andric  // Allocate starting at non-VFP2 registers D16-D31 first.
479*0b57cec5SDimitry Andric  // Prefer even-odd pairs as they are easier to copy.
480*0b57cec5SDimitry Andric  let AltOrders = [(add (rotl QPR, 8),  (rotl DPair, 16)),
481*0b57cec5SDimitry Andric                   (add (trunc QPR, 8), (trunc DPair, 16))];
482*0b57cec5SDimitry Andric  let AltOrderSelect = [{
483*0b57cec5SDimitry Andric    return 1 + MF.getSubtarget<ARMSubtarget>().hasMVEIntegerOps();
484*0b57cec5SDimitry Andric  }];
485*0b57cec5SDimitry Andric}
486*0b57cec5SDimitry Andric
487*0b57cec5SDimitry Andric// Pseudo-registers representing even-odd pairs of GPRs from R1 to R13/SP.
488*0b57cec5SDimitry Andric// These are needed by instructions (e.g. ldrexd/strexd) requiring even-odd GPRs.
489*0b57cec5SDimitry Andricdef Tuples2R : RegisterTuples<[gsub_0, gsub_1],
490*0b57cec5SDimitry Andric                              [(add R0, R2, R4, R6, R8, R10, R12),
491*0b57cec5SDimitry Andric                               (add R1, R3, R5, R7, R9, R11, SP)]>;
492*0b57cec5SDimitry Andric
493*0b57cec5SDimitry Andric// Register class representing a pair of even-odd GPRs.
494*0b57cec5SDimitry Andricdef GPRPair : RegisterClass<"ARM", [untyped], 64, (add Tuples2R)> {
495*0b57cec5SDimitry Andric  let Size = 64; // 2 x 32 bits, we have no predefined type of that size.
496*0b57cec5SDimitry Andric}
497*0b57cec5SDimitry Andric
498*0b57cec5SDimitry Andric// Pseudo-registers representing 3 consecutive D registers.
499*0b57cec5SDimitry Andricdef Tuples3D : RegisterTuples<[dsub_0, dsub_1, dsub_2],
500*0b57cec5SDimitry Andric                              [(shl DPR, 0),
501*0b57cec5SDimitry Andric                               (shl DPR, 1),
502*0b57cec5SDimitry Andric                               (shl DPR, 2)]>;
503*0b57cec5SDimitry Andric
504*0b57cec5SDimitry Andric// 3 consecutive D registers.
505*0b57cec5SDimitry Andricdef DTriple : RegisterClass<"ARM", [untyped], 64, (add Tuples3D)> {
506*0b57cec5SDimitry Andric  let Size = 192; // 3 x 64 bits, we have no predefined type of that size.
507*0b57cec5SDimitry Andric}
508*0b57cec5SDimitry Andric
509*0b57cec5SDimitry Andric// Pseudo 256-bit registers to represent pairs of Q registers. These should
510*0b57cec5SDimitry Andric// never be present in the emitted code.
511*0b57cec5SDimitry Andric// These are used for NEON load / store instructions, e.g., vld4, vst3.
512*0b57cec5SDimitry Andricdef Tuples2Q : RegisterTuples<[qsub_0, qsub_1], [(shl QPR, 0), (shl QPR, 1)]>;
513*0b57cec5SDimitry Andric
514*0b57cec5SDimitry Andric// Pseudo 256-bit vector register class to model pairs of Q registers
515*0b57cec5SDimitry Andric// (4 consecutive D registers).
516*0b57cec5SDimitry Andricdef QQPR : RegisterClass<"ARM", [v4i64], 256, (add Tuples2Q)> {
517*0b57cec5SDimitry Andric  // Allocate non-VFP2 aliases first.
518*0b57cec5SDimitry Andric  let AltOrders = [(rotl QQPR, 8)];
519*0b57cec5SDimitry Andric  let AltOrderSelect = [{ return 1; }];
520*0b57cec5SDimitry Andric}
521*0b57cec5SDimitry Andric
522*0b57cec5SDimitry Andric// Tuples of 4 D regs that isn't also a pair of Q regs.
523*0b57cec5SDimitry Andricdef TuplesOE4D : RegisterTuples<[dsub_0, dsub_1, dsub_2, dsub_3],
524*0b57cec5SDimitry Andric                                [(decimate (shl DPR, 1), 2),
525*0b57cec5SDimitry Andric                                 (decimate (shl DPR, 2), 2),
526*0b57cec5SDimitry Andric                                 (decimate (shl DPR, 3), 2),
527*0b57cec5SDimitry Andric                                 (decimate (shl DPR, 4), 2)]>;
528*0b57cec5SDimitry Andric
529*0b57cec5SDimitry Andric// 4 consecutive D registers.
530*0b57cec5SDimitry Andricdef DQuad : RegisterClass<"ARM", [v4i64], 256,
531*0b57cec5SDimitry Andric                          (interleave Tuples2Q, TuplesOE4D)>;
532*0b57cec5SDimitry Andric
533*0b57cec5SDimitry Andric// Pseudo 512-bit registers to represent four consecutive Q registers.
534*0b57cec5SDimitry Andricdef Tuples2QQ : RegisterTuples<[qqsub_0, qqsub_1],
535*0b57cec5SDimitry Andric                               [(shl QQPR, 0), (shl QQPR, 2)]>;
536*0b57cec5SDimitry Andric
537*0b57cec5SDimitry Andric// Pseudo 512-bit vector register class to model 4 consecutive Q registers
538*0b57cec5SDimitry Andric// (8 consecutive D registers).
539*0b57cec5SDimitry Andricdef QQQQPR : RegisterClass<"ARM", [v8i64], 256, (add Tuples2QQ)> {
540*0b57cec5SDimitry Andric  // Allocate non-VFP2 aliases first.
541*0b57cec5SDimitry Andric  let AltOrders = [(rotl QQQQPR, 8)];
542*0b57cec5SDimitry Andric  let AltOrderSelect = [{ return 1; }];
543*0b57cec5SDimitry Andric}
544*0b57cec5SDimitry Andric
545*0b57cec5SDimitry Andric
546*0b57cec5SDimitry Andric// Pseudo-registers representing 2-spaced consecutive D registers.
547*0b57cec5SDimitry Andricdef Tuples2DSpc : RegisterTuples<[dsub_0, dsub_2],
548*0b57cec5SDimitry Andric                                 [(shl DPR, 0),
549*0b57cec5SDimitry Andric                                  (shl DPR, 2)]>;
550*0b57cec5SDimitry Andric
551*0b57cec5SDimitry Andric// Spaced pairs of D registers.
552*0b57cec5SDimitry Andricdef DPairSpc : RegisterClass<"ARM", [v2i64], 64, (add Tuples2DSpc)>;
553*0b57cec5SDimitry Andric
554*0b57cec5SDimitry Andricdef Tuples3DSpc : RegisterTuples<[dsub_0, dsub_2, dsub_4],
555*0b57cec5SDimitry Andric                                 [(shl DPR, 0),
556*0b57cec5SDimitry Andric                                  (shl DPR, 2),
557*0b57cec5SDimitry Andric                                  (shl DPR, 4)]>;
558*0b57cec5SDimitry Andric
559*0b57cec5SDimitry Andric// Spaced triples of D registers.
560*0b57cec5SDimitry Andricdef DTripleSpc : RegisterClass<"ARM", [untyped], 64, (add Tuples3DSpc)> {
561*0b57cec5SDimitry Andric  let Size = 192; // 3 x 64 bits, we have no predefined type of that size.
562*0b57cec5SDimitry Andric}
563*0b57cec5SDimitry Andric
564*0b57cec5SDimitry Andricdef Tuples4DSpc : RegisterTuples<[dsub_0, dsub_2, dsub_4, dsub_6],
565*0b57cec5SDimitry Andric                                 [(shl DPR, 0),
566*0b57cec5SDimitry Andric                                  (shl DPR, 2),
567*0b57cec5SDimitry Andric                                  (shl DPR, 4),
568*0b57cec5SDimitry Andric                                  (shl DPR, 6)]>;
569*0b57cec5SDimitry Andric
570*0b57cec5SDimitry Andric// Spaced quads of D registers.
571*0b57cec5SDimitry Andricdef DQuadSpc : RegisterClass<"ARM", [v4i64], 64, (add Tuples3DSpc)>;
572