blob: c2d8df31a608da035de3522e3f84f8e749e21c89 [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 Cheng81794bb2008-11-13 07:34:59 +000030def LdFrm : Format<7>;
31def StFrm : Format<8>;
32def LdMiscFrm : Format<9>;
33def StMiscFrm : Format<10>;
34def LdStMulFrm : Format<11>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000035
Evan Cheng81794bb2008-11-13 07:34:59 +000036def ArithMiscFrm : Format<12>;
37def ExtFrm : Format<13>;
Evan Chengbb786b32008-11-11 21:48:44 +000038
Evan Cheng81794bb2008-11-13 07:34:59 +000039def VFPUnaryFrm : Format<14>;
40def VFPBinaryFrm : Format<15>;
41def VFPConv1Frm : Format<16>;
42def VFPConv2Frm : Format<17>;
43def VFPConv3Frm : Format<18>;
44def VFPConv4Frm : Format<19>;
45def VFPConv5Frm : Format<20>;
46def VFPLdStFrm : Format<21>;
47def VFPLdStMulFrm : Format<22>;
48def VFPMiscFrm : Format<23>;
Evan Chengbb786b32008-11-11 21:48:44 +000049
Evan Cheng81794bb2008-11-13 07:34:59 +000050def ThumbFrm : Format<24>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000051
Evan Cheng86a926a2008-11-05 18:35:52 +000052// Misc flag for data processing instructions that indicates whether
53// the instruction has a Rn register operand.
54class UnaryDP { bit isUnaryDataProc = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000055
Evan Cheng7b0249b2008-08-28 23:39:26 +000056//===----------------------------------------------------------------------===//
57
58// ARM Instruction templates.
59//
60
Evan Chengbe998242008-11-06 08:47:38 +000061class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +000062 Format f, string cstr>
63 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +000064 field bits<32> Inst;
65
Evan Cheng7b0249b2008-08-28 23:39:26 +000066 let Namespace = "ARM";
67
Evan Cheng86a926a2008-11-05 18:35:52 +000068 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +000069 AddrMode AM = am;
70 bits<4> AddrModeBits = AM.Value;
71
72 SizeFlagVal SZ = sz;
73 bits<3> SizeFlag = SZ.Value;
74
75 IndexMode IM = im;
76 bits<2> IndexModeBits = IM.Value;
77
78 Format F = f;
79 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +000080
81 //
82 // Attributes specific to ARM instructions...
83 //
84 bit isUnaryDataProc = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +000085
86 let Constraints = cstr;
87}
88
89class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000090 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000091 let OutOperandList = oops;
92 let InOperandList = iops;
93 let AsmString = asm;
94 let Pattern = pattern;
95}
96
97// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +000098class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +000099 IndexMode im, Format f, string opc, string asm, string cstr,
100 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000101 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000102 let OutOperandList = oops;
103 let InOperandList = !con(iops, (ops pred:$p));
104 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
105 let Pattern = pattern;
106 list<Predicate> Predicates = [IsARM];
107}
108
109// Same as I except it can optionally modify CPSR. Note it's modeled as
110// an input operand since by default it's a zero register. It will
111// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000112class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000113 IndexMode im, Format f, string opc, string asm, string cstr,
114 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000115 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000116 let OutOperandList = oops;
117 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
118 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
119 let Pattern = pattern;
120 list<Predicate> Predicates = [IsARM];
121}
122
Evan Chengc5409a82008-09-01 07:19:00 +0000123// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000124class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000125 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000126 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000127 let OutOperandList = oops;
128 let InOperandList = iops;
129 let AsmString = asm;
130 let Pattern = pattern;
131 list<Predicate> Predicates = [IsARM];
132}
133
Evan Chengbe998242008-11-06 08:47:38 +0000134class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000135 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000136 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000137 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000138class AsI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000139 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000140 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000141 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000142class AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000143 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000144 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000145 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000146
147// Ctrl flow instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000148class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000149 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000150 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000151 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000152 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000153}
Evan Chengf8e8b622008-11-06 17:48:05 +0000154class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
155 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000156 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000157 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000158}
Evan Chengf8e8b622008-11-06 17:48:05 +0000159class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
160 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000161 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000162
163// BR_JT instructions
Evan Cheng0f63ae12008-11-07 09:06:08 +0000164class JTI<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000165 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000166 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000167
168// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000169class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
170 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000171 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000172 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000173 let Inst{24-21} = opcod;
174 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000175}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000176class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
177 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000178 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000179 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000180 let Inst{24-21} = opcod;
181 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000182}
Evan Chengc5409a82008-09-01 07:19:00 +0000183class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
184 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000185 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000186 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000187 let Inst{24-21} = opcod;
188 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000189}
Evan Chengbe998242008-11-06 08:47:38 +0000190class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000191 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000192 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000193 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000194
Evan Cheng2e62b662008-09-01 01:51:14 +0000195
196// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000197class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000198 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000199 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000200 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000201 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000202}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000203
204// loads
Evan Chengbe998242008-11-06 08:47:38 +0000205class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000206 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000207 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000208 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000209 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000210 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 Chengda020022008-08-31 19:02:21 +0000214}
Evan Chengbe998242008-11-06 08:47:38 +0000215class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000216 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000217 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000218 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000219 let Inst{20} = 1; // L bit
220 let Inst{21} = 0; // W bit
221 let Inst{22} = 0; // B bit
222 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000223 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000224}
Evan Chengbe998242008-11-06 08:47:38 +0000225class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000226 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000227 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000228 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000229 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000230 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 Chengda020022008-08-31 19:02:21 +0000234}
Evan Chengbe998242008-11-06 08:47:38 +0000235class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000236 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000237 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000238 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000239 let Inst{20} = 1; // L bit
240 let Inst{21} = 0; // W bit
241 let Inst{22} = 1; // B bit
242 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000243 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000244}
Evan Chengda020022008-08-31 19:02:21 +0000245
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000246// stores
Evan Chengbe998242008-11-06 08:47:38 +0000247class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000248 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000249 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000250 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000251 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000252 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 Cheng1a7c1cc2008-09-01 01:27:33 +0000256}
Evan Chengbe998242008-11-06 08:47:38 +0000257class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000258 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000259 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000260 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000261 let Inst{20} = 0; // L bit
262 let Inst{21} = 0; // W bit
263 let Inst{22} = 0; // B bit
264 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000265 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000266}
Evan Chengbe998242008-11-06 08:47:38 +0000267class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000268 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000269 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000270 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000271 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000272 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 Cheng1a7c1cc2008-09-01 01:27:33 +0000276}
Evan Chengbe998242008-11-06 08:47:38 +0000277class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000278 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000279 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000280 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000281 let Inst{20} = 0; // L bit
282 let Inst{21} = 0; // W bit
283 let Inst{22} = 1; // B bit
284 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000285 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000286}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000287
Evan Chengac92c3f2008-09-01 07:00:14 +0000288// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000289class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +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} = 0; // 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}
Evan Chengbe998242008-11-06 08:47:38 +0000299class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000300 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000301 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000302 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000303 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000304 let Inst{21} = 1; // W bit
305 let Inst{22} = 1; // B bit
306 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000307 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000308}
309
Evan Chengac92c3f2008-09-01 07:00:14 +0000310// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000311class AI2stwpr<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} = 0; // 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}
Evan Chengbe998242008-11-06 08:47:38 +0000321class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000322 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000323 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000324 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000325 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000326 let Inst{21} = 1; // W bit
327 let Inst{22} = 1; // B bit
328 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000329 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000330}
331
Evan Chengac92c3f2008-09-01 07:00:14 +0000332// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000333class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +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} = 0; // 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}
Evan Chengbe998242008-11-06 08:47:38 +0000343class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000344 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000345 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000346 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000347 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000348 let Inst{21} = 0; // W bit
349 let Inst{22} = 1; // B bit
350 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000351 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000352}
353
Evan Chengac92c3f2008-09-01 07:00:14 +0000354// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000355class AI2stwpo<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} = 0; // 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}
Evan Chengbe998242008-11-06 08:47:38 +0000365class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000366 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000367 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000368 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000369 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000370 let Inst{21} = 0; // W bit
371 let Inst{22} = 1; // B bit
372 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000373 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000374}
375
Evan Cheng2e62b662008-09-01 01:51:14 +0000376// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000377class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000378 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000379 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000380 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000381class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000382 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000383 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000384 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000385
Evan Chengac92c3f2008-09-01 07:00:14 +0000386// loads
Evan Chengbe998242008-11-06 08:47:38 +0000387class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000388 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000389 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000390 asm, "", pattern> {
391 let Inst{4} = 1;
392 let Inst{5} = 1; // H bit
393 let Inst{6} = 0; // S bit
394 let Inst{7} = 1;
395 let Inst{20} = 1; // L bit
396 let Inst{21} = 0; // W bit
397 let Inst{24} = 1; // P bit
398}
Evan Chengbe998242008-11-06 08:47:38 +0000399class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000400 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000401 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000402 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000403 let Inst{4} = 1;
404 let Inst{5} = 1; // H bit
405 let Inst{6} = 0; // S bit
406 let Inst{7} = 1;
407 let Inst{20} = 1; // L bit
408 let Inst{21} = 0; // W bit
409 let Inst{24} = 1; // P bit
410}
Evan Chengbe998242008-11-06 08:47:38 +0000411class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000412 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000413 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000414 asm, "", pattern> {
415 let Inst{4} = 1;
416 let Inst{5} = 1; // H bit
417 let Inst{6} = 1; // S bit
418 let Inst{7} = 1;
419 let Inst{20} = 1; // L bit
420 let Inst{21} = 0; // W bit
421 let Inst{24} = 1; // P bit
422}
Evan Chengbe998242008-11-06 08:47:38 +0000423class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000424 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000425 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000426 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000427 let Inst{4} = 1;
428 let Inst{5} = 1; // H bit
429 let Inst{6} = 1; // S bit
430 let Inst{7} = 1;
431 let Inst{20} = 1; // L bit
432 let Inst{21} = 0; // W bit
433 let Inst{24} = 1; // P bit
434}
Evan Chengbe998242008-11-06 08:47:38 +0000435class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000436 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000437 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000438 asm, "", pattern> {
439 let Inst{4} = 1;
440 let Inst{5} = 0; // H bit
441 let Inst{6} = 1; // S bit
442 let Inst{7} = 1;
443 let Inst{20} = 1; // L bit
444 let Inst{21} = 0; // W bit
445 let Inst{24} = 1; // P bit
446}
Evan Chengbe998242008-11-06 08:47:38 +0000447class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000448 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000449 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000450 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000451 let Inst{4} = 1;
452 let Inst{5} = 0; // H bit
453 let Inst{6} = 1; // S bit
454 let Inst{7} = 1;
455 let Inst{20} = 1; // L bit
456 let Inst{21} = 0; // W bit
457 let Inst{24} = 1; // P bit
458}
Evan Chengbe998242008-11-06 08:47:38 +0000459class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000460 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000461 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000462 asm, "", pattern> {
463 let Inst{4} = 1;
464 let Inst{5} = 0; // H bit
465 let Inst{6} = 1; // S bit
466 let Inst{7} = 1;
467 let Inst{20} = 0; // L bit
468 let Inst{21} = 0; // W bit
469 let Inst{24} = 1; // P bit
470}
471
472// stores
Evan Chengbe998242008-11-06 08:47:38 +0000473class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000474 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000475 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000476 asm, "", pattern> {
477 let Inst{4} = 1;
478 let Inst{5} = 1; // H bit
479 let Inst{6} = 0; // S bit
480 let Inst{7} = 1;
481 let Inst{20} = 0; // L bit
482 let Inst{21} = 0; // W bit
483 let Inst{24} = 1; // P bit
484}
Evan Chengbe998242008-11-06 08:47:38 +0000485class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000486 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000487 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000488 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000489 let Inst{4} = 1;
490 let Inst{5} = 1; // H bit
491 let Inst{6} = 0; // S bit
492 let Inst{7} = 1;
493 let Inst{20} = 0; // L bit
494 let Inst{21} = 0; // W bit
495 let Inst{24} = 1; // P bit
496}
Evan Chengbe998242008-11-06 08:47:38 +0000497class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000498 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000499 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000500 asm, "", pattern> {
501 let Inst{4} = 1;
502 let Inst{5} = 1; // H bit
503 let Inst{6} = 1; // S bit
504 let Inst{7} = 1;
505 let Inst{20} = 0; // L bit
506 let Inst{21} = 0; // W bit
507 let Inst{24} = 1; // P bit
508}
509
510// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000511class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000512 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000513 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000514 asm, cstr, pattern> {
515 let Inst{4} = 1;
516 let Inst{5} = 1; // H bit
517 let Inst{6} = 0; // S bit
518 let Inst{7} = 1;
519 let Inst{20} = 1; // L bit
520 let Inst{21} = 1; // W bit
521 let Inst{24} = 1; // P bit
522}
Evan Chengbe998242008-11-06 08:47:38 +0000523class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000524 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000525 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000526 asm, cstr, pattern> {
527 let Inst{4} = 1;
528 let Inst{5} = 1; // H bit
529 let Inst{6} = 1; // S bit
530 let Inst{7} = 1;
531 let Inst{20} = 1; // L bit
532 let Inst{21} = 1; // W bit
533 let Inst{24} = 1; // P bit
534}
Evan Chengbe998242008-11-06 08:47:38 +0000535class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000536 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000537 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000538 asm, cstr, pattern> {
539 let Inst{4} = 1;
540 let Inst{5} = 0; // H bit
541 let Inst{6} = 1; // S bit
542 let Inst{7} = 1;
543 let Inst{20} = 1; // L bit
544 let Inst{21} = 1; // W bit
545 let Inst{24} = 1; // P bit
546}
547
548// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000549class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000550 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000551 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000552 asm, cstr, pattern> {
553 let Inst{4} = 1;
554 let Inst{5} = 1; // H bit
555 let Inst{6} = 0; // S bit
556 let Inst{7} = 1;
557 let Inst{20} = 0; // L bit
558 let Inst{21} = 1; // W bit
559 let Inst{24} = 1; // P bit
560}
561
562// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000563class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000564 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000565 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000566 asm, cstr,pattern> {
567 let Inst{4} = 1;
568 let Inst{5} = 1; // H bit
569 let Inst{6} = 0; // S bit
570 let Inst{7} = 1;
571 let Inst{20} = 1; // L bit
572 let Inst{21} = 1; // W bit
573 let Inst{24} = 0; // P bit
574}
Evan Chengbe998242008-11-06 08:47:38 +0000575class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000576 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000577 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000578 asm, cstr,pattern> {
579 let Inst{4} = 1;
580 let Inst{5} = 1; // H bit
581 let Inst{6} = 1; // S bit
582 let Inst{7} = 1;
583 let Inst{20} = 1; // L bit
584 let Inst{21} = 1; // W bit
585 let Inst{24} = 0; // P bit
586}
Evan Chengbe998242008-11-06 08:47:38 +0000587class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000588 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000589 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000590 asm, cstr,pattern> {
591 let Inst{4} = 1;
592 let Inst{5} = 0; // H bit
593 let Inst{6} = 1; // S bit
594 let Inst{7} = 1;
595 let Inst{20} = 1; // L bit
596 let Inst{21} = 1; // W bit
597 let Inst{24} = 0; // P bit
598}
599
600// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000601class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000602 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000603 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000604 asm, cstr,pattern> {
605 let Inst{4} = 1;
606 let Inst{5} = 1; // H bit
607 let Inst{6} = 0; // S bit
608 let Inst{7} = 1;
609 let Inst{20} = 0; // L bit
610 let Inst{21} = 1; // W bit
611 let Inst{24} = 0; // P bit
612}
613
614
Evan Cheng2e62b662008-09-01 01:51:14 +0000615// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000616class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000617 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000618 "", pattern> {
619 let Inst{20} = 1; // L bit
620 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000621 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000622}
Evan Chengf8e8b622008-11-06 17:48:05 +0000623class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000624 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000625 "", pattern> {
626 let Inst{20} = 0; // L bit
627 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000628 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000629}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000630
Jim Grosbach1feed042008-11-03 18:38:31 +0000631// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000632class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000633 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000634 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000635 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000636 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000637 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000638 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000639}
Evan Chengbe998242008-11-06 08:47:38 +0000640class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000641 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000642 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000643 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000644 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000645 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000646}
647
648// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000649class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +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 Chengee80fb72008-11-06 01:21:28 +0000653 let Inst{7-4} = 0b1001;
654 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000655 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000656}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000657
Evan Cheng38396be2008-11-06 03:35:07 +0000658// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000659class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000660 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000661 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000662 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000663 let Inst{4} = 0;
664 let Inst{7} = 1;
665 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000666 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000667}
668
Evan Cheng37afa432008-11-06 22:15:19 +0000669// Extend instructions.
670class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
671 string asm, list<dag> pattern>
672 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
673 asm, "", pattern> {
674 let Inst{7-4} = 0b0111;
675 let Inst{27-20} = opcod;
676}
677
Evan Chengc2121a22008-11-07 01:41:35 +0000678// Misc Arithmetic instructions.
679class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
680 string asm, list<dag> pattern>
681 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
682 asm, "", pattern> {
683 let Inst{27-20} = opcod;
684}
685
Evan Cheng7b0249b2008-08-28 23:39:26 +0000686//===----------------------------------------------------------------------===//
687
688// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
689class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
690 list<Predicate> Predicates = [IsARM];
691}
692class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
693 list<Predicate> Predicates = [IsARM, HasV5TE];
694}
695class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
696 list<Predicate> Predicates = [IsARM, HasV6];
697}
Evan Cheng34a46e12008-08-29 06:41:12 +0000698
699//===----------------------------------------------------------------------===//
700//
701// Thumb Instruction Format Definitions.
702//
703
704
705// TI - Thumb instruction.
706
707class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
708 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000709 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000710 let OutOperandList = outs;
711 let InOperandList = ins;
712 let AsmString = asm;
713 let Pattern = pattern;
714 list<Predicate> Predicates = [IsThumb];
715}
716
717class TI<dag outs, dag ins, string asm, list<dag> pattern>
718 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
719class TI1<dag outs, dag ins, string asm, list<dag> pattern>
720 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
721class TI2<dag outs, dag ins, string asm, list<dag> pattern>
722 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
723class TI4<dag outs, dag ins, string asm, list<dag> pattern>
724 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
725class TIs<dag outs, dag ins, string asm, list<dag> pattern>
726 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
727
728// Two-address instructions
729class TIt<dag outs, dag ins, string asm, list<dag> pattern>
730 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
731
732// BL, BLX(1) are translated by assembler into two instructions
733class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
734 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
735
736// BR_JT instructions
737class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
738 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
739
740
741//===----------------------------------------------------------------------===//
742
Evan Chengc63e15e2008-11-11 02:11:05 +0000743//===----------------------------------------------------------------------===//
744// ARM VFP Instruction templates.
745//
746
Evan Chengbb786b32008-11-11 21:48:44 +0000747// ARM VFP addrmode5 loads and stores
748class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
749 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000750 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000751 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000752 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000753 let Inst{27-24} = opcod1;
754 let Inst{21-20} = opcod2;
755 let Inst{11-8} = 0b1011;
Evan Chengc63e15e2008-11-11 02:11:05 +0000756}
757
Evan Chengbb786b32008-11-11 21:48:44 +0000758class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
759 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000760 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000761 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000762 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000763 let Inst{27-24} = opcod1;
764 let Inst{21-20} = opcod2;
765 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +0000766}
767
Evan Chengbb786b32008-11-11 21:48:44 +0000768// Load / store multiple
769class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
770 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
771 VFPLdStMulFrm, asm, "", pattern> {
772 // TODO: Mark the instructions with the appropriate subtarget info.
773 let Inst{27-25} = 0b110;
774 let Inst{11-8} = 0b1011;
775}
776
777class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
778 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
779 VFPLdStMulFrm, asm, "", pattern> {
780 // TODO: Mark the instructions with the appropriate subtarget info.
781 let Inst{27-25} = 0b110;
782 let Inst{11-8} = 0b1010;
783}
784
785
Evan Chengc63e15e2008-11-11 02:11:05 +0000786// Double precision, unary
787class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
788 string opc, string asm, list<dag> pattern>
789 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
790 let Inst{27-20} = opcod1;
791 let Inst{19-16} = opcod2;
792 let Inst{11-8} = 0b1011;
793 let Inst{7-4} = opcod3;
794}
795
796// Double precision, binary
797class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
798 string asm, list<dag> pattern>
799 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
800 let Inst{27-20} = opcod;
801 let Inst{11-8} = 0b1011;
802}
803
804// Single precision, unary
805class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
806 string opc, string asm, list<dag> pattern>
807 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
808 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
809 let Inst{27-20} = opcod1;
810 let Inst{19-16} = opcod2;
811 let Inst{11-8} = 0b1010;
812 let Inst{7-4} = opcod3;
813}
814
815// Single precision, binary
816class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
817 string asm, list<dag> pattern>
818 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
819 // Bit 22 (D bit) can be changed during instruction encoding.
820 let Inst{27-20} = opcod;
821 let Inst{11-8} = 0b1010;
822}
823
Evan Cheng74273382008-11-12 06:41:41 +0000824// VFP conversion instructions
825class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
826 dag oops, dag iops, string opc, string asm, list<dag> pattern>
Evan Cheng9d3cc182008-11-11 19:40:26 +0000827 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
828 let Inst{27-20} = opcod1;
Evan Cheng74273382008-11-12 06:41:41 +0000829 let Inst{19-16} = opcod2;
830 let Inst{11-8} = opcod3;
831 let Inst{6} = 1;
832}
833
834class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
835 string opc, string asm, list<dag> pattern>
836 : AI<oops, iops, f, opc, asm, pattern> {
837 let Inst{27-20} = opcod1;
Evan Cheng9d3cc182008-11-11 19:40:26 +0000838 let Inst{11-8} = opcod2;
839 let Inst{4} = 1;
840}
841
Evan Cheng828ccdc2008-11-11 22:46:12 +0000842class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
Evan Cheng74273382008-11-12 06:41:41 +0000843 string asm, list<dag> pattern>
844 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, opc, asm, pattern>;
Evan Cheng828ccdc2008-11-11 22:46:12 +0000845
Evan Cheng74273382008-11-12 06:41:41 +0000846class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
847 string asm, list<dag> pattern>
848 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, opc, asm, pattern>;
849
850class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
851 string asm, list<dag> pattern>
852 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, opc, asm, pattern>;
853
854class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
855 string asm, list<dag> pattern>
856 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, opc, asm, pattern>;
Evan Cheng9d3cc182008-11-11 19:40:26 +0000857
Evan Chengc63e15e2008-11-11 02:11:05 +0000858//===----------------------------------------------------------------------===//
859
Evan Cheng34a46e12008-08-29 06:41:12 +0000860
861// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
862class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
863 list<Predicate> Predicates = [IsThumb];
864}
865
866class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
867 list<Predicate> Predicates = [IsThumb, HasV5T];
868}