blob: 9fe56d79d26b0643bf290a150fda5c659a6b5ecc [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
Evan Cheng0f63ae12008-11-07 09:06:08 +0000154class JTI<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000155 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000156 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000157
158// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000159class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
160 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000161 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000162 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000163 let Inst{24-21} = opcod;
164 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000165}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000166class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
167 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000168 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000169 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000170 let Inst{24-21} = opcod;
171 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000172}
Evan Chengc5409a82008-09-01 07:19:00 +0000173class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
174 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000175 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000176 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000177 let Inst{24-21} = opcod;
178 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000179}
Evan Chengbe998242008-11-06 08:47:38 +0000180class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000181 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000182 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000183 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000184
Evan Cheng2e62b662008-09-01 01:51:14 +0000185
186// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000187class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000188 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000189 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000190 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000191 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000192}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000193
194// loads
Evan Chengbe998242008-11-06 08:47:38 +0000195class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000196 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000197 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000198 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000199 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000200 let Inst{21} = 0; // W bit
201 let Inst{22} = 0; // B bit
202 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000203 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000204}
Evan Chengbe998242008-11-06 08:47:38 +0000205class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000206 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000207 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000208 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000209 let Inst{20} = 1; // L bit
210 let Inst{21} = 0; // W bit
211 let Inst{22} = 0; // B bit
212 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000213 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000214}
Evan Chengbe998242008-11-06 08:47:38 +0000215class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000216 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000217 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000218 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000219 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000220 let Inst{21} = 0; // W bit
221 let Inst{22} = 1; // B bit
222 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000223 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000224}
Evan Chengbe998242008-11-06 08:47:38 +0000225class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000226 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000227 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000228 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000229 let Inst{20} = 1; // L bit
230 let Inst{21} = 0; // W bit
231 let Inst{22} = 1; // B bit
232 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000233 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000234}
Evan Chengda020022008-08-31 19:02:21 +0000235
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000236// stores
Evan Chengbe998242008-11-06 08:47:38 +0000237class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000238 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000239 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000240 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000241 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000242 let Inst{21} = 0; // W bit
243 let Inst{22} = 0; // B bit
244 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000245 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000246}
Evan Chengbe998242008-11-06 08:47:38 +0000247class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000248 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000249 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000250 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000251 let Inst{20} = 0; // L bit
252 let Inst{21} = 0; // W bit
253 let Inst{22} = 0; // B bit
254 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000255 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000256}
Evan Chengbe998242008-11-06 08:47:38 +0000257class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000258 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000259 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000260 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000261 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000262 let Inst{21} = 0; // W bit
263 let Inst{22} = 1; // B bit
264 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000265 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000266}
Evan Chengbe998242008-11-06 08:47:38 +0000267class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000268 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000269 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000270 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000271 let Inst{20} = 0; // L bit
272 let Inst{21} = 0; // W bit
273 let Inst{22} = 1; // B bit
274 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000275 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000276}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000277
Evan Chengac92c3f2008-09-01 07:00:14 +0000278// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000279class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000280 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000281 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000282 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000283 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000284 let Inst{21} = 1; // W bit
285 let Inst{22} = 0; // B bit
286 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000287 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000288}
Evan Chengbe998242008-11-06 08:47:38 +0000289class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000290 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000291 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000292 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000293 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000294 let Inst{21} = 1; // W bit
295 let Inst{22} = 1; // B bit
296 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000297 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000298}
299
Evan Chengac92c3f2008-09-01 07:00:14 +0000300// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000301class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000302 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000303 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000304 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000305 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000306 let Inst{21} = 1; // W bit
307 let Inst{22} = 0; // B bit
308 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000309 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000310}
Evan Chengbe998242008-11-06 08:47:38 +0000311class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000312 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000313 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000314 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000315 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000316 let Inst{21} = 1; // W bit
317 let Inst{22} = 1; // B bit
318 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000319 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000320}
321
Evan Chengac92c3f2008-09-01 07:00:14 +0000322// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000323class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000324 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000325 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000326 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000327 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000328 let Inst{21} = 0; // W bit
329 let Inst{22} = 0; // B bit
330 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000331 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000332}
Evan Chengbe998242008-11-06 08:47:38 +0000333class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000334 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000335 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000336 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000337 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000338 let Inst{21} = 0; // W bit
339 let Inst{22} = 1; // B bit
340 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000341 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000342}
343
Evan Chengac92c3f2008-09-01 07:00:14 +0000344// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000345class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000346 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000347 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000348 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000349 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000350 let Inst{21} = 0; // W bit
351 let Inst{22} = 0; // B bit
352 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000353 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000354}
Evan Chengbe998242008-11-06 08:47:38 +0000355class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000356 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000357 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000358 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000359 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000360 let Inst{21} = 0; // W bit
361 let Inst{22} = 1; // B bit
362 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000363 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000364}
365
Evan Cheng2e62b662008-09-01 01:51:14 +0000366// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000367class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000368 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000369 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000370 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000371class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000372 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000373 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000374 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000375
Evan Chengac92c3f2008-09-01 07:00:14 +0000376// loads
Evan Chengbe998242008-11-06 08:47:38 +0000377class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000378 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000379 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000380 asm, "", pattern> {
381 let Inst{4} = 1;
382 let Inst{5} = 1; // H bit
383 let Inst{6} = 0; // S bit
384 let Inst{7} = 1;
385 let Inst{20} = 1; // L bit
386 let Inst{21} = 0; // W bit
387 let Inst{24} = 1; // P bit
388}
Evan Chengbe998242008-11-06 08:47:38 +0000389class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000390 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000391 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000392 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000393 let Inst{4} = 1;
394 let Inst{5} = 1; // H bit
395 let Inst{6} = 0; // S bit
396 let Inst{7} = 1;
397 let Inst{20} = 1; // L bit
398 let Inst{21} = 0; // W bit
399 let Inst{24} = 1; // P bit
400}
Evan Chengbe998242008-11-06 08:47:38 +0000401class AI3ldsh<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} = 1; // 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 AXI3ldsh<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} = 1; // 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 AI3ldsb<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} = 0; // 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 AXI3ldsb<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} = 0; // 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 AI3ldd<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} = 0; // L bit
458 let Inst{21} = 0; // W bit
459 let Inst{24} = 1; // P bit
460}
461
462// stores
Evan Chengbe998242008-11-06 08:47:38 +0000463class AI3sth<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} = 1; // H bit
469 let Inst{6} = 0; // S bit
470 let Inst{7} = 1;
471 let Inst{20} = 0; // 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 AXI3sth<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} = 1; // H bit
481 let Inst{6} = 0; // S bit
482 let Inst{7} = 1;
483 let Inst{20} = 0; // 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 AI3std<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} = 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// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000501class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000502 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000503 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000504 asm, cstr, 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} = 1; // L bit
510 let Inst{21} = 1; // W bit
511 let Inst{24} = 1; // P bit
512}
Evan Chengbe998242008-11-06 08:47:38 +0000513class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000514 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000515 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000516 asm, cstr, pattern> {
517 let Inst{4} = 1;
518 let Inst{5} = 1; // H bit
519 let Inst{6} = 1; // S bit
520 let Inst{7} = 1;
521 let Inst{20} = 1; // L bit
522 let Inst{21} = 1; // W bit
523 let Inst{24} = 1; // P bit
524}
Evan Chengbe998242008-11-06 08:47:38 +0000525class AI3ldsbpr<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} = 0; // H bit
531 let Inst{6} = 1; // 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}
537
538// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000539class AI3sthpr<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} = 0; // L bit
548 let Inst{21} = 1; // W bit
549 let Inst{24} = 1; // P bit
550}
551
552// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000553class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000554 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000555 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000556 asm, cstr,pattern> {
557 let Inst{4} = 1;
558 let Inst{5} = 1; // H bit
559 let Inst{6} = 0; // S bit
560 let Inst{7} = 1;
561 let Inst{20} = 1; // L bit
562 let Inst{21} = 1; // W bit
563 let Inst{24} = 0; // P bit
564}
Evan Chengbe998242008-11-06 08:47:38 +0000565class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000566 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000567 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000568 asm, cstr,pattern> {
569 let Inst{4} = 1;
570 let Inst{5} = 1; // H bit
571 let Inst{6} = 1; // S bit
572 let Inst{7} = 1;
573 let Inst{20} = 1; // L bit
574 let Inst{21} = 1; // W bit
575 let Inst{24} = 0; // P bit
576}
Evan Chengbe998242008-11-06 08:47:38 +0000577class AI3ldsbpo<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} = 0; // H bit
583 let Inst{6} = 1; // 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}
589
590// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000591class AI3sthpo<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} = 0; // L bit
600 let Inst{21} = 1; // W bit
601 let Inst{24} = 0; // P bit
602}
603
604
Evan Cheng2e62b662008-09-01 01:51:14 +0000605// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000606class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000607 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000608 "", pattern> {
609 let Inst{20} = 1; // L bit
610 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000611 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000612}
Evan Chengf8e8b622008-11-06 17:48:05 +0000613class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000614 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000615 "", pattern> {
616 let Inst{20} = 0; // L bit
617 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000618 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000619}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000620
Jim Grosbach1feed042008-11-03 18:38:31 +0000621// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000622class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000623 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000624 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000625 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000626 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000627 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000628 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000629}
Evan Chengbe998242008-11-06 08:47:38 +0000630class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000631 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000632 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000633 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000634 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000635 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000636}
637
638// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000639class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000640 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000641 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000642 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000643 let Inst{7-4} = 0b1001;
644 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000645 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000646}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000647
Evan Cheng38396be2008-11-06 03:35:07 +0000648// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000649class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000650 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000651 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000652 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000653 let Inst{4} = 0;
654 let Inst{7} = 1;
655 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000656 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000657}
658
Evan Cheng37afa432008-11-06 22:15:19 +0000659// Extend instructions.
660class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
661 string asm, list<dag> pattern>
662 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
663 asm, "", pattern> {
664 let Inst{7-4} = 0b0111;
665 let Inst{27-20} = opcod;
666}
667
Evan Chengc2121a22008-11-07 01:41:35 +0000668// Misc Arithmetic instructions.
669class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
670 string asm, list<dag> pattern>
671 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
672 asm, "", pattern> {
673 let Inst{27-20} = opcod;
674}
675
Evan Cheng7b0249b2008-08-28 23:39:26 +0000676//===----------------------------------------------------------------------===//
677
678// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
679class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
680 list<Predicate> Predicates = [IsARM];
681}
682class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
683 list<Predicate> Predicates = [IsARM, HasV5TE];
684}
685class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
686 list<Predicate> Predicates = [IsARM, HasV6];
687}
Evan Cheng34a46e12008-08-29 06:41:12 +0000688
689//===----------------------------------------------------------------------===//
690//
691// Thumb Instruction Format Definitions.
692//
693
694
695// TI - Thumb instruction.
696
697class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
698 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000699 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000700 let OutOperandList = outs;
701 let InOperandList = ins;
702 let AsmString = asm;
703 let Pattern = pattern;
704 list<Predicate> Predicates = [IsThumb];
705}
706
707class TI<dag outs, dag ins, string asm, list<dag> pattern>
708 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
709class TI1<dag outs, dag ins, string asm, list<dag> pattern>
710 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
711class TI2<dag outs, dag ins, string asm, list<dag> pattern>
712 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
713class TI4<dag outs, dag ins, string asm, list<dag> pattern>
714 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
715class TIs<dag outs, dag ins, string asm, list<dag> pattern>
716 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
717
718// Two-address instructions
719class TIt<dag outs, dag ins, string asm, list<dag> pattern>
720 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
721
722// BL, BLX(1) are translated by assembler into two instructions
723class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
724 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
725
726// BR_JT instructions
727class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
728 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
729
730
731//===----------------------------------------------------------------------===//
732
733
734// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
735class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
736 list<Predicate> Predicates = [IsThumb];
737}
738
739class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
740 list<Predicate> Predicates = [IsThumb, HasV5T];
741}