blob: 5efa76db8e143591e74f6000952a4777647e11b0 [file] [log] [blame]
Evan Cheng7b0249b2008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10//===----------------------------------------------------------------------===//
11//
12// ARM Instruction Format Definitions.
13//
14
15// Format specifies the encoding used by the instruction. This is part of the
16// ad-hoc solution used to emit machine instruction encodings by our machine
17// code emitter.
18class Format<bits<5> val> {
19 bits<5> Value = val;
20}
21
22def Pseudo : Format<1>;
Evan Chengee80fb72008-11-06 01:21:28 +000023def MulFrm : Format<2>;
Evan Chengf8e8b622008-11-06 17:48:05 +000024def BrFrm : Format<3>;
25def BrMiscFrm : Format<4>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000026
Evan Cheng38396be2008-11-06 03:35:07 +000027def DPFrm : Format<5>;
28def DPSoRegFrm : Format<6>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000029
Evan Cheng38396be2008-11-06 03:35:07 +000030def LdFrm : Format<7>;
31def StFrm : Format<8>;
32def LdMiscFrm : Format<9>;
33def StMiscFrm : Format<10>;
34def LdMulFrm : Format<11>;
35def StMulFrm : Format<12>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000036
Evan Cheng37afa432008-11-06 22:15:19 +000037def ArithMiscFrm: Format<13>;
38def ExtFrm : Format<14>;
Evan Chengc63e15e2008-11-11 02:11:05 +000039def VFPFrm : Format<15>;
40def VFPUnaryFrm : Format<16>;
41def VFPBinaryFrm: Format<17>;
Evan Cheng9d3cc182008-11-11 19:40:26 +000042def VFPConv1Frm : Format<18>;
43def VFPConv2Frm : Format<19>;
44def ThumbFrm : Format<20>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000045
Evan Cheng86a926a2008-11-05 18:35:52 +000046// Misc flag for data processing instructions that indicates whether
47// the instruction has a Rn register operand.
48class UnaryDP { bit isUnaryDataProc = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000049
Evan Cheng7b0249b2008-08-28 23:39:26 +000050//===----------------------------------------------------------------------===//
51
52// ARM Instruction templates.
53//
54
Evan Chengbe998242008-11-06 08:47:38 +000055class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +000056 Format f, string cstr>
57 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +000058 field bits<32> Inst;
59
Evan Cheng7b0249b2008-08-28 23:39:26 +000060 let Namespace = "ARM";
61
Evan Cheng86a926a2008-11-05 18:35:52 +000062 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +000063 AddrMode AM = am;
64 bits<4> AddrModeBits = AM.Value;
65
66 SizeFlagVal SZ = sz;
67 bits<3> SizeFlag = SZ.Value;
68
69 IndexMode IM = im;
70 bits<2> IndexModeBits = IM.Value;
71
72 Format F = f;
73 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +000074
75 //
76 // Attributes specific to ARM instructions...
77 //
78 bit isUnaryDataProc = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +000079
80 let Constraints = cstr;
81}
82
83class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000084 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000085 let OutOperandList = oops;
86 let InOperandList = iops;
87 let AsmString = asm;
88 let Pattern = pattern;
89}
90
91// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +000092class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +000093 IndexMode im, Format f, string opc, string asm, string cstr,
94 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000095 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000096 let OutOperandList = oops;
97 let InOperandList = !con(iops, (ops pred:$p));
98 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
99 let Pattern = pattern;
100 list<Predicate> Predicates = [IsARM];
101}
102
103// Same as I except it can optionally modify CPSR. Note it's modeled as
104// an input operand since by default it's a zero register. It will
105// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000106class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000107 IndexMode im, Format f, string opc, string asm, string cstr,
108 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000109 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000110 let OutOperandList = oops;
111 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
112 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
113 let Pattern = pattern;
114 list<Predicate> Predicates = [IsARM];
115}
116
Evan Chengc5409a82008-09-01 07:19:00 +0000117// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000118class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000119 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000120 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000121 let OutOperandList = oops;
122 let InOperandList = iops;
123 let AsmString = asm;
124 let Pattern = pattern;
125 list<Predicate> Predicates = [IsARM];
126}
127
Evan Chengbe998242008-11-06 08:47:38 +0000128class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000129 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000130 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000131 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000132class AsI<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 : sI<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 AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000137 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000138 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000139 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000140
141// Ctrl flow instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000142class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000143 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000144 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000145 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000146 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000147}
Evan Chengf8e8b622008-11-06 17:48:05 +0000148class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
149 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000150 "", 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 ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
154 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000155 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000156
157// BR_JT instructions
Evan Cheng0f63ae12008-11-07 09:06:08 +0000158class JTI<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000159 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000160 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000161
162// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000163class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
164 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000165 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000166 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000167 let Inst{24-21} = opcod;
168 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000169}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000170class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
171 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000172 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000173 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000174 let Inst{24-21} = opcod;
175 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000176}
Evan Chengc5409a82008-09-01 07:19:00 +0000177class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
178 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000179 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000180 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000181 let Inst{24-21} = opcod;
182 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000183}
Evan Chengbe998242008-11-06 08:47:38 +0000184class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000185 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000186 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000187 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000188
Evan Cheng2e62b662008-09-01 01:51:14 +0000189
190// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000191class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000192 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000193 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000194 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000195 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000196}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000197
198// loads
Evan Chengbe998242008-11-06 08:47:38 +0000199class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000200 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000201 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000202 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000203 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000204 let Inst{21} = 0; // W bit
205 let Inst{22} = 0; // B bit
206 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000207 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000208}
Evan Chengbe998242008-11-06 08:47:38 +0000209class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000210 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000211 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000212 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000213 let Inst{20} = 1; // L bit
214 let Inst{21} = 0; // W bit
215 let Inst{22} = 0; // B bit
216 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000217 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000218}
Evan Chengbe998242008-11-06 08:47:38 +0000219class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000220 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000221 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000222 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000223 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000224 let Inst{21} = 0; // W bit
225 let Inst{22} = 1; // B bit
226 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000227 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000228}
Evan Chengbe998242008-11-06 08:47:38 +0000229class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000230 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000231 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000232 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000233 let Inst{20} = 1; // L bit
234 let Inst{21} = 0; // W bit
235 let Inst{22} = 1; // B bit
236 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000237 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000238}
Evan Chengda020022008-08-31 19:02:21 +0000239
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000240// stores
Evan Chengbe998242008-11-06 08:47:38 +0000241class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000242 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000243 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000244 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000245 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000246 let Inst{21} = 0; // W bit
247 let Inst{22} = 0; // B bit
248 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000249 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000250}
Evan Chengbe998242008-11-06 08:47:38 +0000251class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000252 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000253 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000254 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000255 let Inst{20} = 0; // L bit
256 let Inst{21} = 0; // W bit
257 let Inst{22} = 0; // B bit
258 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000259 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000260}
Evan Chengbe998242008-11-06 08:47:38 +0000261class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000262 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000263 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000264 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000265 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000266 let Inst{21} = 0; // W bit
267 let Inst{22} = 1; // B bit
268 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000269 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000270}
Evan Chengbe998242008-11-06 08:47:38 +0000271class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000272 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000273 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000274 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000275 let Inst{20} = 0; // L bit
276 let Inst{21} = 0; // W bit
277 let Inst{22} = 1; // B bit
278 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000279 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000280}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000281
Evan Chengac92c3f2008-09-01 07:00:14 +0000282// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000283class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000284 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000285 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000286 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000287 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000288 let Inst{21} = 1; // W bit
289 let Inst{22} = 0; // B bit
290 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000291 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000292}
Evan Chengbe998242008-11-06 08:47:38 +0000293class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000294 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000295 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000296 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000297 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000298 let Inst{21} = 1; // W bit
299 let Inst{22} = 1; // B bit
300 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000301 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000302}
303
Evan Chengac92c3f2008-09-01 07:00:14 +0000304// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000305class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000306 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000307 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000308 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000309 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000310 let Inst{21} = 1; // W bit
311 let Inst{22} = 0; // B bit
312 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000313 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000314}
Evan Chengbe998242008-11-06 08:47:38 +0000315class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000316 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000317 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000318 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000319 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000320 let Inst{21} = 1; // W bit
321 let Inst{22} = 1; // B bit
322 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000323 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000324}
325
Evan Chengac92c3f2008-09-01 07:00:14 +0000326// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000327class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000328 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000329 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000330 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000331 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000332 let Inst{21} = 0; // W bit
333 let Inst{22} = 0; // B bit
334 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000335 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000336}
Evan Chengbe998242008-11-06 08:47:38 +0000337class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000338 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000339 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000340 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000341 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000342 let Inst{21} = 0; // W bit
343 let Inst{22} = 1; // B bit
344 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000345 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000346}
347
Evan Chengac92c3f2008-09-01 07:00:14 +0000348// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000349class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000350 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000351 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000352 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000353 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000354 let Inst{21} = 0; // W bit
355 let Inst{22} = 0; // B bit
356 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000357 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000358}
Evan Chengbe998242008-11-06 08:47:38 +0000359class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000360 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000361 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000362 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000363 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000364 let Inst{21} = 0; // W bit
365 let Inst{22} = 1; // B bit
366 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000367 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000368}
369
Evan Cheng2e62b662008-09-01 01:51:14 +0000370// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000371class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000372 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000373 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000374 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000375class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000376 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000377 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000378 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000379
Evan Chengac92c3f2008-09-01 07:00:14 +0000380// loads
Evan Chengbe998242008-11-06 08:47:38 +0000381class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000382 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000383 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000384 asm, "", pattern> {
385 let Inst{4} = 1;
386 let Inst{5} = 1; // H bit
387 let Inst{6} = 0; // S bit
388 let Inst{7} = 1;
389 let Inst{20} = 1; // L bit
390 let Inst{21} = 0; // W bit
391 let Inst{24} = 1; // P bit
392}
Evan Chengbe998242008-11-06 08:47:38 +0000393class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000394 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000395 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000396 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000397 let Inst{4} = 1;
398 let Inst{5} = 1; // H bit
399 let Inst{6} = 0; // S bit
400 let Inst{7} = 1;
401 let Inst{20} = 1; // L bit
402 let Inst{21} = 0; // W bit
403 let Inst{24} = 1; // P bit
404}
Evan Chengbe998242008-11-06 08:47:38 +0000405class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000406 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000407 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000408 asm, "", pattern> {
409 let Inst{4} = 1;
410 let Inst{5} = 1; // H bit
411 let Inst{6} = 1; // S bit
412 let Inst{7} = 1;
413 let Inst{20} = 1; // L bit
414 let Inst{21} = 0; // W bit
415 let Inst{24} = 1; // P bit
416}
Evan Chengbe998242008-11-06 08:47:38 +0000417class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000418 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000419 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000420 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000421 let Inst{4} = 1;
422 let Inst{5} = 1; // H bit
423 let Inst{6} = 1; // S bit
424 let Inst{7} = 1;
425 let Inst{20} = 1; // L bit
426 let Inst{21} = 0; // W bit
427 let Inst{24} = 1; // P bit
428}
Evan Chengbe998242008-11-06 08:47:38 +0000429class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000430 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000431 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000432 asm, "", pattern> {
433 let Inst{4} = 1;
434 let Inst{5} = 0; // H bit
435 let Inst{6} = 1; // S bit
436 let Inst{7} = 1;
437 let Inst{20} = 1; // L bit
438 let Inst{21} = 0; // W bit
439 let Inst{24} = 1; // P bit
440}
Evan Chengbe998242008-11-06 08:47:38 +0000441class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000442 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000443 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000444 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000445 let Inst{4} = 1;
446 let Inst{5} = 0; // H bit
447 let Inst{6} = 1; // S bit
448 let Inst{7} = 1;
449 let Inst{20} = 1; // L bit
450 let Inst{21} = 0; // W bit
451 let Inst{24} = 1; // P bit
452}
Evan Chengbe998242008-11-06 08:47:38 +0000453class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000454 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000455 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000456 asm, "", pattern> {
457 let Inst{4} = 1;
458 let Inst{5} = 0; // H bit
459 let Inst{6} = 1; // S bit
460 let Inst{7} = 1;
461 let Inst{20} = 0; // L bit
462 let Inst{21} = 0; // W bit
463 let Inst{24} = 1; // P bit
464}
465
466// stores
Evan Chengbe998242008-11-06 08:47:38 +0000467class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000468 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000469 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000470 asm, "", pattern> {
471 let Inst{4} = 1;
472 let Inst{5} = 1; // H bit
473 let Inst{6} = 0; // S bit
474 let Inst{7} = 1;
475 let Inst{20} = 0; // L bit
476 let Inst{21} = 0; // W bit
477 let Inst{24} = 1; // P bit
478}
Evan Chengbe998242008-11-06 08:47:38 +0000479class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000480 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000481 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000482 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000483 let Inst{4} = 1;
484 let Inst{5} = 1; // H bit
485 let Inst{6} = 0; // S bit
486 let Inst{7} = 1;
487 let Inst{20} = 0; // L bit
488 let Inst{21} = 0; // W bit
489 let Inst{24} = 1; // P bit
490}
Evan Chengbe998242008-11-06 08:47:38 +0000491class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000492 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000493 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000494 asm, "", pattern> {
495 let Inst{4} = 1;
496 let Inst{5} = 1; // H bit
497 let Inst{6} = 1; // S bit
498 let Inst{7} = 1;
499 let Inst{20} = 0; // L bit
500 let Inst{21} = 0; // W bit
501 let Inst{24} = 1; // P bit
502}
503
504// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000505class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000506 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000507 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000508 asm, cstr, pattern> {
509 let Inst{4} = 1;
510 let Inst{5} = 1; // H bit
511 let Inst{6} = 0; // S bit
512 let Inst{7} = 1;
513 let Inst{20} = 1; // L bit
514 let Inst{21} = 1; // W bit
515 let Inst{24} = 1; // P bit
516}
Evan Chengbe998242008-11-06 08:47:38 +0000517class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000518 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000519 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000520 asm, cstr, pattern> {
521 let Inst{4} = 1;
522 let Inst{5} = 1; // H bit
523 let Inst{6} = 1; // S bit
524 let Inst{7} = 1;
525 let Inst{20} = 1; // L bit
526 let Inst{21} = 1; // W bit
527 let Inst{24} = 1; // P bit
528}
Evan Chengbe998242008-11-06 08:47:38 +0000529class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000530 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000531 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000532 asm, cstr, pattern> {
533 let Inst{4} = 1;
534 let Inst{5} = 0; // H bit
535 let Inst{6} = 1; // S bit
536 let Inst{7} = 1;
537 let Inst{20} = 1; // L bit
538 let Inst{21} = 1; // W bit
539 let Inst{24} = 1; // P bit
540}
541
542// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000543class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000544 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000545 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000546 asm, cstr, pattern> {
547 let Inst{4} = 1;
548 let Inst{5} = 1; // H bit
549 let Inst{6} = 0; // S bit
550 let Inst{7} = 1;
551 let Inst{20} = 0; // L bit
552 let Inst{21} = 1; // W bit
553 let Inst{24} = 1; // P bit
554}
555
556// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000557class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000558 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000559 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000560 asm, cstr,pattern> {
561 let Inst{4} = 1;
562 let Inst{5} = 1; // H bit
563 let Inst{6} = 0; // S bit
564 let Inst{7} = 1;
565 let Inst{20} = 1; // L bit
566 let Inst{21} = 1; // W bit
567 let Inst{24} = 0; // P bit
568}
Evan Chengbe998242008-11-06 08:47:38 +0000569class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000570 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000571 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000572 asm, cstr,pattern> {
573 let Inst{4} = 1;
574 let Inst{5} = 1; // H bit
575 let Inst{6} = 1; // S bit
576 let Inst{7} = 1;
577 let Inst{20} = 1; // L bit
578 let Inst{21} = 1; // W bit
579 let Inst{24} = 0; // P bit
580}
Evan Chengbe998242008-11-06 08:47:38 +0000581class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000582 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000583 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000584 asm, cstr,pattern> {
585 let Inst{4} = 1;
586 let Inst{5} = 0; // H bit
587 let Inst{6} = 1; // S bit
588 let Inst{7} = 1;
589 let Inst{20} = 1; // L bit
590 let Inst{21} = 1; // W bit
591 let Inst{24} = 0; // P bit
592}
593
594// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000595class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000596 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000597 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000598 asm, cstr,pattern> {
599 let Inst{4} = 1;
600 let Inst{5} = 1; // H bit
601 let Inst{6} = 0; // S bit
602 let Inst{7} = 1;
603 let Inst{20} = 0; // L bit
604 let Inst{21} = 1; // W bit
605 let Inst{24} = 0; // P bit
606}
607
608
Evan Cheng2e62b662008-09-01 01:51:14 +0000609// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000610class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000611 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000612 "", pattern> {
613 let Inst{20} = 1; // L bit
614 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000615 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000616}
Evan Chengf8e8b622008-11-06 17:48:05 +0000617class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000618 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000619 "", pattern> {
620 let Inst{20} = 0; // L bit
621 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000622 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000623}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000624
Jim Grosbach1feed042008-11-03 18:38:31 +0000625// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000626class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000627 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000628 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000629 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000630 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000631 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000632 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000633}
Evan Chengbe998242008-11-06 08:47:38 +0000634class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000635 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000636 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000637 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000638 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000639 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000640}
641
642// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000643class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000644 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000645 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000646 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000647 let Inst{7-4} = 0b1001;
648 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000649 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000650}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000651
Evan Cheng38396be2008-11-06 03:35:07 +0000652// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000653class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000654 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000655 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000656 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000657 let Inst{4} = 0;
658 let Inst{7} = 1;
659 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000660 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000661}
662
Evan Cheng37afa432008-11-06 22:15:19 +0000663// Extend instructions.
664class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
665 string asm, list<dag> pattern>
666 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
667 asm, "", pattern> {
668 let Inst{7-4} = 0b0111;
669 let Inst{27-20} = opcod;
670}
671
Evan Chengc2121a22008-11-07 01:41:35 +0000672// Misc Arithmetic instructions.
673class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
674 string asm, list<dag> pattern>
675 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
676 asm, "", pattern> {
677 let Inst{27-20} = opcod;
678}
679
Evan Cheng7b0249b2008-08-28 23:39:26 +0000680//===----------------------------------------------------------------------===//
681
682// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
683class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
684 list<Predicate> Predicates = [IsARM];
685}
686class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
687 list<Predicate> Predicates = [IsARM, HasV5TE];
688}
689class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
690 list<Predicate> Predicates = [IsARM, HasV6];
691}
Evan Cheng34a46e12008-08-29 06:41:12 +0000692
693//===----------------------------------------------------------------------===//
694//
695// Thumb Instruction Format Definitions.
696//
697
698
699// TI - Thumb instruction.
700
701class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
702 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000703 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000704 let OutOperandList = outs;
705 let InOperandList = ins;
706 let AsmString = asm;
707 let Pattern = pattern;
708 list<Predicate> Predicates = [IsThumb];
709}
710
711class TI<dag outs, dag ins, string asm, list<dag> pattern>
712 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
713class TI1<dag outs, dag ins, string asm, list<dag> pattern>
714 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
715class TI2<dag outs, dag ins, string asm, list<dag> pattern>
716 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
717class TI4<dag outs, dag ins, string asm, list<dag> pattern>
718 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
719class TIs<dag outs, dag ins, string asm, list<dag> pattern>
720 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
721
722// Two-address instructions
723class TIt<dag outs, dag ins, string asm, list<dag> pattern>
724 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
725
726// BL, BLX(1) are translated by assembler into two instructions
727class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
728 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
729
730// BR_JT instructions
731class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
732 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
733
734
735//===----------------------------------------------------------------------===//
736
Evan Chengc63e15e2008-11-11 02:11:05 +0000737//===----------------------------------------------------------------------===//
738// ARM VFP Instruction templates.
739//
740
741// ARM Float Instruction
742class ASI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
743 : AI<oops, iops, VFPFrm, opc, asm, pattern> {
744 // TODO: Mark the instructions with the appropriate subtarget info.
745}
746
747class ASI5<dag oops, dag iops, string opc, string asm, list<dag> pattern>
748 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
749 VFPFrm, opc, asm, "", pattern> {
750 // TODO: Mark the instructions with the appropriate subtarget info.
751}
752
753// ARM Double Instruction
754class ADI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
755 : AI<oops, iops, VFPFrm, opc, asm, pattern> {
756 // TODO: Mark the instructions with the appropriate subtarget info.
757}
758
759class ADI5<dag oops, dag iops, string opc, string asm, list<dag> pattern>
760 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
761 VFPFrm, opc, asm, "", pattern> {
762 // TODO: Mark the instructions with the appropriate subtarget info.
763}
764
765// Double precision, unary
766class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
767 string opc, string asm, list<dag> pattern>
768 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
769 let Inst{27-20} = opcod1;
770 let Inst{19-16} = opcod2;
771 let Inst{11-8} = 0b1011;
772 let Inst{7-4} = opcod3;
773}
774
775// Double precision, binary
776class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
777 string asm, list<dag> pattern>
778 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
779 let Inst{27-20} = opcod;
780 let Inst{11-8} = 0b1011;
781}
782
783// Single precision, unary
784class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
785 string opc, string asm, list<dag> pattern>
786 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
787 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
788 let Inst{27-20} = opcod1;
789 let Inst{19-16} = opcod2;
790 let Inst{11-8} = 0b1010;
791 let Inst{7-4} = opcod3;
792}
793
794// Single precision, binary
795class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
796 string asm, list<dag> pattern>
797 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
798 // Bit 22 (D bit) can be changed during instruction encoding.
799 let Inst{27-20} = opcod;
800 let Inst{11-8} = 0b1010;
801}
802
Evan Cheng9d3cc182008-11-11 19:40:26 +0000803class AVConv1I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
804 string asm, list<dag> pattern>
805 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
806 let Inst{27-20} = opcod1;
807 let Inst{11-8} = opcod2;
808 let Inst{4} = 1;
809}
810
811class AVConv2I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
812 dag oops, dag iops, string opc, string asm, list<dag> pattern>
813 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
814 let Inst{27-20} = opcod1;
815 let Inst{19-16} = opcod2;
816 let Inst{11-8} = opcod3;
817 let Inst{6} = 1;
818}
819
Evan Chengc63e15e2008-11-11 02:11:05 +0000820// Special cases.
821class AXSI<dag oops, dag iops, string asm, list<dag> pattern>
822 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone,
823 VFPFrm, asm, "", pattern> {
824 // TODO: Mark the instructions with the appropriate subtarget info.
825}
826
827class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
828 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
829 VFPFrm, asm, "", pattern> {
830 // TODO: Mark the instructions with the appropriate subtarget info.
831}
832
833class AXDI<dag oops, dag iops, string asm, list<dag> pattern>
834 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone,
835 VFPFrm, asm, "", pattern> {
836 // TODO: Mark the instructions with the appropriate subtarget info.
837}
838
839class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
840 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
841 VFPFrm, asm, "", pattern> {
842 // TODO: Mark the instructions with the appropriate subtarget info.
843}
844
845
846//===----------------------------------------------------------------------===//
847
Evan Cheng34a46e12008-08-29 06:41:12 +0000848
849// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
850class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
851 list<Predicate> Predicates = [IsThumb];
852}
853
854class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
855 list<Predicate> Predicates = [IsThumb, HasV5T];
856}