blob: d5fca09bafe06bd8c9801543c664ab9822270a86 [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 Chengf8e8b622008-11-06 17:48:05 +000024def BrFrm : Format<3>;
25def BrMiscFrm : 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 Cheng37afa432008-11-06 22:15:19 +000037def ArithMiscFrm: Format<13>;
38def ExtFrm : Format<14>;
39def ThumbFrm : Format<15>;
40def VFPFrm : Format<16>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000041
Evan Cheng86a926a2008-11-05 18:35:52 +000042// Misc flag for data processing instructions that indicates whether
43// the instruction has a Rn register operand.
44class UnaryDP { bit isUnaryDataProc = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000045
Evan Cheng7b0249b2008-08-28 23:39:26 +000046//===----------------------------------------------------------------------===//
47
48// ARM Instruction templates.
49//
50
Evan Chengbe998242008-11-06 08:47:38 +000051class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +000052 Format f, string cstr>
53 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +000054 field bits<32> Inst;
55
Evan Cheng7b0249b2008-08-28 23:39:26 +000056 let Namespace = "ARM";
57
Evan Cheng86a926a2008-11-05 18:35:52 +000058 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +000059 AddrMode AM = am;
60 bits<4> AddrModeBits = AM.Value;
61
62 SizeFlagVal SZ = sz;
63 bits<3> SizeFlag = SZ.Value;
64
65 IndexMode IM = im;
66 bits<2> IndexModeBits = IM.Value;
67
68 Format F = f;
69 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +000070
71 //
72 // Attributes specific to ARM instructions...
73 //
74 bit isUnaryDataProc = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +000075
76 let Constraints = cstr;
77}
78
79class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000080 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000081 let OutOperandList = oops;
82 let InOperandList = iops;
83 let AsmString = asm;
84 let Pattern = pattern;
85}
86
87// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +000088class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +000089 IndexMode im, Format f, string opc, string asm, string cstr,
90 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000091 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000092 let OutOperandList = oops;
93 let InOperandList = !con(iops, (ops pred:$p));
94 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
95 let Pattern = pattern;
96 list<Predicate> Predicates = [IsARM];
97}
98
99// Same as I except it can optionally modify CPSR. Note it's modeled as
100// an input operand since by default it's a zero register. It will
101// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000102class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000103 IndexMode im, Format f, string opc, string asm, string cstr,
104 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000105 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000106 let OutOperandList = oops;
107 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
108 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
109 let Pattern = pattern;
110 list<Predicate> Predicates = [IsARM];
111}
112
Evan Chengc5409a82008-09-01 07:19:00 +0000113// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000114class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000115 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000116 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000117 let OutOperandList = oops;
118 let InOperandList = iops;
119 let AsmString = asm;
120 let Pattern = pattern;
121 list<Predicate> Predicates = [IsARM];
122}
123
Evan Chengbe998242008-11-06 08:47:38 +0000124class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000125 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000126 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000127 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000128class AsI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000129 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000130 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000131 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000132class AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000133 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000134 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000135 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000136
137// Ctrl flow instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000138class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000139 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000140 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000141 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000142 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000143}
Evan Chengf8e8b622008-11-06 17:48:05 +0000144class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
145 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, 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 Chengf8e8b622008-11-06 17:48:05 +0000149class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
150 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000151 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000152
153// BR_JT instructions
154// == mov pc
155class JTI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000156 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000157 asm, "", pattern> {
158 let Inst{20} = 0; // S Bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000159 let Inst{24-21} = opcod;
160 let Inst{27-26} = {0,0};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000161}
Evan Cheng18e5d102008-09-17 07:16:21 +0000162// == add pc
Evan Cheng10a9eb82008-09-01 08:25:56 +0000163class JTI1<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000164 : XI<oops, iops, AddrMode1, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000165 asm, "", pattern> {
Evan Cheng18e5d102008-09-17 07:16:21 +0000166 let Inst{20} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000167 let Inst{24-21} = opcod;
168 let Inst{27-26} = {0,0};
Evan Cheng18e5d102008-09-17 07:16:21 +0000169}
170// == ldr pc
171class JTI2<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000172 : XI<oops, iops, AddrMode2, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng18e5d102008-09-17 07:16:21 +0000173 asm, "", pattern> {
Evan Cheng10a9eb82008-09-01 08:25:56 +0000174 let Inst{20} = 1; // L bit
175 let Inst{21} = 0; // W bit
176 let Inst{22} = 0; // B bit
177 let Inst{24} = 1; // P bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000178 let Inst{27-26} = {0,1};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000179}
180
Evan Cheng2e62b662008-09-01 01:51:14 +0000181
182// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000183class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
184 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000185 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000186 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000187 let Inst{24-21} = opcod;
188 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000189}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000190class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
191 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000192 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000193 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000194 let Inst{24-21} = opcod;
195 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000196}
Evan Chengc5409a82008-09-01 07:19:00 +0000197class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
198 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000199 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000200 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000201 let Inst{24-21} = opcod;
202 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000203}
Evan Chengbe998242008-11-06 08:47:38 +0000204class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000205 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000206 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000207 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000208
Evan Cheng2e62b662008-09-01 01:51:14 +0000209
210// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000211class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000212 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000213 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000214 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000215 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000216}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000217
218// loads
Evan Chengbe998242008-11-06 08:47:38 +0000219class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000220 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000221 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000222 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000223 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000224 let Inst{21} = 0; // W bit
225 let Inst{22} = 0; // B bit
226 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000227 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000228}
Evan Chengbe998242008-11-06 08:47:38 +0000229class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000230 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000231 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000232 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000233 let Inst{20} = 1; // L bit
234 let Inst{21} = 0; // W bit
235 let Inst{22} = 0; // B bit
236 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000237 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000238}
Evan Chengbe998242008-11-06 08:47:38 +0000239class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000240 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000241 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000242 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000243 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000244 let Inst{21} = 0; // W bit
245 let Inst{22} = 1; // B bit
246 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000247 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000248}
Evan Chengbe998242008-11-06 08:47:38 +0000249class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000250 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000251 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000252 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000253 let Inst{20} = 1; // L bit
254 let Inst{21} = 0; // W bit
255 let Inst{22} = 1; // B bit
256 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000257 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000258}
Evan Chengda020022008-08-31 19:02:21 +0000259
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000260// stores
Evan Chengbe998242008-11-06 08:47:38 +0000261class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000262 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000263 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000264 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000265 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000266 let Inst{21} = 0; // W bit
267 let Inst{22} = 0; // B bit
268 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000269 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000270}
Evan Chengbe998242008-11-06 08:47:38 +0000271class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000272 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000273 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000274 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000275 let Inst{20} = 0; // L bit
276 let Inst{21} = 0; // W bit
277 let Inst{22} = 0; // B bit
278 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000279 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000280}
Evan Chengbe998242008-11-06 08:47:38 +0000281class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000282 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000283 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000284 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000285 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000286 let Inst{21} = 0; // W bit
287 let Inst{22} = 1; // B bit
288 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000289 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000290}
Evan Chengbe998242008-11-06 08:47:38 +0000291class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000292 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000293 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000294 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000295 let Inst{20} = 0; // L bit
296 let Inst{21} = 0; // W bit
297 let Inst{22} = 1; // B bit
298 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000299 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000300}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000301
Evan Chengac92c3f2008-09-01 07:00:14 +0000302// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000303class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000304 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000305 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000306 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000307 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000308 let Inst{21} = 1; // W bit
309 let Inst{22} = 0; // B bit
310 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000311 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000312}
Evan Chengbe998242008-11-06 08:47:38 +0000313class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000314 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000315 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000316 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000317 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000318 let Inst{21} = 1; // W bit
319 let Inst{22} = 1; // B bit
320 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000321 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000322}
323
Evan Chengac92c3f2008-09-01 07:00:14 +0000324// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000325class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000326 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000327 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000328 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000329 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000330 let Inst{21} = 1; // W bit
331 let Inst{22} = 0; // B bit
332 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000333 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000334}
Evan Chengbe998242008-11-06 08:47:38 +0000335class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000336 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000337 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000338 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000339 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000340 let Inst{21} = 1; // W bit
341 let Inst{22} = 1; // B bit
342 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000343 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000344}
345
Evan Chengac92c3f2008-09-01 07:00:14 +0000346// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000347class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000348 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000349 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000350 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000351 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000352 let Inst{21} = 0; // W bit
353 let Inst{22} = 0; // B bit
354 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000355 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000356}
Evan Chengbe998242008-11-06 08:47:38 +0000357class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000358 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000359 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000360 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000361 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000362 let Inst{21} = 0; // W bit
363 let Inst{22} = 1; // B bit
364 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000365 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000366}
367
Evan Chengac92c3f2008-09-01 07:00:14 +0000368// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000369class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000370 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000371 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000372 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000373 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000374 let Inst{21} = 0; // W bit
375 let Inst{22} = 0; // B bit
376 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000377 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000378}
Evan Chengbe998242008-11-06 08:47:38 +0000379class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000380 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000381 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000382 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000383 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000384 let Inst{21} = 0; // W bit
385 let Inst{22} = 1; // B bit
386 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000387 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000388}
389
Evan Cheng2e62b662008-09-01 01:51:14 +0000390// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000391class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000392 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000393 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000394 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000395class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000396 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000397 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000398 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000399
Evan Chengac92c3f2008-09-01 07:00:14 +0000400// loads
Evan Chengbe998242008-11-06 08:47:38 +0000401class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000402 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000403 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000404 asm, "", pattern> {
405 let Inst{4} = 1;
406 let Inst{5} = 1; // H bit
407 let Inst{6} = 0; // S bit
408 let Inst{7} = 1;
409 let Inst{20} = 1; // L bit
410 let Inst{21} = 0; // W bit
411 let Inst{24} = 1; // P bit
412}
Evan Chengbe998242008-11-06 08:47:38 +0000413class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000414 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000415 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000416 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000417 let Inst{4} = 1;
418 let Inst{5} = 1; // H bit
419 let Inst{6} = 0; // S bit
420 let Inst{7} = 1;
421 let Inst{20} = 1; // L bit
422 let Inst{21} = 0; // W bit
423 let Inst{24} = 1; // P bit
424}
Evan Chengbe998242008-11-06 08:47:38 +0000425class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000426 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000427 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000428 asm, "", pattern> {
429 let Inst{4} = 1;
430 let Inst{5} = 1; // H bit
431 let Inst{6} = 1; // S bit
432 let Inst{7} = 1;
433 let Inst{20} = 1; // L bit
434 let Inst{21} = 0; // W bit
435 let Inst{24} = 1; // P bit
436}
Evan Chengbe998242008-11-06 08:47:38 +0000437class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000438 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000439 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000440 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000441 let Inst{4} = 1;
442 let Inst{5} = 1; // H bit
443 let Inst{6} = 1; // S bit
444 let Inst{7} = 1;
445 let Inst{20} = 1; // L bit
446 let Inst{21} = 0; // W bit
447 let Inst{24} = 1; // P bit
448}
Evan Chengbe998242008-11-06 08:47:38 +0000449class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000450 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000451 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000452 asm, "", pattern> {
453 let Inst{4} = 1;
454 let Inst{5} = 0; // H bit
455 let Inst{6} = 1; // S bit
456 let Inst{7} = 1;
457 let Inst{20} = 1; // L bit
458 let Inst{21} = 0; // W bit
459 let Inst{24} = 1; // P bit
460}
Evan Chengbe998242008-11-06 08:47:38 +0000461class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000462 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000463 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000464 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000465 let Inst{4} = 1;
466 let Inst{5} = 0; // H bit
467 let Inst{6} = 1; // S bit
468 let Inst{7} = 1;
469 let Inst{20} = 1; // L bit
470 let Inst{21} = 0; // W bit
471 let Inst{24} = 1; // P bit
472}
Evan Chengbe998242008-11-06 08:47:38 +0000473class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000474 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000475 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000476 asm, "", pattern> {
477 let Inst{4} = 1;
478 let Inst{5} = 0; // H bit
479 let Inst{6} = 1; // S bit
480 let Inst{7} = 1;
481 let Inst{20} = 0; // L bit
482 let Inst{21} = 0; // W bit
483 let Inst{24} = 1; // P bit
484}
485
486// stores
Evan Chengbe998242008-11-06 08:47:38 +0000487class AI3sth<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} = 1; // H bit
493 let Inst{6} = 0; // 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}
Evan Chengbe998242008-11-06 08:47:38 +0000499class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000500 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000501 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000502 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000503 let Inst{4} = 1;
504 let Inst{5} = 1; // H bit
505 let Inst{6} = 0; // S bit
506 let Inst{7} = 1;
507 let Inst{20} = 0; // L bit
508 let Inst{21} = 0; // W bit
509 let Inst{24} = 1; // P bit
510}
Evan Chengbe998242008-11-06 08:47:38 +0000511class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000512 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000513 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000514 asm, "", pattern> {
515 let Inst{4} = 1;
516 let Inst{5} = 1; // H bit
517 let Inst{6} = 1; // S bit
518 let Inst{7} = 1;
519 let Inst{20} = 0; // L bit
520 let Inst{21} = 0; // W bit
521 let Inst{24} = 1; // P bit
522}
523
524// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000525class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000526 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000527 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000528 asm, cstr, pattern> {
529 let Inst{4} = 1;
530 let Inst{5} = 1; // H bit
531 let Inst{6} = 0; // S bit
532 let Inst{7} = 1;
533 let Inst{20} = 1; // L bit
534 let Inst{21} = 1; // W bit
535 let Inst{24} = 1; // P bit
536}
Evan Chengbe998242008-11-06 08:47:38 +0000537class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000538 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000539 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000540 asm, cstr, pattern> {
541 let Inst{4} = 1;
542 let Inst{5} = 1; // H bit
543 let Inst{6} = 1; // S bit
544 let Inst{7} = 1;
545 let Inst{20} = 1; // L bit
546 let Inst{21} = 1; // W bit
547 let Inst{24} = 1; // P bit
548}
Evan Chengbe998242008-11-06 08:47:38 +0000549class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000550 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000551 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000552 asm, cstr, pattern> {
553 let Inst{4} = 1;
554 let Inst{5} = 0; // H bit
555 let Inst{6} = 1; // S bit
556 let Inst{7} = 1;
557 let Inst{20} = 1; // L bit
558 let Inst{21} = 1; // W bit
559 let Inst{24} = 1; // P bit
560}
561
562// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000563class AI3sthpr<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} = 1; // H bit
569 let Inst{6} = 0; // S bit
570 let Inst{7} = 1;
571 let Inst{20} = 0; // L bit
572 let Inst{21} = 1; // W bit
573 let Inst{24} = 1; // P bit
574}
575
576// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000577class AI3ldhpo<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, IndexModePost, 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} = 1; // L bit
586 let Inst{21} = 1; // W bit
587 let Inst{24} = 0; // P bit
588}
Evan Chengbe998242008-11-06 08:47:38 +0000589class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000590 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000591 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000592 asm, cstr,pattern> {
593 let Inst{4} = 1;
594 let Inst{5} = 1; // H bit
595 let Inst{6} = 1; // S bit
596 let Inst{7} = 1;
597 let Inst{20} = 1; // L bit
598 let Inst{21} = 1; // W bit
599 let Inst{24} = 0; // P bit
600}
Evan Chengbe998242008-11-06 08:47:38 +0000601class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000602 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000603 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000604 asm, cstr,pattern> {
605 let Inst{4} = 1;
606 let Inst{5} = 0; // H bit
607 let Inst{6} = 1; // S bit
608 let Inst{7} = 1;
609 let Inst{20} = 1; // L bit
610 let Inst{21} = 1; // W bit
611 let Inst{24} = 0; // P bit
612}
613
614// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000615class AI3sthpo<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} = 1; // H bit
621 let Inst{6} = 0; // S bit
622 let Inst{7} = 1;
623 let Inst{20} = 0; // L bit
624 let Inst{21} = 1; // W bit
625 let Inst{24} = 0; // P bit
626}
627
628
Evan Cheng2e62b662008-09-01 01:51:14 +0000629// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000630class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000631 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000632 "", pattern> {
633 let Inst{20} = 1; // L bit
634 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000635 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000636}
Evan Chengf8e8b622008-11-06 17:48:05 +0000637class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000638 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000639 "", pattern> {
640 let Inst{20} = 0; // L bit
641 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000642 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000643}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000644
Jim Grosbach1feed042008-11-03 18:38:31 +0000645// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000646class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000647 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000648 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000649 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000650 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000651 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000652 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000653}
Evan Chengbe998242008-11-06 08:47:38 +0000654class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000655 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000656 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000657 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000658 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000659 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000660}
661
662// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000663class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000664 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000665 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000666 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000667 let Inst{7-4} = 0b1001;
668 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000669 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000670}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000671
Evan Cheng38396be2008-11-06 03:35:07 +0000672// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000673class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000674 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000675 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000676 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000677 let Inst{4} = 0;
678 let Inst{7} = 1;
679 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000680 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000681}
682
Evan Cheng37afa432008-11-06 22:15:19 +0000683// Extend instructions.
684class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
685 string asm, list<dag> pattern>
686 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
687 asm, "", pattern> {
688 let Inst{7-4} = 0b0111;
689 let Inst{27-20} = opcod;
690}
691
Evan Cheng7b0249b2008-08-28 23:39:26 +0000692//===----------------------------------------------------------------------===//
693
694// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
695class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
696 list<Predicate> Predicates = [IsARM];
697}
698class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
699 list<Predicate> Predicates = [IsARM, HasV5TE];
700}
701class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
702 list<Predicate> Predicates = [IsARM, HasV6];
703}
Evan Cheng34a46e12008-08-29 06:41:12 +0000704
705//===----------------------------------------------------------------------===//
706//
707// Thumb Instruction Format Definitions.
708//
709
710
711// TI - Thumb instruction.
712
713class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
714 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000715 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000716 let OutOperandList = outs;
717 let InOperandList = ins;
718 let AsmString = asm;
719 let Pattern = pattern;
720 list<Predicate> Predicates = [IsThumb];
721}
722
723class TI<dag outs, dag ins, string asm, list<dag> pattern>
724 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
725class TI1<dag outs, dag ins, string asm, list<dag> pattern>
726 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
727class TI2<dag outs, dag ins, string asm, list<dag> pattern>
728 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
729class TI4<dag outs, dag ins, string asm, list<dag> pattern>
730 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
731class TIs<dag outs, dag ins, string asm, list<dag> pattern>
732 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
733
734// Two-address instructions
735class TIt<dag outs, dag ins, string asm, list<dag> pattern>
736 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
737
738// BL, BLX(1) are translated by assembler into two instructions
739class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
740 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
741
742// BR_JT instructions
743class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
744 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
745
746
747//===----------------------------------------------------------------------===//
748
749
750// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
751class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
752 list<Predicate> Predicates = [IsThumb];
753}
754
755class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
756 list<Predicate> Predicates = [IsThumb, HasV5T];
757}