blob: b59af13cd9e8d02f023e3e2ef110dcdf343c41cd [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
Evan Chengbb786b32008-11-11 21:48:44 +000022def Pseudo : Format<1>;
23def MulFrm : Format<2>;
24def BrFrm : Format<3>;
25def BrMiscFrm : Format<4>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000026
Evan Chengbb786b32008-11-11 21:48:44 +000027def DPFrm : Format<5>;
28def DPSoRegFrm : Format<6>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000029
Evan Chengbb786b32008-11-11 21:48:44 +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 Chengbb786b32008-11-11 21:48:44 +000037def ArithMiscFrm : Format<13>;
38def ExtFrm : Format<14>;
39
40def VFPUnaryFrm : Format<15>;
41def VFPBinaryFrm : Format<16>;
42def VFPConv1Frm : Format<17>;
43def VFPConv2Frm : Format<18>;
44def VFPLdStFrm : Format<19>;
45def VFPLdStMulFrm : Format<20>;
46def VFPMiscFrm : Format<21>;
47
48def ThumbFrm : Format<22>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000049
Evan Cheng86a926a2008-11-05 18:35:52 +000050// Misc flag for data processing instructions that indicates whether
51// the instruction has a Rn register operand.
52class UnaryDP { bit isUnaryDataProc = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000053
Evan Cheng7b0249b2008-08-28 23:39:26 +000054//===----------------------------------------------------------------------===//
55
56// ARM Instruction templates.
57//
58
Evan Chengbe998242008-11-06 08:47:38 +000059class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +000060 Format f, string cstr>
61 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +000062 field bits<32> Inst;
63
Evan Cheng7b0249b2008-08-28 23:39:26 +000064 let Namespace = "ARM";
65
Evan Cheng86a926a2008-11-05 18:35:52 +000066 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +000067 AddrMode AM = am;
68 bits<4> AddrModeBits = AM.Value;
69
70 SizeFlagVal SZ = sz;
71 bits<3> SizeFlag = SZ.Value;
72
73 IndexMode IM = im;
74 bits<2> IndexModeBits = IM.Value;
75
76 Format F = f;
77 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +000078
79 //
80 // Attributes specific to ARM instructions...
81 //
82 bit isUnaryDataProc = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +000083
84 let Constraints = cstr;
85}
86
87class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000088 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000089 let OutOperandList = oops;
90 let InOperandList = iops;
91 let AsmString = asm;
92 let Pattern = pattern;
93}
94
95// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +000096class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +000097 IndexMode im, Format f, string opc, string asm, string cstr,
98 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000099 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000100 let OutOperandList = oops;
101 let InOperandList = !con(iops, (ops pred:$p));
102 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
103 let Pattern = pattern;
104 list<Predicate> Predicates = [IsARM];
105}
106
107// Same as I except it can optionally modify CPSR. Note it's modeled as
108// an input operand since by default it's a zero register. It will
109// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000110class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000111 IndexMode im, Format f, string opc, string asm, string cstr,
112 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000113 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000114 let OutOperandList = oops;
115 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
116 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
117 let Pattern = pattern;
118 list<Predicate> Predicates = [IsARM];
119}
120
Evan Chengc5409a82008-09-01 07:19:00 +0000121// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000122class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000123 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000124 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000125 let OutOperandList = oops;
126 let InOperandList = iops;
127 let AsmString = asm;
128 let Pattern = pattern;
129 list<Predicate> Predicates = [IsARM];
130}
131
Evan Chengbe998242008-11-06 08:47:38 +0000132class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000133 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000134 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000135 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000136class AsI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000137 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000138 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000139 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000140class AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000141 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000142 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000143 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000144
145// Ctrl flow instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000146class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000147 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000148 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000149 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000150 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000151}
Evan Chengf8e8b622008-11-06 17:48:05 +0000152class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
153 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000154 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000155 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000156}
Evan Chengf8e8b622008-11-06 17:48:05 +0000157class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
158 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000159 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000160
161// BR_JT instructions
Evan Cheng0f63ae12008-11-07 09:06:08 +0000162class JTI<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000163 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000164 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000165
166// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000167class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
168 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000169 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000170 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000171 let Inst{24-21} = opcod;
172 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000173}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000174class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
175 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000176 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000177 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000178 let Inst{24-21} = opcod;
179 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000180}
Evan Chengc5409a82008-09-01 07:19:00 +0000181class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
182 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000183 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000184 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000185 let Inst{24-21} = opcod;
186 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000187}
Evan Chengbe998242008-11-06 08:47:38 +0000188class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000189 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000190 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000191 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000192
Evan Cheng2e62b662008-09-01 01:51:14 +0000193
194// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000195class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000196 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000197 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000198 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000199 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000200}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000201
202// loads
Evan Chengbe998242008-11-06 08:47:38 +0000203class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000204 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000205 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000206 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000207 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000208 let Inst{21} = 0; // W bit
209 let Inst{22} = 0; // B bit
210 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000211 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000212}
Evan Chengbe998242008-11-06 08:47:38 +0000213class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000214 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000215 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000216 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000217 let Inst{20} = 1; // L bit
218 let Inst{21} = 0; // W bit
219 let Inst{22} = 0; // B bit
220 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000221 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000222}
Evan Chengbe998242008-11-06 08:47:38 +0000223class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000224 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000225 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000226 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000227 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000228 let Inst{21} = 0; // W bit
229 let Inst{22} = 1; // B bit
230 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000231 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000232}
Evan Chengbe998242008-11-06 08:47:38 +0000233class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000234 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000235 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000236 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000237 let Inst{20} = 1; // L bit
238 let Inst{21} = 0; // W bit
239 let Inst{22} = 1; // B bit
240 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000241 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000242}
Evan Chengda020022008-08-31 19:02:21 +0000243
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000244// stores
Evan Chengbe998242008-11-06 08:47:38 +0000245class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000246 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000247 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000248 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000249 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000250 let Inst{21} = 0; // W bit
251 let Inst{22} = 0; // B bit
252 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000253 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000254}
Evan Chengbe998242008-11-06 08:47:38 +0000255class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000256 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000257 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000258 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000259 let Inst{20} = 0; // L bit
260 let Inst{21} = 0; // W bit
261 let Inst{22} = 0; // B bit
262 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000263 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000264}
Evan Chengbe998242008-11-06 08:47:38 +0000265class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000266 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000267 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000268 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000269 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000270 let Inst{21} = 0; // W bit
271 let Inst{22} = 1; // B bit
272 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000273 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000274}
Evan Chengbe998242008-11-06 08:47:38 +0000275class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000276 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000277 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000278 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000279 let Inst{20} = 0; // L bit
280 let Inst{21} = 0; // W bit
281 let Inst{22} = 1; // B bit
282 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000283 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000284}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000285
Evan Chengac92c3f2008-09-01 07:00:14 +0000286// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000287class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000288 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000289 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000290 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000291 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000292 let Inst{21} = 1; // W bit
293 let Inst{22} = 0; // B bit
294 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000295 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000296}
Evan Chengbe998242008-11-06 08:47:38 +0000297class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000298 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000299 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000300 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000301 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000302 let Inst{21} = 1; // W bit
303 let Inst{22} = 1; // B bit
304 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000305 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000306}
307
Evan Chengac92c3f2008-09-01 07:00:14 +0000308// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000309class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000310 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000311 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000312 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000313 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000314 let Inst{21} = 1; // W bit
315 let Inst{22} = 0; // B bit
316 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000317 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000318}
Evan Chengbe998242008-11-06 08:47:38 +0000319class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000320 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000321 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000322 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000323 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000324 let Inst{21} = 1; // W bit
325 let Inst{22} = 1; // B bit
326 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000327 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000328}
329
Evan Chengac92c3f2008-09-01 07:00:14 +0000330// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000331class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000332 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000333 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000334 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000335 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000336 let Inst{21} = 0; // W bit
337 let Inst{22} = 0; // B bit
338 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000339 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000340}
Evan Chengbe998242008-11-06 08:47:38 +0000341class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000342 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000343 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000344 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000345 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000346 let Inst{21} = 0; // W bit
347 let Inst{22} = 1; // B bit
348 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000349 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000350}
351
Evan Chengac92c3f2008-09-01 07:00:14 +0000352// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000353class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000354 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000355 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000356 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000357 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000358 let Inst{21} = 0; // W bit
359 let Inst{22} = 0; // B bit
360 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000361 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000362}
Evan Chengbe998242008-11-06 08:47:38 +0000363class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000364 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000365 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000366 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000367 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000368 let Inst{21} = 0; // W bit
369 let Inst{22} = 1; // B bit
370 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000371 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000372}
373
Evan Cheng2e62b662008-09-01 01:51:14 +0000374// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000375class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000376 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000377 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000378 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000379class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000380 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000381 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000382 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000383
Evan Chengac92c3f2008-09-01 07:00:14 +0000384// loads
Evan Chengbe998242008-11-06 08:47:38 +0000385class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000386 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000387 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000388 asm, "", pattern> {
389 let Inst{4} = 1;
390 let Inst{5} = 1; // H bit
391 let Inst{6} = 0; // S bit
392 let Inst{7} = 1;
393 let Inst{20} = 1; // L bit
394 let Inst{21} = 0; // W bit
395 let Inst{24} = 1; // P bit
396}
Evan Chengbe998242008-11-06 08:47:38 +0000397class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000398 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000399 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000400 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000401 let Inst{4} = 1;
402 let Inst{5} = 1; // H bit
403 let Inst{6} = 0; // S bit
404 let Inst{7} = 1;
405 let Inst{20} = 1; // L bit
406 let Inst{21} = 0; // W bit
407 let Inst{24} = 1; // P bit
408}
Evan Chengbe998242008-11-06 08:47:38 +0000409class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000410 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000411 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000412 asm, "", pattern> {
413 let Inst{4} = 1;
414 let Inst{5} = 1; // H bit
415 let Inst{6} = 1; // S bit
416 let Inst{7} = 1;
417 let Inst{20} = 1; // L bit
418 let Inst{21} = 0; // W bit
419 let Inst{24} = 1; // P bit
420}
Evan Chengbe998242008-11-06 08:47:38 +0000421class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000422 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000423 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000424 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000425 let Inst{4} = 1;
426 let Inst{5} = 1; // H bit
427 let Inst{6} = 1; // S bit
428 let Inst{7} = 1;
429 let Inst{20} = 1; // L bit
430 let Inst{21} = 0; // W bit
431 let Inst{24} = 1; // P bit
432}
Evan Chengbe998242008-11-06 08:47:38 +0000433class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000434 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000435 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000436 asm, "", pattern> {
437 let Inst{4} = 1;
438 let Inst{5} = 0; // H bit
439 let Inst{6} = 1; // S bit
440 let Inst{7} = 1;
441 let Inst{20} = 1; // L bit
442 let Inst{21} = 0; // W bit
443 let Inst{24} = 1; // P bit
444}
Evan Chengbe998242008-11-06 08:47:38 +0000445class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000446 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000447 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000448 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000449 let Inst{4} = 1;
450 let Inst{5} = 0; // H bit
451 let Inst{6} = 1; // S bit
452 let Inst{7} = 1;
453 let Inst{20} = 1; // L bit
454 let Inst{21} = 0; // W bit
455 let Inst{24} = 1; // P bit
456}
Evan Chengbe998242008-11-06 08:47:38 +0000457class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000458 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000459 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000460 asm, "", pattern> {
461 let Inst{4} = 1;
462 let Inst{5} = 0; // H bit
463 let Inst{6} = 1; // S bit
464 let Inst{7} = 1;
465 let Inst{20} = 0; // L bit
466 let Inst{21} = 0; // W bit
467 let Inst{24} = 1; // P bit
468}
469
470// stores
Evan Chengbe998242008-11-06 08:47:38 +0000471class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000472 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000473 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000474 asm, "", pattern> {
475 let Inst{4} = 1;
476 let Inst{5} = 1; // H bit
477 let Inst{6} = 0; // S bit
478 let Inst{7} = 1;
479 let Inst{20} = 0; // L bit
480 let Inst{21} = 0; // W bit
481 let Inst{24} = 1; // P bit
482}
Evan Chengbe998242008-11-06 08:47:38 +0000483class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000484 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000485 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000486 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000487 let Inst{4} = 1;
488 let Inst{5} = 1; // H bit
489 let Inst{6} = 0; // S bit
490 let Inst{7} = 1;
491 let Inst{20} = 0; // L bit
492 let Inst{21} = 0; // W bit
493 let Inst{24} = 1; // P bit
494}
Evan Chengbe998242008-11-06 08:47:38 +0000495class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000496 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000497 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000498 asm, "", pattern> {
499 let Inst{4} = 1;
500 let Inst{5} = 1; // H bit
501 let Inst{6} = 1; // S bit
502 let Inst{7} = 1;
503 let Inst{20} = 0; // L bit
504 let Inst{21} = 0; // W bit
505 let Inst{24} = 1; // P bit
506}
507
508// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000509class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000510 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000511 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000512 asm, cstr, pattern> {
513 let Inst{4} = 1;
514 let Inst{5} = 1; // H bit
515 let Inst{6} = 0; // S bit
516 let Inst{7} = 1;
517 let Inst{20} = 1; // L bit
518 let Inst{21} = 1; // W bit
519 let Inst{24} = 1; // P bit
520}
Evan Chengbe998242008-11-06 08:47:38 +0000521class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000522 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000523 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000524 asm, cstr, pattern> {
525 let Inst{4} = 1;
526 let Inst{5} = 1; // H bit
527 let Inst{6} = 1; // S bit
528 let Inst{7} = 1;
529 let Inst{20} = 1; // L bit
530 let Inst{21} = 1; // W bit
531 let Inst{24} = 1; // P bit
532}
Evan Chengbe998242008-11-06 08:47:38 +0000533class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000534 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000535 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000536 asm, cstr, pattern> {
537 let Inst{4} = 1;
538 let Inst{5} = 0; // H bit
539 let Inst{6} = 1; // S bit
540 let Inst{7} = 1;
541 let Inst{20} = 1; // L bit
542 let Inst{21} = 1; // W bit
543 let Inst{24} = 1; // P bit
544}
545
546// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000547class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000548 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000549 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000550 asm, cstr, pattern> {
551 let Inst{4} = 1;
552 let Inst{5} = 1; // H bit
553 let Inst{6} = 0; // S bit
554 let Inst{7} = 1;
555 let Inst{20} = 0; // L bit
556 let Inst{21} = 1; // W bit
557 let Inst{24} = 1; // P bit
558}
559
560// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000561class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000562 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000563 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000564 asm, cstr,pattern> {
565 let Inst{4} = 1;
566 let Inst{5} = 1; // H bit
567 let Inst{6} = 0; // S bit
568 let Inst{7} = 1;
569 let Inst{20} = 1; // L bit
570 let Inst{21} = 1; // W bit
571 let Inst{24} = 0; // P bit
572}
Evan Chengbe998242008-11-06 08:47:38 +0000573class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000574 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000575 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000576 asm, cstr,pattern> {
577 let Inst{4} = 1;
578 let Inst{5} = 1; // H bit
579 let Inst{6} = 1; // S bit
580 let Inst{7} = 1;
581 let Inst{20} = 1; // L bit
582 let Inst{21} = 1; // W bit
583 let Inst{24} = 0; // P bit
584}
Evan Chengbe998242008-11-06 08:47:38 +0000585class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000586 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000587 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000588 asm, cstr,pattern> {
589 let Inst{4} = 1;
590 let Inst{5} = 0; // H bit
591 let Inst{6} = 1; // S bit
592 let Inst{7} = 1;
593 let Inst{20} = 1; // L bit
594 let Inst{21} = 1; // W bit
595 let Inst{24} = 0; // P bit
596}
597
598// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000599class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000600 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000601 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000602 asm, cstr,pattern> {
603 let Inst{4} = 1;
604 let Inst{5} = 1; // H bit
605 let Inst{6} = 0; // S bit
606 let Inst{7} = 1;
607 let Inst{20} = 0; // L bit
608 let Inst{21} = 1; // W bit
609 let Inst{24} = 0; // P bit
610}
611
612
Evan Cheng2e62b662008-09-01 01:51:14 +0000613// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000614class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000615 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000616 "", pattern> {
617 let Inst{20} = 1; // L bit
618 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000619 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000620}
Evan Chengf8e8b622008-11-06 17:48:05 +0000621class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000622 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000623 "", pattern> {
624 let Inst{20} = 0; // L bit
625 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000626 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000627}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000628
Jim Grosbach1feed042008-11-03 18:38:31 +0000629// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000630class AMul1I<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 : I<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 Chengee80fb72008-11-06 01:21:28 +0000635 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000636 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000637}
Evan Chengbe998242008-11-06 08:47:38 +0000638class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000639 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000640 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000641 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000642 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000643 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000644}
645
646// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000647class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000648 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000649 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000650 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000651 let Inst{7-4} = 0b1001;
652 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000653 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000654}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000655
Evan Cheng38396be2008-11-06 03:35:07 +0000656// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000657class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000658 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000659 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000660 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000661 let Inst{4} = 0;
662 let Inst{7} = 1;
663 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000664 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000665}
666
Evan Cheng37afa432008-11-06 22:15:19 +0000667// Extend instructions.
668class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
669 string asm, list<dag> pattern>
670 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
671 asm, "", pattern> {
672 let Inst{7-4} = 0b0111;
673 let Inst{27-20} = opcod;
674}
675
Evan Chengc2121a22008-11-07 01:41:35 +0000676// Misc Arithmetic instructions.
677class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
678 string asm, list<dag> pattern>
679 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
680 asm, "", pattern> {
681 let Inst{27-20} = opcod;
682}
683
Evan Cheng7b0249b2008-08-28 23:39:26 +0000684//===----------------------------------------------------------------------===//
685
686// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
687class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
688 list<Predicate> Predicates = [IsARM];
689}
690class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
691 list<Predicate> Predicates = [IsARM, HasV5TE];
692}
693class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
694 list<Predicate> Predicates = [IsARM, HasV6];
695}
Evan Cheng34a46e12008-08-29 06:41:12 +0000696
697//===----------------------------------------------------------------------===//
698//
699// Thumb Instruction Format Definitions.
700//
701
702
703// TI - Thumb instruction.
704
705class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
706 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000707 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000708 let OutOperandList = outs;
709 let InOperandList = ins;
710 let AsmString = asm;
711 let Pattern = pattern;
712 list<Predicate> Predicates = [IsThumb];
713}
714
715class TI<dag outs, dag ins, string asm, list<dag> pattern>
716 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
717class TI1<dag outs, dag ins, string asm, list<dag> pattern>
718 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
719class TI2<dag outs, dag ins, string asm, list<dag> pattern>
720 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
721class TI4<dag outs, dag ins, string asm, list<dag> pattern>
722 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
723class TIs<dag outs, dag ins, string asm, list<dag> pattern>
724 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
725
726// Two-address instructions
727class TIt<dag outs, dag ins, string asm, list<dag> pattern>
728 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
729
730// BL, BLX(1) are translated by assembler into two instructions
731class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
732 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
733
734// BR_JT instructions
735class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
736 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
737
738
739//===----------------------------------------------------------------------===//
740
Evan Chengc63e15e2008-11-11 02:11:05 +0000741//===----------------------------------------------------------------------===//
742// ARM VFP Instruction templates.
743//
744
Evan Chengbb786b32008-11-11 21:48:44 +0000745// ARM VFP addrmode5 loads and stores
746class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
747 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000748 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000749 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000750 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000751 let Inst{27-24} = opcod1;
752 let Inst{21-20} = opcod2;
753 let Inst{11-8} = 0b1011;
Evan Chengc63e15e2008-11-11 02:11:05 +0000754}
755
Evan Chengbb786b32008-11-11 21:48:44 +0000756class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
757 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000758 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000759 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000760 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000761 let Inst{27-24} = opcod1;
762 let Inst{21-20} = opcod2;
763 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +0000764}
765
Evan Chengbb786b32008-11-11 21:48:44 +0000766// Load / store multiple
767class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
768 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
769 VFPLdStMulFrm, asm, "", pattern> {
770 // TODO: Mark the instructions with the appropriate subtarget info.
771 let Inst{27-25} = 0b110;
772 let Inst{11-8} = 0b1011;
773}
774
775class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
776 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
777 VFPLdStMulFrm, asm, "", pattern> {
778 // TODO: Mark the instructions with the appropriate subtarget info.
779 let Inst{27-25} = 0b110;
780 let Inst{11-8} = 0b1010;
781}
782
783
Evan Chengc63e15e2008-11-11 02:11:05 +0000784// Double precision, unary
785class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
786 string opc, string asm, list<dag> pattern>
787 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
788 let Inst{27-20} = opcod1;
789 let Inst{19-16} = opcod2;
790 let Inst{11-8} = 0b1011;
791 let Inst{7-4} = opcod3;
792}
793
794// Double precision, binary
795class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
796 string asm, list<dag> pattern>
797 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
798 let Inst{27-20} = opcod;
799 let Inst{11-8} = 0b1011;
800}
801
802// Single precision, unary
803class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
804 string opc, string asm, list<dag> pattern>
805 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
806 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
807 let Inst{27-20} = opcod1;
808 let Inst{19-16} = opcod2;
809 let Inst{11-8} = 0b1010;
810 let Inst{7-4} = opcod3;
811}
812
813// Single precision, binary
814class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
815 string asm, list<dag> pattern>
816 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
817 // Bit 22 (D bit) can be changed during instruction encoding.
818 let Inst{27-20} = opcod;
819 let Inst{11-8} = 0b1010;
820}
821
Evan Cheng9d3cc182008-11-11 19:40:26 +0000822class AVConv1I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
823 string asm, list<dag> pattern>
824 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
825 let Inst{27-20} = opcod1;
826 let Inst{11-8} = opcod2;
827 let Inst{4} = 1;
828}
829
830class AVConv2I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
831 dag oops, dag iops, string opc, string asm, list<dag> pattern>
832 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
833 let Inst{27-20} = opcod1;
834 let Inst{19-16} = opcod2;
835 let Inst{11-8} = opcod3;
836 let Inst{6} = 1;
837}
838
Evan Chengc63e15e2008-11-11 02:11:05 +0000839//===----------------------------------------------------------------------===//
840
Evan Cheng34a46e12008-08-29 06:41:12 +0000841
842// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
843class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
844 list<Predicate> Predicates = [IsThumb];
845}
846
847class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
848 list<Predicate> Predicates = [IsThumb, HasV5T];
849}