blob: de640c40c4627ccf395181e89f68d33f5de5cc07 [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 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
Evan Chengf8e8b622008-11-06 17:48:05 +0000137class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000138 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000139 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, 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}
Evan Chengf8e8b622008-11-06 17:48:05 +0000143class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
144 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000145 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000146 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000147}
Evan Chengf8e8b622008-11-06 17:48:05 +0000148class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
149 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000150 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000151
152// BR_JT instructions
153// == mov pc
154class JTI<bits<4> opcod, 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 Cheng10a9eb82008-09-01 08:25:56 +0000156 asm, "", pattern> {
157 let Inst{20} = 0; // S Bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000158 let Inst{24-21} = opcod;
159 let Inst{27-26} = {0,0};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000160}
Evan Cheng18e5d102008-09-17 07:16:21 +0000161// == add pc
Evan Cheng10a9eb82008-09-01 08:25:56 +0000162class JTI1<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000163 : XI<oops, iops, AddrMode1, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000164 asm, "", pattern> {
Evan Cheng18e5d102008-09-17 07:16:21 +0000165 let Inst{20} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000166 let Inst{24-21} = opcod;
167 let Inst{27-26} = {0,0};
Evan Cheng18e5d102008-09-17 07:16:21 +0000168}
169// == ldr pc
170class JTI2<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000171 : XI<oops, iops, AddrMode2, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng18e5d102008-09-17 07:16:21 +0000172 asm, "", pattern> {
Evan Cheng10a9eb82008-09-01 08:25:56 +0000173 let Inst{20} = 1; // L bit
174 let Inst{21} = 0; // W bit
175 let Inst{22} = 0; // B bit
176 let Inst{24} = 1; // P bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000177 let Inst{27-26} = {0,1};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000178}
179
Evan Cheng2e62b662008-09-01 01:51:14 +0000180
181// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000182class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
183 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000184 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000185 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000186 let Inst{24-21} = opcod;
187 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000188}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000189class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
190 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000191 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000192 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000193 let Inst{24-21} = opcod;
194 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000195}
Evan Chengc5409a82008-09-01 07:19:00 +0000196class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
197 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000198 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000199 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000200 let Inst{24-21} = opcod;
201 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000202}
Evan Chengbe998242008-11-06 08:47:38 +0000203class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000204 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000205 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000206 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000207
Evan Cheng2e62b662008-09-01 01:51:14 +0000208
209// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000210class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000211 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000212 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000213 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000214 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000215}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000216
217// loads
Evan Chengbe998242008-11-06 08:47:38 +0000218class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000219 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000220 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000221 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000222 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000223 let Inst{21} = 0; // W bit
224 let Inst{22} = 0; // B bit
225 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000226 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000227}
Evan Chengbe998242008-11-06 08:47:38 +0000228class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000229 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000230 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000231 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000232 let Inst{20} = 1; // L bit
233 let Inst{21} = 0; // W bit
234 let Inst{22} = 0; // B bit
235 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000236 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000237}
Evan Chengbe998242008-11-06 08:47:38 +0000238class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000239 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000240 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000241 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000242 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000243 let Inst{21} = 0; // W bit
244 let Inst{22} = 1; // B bit
245 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000246 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000247}
Evan Chengbe998242008-11-06 08:47:38 +0000248class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000249 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000250 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000251 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000252 let Inst{20} = 1; // L bit
253 let Inst{21} = 0; // W bit
254 let Inst{22} = 1; // B bit
255 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000256 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000257}
Evan Chengda020022008-08-31 19:02:21 +0000258
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000259// stores
Evan Chengbe998242008-11-06 08:47:38 +0000260class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000261 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000262 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000263 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000264 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000265 let Inst{21} = 0; // W bit
266 let Inst{22} = 0; // B bit
267 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000268 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000269}
Evan Chengbe998242008-11-06 08:47:38 +0000270class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000271 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000272 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000273 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000274 let Inst{20} = 0; // L bit
275 let Inst{21} = 0; // W bit
276 let Inst{22} = 0; // B bit
277 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000278 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000279}
Evan Chengbe998242008-11-06 08:47:38 +0000280class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000281 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000282 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000283 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000284 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000285 let Inst{21} = 0; // W bit
286 let Inst{22} = 1; // B bit
287 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000288 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000289}
Evan Chengbe998242008-11-06 08:47:38 +0000290class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000291 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000292 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000293 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000294 let Inst{20} = 0; // L bit
295 let Inst{21} = 0; // W bit
296 let Inst{22} = 1; // B bit
297 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000298 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000299}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000300
Evan Chengac92c3f2008-09-01 07:00:14 +0000301// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000302class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000303 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000304 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000305 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000306 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000307 let Inst{21} = 1; // W bit
308 let Inst{22} = 0; // B bit
309 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000310 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000311}
Evan Chengbe998242008-11-06 08:47:38 +0000312class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000313 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000314 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000315 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000316 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000317 let Inst{21} = 1; // W bit
318 let Inst{22} = 1; // B bit
319 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000320 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000321}
322
Evan Chengac92c3f2008-09-01 07:00:14 +0000323// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000324class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000325 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000326 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000327 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000328 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000329 let Inst{21} = 1; // W bit
330 let Inst{22} = 0; // B bit
331 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000332 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000333}
Evan Chengbe998242008-11-06 08:47:38 +0000334class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000335 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000336 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000337 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000338 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000339 let Inst{21} = 1; // W bit
340 let Inst{22} = 1; // B bit
341 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000342 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000343}
344
Evan Chengac92c3f2008-09-01 07:00:14 +0000345// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000346class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000347 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000348 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000349 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000350 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000351 let Inst{21} = 0; // W bit
352 let Inst{22} = 0; // B bit
353 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000354 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000355}
Evan Chengbe998242008-11-06 08:47:38 +0000356class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000357 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000358 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000359 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000360 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000361 let Inst{21} = 0; // W bit
362 let Inst{22} = 1; // B bit
363 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000364 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000365}
366
Evan Chengac92c3f2008-09-01 07:00:14 +0000367// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000368class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000369 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000370 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000371 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000372 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000373 let Inst{21} = 0; // W bit
374 let Inst{22} = 0; // B bit
375 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000376 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000377}
Evan Chengbe998242008-11-06 08:47:38 +0000378class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000379 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000380 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000381 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000382 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000383 let Inst{21} = 0; // W bit
384 let Inst{22} = 1; // B bit
385 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000386 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000387}
388
Evan Cheng2e62b662008-09-01 01:51:14 +0000389// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000390class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000391 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000392 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000393 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000394class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000395 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000396 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000397 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000398
Evan Chengac92c3f2008-09-01 07:00:14 +0000399// loads
Evan Chengbe998242008-11-06 08:47:38 +0000400class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000401 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000402 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000403 asm, "", pattern> {
404 let Inst{4} = 1;
405 let Inst{5} = 1; // H bit
406 let Inst{6} = 0; // S bit
407 let Inst{7} = 1;
408 let Inst{20} = 1; // L bit
409 let Inst{21} = 0; // W bit
410 let Inst{24} = 1; // P bit
411}
Evan Chengbe998242008-11-06 08:47:38 +0000412class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000413 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000414 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000415 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000416 let Inst{4} = 1;
417 let Inst{5} = 1; // H bit
418 let Inst{6} = 0; // S bit
419 let Inst{7} = 1;
420 let Inst{20} = 1; // L bit
421 let Inst{21} = 0; // W bit
422 let Inst{24} = 1; // P bit
423}
Evan Chengbe998242008-11-06 08:47:38 +0000424class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000425 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000426 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000427 asm, "", pattern> {
428 let Inst{4} = 1;
429 let Inst{5} = 1; // H bit
430 let Inst{6} = 1; // S bit
431 let Inst{7} = 1;
432 let Inst{20} = 1; // L bit
433 let Inst{21} = 0; // W bit
434 let Inst{24} = 1; // P bit
435}
Evan Chengbe998242008-11-06 08:47:38 +0000436class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000437 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000438 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000439 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000440 let Inst{4} = 1;
441 let Inst{5} = 1; // H bit
442 let Inst{6} = 1; // S bit
443 let Inst{7} = 1;
444 let Inst{20} = 1; // L bit
445 let Inst{21} = 0; // W bit
446 let Inst{24} = 1; // P bit
447}
Evan Chengbe998242008-11-06 08:47:38 +0000448class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000449 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000450 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000451 asm, "", pattern> {
452 let Inst{4} = 1;
453 let Inst{5} = 0; // H bit
454 let Inst{6} = 1; // S bit
455 let Inst{7} = 1;
456 let Inst{20} = 1; // L bit
457 let Inst{21} = 0; // W bit
458 let Inst{24} = 1; // P bit
459}
Evan Chengbe998242008-11-06 08:47:38 +0000460class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000461 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000462 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000463 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000464 let Inst{4} = 1;
465 let Inst{5} = 0; // H bit
466 let Inst{6} = 1; // S bit
467 let Inst{7} = 1;
468 let Inst{20} = 1; // L bit
469 let Inst{21} = 0; // W bit
470 let Inst{24} = 1; // P bit
471}
Evan Chengbe998242008-11-06 08:47:38 +0000472class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000473 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000474 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000475 asm, "", pattern> {
476 let Inst{4} = 1;
477 let Inst{5} = 0; // H bit
478 let Inst{6} = 1; // S bit
479 let Inst{7} = 1;
480 let Inst{20} = 0; // L bit
481 let Inst{21} = 0; // W bit
482 let Inst{24} = 1; // P bit
483}
484
485// stores
Evan Chengbe998242008-11-06 08:47:38 +0000486class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000487 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000488 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000489 asm, "", pattern> {
490 let Inst{4} = 1;
491 let Inst{5} = 1; // H bit
492 let Inst{6} = 0; // S bit
493 let Inst{7} = 1;
494 let Inst{20} = 0; // L bit
495 let Inst{21} = 0; // W bit
496 let Inst{24} = 1; // P bit
497}
Evan Chengbe998242008-11-06 08:47:38 +0000498class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000499 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000500 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000501 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000502 let Inst{4} = 1;
503 let Inst{5} = 1; // H bit
504 let Inst{6} = 0; // S bit
505 let Inst{7} = 1;
506 let Inst{20} = 0; // L bit
507 let Inst{21} = 0; // W bit
508 let Inst{24} = 1; // P bit
509}
Evan Chengbe998242008-11-06 08:47:38 +0000510class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000511 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000512 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000513 asm, "", pattern> {
514 let Inst{4} = 1;
515 let Inst{5} = 1; // H bit
516 let Inst{6} = 1; // S bit
517 let Inst{7} = 1;
518 let Inst{20} = 0; // L bit
519 let Inst{21} = 0; // W bit
520 let Inst{24} = 1; // P bit
521}
522
523// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000524class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000525 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000526 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000527 asm, cstr, pattern> {
528 let Inst{4} = 1;
529 let Inst{5} = 1; // H bit
530 let Inst{6} = 0; // S bit
531 let Inst{7} = 1;
532 let Inst{20} = 1; // L bit
533 let Inst{21} = 1; // W bit
534 let Inst{24} = 1; // P bit
535}
Evan Chengbe998242008-11-06 08:47:38 +0000536class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000537 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000538 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000539 asm, cstr, pattern> {
540 let Inst{4} = 1;
541 let Inst{5} = 1; // H bit
542 let Inst{6} = 1; // S bit
543 let Inst{7} = 1;
544 let Inst{20} = 1; // L bit
545 let Inst{21} = 1; // W bit
546 let Inst{24} = 1; // P bit
547}
Evan Chengbe998242008-11-06 08:47:38 +0000548class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000549 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000550 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000551 asm, cstr, pattern> {
552 let Inst{4} = 1;
553 let Inst{5} = 0; // H bit
554 let Inst{6} = 1; // S bit
555 let Inst{7} = 1;
556 let Inst{20} = 1; // L bit
557 let Inst{21} = 1; // W bit
558 let Inst{24} = 1; // P bit
559}
560
561// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000562class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000563 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000564 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000565 asm, cstr, pattern> {
566 let Inst{4} = 1;
567 let Inst{5} = 1; // H bit
568 let Inst{6} = 0; // S bit
569 let Inst{7} = 1;
570 let Inst{20} = 0; // L bit
571 let Inst{21} = 1; // W bit
572 let Inst{24} = 1; // P bit
573}
574
575// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000576class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000577 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000578 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000579 asm, cstr,pattern> {
580 let Inst{4} = 1;
581 let Inst{5} = 1; // H bit
582 let Inst{6} = 0; // S bit
583 let Inst{7} = 1;
584 let Inst{20} = 1; // L bit
585 let Inst{21} = 1; // W bit
586 let Inst{24} = 0; // P bit
587}
Evan Chengbe998242008-11-06 08:47:38 +0000588class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000589 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000590 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000591 asm, cstr,pattern> {
592 let Inst{4} = 1;
593 let Inst{5} = 1; // H bit
594 let Inst{6} = 1; // S bit
595 let Inst{7} = 1;
596 let Inst{20} = 1; // L bit
597 let Inst{21} = 1; // W bit
598 let Inst{24} = 0; // P bit
599}
Evan Chengbe998242008-11-06 08:47:38 +0000600class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000601 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000602 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000603 asm, cstr,pattern> {
604 let Inst{4} = 1;
605 let Inst{5} = 0; // H bit
606 let Inst{6} = 1; // S bit
607 let Inst{7} = 1;
608 let Inst{20} = 1; // L bit
609 let Inst{21} = 1; // W bit
610 let Inst{24} = 0; // P bit
611}
612
613// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000614class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000615 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000616 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000617 asm, cstr,pattern> {
618 let Inst{4} = 1;
619 let Inst{5} = 1; // H bit
620 let Inst{6} = 0; // S bit
621 let Inst{7} = 1;
622 let Inst{20} = 0; // L bit
623 let Inst{21} = 1; // W bit
624 let Inst{24} = 0; // P bit
625}
626
627
Evan Cheng2e62b662008-09-01 01:51:14 +0000628// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000629class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000630 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000631 "", pattern> {
632 let Inst{20} = 1; // L bit
633 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000634 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000635}
Evan Chengf8e8b622008-11-06 17:48:05 +0000636class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000637 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000638 "", pattern> {
639 let Inst{20} = 0; // L bit
640 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000641 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000642}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000643
Jim Grosbach1feed042008-11-03 18:38:31 +0000644// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000645class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000646 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000647 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng86a926a2008-11-05 18:35:52 +0000648 asm,"",pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000649 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000650 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000651 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000652}
Evan Chengbe998242008-11-06 08:47:38 +0000653class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000654 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000655 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng86a926a2008-11-05 18:35:52 +0000656 asm,"",pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000657 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000658 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000659}
660
661// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000662class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000663 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000664 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000665 asm,"",pattern> {
666 let Inst{7-4} = 0b1001;
667 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000668 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000669}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000670
Evan Cheng38396be2008-11-06 03:35:07 +0000671// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000672class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000673 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000674 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000675 asm,"",pattern> {
676 let Inst{4} = 0;
677 let Inst{7} = 1;
678 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000679 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000680}
681
Evan Cheng7b0249b2008-08-28 23:39:26 +0000682//===----------------------------------------------------------------------===//
683
684// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
685class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
686 list<Predicate> Predicates = [IsARM];
687}
688class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
689 list<Predicate> Predicates = [IsARM, HasV5TE];
690}
691class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
692 list<Predicate> Predicates = [IsARM, HasV6];
693}
Evan Cheng34a46e12008-08-29 06:41:12 +0000694
695//===----------------------------------------------------------------------===//
696//
697// Thumb Instruction Format Definitions.
698//
699
700
701// TI - Thumb instruction.
702
703class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
704 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000705 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000706 let OutOperandList = outs;
707 let InOperandList = ins;
708 let AsmString = asm;
709 let Pattern = pattern;
710 list<Predicate> Predicates = [IsThumb];
711}
712
713class TI<dag outs, dag ins, string asm, list<dag> pattern>
714 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
715class TI1<dag outs, dag ins, string asm, list<dag> pattern>
716 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
717class TI2<dag outs, dag ins, string asm, list<dag> pattern>
718 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
719class TI4<dag outs, dag ins, string asm, list<dag> pattern>
720 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
721class TIs<dag outs, dag ins, string asm, list<dag> pattern>
722 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
723
724// Two-address instructions
725class TIt<dag outs, dag ins, string asm, list<dag> pattern>
726 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
727
728// BL, BLX(1) are translated by assembler into two instructions
729class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
730 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
731
732// BR_JT instructions
733class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
734 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
735
736
737//===----------------------------------------------------------------------===//
738
739
740// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
741class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
742 list<Predicate> Predicates = [IsThumb];
743}
744
745class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
746 list<Predicate> Predicates = [IsThumb, HasV5T];
747}