blob: 1db0838d07b8288863017963f36761fca6786f9e [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>;
Evan Cheng828ccdc2008-11-11 22:46:12 +000044def VFPConv3Frm : Format<19>;
45def VFPLdStFrm : Format<20>;
46def VFPLdStMulFrm : Format<21>;
47def VFPMiscFrm : Format<22>;
Evan Chengbb786b32008-11-11 21:48:44 +000048
Evan Cheng828ccdc2008-11-11 22:46:12 +000049def ThumbFrm : Format<23>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000050
Evan Cheng86a926a2008-11-05 18:35:52 +000051// Misc flag for data processing instructions that indicates whether
52// the instruction has a Rn register operand.
53class UnaryDP { bit isUnaryDataProc = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000054
Evan Cheng7b0249b2008-08-28 23:39:26 +000055//===----------------------------------------------------------------------===//
56
57// ARM Instruction templates.
58//
59
Evan Chengbe998242008-11-06 08:47:38 +000060class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +000061 Format f, string cstr>
62 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +000063 field bits<32> Inst;
64
Evan Cheng7b0249b2008-08-28 23:39:26 +000065 let Namespace = "ARM";
66
Evan Cheng86a926a2008-11-05 18:35:52 +000067 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +000068 AddrMode AM = am;
69 bits<4> AddrModeBits = AM.Value;
70
71 SizeFlagVal SZ = sz;
72 bits<3> SizeFlag = SZ.Value;
73
74 IndexMode IM = im;
75 bits<2> IndexModeBits = IM.Value;
76
77 Format F = f;
78 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +000079
80 //
81 // Attributes specific to ARM instructions...
82 //
83 bit isUnaryDataProc = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +000084
85 let Constraints = cstr;
86}
87
88class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000089 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000090 let OutOperandList = oops;
91 let InOperandList = iops;
92 let AsmString = asm;
93 let Pattern = pattern;
94}
95
96// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +000097class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +000098 IndexMode im, Format f, string opc, string asm, string cstr,
99 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000100 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000101 let OutOperandList = oops;
102 let InOperandList = !con(iops, (ops pred:$p));
103 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
104 let Pattern = pattern;
105 list<Predicate> Predicates = [IsARM];
106}
107
108// Same as I except it can optionally modify CPSR. Note it's modeled as
109// an input operand since by default it's a zero register. It will
110// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000111class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000112 IndexMode im, Format f, string opc, string asm, string cstr,
113 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000114 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000115 let OutOperandList = oops;
116 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
117 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
118 let Pattern = pattern;
119 list<Predicate> Predicates = [IsARM];
120}
121
Evan Chengc5409a82008-09-01 07:19:00 +0000122// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000123class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000124 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000125 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000126 let OutOperandList = oops;
127 let InOperandList = iops;
128 let AsmString = asm;
129 let Pattern = pattern;
130 list<Predicate> Predicates = [IsARM];
131}
132
Evan Chengbe998242008-11-06 08:47:38 +0000133class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000134 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000135 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000136 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000137class AsI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000138 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000139 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000140 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000141class AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000142 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000143 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000144 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000145
146// Ctrl flow instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000147class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000148 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000149 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000150 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000151 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000152}
Evan Chengf8e8b622008-11-06 17:48:05 +0000153class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
154 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000155 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000156 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000157}
Evan Chengf8e8b622008-11-06 17:48:05 +0000158class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
159 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000160 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000161
162// BR_JT instructions
Evan Cheng0f63ae12008-11-07 09:06:08 +0000163class JTI<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000164 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000165 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000166
167// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000168class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
169 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000170 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000171 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000172 let Inst{24-21} = opcod;
173 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000174}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000175class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
176 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000177 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000178 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000179 let Inst{24-21} = opcod;
180 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000181}
Evan Chengc5409a82008-09-01 07:19:00 +0000182class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
183 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000184 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000185 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000186 let Inst{24-21} = opcod;
187 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000188}
Evan Chengbe998242008-11-06 08:47:38 +0000189class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000190 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000191 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000192 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000193
Evan Cheng2e62b662008-09-01 01:51:14 +0000194
195// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000196class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000197 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000198 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000199 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000200 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000201}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000202
203// loads
Evan Chengbe998242008-11-06 08:47:38 +0000204class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000205 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000206 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000207 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000208 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000209 let Inst{21} = 0; // W bit
210 let Inst{22} = 0; // B bit
211 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000212 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000213}
Evan Chengbe998242008-11-06 08:47:38 +0000214class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000215 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000216 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000217 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000218 let Inst{20} = 1; // L bit
219 let Inst{21} = 0; // W bit
220 let Inst{22} = 0; // B bit
221 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000222 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000223}
Evan Chengbe998242008-11-06 08:47:38 +0000224class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000225 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000226 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000227 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000228 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000229 let Inst{21} = 0; // W bit
230 let Inst{22} = 1; // B bit
231 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000232 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000233}
Evan Chengbe998242008-11-06 08:47:38 +0000234class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000235 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000236 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000237 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000238 let Inst{20} = 1; // L bit
239 let Inst{21} = 0; // W bit
240 let Inst{22} = 1; // B bit
241 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000242 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000243}
Evan Chengda020022008-08-31 19:02:21 +0000244
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000245// stores
Evan Chengbe998242008-11-06 08:47:38 +0000246class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000247 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000248 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000249 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000250 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000251 let Inst{21} = 0; // W bit
252 let Inst{22} = 0; // B bit
253 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000254 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000255}
Evan Chengbe998242008-11-06 08:47:38 +0000256class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000257 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000258 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000259 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000260 let Inst{20} = 0; // L bit
261 let Inst{21} = 0; // W bit
262 let Inst{22} = 0; // B bit
263 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000264 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000265}
Evan Chengbe998242008-11-06 08:47:38 +0000266class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000267 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000268 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000269 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000270 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000271 let Inst{21} = 0; // W bit
272 let Inst{22} = 1; // B bit
273 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000274 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000275}
Evan Chengbe998242008-11-06 08:47:38 +0000276class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000277 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000278 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000279 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000280 let Inst{20} = 0; // L bit
281 let Inst{21} = 0; // W bit
282 let Inst{22} = 1; // B bit
283 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000284 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000285}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000286
Evan Chengac92c3f2008-09-01 07:00:14 +0000287// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000288class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000289 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000290 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000291 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000292 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000293 let Inst{21} = 1; // W bit
294 let Inst{22} = 0; // B bit
295 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000296 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000297}
Evan Chengbe998242008-11-06 08:47:38 +0000298class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000299 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000300 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000301 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000302 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000303 let Inst{21} = 1; // W bit
304 let Inst{22} = 1; // B bit
305 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000306 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000307}
308
Evan Chengac92c3f2008-09-01 07:00:14 +0000309// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000310class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000311 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000312 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000313 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000314 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000315 let Inst{21} = 1; // W bit
316 let Inst{22} = 0; // B bit
317 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000318 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000319}
Evan Chengbe998242008-11-06 08:47:38 +0000320class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000321 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000322 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000323 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000324 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000325 let Inst{21} = 1; // W bit
326 let Inst{22} = 1; // B bit
327 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000328 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000329}
330
Evan Chengac92c3f2008-09-01 07:00:14 +0000331// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000332class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000333 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000334 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000335 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000336 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000337 let Inst{21} = 0; // W bit
338 let Inst{22} = 0; // B bit
339 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000340 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000341}
Evan Chengbe998242008-11-06 08:47:38 +0000342class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000343 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000344 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000345 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000346 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000347 let Inst{21} = 0; // W bit
348 let Inst{22} = 1; // B bit
349 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000350 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000351}
352
Evan Chengac92c3f2008-09-01 07:00:14 +0000353// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000354class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000355 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000356 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000357 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000358 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000359 let Inst{21} = 0; // W bit
360 let Inst{22} = 0; // B bit
361 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000362 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000363}
Evan Chengbe998242008-11-06 08:47:38 +0000364class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000365 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000366 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000367 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000368 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000369 let Inst{21} = 0; // W bit
370 let Inst{22} = 1; // B bit
371 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000372 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000373}
374
Evan Cheng2e62b662008-09-01 01:51:14 +0000375// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000376class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000377 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000378 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000379 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000380class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000381 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000382 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000383 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000384
Evan Chengac92c3f2008-09-01 07:00:14 +0000385// loads
Evan Chengbe998242008-11-06 08:47:38 +0000386class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000387 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000388 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000389 asm, "", pattern> {
390 let Inst{4} = 1;
391 let Inst{5} = 1; // H bit
392 let Inst{6} = 0; // S bit
393 let Inst{7} = 1;
394 let Inst{20} = 1; // L bit
395 let Inst{21} = 0; // W bit
396 let Inst{24} = 1; // P bit
397}
Evan Chengbe998242008-11-06 08:47:38 +0000398class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000399 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000400 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000401 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000402 let Inst{4} = 1;
403 let Inst{5} = 1; // H bit
404 let Inst{6} = 0; // S bit
405 let Inst{7} = 1;
406 let Inst{20} = 1; // L bit
407 let Inst{21} = 0; // W bit
408 let Inst{24} = 1; // P bit
409}
Evan Chengbe998242008-11-06 08:47:38 +0000410class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000411 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000412 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000413 asm, "", pattern> {
414 let Inst{4} = 1;
415 let Inst{5} = 1; // H bit
416 let Inst{6} = 1; // S bit
417 let Inst{7} = 1;
418 let Inst{20} = 1; // L bit
419 let Inst{21} = 0; // W bit
420 let Inst{24} = 1; // P bit
421}
Evan Chengbe998242008-11-06 08:47:38 +0000422class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000423 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000424 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000425 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000426 let Inst{4} = 1;
427 let Inst{5} = 1; // H bit
428 let Inst{6} = 1; // S bit
429 let Inst{7} = 1;
430 let Inst{20} = 1; // L bit
431 let Inst{21} = 0; // W bit
432 let Inst{24} = 1; // P bit
433}
Evan Chengbe998242008-11-06 08:47:38 +0000434class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000435 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000436 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000437 asm, "", pattern> {
438 let Inst{4} = 1;
439 let Inst{5} = 0; // H bit
440 let Inst{6} = 1; // S bit
441 let Inst{7} = 1;
442 let Inst{20} = 1; // L bit
443 let Inst{21} = 0; // W bit
444 let Inst{24} = 1; // P bit
445}
Evan Chengbe998242008-11-06 08:47:38 +0000446class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000447 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000448 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000449 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000450 let Inst{4} = 1;
451 let Inst{5} = 0; // H bit
452 let Inst{6} = 1; // S bit
453 let Inst{7} = 1;
454 let Inst{20} = 1; // L bit
455 let Inst{21} = 0; // W bit
456 let Inst{24} = 1; // P bit
457}
Evan Chengbe998242008-11-06 08:47:38 +0000458class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000459 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000460 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000461 asm, "", pattern> {
462 let Inst{4} = 1;
463 let Inst{5} = 0; // H bit
464 let Inst{6} = 1; // S bit
465 let Inst{7} = 1;
466 let Inst{20} = 0; // L bit
467 let Inst{21} = 0; // W bit
468 let Inst{24} = 1; // P bit
469}
470
471// stores
Evan Chengbe998242008-11-06 08:47:38 +0000472class AI3sth<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} = 1; // H bit
478 let Inst{6} = 0; // 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}
Evan Chengbe998242008-11-06 08:47:38 +0000484class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000485 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000486 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000487 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000488 let Inst{4} = 1;
489 let Inst{5} = 1; // H bit
490 let Inst{6} = 0; // S bit
491 let Inst{7} = 1;
492 let Inst{20} = 0; // L bit
493 let Inst{21} = 0; // W bit
494 let Inst{24} = 1; // P bit
495}
Evan Chengbe998242008-11-06 08:47:38 +0000496class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000497 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000498 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000499 asm, "", pattern> {
500 let Inst{4} = 1;
501 let Inst{5} = 1; // H bit
502 let Inst{6} = 1; // S bit
503 let Inst{7} = 1;
504 let Inst{20} = 0; // L bit
505 let Inst{21} = 0; // W bit
506 let Inst{24} = 1; // P bit
507}
508
509// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000510class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000511 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000512 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000513 asm, cstr, pattern> {
514 let Inst{4} = 1;
515 let Inst{5} = 1; // H bit
516 let Inst{6} = 0; // S bit
517 let Inst{7} = 1;
518 let Inst{20} = 1; // L bit
519 let Inst{21} = 1; // W bit
520 let Inst{24} = 1; // P bit
521}
Evan Chengbe998242008-11-06 08:47:38 +0000522class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000523 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000524 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000525 asm, cstr, pattern> {
526 let Inst{4} = 1;
527 let Inst{5} = 1; // H bit
528 let Inst{6} = 1; // S bit
529 let Inst{7} = 1;
530 let Inst{20} = 1; // L bit
531 let Inst{21} = 1; // W bit
532 let Inst{24} = 1; // P bit
533}
Evan Chengbe998242008-11-06 08:47:38 +0000534class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000535 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000536 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000537 asm, cstr, pattern> {
538 let Inst{4} = 1;
539 let Inst{5} = 0; // H bit
540 let Inst{6} = 1; // S bit
541 let Inst{7} = 1;
542 let Inst{20} = 1; // L bit
543 let Inst{21} = 1; // W bit
544 let Inst{24} = 1; // P bit
545}
546
547// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000548class AI3sthpr<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} = 1; // H bit
554 let Inst{6} = 0; // S bit
555 let Inst{7} = 1;
556 let Inst{20} = 0; // L bit
557 let Inst{21} = 1; // W bit
558 let Inst{24} = 1; // P bit
559}
560
561// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000562class AI3ldhpo<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, IndexModePost, 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} = 1; // L bit
571 let Inst{21} = 1; // W bit
572 let Inst{24} = 0; // P bit
573}
Evan Chengbe998242008-11-06 08:47:38 +0000574class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000575 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000576 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000577 asm, cstr,pattern> {
578 let Inst{4} = 1;
579 let Inst{5} = 1; // H bit
580 let Inst{6} = 1; // S bit
581 let Inst{7} = 1;
582 let Inst{20} = 1; // L bit
583 let Inst{21} = 1; // W bit
584 let Inst{24} = 0; // P bit
585}
Evan Chengbe998242008-11-06 08:47:38 +0000586class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000587 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000588 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000589 asm, cstr,pattern> {
590 let Inst{4} = 1;
591 let Inst{5} = 0; // H bit
592 let Inst{6} = 1; // S bit
593 let Inst{7} = 1;
594 let Inst{20} = 1; // L bit
595 let Inst{21} = 1; // W bit
596 let Inst{24} = 0; // P bit
597}
598
599// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000600class AI3sthpo<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} = 1; // H bit
606 let Inst{6} = 0; // S bit
607 let Inst{7} = 1;
608 let Inst{20} = 0; // L bit
609 let Inst{21} = 1; // W bit
610 let Inst{24} = 0; // P bit
611}
612
613
Evan Cheng2e62b662008-09-01 01:51:14 +0000614// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000615class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000616 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000617 "", pattern> {
618 let Inst{20} = 1; // L bit
619 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000620 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000621}
Evan Chengf8e8b622008-11-06 17:48:05 +0000622class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000623 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000624 "", pattern> {
625 let Inst{20} = 0; // L bit
626 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000627 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000628}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000629
Jim Grosbach1feed042008-11-03 18:38:31 +0000630// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000631class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000632 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000633 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000634 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000635 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000636 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000637 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000638}
Evan Chengbe998242008-11-06 08:47:38 +0000639class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000640 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000641 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000642 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000643 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000644 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000645}
646
647// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000648class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000649 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000650 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000651 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000652 let Inst{7-4} = 0b1001;
653 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000654 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000655}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000656
Evan Cheng38396be2008-11-06 03:35:07 +0000657// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000658class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000659 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000660 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000661 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000662 let Inst{4} = 0;
663 let Inst{7} = 1;
664 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000665 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000666}
667
Evan Cheng37afa432008-11-06 22:15:19 +0000668// Extend instructions.
669class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
670 string asm, list<dag> pattern>
671 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
672 asm, "", pattern> {
673 let Inst{7-4} = 0b0111;
674 let Inst{27-20} = opcod;
675}
676
Evan Chengc2121a22008-11-07 01:41:35 +0000677// Misc Arithmetic instructions.
678class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
679 string asm, list<dag> pattern>
680 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
681 asm, "", pattern> {
682 let Inst{27-20} = opcod;
683}
684
Evan Cheng7b0249b2008-08-28 23:39:26 +0000685//===----------------------------------------------------------------------===//
686
687// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
688class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
689 list<Predicate> Predicates = [IsARM];
690}
691class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
692 list<Predicate> Predicates = [IsARM, HasV5TE];
693}
694class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
695 list<Predicate> Predicates = [IsARM, HasV6];
696}
Evan Cheng34a46e12008-08-29 06:41:12 +0000697
698//===----------------------------------------------------------------------===//
699//
700// Thumb Instruction Format Definitions.
701//
702
703
704// TI - Thumb instruction.
705
706class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
707 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000708 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000709 let OutOperandList = outs;
710 let InOperandList = ins;
711 let AsmString = asm;
712 let Pattern = pattern;
713 list<Predicate> Predicates = [IsThumb];
714}
715
716class TI<dag outs, dag ins, string asm, list<dag> pattern>
717 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
718class TI1<dag outs, dag ins, string asm, list<dag> pattern>
719 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
720class TI2<dag outs, dag ins, string asm, list<dag> pattern>
721 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
722class TI4<dag outs, dag ins, string asm, list<dag> pattern>
723 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
724class TIs<dag outs, dag ins, string asm, list<dag> pattern>
725 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
726
727// Two-address instructions
728class TIt<dag outs, dag ins, string asm, list<dag> pattern>
729 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
730
731// BL, BLX(1) are translated by assembler into two instructions
732class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
733 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
734
735// BR_JT instructions
736class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
737 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
738
739
740//===----------------------------------------------------------------------===//
741
Evan Chengc63e15e2008-11-11 02:11:05 +0000742//===----------------------------------------------------------------------===//
743// ARM VFP Instruction templates.
744//
745
Evan Chengbb786b32008-11-11 21:48:44 +0000746// ARM VFP addrmode5 loads and stores
747class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
748 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000749 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000750 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000751 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000752 let Inst{27-24} = opcod1;
753 let Inst{21-20} = opcod2;
754 let Inst{11-8} = 0b1011;
Evan Chengc63e15e2008-11-11 02:11:05 +0000755}
756
Evan Chengbb786b32008-11-11 21:48:44 +0000757class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
758 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000759 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000760 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000761 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000762 let Inst{27-24} = opcod1;
763 let Inst{21-20} = opcod2;
764 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +0000765}
766
Evan Chengbb786b32008-11-11 21:48:44 +0000767// Load / store multiple
768class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
769 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
770 VFPLdStMulFrm, asm, "", pattern> {
771 // TODO: Mark the instructions with the appropriate subtarget info.
772 let Inst{27-25} = 0b110;
773 let Inst{11-8} = 0b1011;
774}
775
776class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
777 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
778 VFPLdStMulFrm, asm, "", pattern> {
779 // TODO: Mark the instructions with the appropriate subtarget info.
780 let Inst{27-25} = 0b110;
781 let Inst{11-8} = 0b1010;
782}
783
784
Evan Chengc63e15e2008-11-11 02:11:05 +0000785// Double precision, unary
786class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
787 string opc, string asm, list<dag> pattern>
788 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
789 let Inst{27-20} = opcod1;
790 let Inst{19-16} = opcod2;
791 let Inst{11-8} = 0b1011;
792 let Inst{7-4} = opcod3;
793}
794
795// Double precision, binary
796class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
797 string asm, list<dag> pattern>
798 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
799 let Inst{27-20} = opcod;
800 let Inst{11-8} = 0b1011;
801}
802
803// Single precision, unary
804class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
805 string opc, string asm, list<dag> pattern>
806 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
807 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
808 let Inst{27-20} = opcod1;
809 let Inst{19-16} = opcod2;
810 let Inst{11-8} = 0b1010;
811 let Inst{7-4} = opcod3;
812}
813
814// Single precision, binary
815class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
816 string asm, list<dag> pattern>
817 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
818 // Bit 22 (D bit) can be changed during instruction encoding.
819 let Inst{27-20} = opcod;
820 let Inst{11-8} = 0b1010;
821}
822
Evan Cheng9d3cc182008-11-11 19:40:26 +0000823class AVConv1I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
824 string asm, list<dag> pattern>
825 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
826 let Inst{27-20} = opcod1;
827 let Inst{11-8} = opcod2;
828 let Inst{4} = 1;
829}
830
Evan Cheng828ccdc2008-11-11 22:46:12 +0000831class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
832 string asm, list<dag> pattern>
833 : AI<oops, iops, VFPConv2Frm, opc, asm, pattern> {
834 let Inst{27-20} = opcod1;
835 let Inst{11-8} = opcod2;
836 let Inst{4} = 1;
837}
838
839class AVConv3I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
Evan Cheng9d3cc182008-11-11 19:40:26 +0000840 dag oops, dag iops, string opc, string asm, list<dag> pattern>
Evan Cheng828ccdc2008-11-11 22:46:12 +0000841 : AI<oops, iops, VFPConv3Frm, opc, asm, pattern> {
Evan Cheng9d3cc182008-11-11 19:40:26 +0000842 let Inst{27-20} = opcod1;
843 let Inst{19-16} = opcod2;
844 let Inst{11-8} = opcod3;
845 let Inst{6} = 1;
846}
847
Evan Chengc63e15e2008-11-11 02:11:05 +0000848//===----------------------------------------------------------------------===//
849
Evan Cheng34a46e12008-08-29 06:41:12 +0000850
851// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
852class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
853 list<Predicate> Predicates = [IsThumb];
854}
855
856class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
857 list<Predicate> Predicates = [IsThumb, HasV5T];
858}