blob: 6de2d577dd7b0b0504b497df07b1944a3b90fb51 [file] [log] [blame]
Evan Cheng7b0249b2008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- 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// ARM Instruction Format Definitions.
13//
14
15// Format specifies the encoding used by the instruction. This is part of the
16// ad-hoc solution used to emit machine instruction encodings by our machine
17// code emitter.
18class Format<bits<5> val> {
19 bits<5> Value = val;
20}
21
22def Pseudo : Format<1>;
Evan Chengee80fb72008-11-06 01:21:28 +000023def MulFrm : Format<2>;
Evan Cheng38396be2008-11-06 03:35:07 +000024def Branch : Format<3>;
25def BranchMisc : Format<4>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000026
Evan Cheng38396be2008-11-06 03:35:07 +000027def DPFrm : Format<5>;
28def DPSoRegFrm : Format<6>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000029
Evan Cheng38396be2008-11-06 03:35:07 +000030def LdFrm : Format<7>;
31def StFrm : Format<8>;
32def LdMiscFrm : Format<9>;
33def StMiscFrm : Format<10>;
34def LdMulFrm : Format<11>;
35def StMulFrm : Format<12>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000036
Evan Cheng38396be2008-11-06 03:35:07 +000037def ArithMisc : Format<13>;
38def ThumbFrm : Format<14>;
39def VFPFrm : Format<15>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000040
Evan Cheng86a926a2008-11-05 18:35:52 +000041// Misc flag for data processing instructions that indicates whether
42// the instruction has a Rn register operand.
43class UnaryDP { bit isUnaryDataProc = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000044
Evan Cheng7b0249b2008-08-28 23:39:26 +000045//===----------------------------------------------------------------------===//
46
47// ARM Instruction templates.
48//
49
Evan Chengbe998242008-11-06 08:47:38 +000050class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +000051 Format f, string cstr>
52 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +000053 field bits<32> Inst;
54
Evan Cheng7b0249b2008-08-28 23:39:26 +000055 let Namespace = "ARM";
56
Evan Cheng86a926a2008-11-05 18:35:52 +000057 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +000058 AddrMode AM = am;
59 bits<4> AddrModeBits = AM.Value;
60
61 SizeFlagVal SZ = sz;
62 bits<3> SizeFlag = SZ.Value;
63
64 IndexMode IM = im;
65 bits<2> IndexModeBits = IM.Value;
66
67 Format F = f;
68 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +000069
70 //
71 // Attributes specific to ARM instructions...
72 //
73 bit isUnaryDataProc = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +000074
75 let Constraints = cstr;
76}
77
78class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000079 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000080 let OutOperandList = oops;
81 let InOperandList = iops;
82 let AsmString = asm;
83 let Pattern = pattern;
84}
85
86// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +000087class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +000088 IndexMode im, Format f, string opc, string asm, string cstr,
89 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000090 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000091 let OutOperandList = oops;
92 let InOperandList = !con(iops, (ops pred:$p));
93 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
94 let Pattern = pattern;
95 list<Predicate> Predicates = [IsARM];
96}
97
98// Same as I except it can optionally modify CPSR. Note it's modeled as
99// an input operand since by default it's a zero register. It will
100// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000101class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000102 IndexMode im, Format f, string opc, string asm, string cstr,
103 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000104 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000105 let OutOperandList = oops;
106 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
107 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
108 let Pattern = pattern;
109 list<Predicate> Predicates = [IsARM];
110}
111
Evan Chengc5409a82008-09-01 07:19:00 +0000112// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000113class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000114 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000115 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000116 let OutOperandList = oops;
117 let InOperandList = iops;
118 let AsmString = asm;
119 let Pattern = pattern;
120 list<Predicate> Predicates = [IsARM];
121}
122
Evan Chengbe998242008-11-06 08:47:38 +0000123class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000124 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000125 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000126 asm,"",pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000127class AsI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000128 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000129 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000130 asm,"",pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000131class AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000132 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000133 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000134 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000135
136// Ctrl flow instructions
137class ABLpredI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
138 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000139 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000140 asm,"",pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000141 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000142}
143class ABLI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
144 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000145 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000146 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000147 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000148}
Evan Cheng10a9eb82008-09-01 08:25:56 +0000149// FIXME: BX
Evan Chengbe998242008-11-06 08:47:38 +0000150class AXIx2<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000151 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000152 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000153 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000154class ABI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
155 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000156 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000157 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000158 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000159}
160class ABccI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
161 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000162 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000163 asm,"",pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000164 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000165}
166
167// BR_JT instructions
168// == mov pc
169class JTI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000170 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BranchMisc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000171 asm, "", pattern> {
172 let Inst{20} = 0; // S Bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000173 let Inst{24-21} = opcod;
174 let Inst{27-26} = {0,0};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000175}
Evan Cheng18e5d102008-09-17 07:16:21 +0000176// == add pc
Evan Cheng10a9eb82008-09-01 08:25:56 +0000177class JTI1<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000178 : XI<oops, iops, AddrMode1, SizeSpecial, IndexModeNone, BranchMisc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000179 asm, "", pattern> {
Evan Cheng18e5d102008-09-17 07:16:21 +0000180 let Inst{20} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000181 let Inst{24-21} = opcod;
182 let Inst{27-26} = {0,0};
Evan Cheng18e5d102008-09-17 07:16:21 +0000183}
184// == ldr pc
185class JTI2<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000186 : XI<oops, iops, AddrMode2, SizeSpecial, IndexModeNone, BranchMisc,
Evan Cheng18e5d102008-09-17 07:16:21 +0000187 asm, "", pattern> {
Evan Cheng10a9eb82008-09-01 08:25:56 +0000188 let Inst{20} = 1; // L bit
189 let Inst{21} = 0; // W bit
190 let Inst{22} = 0; // B bit
191 let Inst{24} = 1; // P bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000192 let Inst{27-26} = {0,1};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000193}
194
Evan Cheng2e62b662008-09-01 01:51:14 +0000195
196// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000197class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
198 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000199 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000200 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000201 let Inst{24-21} = opcod;
202 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000203}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000204class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
205 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000206 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000207 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000208 let Inst{24-21} = opcod;
209 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000210}
Evan Chengc5409a82008-09-01 07:19:00 +0000211class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
212 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000213 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000214 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000215 let Inst{24-21} = opcod;
216 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000217}
Evan Chengbe998242008-11-06 08:47:38 +0000218class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000219 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000220 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000221 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000222
Evan Cheng2e62b662008-09-01 01:51:14 +0000223
224// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000225class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000226 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000227 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000228 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000229 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000230}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000231
232// loads
Evan Chengbe998242008-11-06 08:47:38 +0000233class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000234 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000235 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000236 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000237 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000238 let Inst{21} = 0; // W bit
239 let Inst{22} = 0; // B bit
240 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000241 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000242}
Evan Chengbe998242008-11-06 08:47:38 +0000243class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000244 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000245 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000246 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000247 let Inst{20} = 1; // L bit
248 let Inst{21} = 0; // W bit
249 let Inst{22} = 0; // B bit
250 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000251 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000252}
Evan Chengbe998242008-11-06 08:47:38 +0000253class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000254 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000255 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000256 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000257 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000258 let Inst{21} = 0; // W bit
259 let Inst{22} = 1; // B bit
260 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000261 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000262}
Evan Chengbe998242008-11-06 08:47:38 +0000263class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000264 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000265 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000266 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000267 let Inst{20} = 1; // L bit
268 let Inst{21} = 0; // W bit
269 let Inst{22} = 1; // B bit
270 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000271 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000272}
Evan Chengda020022008-08-31 19:02:21 +0000273
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000274// stores
Evan Chengbe998242008-11-06 08:47:38 +0000275class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000276 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000277 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000278 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000279 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000280 let Inst{21} = 0; // W bit
281 let Inst{22} = 0; // B bit
282 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000283 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000284}
Evan Chengbe998242008-11-06 08:47:38 +0000285class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000286 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000287 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000288 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000289 let Inst{20} = 0; // L bit
290 let Inst{21} = 0; // W bit
291 let Inst{22} = 0; // B bit
292 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000293 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000294}
Evan Chengbe998242008-11-06 08:47:38 +0000295class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000296 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000297 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000298 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000299 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000300 let Inst{21} = 0; // W bit
301 let Inst{22} = 1; // B bit
302 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000303 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000304}
Evan Chengbe998242008-11-06 08:47:38 +0000305class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000306 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000307 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000308 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000309 let Inst{20} = 0; // L bit
310 let Inst{21} = 0; // W bit
311 let Inst{22} = 1; // B bit
312 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000313 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000314}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000315
Evan Chengac92c3f2008-09-01 07:00:14 +0000316// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000317class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000318 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000319 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000320 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000321 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000322 let Inst{21} = 1; // W bit
323 let Inst{22} = 0; // B bit
324 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000325 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000326}
Evan Chengbe998242008-11-06 08:47:38 +0000327class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000328 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000329 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000330 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000331 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000332 let Inst{21} = 1; // W bit
333 let Inst{22} = 1; // B bit
334 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000335 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000336}
337
Evan Chengac92c3f2008-09-01 07:00:14 +0000338// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000339class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000340 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000341 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000342 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000343 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000344 let Inst{21} = 1; // W bit
345 let Inst{22} = 0; // B bit
346 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000347 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000348}
Evan Chengbe998242008-11-06 08:47:38 +0000349class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000350 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000351 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000352 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000353 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000354 let Inst{21} = 1; // W bit
355 let Inst{22} = 1; // B bit
356 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000357 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000358}
359
Evan Chengac92c3f2008-09-01 07:00:14 +0000360// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000361class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000362 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000363 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000364 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000365 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000366 let Inst{21} = 0; // W bit
367 let Inst{22} = 0; // B bit
368 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000369 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000370}
Evan Chengbe998242008-11-06 08:47:38 +0000371class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000372 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000373 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000374 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000375 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000376 let Inst{21} = 0; // W bit
377 let Inst{22} = 1; // B bit
378 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000379 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000380}
381
Evan Chengac92c3f2008-09-01 07:00:14 +0000382// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000383class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000384 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000385 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000386 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000387 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000388 let Inst{21} = 0; // W bit
389 let Inst{22} = 0; // B bit
390 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000391 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000392}
Evan Chengbe998242008-11-06 08:47:38 +0000393class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000394 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000395 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000396 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000397 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000398 let Inst{21} = 0; // W bit
399 let Inst{22} = 1; // B bit
400 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000401 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000402}
403
Evan Cheng2e62b662008-09-01 01:51:14 +0000404// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000405class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000406 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000407 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000408 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000409class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000410 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000411 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000412 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000413
Evan Chengac92c3f2008-09-01 07:00:14 +0000414// loads
Evan Chengbe998242008-11-06 08:47:38 +0000415class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000416 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000417 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000418 asm, "", pattern> {
419 let Inst{4} = 1;
420 let Inst{5} = 1; // H bit
421 let Inst{6} = 0; // S bit
422 let Inst{7} = 1;
423 let Inst{20} = 1; // L bit
424 let Inst{21} = 0; // W bit
425 let Inst{24} = 1; // P bit
426}
Evan Chengbe998242008-11-06 08:47:38 +0000427class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000428 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000429 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000430 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000431 let Inst{4} = 1;
432 let Inst{5} = 1; // H bit
433 let Inst{6} = 0; // S bit
434 let Inst{7} = 1;
435 let Inst{20} = 1; // L bit
436 let Inst{21} = 0; // W bit
437 let Inst{24} = 1; // P bit
438}
Evan Chengbe998242008-11-06 08:47:38 +0000439class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000440 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000441 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000442 asm, "", pattern> {
443 let Inst{4} = 1;
444 let Inst{5} = 1; // H bit
445 let Inst{6} = 1; // S bit
446 let Inst{7} = 1;
447 let Inst{20} = 1; // L bit
448 let Inst{21} = 0; // W bit
449 let Inst{24} = 1; // P bit
450}
Evan Chengbe998242008-11-06 08:47:38 +0000451class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000452 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000453 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000454 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000455 let Inst{4} = 1;
456 let Inst{5} = 1; // H bit
457 let Inst{6} = 1; // S bit
458 let Inst{7} = 1;
459 let Inst{20} = 1; // L bit
460 let Inst{21} = 0; // W bit
461 let Inst{24} = 1; // P bit
462}
Evan Chengbe998242008-11-06 08:47:38 +0000463class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000464 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000465 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000466 asm, "", pattern> {
467 let Inst{4} = 1;
468 let Inst{5} = 0; // H bit
469 let Inst{6} = 1; // S bit
470 let Inst{7} = 1;
471 let Inst{20} = 1; // L bit
472 let Inst{21} = 0; // W bit
473 let Inst{24} = 1; // P bit
474}
Evan Chengbe998242008-11-06 08:47:38 +0000475class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000476 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000477 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000478 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000479 let Inst{4} = 1;
480 let Inst{5} = 0; // H bit
481 let Inst{6} = 1; // S bit
482 let Inst{7} = 1;
483 let Inst{20} = 1; // L bit
484 let Inst{21} = 0; // W bit
485 let Inst{24} = 1; // P bit
486}
Evan Chengbe998242008-11-06 08:47:38 +0000487class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000488 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000489 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000490 asm, "", pattern> {
491 let Inst{4} = 1;
492 let Inst{5} = 0; // H bit
493 let Inst{6} = 1; // S bit
494 let Inst{7} = 1;
495 let Inst{20} = 0; // L bit
496 let Inst{21} = 0; // W bit
497 let Inst{24} = 1; // P bit
498}
499
500// stores
Evan Chengbe998242008-11-06 08:47:38 +0000501class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000502 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000503 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000504 asm, "", pattern> {
505 let Inst{4} = 1;
506 let Inst{5} = 1; // H bit
507 let Inst{6} = 0; // S bit
508 let Inst{7} = 1;
509 let Inst{20} = 0; // L bit
510 let Inst{21} = 0; // W bit
511 let Inst{24} = 1; // P bit
512}
Evan Chengbe998242008-11-06 08:47:38 +0000513class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000514 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000515 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000516 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000517 let Inst{4} = 1;
518 let Inst{5} = 1; // H bit
519 let Inst{6} = 0; // S bit
520 let Inst{7} = 1;
521 let Inst{20} = 0; // L bit
522 let Inst{21} = 0; // W bit
523 let Inst{24} = 1; // P bit
524}
Evan Chengbe998242008-11-06 08:47:38 +0000525class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000526 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000527 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000528 asm, "", pattern> {
529 let Inst{4} = 1;
530 let Inst{5} = 1; // H bit
531 let Inst{6} = 1; // S bit
532 let Inst{7} = 1;
533 let Inst{20} = 0; // L bit
534 let Inst{21} = 0; // W bit
535 let Inst{24} = 1; // P bit
536}
537
538// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000539class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000540 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000541 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000542 asm, cstr, pattern> {
543 let Inst{4} = 1;
544 let Inst{5} = 1; // H bit
545 let Inst{6} = 0; // S bit
546 let Inst{7} = 1;
547 let Inst{20} = 1; // L bit
548 let Inst{21} = 1; // W bit
549 let Inst{24} = 1; // P bit
550}
Evan Chengbe998242008-11-06 08:47:38 +0000551class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000552 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000553 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000554 asm, cstr, pattern> {
555 let Inst{4} = 1;
556 let Inst{5} = 1; // H bit
557 let Inst{6} = 1; // S bit
558 let Inst{7} = 1;
559 let Inst{20} = 1; // L bit
560 let Inst{21} = 1; // W bit
561 let Inst{24} = 1; // P bit
562}
Evan Chengbe998242008-11-06 08:47:38 +0000563class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000564 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000565 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000566 asm, cstr, pattern> {
567 let Inst{4} = 1;
568 let Inst{5} = 0; // H bit
569 let Inst{6} = 1; // S bit
570 let Inst{7} = 1;
571 let Inst{20} = 1; // L bit
572 let Inst{21} = 1; // W bit
573 let Inst{24} = 1; // P bit
574}
575
576// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000577class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000578 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000579 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000580 asm, cstr, pattern> {
581 let Inst{4} = 1;
582 let Inst{5} = 1; // H bit
583 let Inst{6} = 0; // S bit
584 let Inst{7} = 1;
585 let Inst{20} = 0; // L bit
586 let Inst{21} = 1; // W bit
587 let Inst{24} = 1; // P bit
588}
589
590// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000591class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000592 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000593 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000594 asm, cstr,pattern> {
595 let Inst{4} = 1;
596 let Inst{5} = 1; // H bit
597 let Inst{6} = 0; // S bit
598 let Inst{7} = 1;
599 let Inst{20} = 1; // L bit
600 let Inst{21} = 1; // W bit
601 let Inst{24} = 0; // P bit
602}
Evan Chengbe998242008-11-06 08:47:38 +0000603class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000604 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000605 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000606 asm, cstr,pattern> {
607 let Inst{4} = 1;
608 let Inst{5} = 1; // H bit
609 let Inst{6} = 1; // S bit
610 let Inst{7} = 1;
611 let Inst{20} = 1; // L bit
612 let Inst{21} = 1; // W bit
613 let Inst{24} = 0; // P bit
614}
Evan Chengbe998242008-11-06 08:47:38 +0000615class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000616 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000617 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000618 asm, cstr,pattern> {
619 let Inst{4} = 1;
620 let Inst{5} = 0; // H bit
621 let Inst{6} = 1; // S bit
622 let Inst{7} = 1;
623 let Inst{20} = 1; // L bit
624 let Inst{21} = 1; // W bit
625 let Inst{24} = 0; // P bit
626}
627
628// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000629class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000630 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000631 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000632 asm, cstr,pattern> {
633 let Inst{4} = 1;
634 let Inst{5} = 1; // H bit
635 let Inst{6} = 0; // S bit
636 let Inst{7} = 1;
637 let Inst{20} = 0; // L bit
638 let Inst{21} = 1; // W bit
639 let Inst{24} = 0; // P bit
640}
641
642
Evan Cheng2e62b662008-09-01 01:51:14 +0000643// addrmode4 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000644class AI4<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000645 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000646 : I<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd36b01c2008-09-01 07:48:18 +0000647 asm, "", pattern> {
Evan Cheng18e5d102008-09-17 07:16:21 +0000648 let Inst{25-27} = {0,0,1};
Evan Chengd36b01c2008-09-01 07:48:18 +0000649}
Evan Chengbe998242008-11-06 08:47:38 +0000650class AXI4ld<dag oops, dag iops, Format f, string asm,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000651 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000652 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000653 "", pattern> {
654 let Inst{20} = 1; // L bit
655 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000656 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000657}
Evan Chengbe998242008-11-06 08:47:38 +0000658class AXI4ldpc<dag oops, dag iops, Format f, string asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000659 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000660 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000661 "", pattern> {
662 let Inst{20} = 1; // L bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000663 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000664}
Evan Chengbe998242008-11-06 08:47:38 +0000665class AXI4st<dag oops, dag iops, Format f, string asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000666 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000667 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000668 "", pattern> {
669 let Inst{20} = 0; // L bit
670 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000671 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000672}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000673
Jim Grosbach1feed042008-11-03 18:38:31 +0000674// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000675class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000676 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000677 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng86a926a2008-11-05 18:35:52 +0000678 asm,"",pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000679 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000680 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000681 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000682}
Evan Chengbe998242008-11-06 08:47:38 +0000683class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000684 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000685 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng86a926a2008-11-05 18:35:52 +0000686 asm,"",pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000687 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000688 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000689}
690
691// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000692class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000693 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000694 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000695 asm,"",pattern> {
696 let Inst{7-4} = 0b1001;
697 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000698 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000699}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000700
Evan Cheng38396be2008-11-06 03:35:07 +0000701// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000702class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000703 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000704 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000705 asm,"",pattern> {
706 let Inst{4} = 0;
707 let Inst{7} = 1;
708 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000709 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000710}
711
Evan Cheng7b0249b2008-08-28 23:39:26 +0000712//===----------------------------------------------------------------------===//
713
714// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
715class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
716 list<Predicate> Predicates = [IsARM];
717}
718class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
719 list<Predicate> Predicates = [IsARM, HasV5TE];
720}
721class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
722 list<Predicate> Predicates = [IsARM, HasV6];
723}
Evan Cheng34a46e12008-08-29 06:41:12 +0000724
725//===----------------------------------------------------------------------===//
726//
727// Thumb Instruction Format Definitions.
728//
729
730
731// TI - Thumb instruction.
732
733class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
734 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000735 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000736 let OutOperandList = outs;
737 let InOperandList = ins;
738 let AsmString = asm;
739 let Pattern = pattern;
740 list<Predicate> Predicates = [IsThumb];
741}
742
743class TI<dag outs, dag ins, string asm, list<dag> pattern>
744 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
745class TI1<dag outs, dag ins, string asm, list<dag> pattern>
746 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
747class TI2<dag outs, dag ins, string asm, list<dag> pattern>
748 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
749class TI4<dag outs, dag ins, string asm, list<dag> pattern>
750 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
751class TIs<dag outs, dag ins, string asm, list<dag> pattern>
752 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
753
754// Two-address instructions
755class TIt<dag outs, dag ins, string asm, list<dag> pattern>
756 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
757
758// BL, BLX(1) are translated by assembler into two instructions
759class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
760 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
761
762// BR_JT instructions
763class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
764 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
765
766
767//===----------------------------------------------------------------------===//
768
769
770// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
771class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
772 list<Predicate> Predicates = [IsThumb];
773}
774
775class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
776 list<Predicate> Predicates = [IsThumb, HasV5T];
777}