blob: cf48b2aa21e2d6e3161b6af54e4854a7853ddd7a [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 Cheng9d2c9232008-11-13 23:36:57 +000022def Pseudo : Format<0>;
23def MulFrm : Format<1>;
24def BrFrm : Format<2>;
25def BrMiscFrm : Format<3>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000026
Evan Cheng9d2c9232008-11-13 23:36:57 +000027def DPFrm : Format<4>;
28def DPSoRegFrm : Format<5>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000029
Evan Cheng9d2c9232008-11-13 23:36:57 +000030def LdFrm : Format<6>;
31def StFrm : Format<7>;
32def LdMiscFrm : Format<8>;
33def StMiscFrm : Format<9>;
34def LdStMulFrm : Format<10>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000035
Evan Cheng9d2c9232008-11-13 23:36:57 +000036def ArithMiscFrm : Format<11>;
37def ExtFrm : Format<12>;
Evan Chengbb786b32008-11-11 21:48:44 +000038
Evan Cheng9d2c9232008-11-13 23:36:57 +000039def VFPUnaryFrm : Format<13>;
40def VFPBinaryFrm : Format<14>;
41def VFPConv1Frm : Format<15>;
42def VFPConv2Frm : Format<16>;
43def VFPConv3Frm : Format<17>;
44def VFPConv4Frm : Format<18>;
45def VFPConv5Frm : Format<19>;
46def VFPLdStFrm : Format<20>;
47def VFPLdStMulFrm : Format<21>;
48def VFPMiscFrm : Format<22>;
Evan Chengbb786b32008-11-11 21:48:44 +000049
Evan Cheng9d2c9232008-11-13 23:36:57 +000050def ThumbFrm : Format<23>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000051
Bob Wilsone60fee02009-06-22 23:27:02 +000052def NEONFrm : Format<24>;
53def NEONGetLnFrm : Format<25>;
54def NEONSetLnFrm : Format<26>;
55def NEONDupFrm : Format<27>;
56
Evan Cheng86a926a2008-11-05 18:35:52 +000057// Misc flag for data processing instructions that indicates whether
58// the instruction has a Rn register operand.
59class UnaryDP { bit isUnaryDataProc = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000060
Evan Cheng7b0249b2008-08-28 23:39:26 +000061//===----------------------------------------------------------------------===//
62
63// ARM Instruction templates.
64//
65
Evan Chengbe998242008-11-06 08:47:38 +000066class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +000067 Format f, string cstr>
68 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +000069 field bits<32> Inst;
70
Evan Cheng7b0249b2008-08-28 23:39:26 +000071 let Namespace = "ARM";
72
Evan Cheng86a926a2008-11-05 18:35:52 +000073 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +000074 AddrMode AM = am;
75 bits<4> AddrModeBits = AM.Value;
76
77 SizeFlagVal SZ = sz;
78 bits<3> SizeFlag = SZ.Value;
79
80 IndexMode IM = im;
81 bits<2> IndexModeBits = IM.Value;
82
83 Format F = f;
84 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +000085
86 //
87 // Attributes specific to ARM instructions...
88 //
89 bit isUnaryDataProc = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +000090
91 let Constraints = cstr;
92}
93
94class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000095 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000096 let OutOperandList = oops;
97 let InOperandList = iops;
98 let AsmString = asm;
99 let Pattern = pattern;
100}
101
102// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +0000103class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000104 IndexMode im, Format f, string opc, string asm, string cstr,
105 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000106 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000107 let OutOperandList = oops;
108 let InOperandList = !con(iops, (ops pred:$p));
109 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
110 let Pattern = pattern;
111 list<Predicate> Predicates = [IsARM];
112}
113
114// Same as I except it can optionally modify CPSR. Note it's modeled as
115// an input operand since by default it's a zero register. It will
116// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000117class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000118 IndexMode im, Format f, string opc, string asm, string cstr,
119 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000120 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000121 let OutOperandList = oops;
122 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
123 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
124 let Pattern = pattern;
125 list<Predicate> Predicates = [IsARM];
126}
127
Evan Chengc5409a82008-09-01 07:19:00 +0000128// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000129class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000130 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000131 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000132 let OutOperandList = oops;
133 let InOperandList = iops;
134 let AsmString = asm;
135 let Pattern = pattern;
136 list<Predicate> Predicates = [IsARM];
137}
138
Evan Chengbe998242008-11-06 08:47:38 +0000139class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000140 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000141 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000142 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000143class AsI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000144 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000145 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000146 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000147class AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000148 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000149 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000150 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000151
152// Ctrl flow instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000153class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000154 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000155 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000156 asm, "", 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 ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
160 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000161 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000162 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000163}
Evan Chengf8e8b622008-11-06 17:48:05 +0000164class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
165 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000166 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000167
168// BR_JT instructions
Evan Cheng0f63ae12008-11-07 09:06:08 +0000169class JTI<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000170 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000171 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000172
173// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000174class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
175 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000176 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000177 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000178 let Inst{24-21} = opcod;
179 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000180}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000181class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
182 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000183 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000184 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000185 let Inst{24-21} = opcod;
186 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000187}
Evan Chengc5409a82008-09-01 07:19:00 +0000188class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
189 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000190 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000191 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000192 let Inst{24-21} = opcod;
193 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000194}
Evan Chengbe998242008-11-06 08:47:38 +0000195class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000196 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000197 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000198 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000199
Evan Cheng2e62b662008-09-01 01:51:14 +0000200
201// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000202class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000203 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000204 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000205 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000206 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000207}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000208
209// loads
Evan Chengbe998242008-11-06 08:47:38 +0000210class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000211 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000212 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000213 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000214 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000215 let Inst{21} = 0; // W bit
216 let Inst{22} = 0; // B bit
217 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000218 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000219}
Evan Chengbe998242008-11-06 08:47:38 +0000220class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000221 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000222 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000223 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000224 let Inst{20} = 1; // L bit
225 let Inst{21} = 0; // W bit
226 let Inst{22} = 0; // B bit
227 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000228 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000229}
Evan Chengbe998242008-11-06 08:47:38 +0000230class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000231 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000232 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000233 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000234 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000235 let Inst{21} = 0; // W bit
236 let Inst{22} = 1; // B bit
237 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000238 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000239}
Evan Chengbe998242008-11-06 08:47:38 +0000240class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000241 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000242 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000243 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000244 let Inst{20} = 1; // L bit
245 let Inst{21} = 0; // W bit
246 let Inst{22} = 1; // B bit
247 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000248 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000249}
Evan Chengda020022008-08-31 19:02:21 +0000250
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000251// stores
Evan Chengbe998242008-11-06 08:47:38 +0000252class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000253 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000254 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000255 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000256 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000257 let Inst{21} = 0; // W bit
258 let Inst{22} = 0; // B bit
259 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000260 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000261}
Evan Chengbe998242008-11-06 08:47:38 +0000262class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000263 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000264 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000265 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000266 let Inst{20} = 0; // L bit
267 let Inst{21} = 0; // W bit
268 let Inst{22} = 0; // B bit
269 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000270 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000271}
Evan Chengbe998242008-11-06 08:47:38 +0000272class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000273 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000274 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000275 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000276 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000277 let Inst{21} = 0; // W bit
278 let Inst{22} = 1; // B bit
279 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000280 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000281}
Evan Chengbe998242008-11-06 08:47:38 +0000282class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000283 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000284 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000285 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000286 let Inst{20} = 0; // L bit
287 let Inst{21} = 0; // W bit
288 let Inst{22} = 1; // B bit
289 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000290 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000291}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000292
Evan Chengac92c3f2008-09-01 07:00:14 +0000293// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000294class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000295 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000296 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000297 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000298 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000299 let Inst{21} = 1; // W bit
300 let Inst{22} = 0; // B bit
301 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000302 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000303}
Evan Chengbe998242008-11-06 08:47:38 +0000304class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000305 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000306 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000307 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000308 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000309 let Inst{21} = 1; // W bit
310 let Inst{22} = 1; // B bit
311 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000312 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000313}
314
Evan Chengac92c3f2008-09-01 07:00:14 +0000315// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000316class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000317 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000318 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000319 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000320 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000321 let Inst{21} = 1; // W bit
322 let Inst{22} = 0; // B bit
323 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000324 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000325}
Evan Chengbe998242008-11-06 08:47:38 +0000326class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000327 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000328 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000329 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000330 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000331 let Inst{21} = 1; // W bit
332 let Inst{22} = 1; // B bit
333 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000334 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000335}
336
Evan Chengac92c3f2008-09-01 07:00:14 +0000337// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000338class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000339 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000340 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000341 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000342 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000343 let Inst{21} = 0; // W bit
344 let Inst{22} = 0; // B bit
345 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000346 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000347}
Evan Chengbe998242008-11-06 08:47:38 +0000348class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000349 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000350 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000351 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000352 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000353 let Inst{21} = 0; // W bit
354 let Inst{22} = 1; // B bit
355 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000356 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000357}
358
Evan Chengac92c3f2008-09-01 07:00:14 +0000359// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000360class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000361 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000362 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000363 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000364 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000365 let Inst{21} = 0; // W bit
366 let Inst{22} = 0; // B bit
367 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000368 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000369}
Evan Chengbe998242008-11-06 08:47:38 +0000370class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000371 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000372 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000373 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000374 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000375 let Inst{21} = 0; // W bit
376 let Inst{22} = 1; // B bit
377 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000378 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000379}
380
Evan Cheng2e62b662008-09-01 01:51:14 +0000381// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000382class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000383 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000384 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000385 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000386class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000387 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000388 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000389 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000390
Evan Chengac92c3f2008-09-01 07:00:14 +0000391// loads
Evan Chengbe998242008-11-06 08:47:38 +0000392class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000393 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000394 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000395 asm, "", pattern> {
396 let Inst{4} = 1;
397 let Inst{5} = 1; // H bit
398 let Inst{6} = 0; // S bit
399 let Inst{7} = 1;
400 let Inst{20} = 1; // L bit
401 let Inst{21} = 0; // W bit
402 let Inst{24} = 1; // P bit
403}
Evan Chengbe998242008-11-06 08:47:38 +0000404class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000405 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000406 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000407 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000408 let Inst{4} = 1;
409 let Inst{5} = 1; // H bit
410 let Inst{6} = 0; // S bit
411 let Inst{7} = 1;
412 let Inst{20} = 1; // L bit
413 let Inst{21} = 0; // W bit
414 let Inst{24} = 1; // P bit
415}
Evan Chengbe998242008-11-06 08:47:38 +0000416class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000417 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000418 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000419 asm, "", pattern> {
420 let Inst{4} = 1;
421 let Inst{5} = 1; // H bit
422 let Inst{6} = 1; // S bit
423 let Inst{7} = 1;
424 let Inst{20} = 1; // L bit
425 let Inst{21} = 0; // W bit
426 let Inst{24} = 1; // P bit
427}
Evan Chengbe998242008-11-06 08:47:38 +0000428class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000429 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000430 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000431 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000432 let Inst{4} = 1;
433 let Inst{5} = 1; // H bit
434 let Inst{6} = 1; // S bit
435 let Inst{7} = 1;
436 let Inst{20} = 1; // L bit
437 let Inst{21} = 0; // W bit
438 let Inst{24} = 1; // P bit
439}
Evan Chengbe998242008-11-06 08:47:38 +0000440class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000441 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000442 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000443 asm, "", pattern> {
444 let Inst{4} = 1;
445 let Inst{5} = 0; // H bit
446 let Inst{6} = 1; // S bit
447 let Inst{7} = 1;
448 let Inst{20} = 1; // L bit
449 let Inst{21} = 0; // W bit
450 let Inst{24} = 1; // P bit
451}
Evan Chengbe998242008-11-06 08:47:38 +0000452class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000453 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000454 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000455 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000456 let Inst{4} = 1;
457 let Inst{5} = 0; // H bit
458 let Inst{6} = 1; // S bit
459 let Inst{7} = 1;
460 let Inst{20} = 1; // L bit
461 let Inst{21} = 0; // W bit
462 let Inst{24} = 1; // P bit
463}
Evan Chengbe998242008-11-06 08:47:38 +0000464class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000465 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000466 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000467 asm, "", pattern> {
468 let Inst{4} = 1;
469 let Inst{5} = 0; // H bit
470 let Inst{6} = 1; // S bit
471 let Inst{7} = 1;
472 let Inst{20} = 0; // L bit
473 let Inst{21} = 0; // W bit
474 let Inst{24} = 1; // P bit
475}
476
477// stores
Evan Chengbe998242008-11-06 08:47:38 +0000478class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000479 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000480 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000481 asm, "", pattern> {
482 let Inst{4} = 1;
483 let Inst{5} = 1; // H bit
484 let Inst{6} = 0; // S bit
485 let Inst{7} = 1;
486 let Inst{20} = 0; // L bit
487 let Inst{21} = 0; // W bit
488 let Inst{24} = 1; // P bit
489}
Evan Chengbe998242008-11-06 08:47:38 +0000490class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000491 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000492 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000493 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000494 let Inst{4} = 1;
495 let Inst{5} = 1; // H bit
496 let Inst{6} = 0; // S bit
497 let Inst{7} = 1;
498 let Inst{20} = 0; // L bit
499 let Inst{21} = 0; // W bit
500 let Inst{24} = 1; // P bit
501}
Evan Chengbe998242008-11-06 08:47:38 +0000502class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000503 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000504 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000505 asm, "", pattern> {
506 let Inst{4} = 1;
507 let Inst{5} = 1; // H bit
508 let Inst{6} = 1; // S bit
509 let Inst{7} = 1;
510 let Inst{20} = 0; // L bit
511 let Inst{21} = 0; // W bit
512 let Inst{24} = 1; // P bit
513}
514
515// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000516class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000517 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000518 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000519 asm, cstr, pattern> {
520 let Inst{4} = 1;
521 let Inst{5} = 1; // H bit
522 let Inst{6} = 0; // S bit
523 let Inst{7} = 1;
524 let Inst{20} = 1; // L bit
525 let Inst{21} = 1; // W bit
526 let Inst{24} = 1; // P bit
527}
Evan Chengbe998242008-11-06 08:47:38 +0000528class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000529 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000530 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000531 asm, cstr, pattern> {
532 let Inst{4} = 1;
533 let Inst{5} = 1; // H bit
534 let Inst{6} = 1; // S bit
535 let Inst{7} = 1;
536 let Inst{20} = 1; // L bit
537 let Inst{21} = 1; // W bit
538 let Inst{24} = 1; // P bit
539}
Evan Chengbe998242008-11-06 08:47:38 +0000540class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000541 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000542 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000543 asm, cstr, pattern> {
544 let Inst{4} = 1;
545 let Inst{5} = 0; // H bit
546 let Inst{6} = 1; // S bit
547 let Inst{7} = 1;
548 let Inst{20} = 1; // L bit
549 let Inst{21} = 1; // W bit
550 let Inst{24} = 1; // P bit
551}
552
553// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000554class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000555 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000556 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000557 asm, cstr, pattern> {
558 let Inst{4} = 1;
559 let Inst{5} = 1; // H bit
560 let Inst{6} = 0; // S bit
561 let Inst{7} = 1;
562 let Inst{20} = 0; // L bit
563 let Inst{21} = 1; // W bit
564 let Inst{24} = 1; // P bit
565}
566
567// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000568class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000569 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000570 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000571 asm, cstr,pattern> {
572 let Inst{4} = 1;
573 let Inst{5} = 1; // H bit
574 let Inst{6} = 0; // S bit
575 let Inst{7} = 1;
576 let Inst{20} = 1; // L bit
577 let Inst{21} = 1; // W bit
578 let Inst{24} = 0; // P bit
579}
Evan Chengbe998242008-11-06 08:47:38 +0000580class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000581 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000582 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000583 asm, cstr,pattern> {
584 let Inst{4} = 1;
585 let Inst{5} = 1; // H bit
586 let Inst{6} = 1; // S bit
587 let Inst{7} = 1;
588 let Inst{20} = 1; // L bit
589 let Inst{21} = 1; // W bit
590 let Inst{24} = 0; // P bit
591}
Evan Chengbe998242008-11-06 08:47:38 +0000592class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000593 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000594 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000595 asm, cstr,pattern> {
596 let Inst{4} = 1;
597 let Inst{5} = 0; // H bit
598 let Inst{6} = 1; // S bit
599 let Inst{7} = 1;
600 let Inst{20} = 1; // L bit
601 let Inst{21} = 1; // W bit
602 let Inst{24} = 0; // P bit
603}
604
605// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000606class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000607 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000608 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000609 asm, cstr,pattern> {
610 let Inst{4} = 1;
611 let Inst{5} = 1; // H bit
612 let Inst{6} = 0; // S bit
613 let Inst{7} = 1;
614 let Inst{20} = 0; // L bit
615 let Inst{21} = 1; // W bit
616 let Inst{24} = 0; // P bit
617}
618
619
Evan Cheng2e62b662008-09-01 01:51:14 +0000620// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000621class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000622 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000623 "", pattern> {
624 let Inst{20} = 1; // L bit
625 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000626 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000627}
Evan Chengf8e8b622008-11-06 17:48:05 +0000628class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000629 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000630 "", pattern> {
631 let Inst{20} = 0; // L bit
632 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000633 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000634}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000635
Jim Grosbach1feed042008-11-03 18:38:31 +0000636// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000637class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000638 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000639 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000640 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000641 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000642 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000643 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000644}
Evan Chengbe998242008-11-06 08:47:38 +0000645class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000646 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000647 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000648 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000649 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000650 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000651}
652
653// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000654class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000655 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000656 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000657 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000658 let Inst{7-4} = 0b1001;
659 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000660 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000661}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000662
Evan Cheng38396be2008-11-06 03:35:07 +0000663// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000664class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000665 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000666 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000667 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000668 let Inst{4} = 0;
669 let Inst{7} = 1;
670 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000671 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000672}
673
Evan Cheng37afa432008-11-06 22:15:19 +0000674// Extend instructions.
675class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
676 string asm, list<dag> pattern>
677 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
678 asm, "", pattern> {
679 let Inst{7-4} = 0b0111;
680 let Inst{27-20} = opcod;
681}
682
Evan Chengc2121a22008-11-07 01:41:35 +0000683// Misc Arithmetic instructions.
684class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
685 string asm, list<dag> pattern>
686 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
687 asm, "", pattern> {
688 let Inst{27-20} = opcod;
689}
690
Evan Cheng7b0249b2008-08-28 23:39:26 +0000691//===----------------------------------------------------------------------===//
692
693// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
694class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
695 list<Predicate> Predicates = [IsARM];
696}
697class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
698 list<Predicate> Predicates = [IsARM, HasV5TE];
699}
700class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
701 list<Predicate> Predicates = [IsARM, HasV6];
702}
Evan Cheng34a46e12008-08-29 06:41:12 +0000703
704//===----------------------------------------------------------------------===//
705//
706// Thumb Instruction Format Definitions.
707//
708
709
710// TI - Thumb instruction.
711
712class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
713 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000714 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000715 let OutOperandList = outs;
716 let InOperandList = ins;
717 let AsmString = asm;
718 let Pattern = pattern;
719 list<Predicate> Predicates = [IsThumb];
720}
721
722class TI<dag outs, dag ins, string asm, list<dag> pattern>
723 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
724class TI1<dag outs, dag ins, string asm, list<dag> pattern>
725 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
726class TI2<dag outs, dag ins, string asm, list<dag> pattern>
727 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
728class TI4<dag outs, dag ins, string asm, list<dag> pattern>
729 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
730class TIs<dag outs, dag ins, string asm, list<dag> pattern>
731 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
732
733// Two-address instructions
734class TIt<dag outs, dag ins, string asm, list<dag> pattern>
735 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
736
737// BL, BLX(1) are translated by assembler into two instructions
738class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
739 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
740
741// BR_JT instructions
742class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
743 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
744
Bob Wilsone60fee02009-06-22 23:27:02 +0000745// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
746class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
747 list<Predicate> Predicates = [IsThumb];
748}
749
750class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
751 list<Predicate> Predicates = [IsThumb, HasV5T];
752}
Evan Cheng34a46e12008-08-29 06:41:12 +0000753
Evan Cheng6fc534c2009-06-23 19:38:13 +0000754// Thumb1 only
755class Thumb1I<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
756 string asm, string cstr, list<dag> pattern>
757 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
758 let OutOperandList = outs;
759 let InOperandList = ins;
760 let AsmString = asm;
761 let Pattern = pattern;
762 list<Predicate> Predicates = [IsThumb1Only];
763}
764
765class T1I<dag outs, dag ins, string asm, list<dag> pattern>
766 : Thumb1I<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
767
768// Two-address instructions
769class T1It<dag outs, dag ins, string asm, list<dag> pattern>
770 : Thumb1I<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
771
772class Thumb1Pat<dag pattern, dag result> : Pat<pattern, result> {
773 list<Predicate> Predicates = [IsThumb1Only];
774}
775
Evan Cheng36173712009-06-23 17:48:47 +0000776// T2I - Thumb2 instruction.
777
778class Thumb2I<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
779 string asm, string cstr, list<dag> pattern>
780 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
781 let OutOperandList = outs;
782 let InOperandList = ins;
783 let AsmString = asm;
784 let Pattern = pattern;
785 list<Predicate> Predicates = [IsThumb, HasThumb2];
786}
787
788class T2I<dag outs, dag ins, string asm, list<dag> pattern>
789 : Thumb2I<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
790
791// Thumb2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
792class Thumb2Pat<dag pattern, dag result> : Pat<pattern, result> {
793 list<Predicate> Predicates = [IsThumb, HasThumb2];
794}
795
Evan Cheng34a46e12008-08-29 06:41:12 +0000796//===----------------------------------------------------------------------===//
797
Evan Chengc63e15e2008-11-11 02:11:05 +0000798//===----------------------------------------------------------------------===//
799// ARM VFP Instruction templates.
800//
801
Evan Chengbb786b32008-11-11 21:48:44 +0000802// ARM VFP addrmode5 loads and stores
803class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
804 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000805 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000806 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000807 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000808 let Inst{27-24} = opcod1;
809 let Inst{21-20} = opcod2;
810 let Inst{11-8} = 0b1011;
Evan Chengc63e15e2008-11-11 02:11:05 +0000811}
812
Evan Chengbb786b32008-11-11 21:48:44 +0000813class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
814 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000815 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000816 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000817 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000818 let Inst{27-24} = opcod1;
819 let Inst{21-20} = opcod2;
820 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +0000821}
822
Evan Chengbb786b32008-11-11 21:48:44 +0000823// Load / store multiple
824class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
825 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
826 VFPLdStMulFrm, asm, "", pattern> {
827 // TODO: Mark the instructions with the appropriate subtarget info.
828 let Inst{27-25} = 0b110;
829 let Inst{11-8} = 0b1011;
830}
831
832class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
833 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
834 VFPLdStMulFrm, asm, "", pattern> {
835 // TODO: Mark the instructions with the appropriate subtarget info.
836 let Inst{27-25} = 0b110;
837 let Inst{11-8} = 0b1010;
838}
839
840
Evan Chengc63e15e2008-11-11 02:11:05 +0000841// Double precision, unary
842class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
843 string opc, string asm, list<dag> pattern>
844 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
845 let Inst{27-20} = opcod1;
846 let Inst{19-16} = opcod2;
847 let Inst{11-8} = 0b1011;
848 let Inst{7-4} = opcod3;
849}
850
851// Double precision, binary
852class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
853 string asm, list<dag> pattern>
854 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
855 let Inst{27-20} = opcod;
856 let Inst{11-8} = 0b1011;
857}
858
859// Single precision, unary
860class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
861 string opc, string asm, list<dag> pattern>
862 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
863 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
864 let Inst{27-20} = opcod1;
865 let Inst{19-16} = opcod2;
866 let Inst{11-8} = 0b1010;
867 let Inst{7-4} = opcod3;
868}
869
870// Single precision, binary
871class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
872 string asm, list<dag> pattern>
873 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
874 // Bit 22 (D bit) can be changed during instruction encoding.
875 let Inst{27-20} = opcod;
876 let Inst{11-8} = 0b1010;
877}
878
Evan Cheng74273382008-11-12 06:41:41 +0000879// VFP conversion instructions
880class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
881 dag oops, dag iops, string opc, string asm, list<dag> pattern>
Evan Cheng9d3cc182008-11-11 19:40:26 +0000882 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
883 let Inst{27-20} = opcod1;
Evan Cheng74273382008-11-12 06:41:41 +0000884 let Inst{19-16} = opcod2;
885 let Inst{11-8} = opcod3;
886 let Inst{6} = 1;
887}
888
889class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
890 string opc, string asm, list<dag> pattern>
891 : AI<oops, iops, f, opc, asm, pattern> {
892 let Inst{27-20} = opcod1;
Evan Cheng9d3cc182008-11-11 19:40:26 +0000893 let Inst{11-8} = opcod2;
894 let Inst{4} = 1;
895}
896
Evan Cheng828ccdc2008-11-11 22:46:12 +0000897class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
Evan Cheng74273382008-11-12 06:41:41 +0000898 string asm, list<dag> pattern>
899 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, opc, asm, pattern>;
Evan Cheng828ccdc2008-11-11 22:46:12 +0000900
Evan Cheng74273382008-11-12 06:41:41 +0000901class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
902 string asm, list<dag> pattern>
903 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, opc, asm, pattern>;
904
905class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
906 string asm, list<dag> pattern>
907 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, opc, asm, pattern>;
908
909class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
910 string asm, list<dag> pattern>
911 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, opc, asm, pattern>;
Evan Cheng9d3cc182008-11-11 19:40:26 +0000912
Evan Chengc63e15e2008-11-11 02:11:05 +0000913//===----------------------------------------------------------------------===//
914
Bob Wilsone60fee02009-06-22 23:27:02 +0000915//===----------------------------------------------------------------------===//
916// ARM NEON Instruction templates.
917//
Evan Cheng34a46e12008-08-29 06:41:12 +0000918
Bob Wilsone60fee02009-06-22 23:27:02 +0000919class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, string asm,
920 string cstr, list<dag> pattern>
921 : InstARM<am, Size4Bytes, im, NEONFrm, cstr> {
922 let OutOperandList = oops;
923 let InOperandList = iops;
924 let AsmString = asm;
925 let Pattern = pattern;
926 list<Predicate> Predicates = [HasNEON];
Evan Cheng34a46e12008-08-29 06:41:12 +0000927}
928
Bob Wilsone60fee02009-06-22 23:27:02 +0000929class NI<dag oops, dag iops, string asm, list<dag> pattern>
930 : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, "", pattern> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000931}
Bob Wilsone60fee02009-06-22 23:27:02 +0000932
933class NDataI<dag oops, dag iops, string asm, string cstr, list<dag> pattern>
934 : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, cstr, pattern> {
935 let Inst{31-25} = 0b1111001;
936}
937
938// NEON "one register and a modified immediate" format.
939class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
940 bit op5, bit op4,
941 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
942 : NDataI<oops, iops, asm, cstr, pattern> {
943 let Inst{23} = op23;
944 let Inst{21-19} = op21_19;
945 let Inst{11-8} = op11_8;
946 let Inst{7} = op7;
947 let Inst{6} = op6;
948 let Inst{5} = op5;
949 let Inst{4} = op4;
950}
951
952// NEON 2 vector register format.
953class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
954 bits<5> op11_7, bit op6, bit op4,
955 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
956 : NDataI<oops, iops, asm, cstr, pattern> {
957 let Inst{24-23} = op24_23;
958 let Inst{21-20} = op21_20;
959 let Inst{19-18} = op19_18;
960 let Inst{17-16} = op17_16;
961 let Inst{11-7} = op11_7;
962 let Inst{6} = op6;
963 let Inst{4} = op4;
964}
965
966// NEON 2 vector register with immediate.
967class N2VImm<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
968 bit op6, bit op4,
969 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
970 : NDataI<oops, iops, asm, cstr, pattern> {
971 let Inst{24} = op24;
972 let Inst{23} = op23;
973 let Inst{21-16} = op21_16;
974 let Inst{11-8} = op11_8;
975 let Inst{7} = op7;
976 let Inst{6} = op6;
977 let Inst{4} = op4;
978}
979
980// NEON 3 vector register format.
981class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
982 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
983 : NDataI<oops, iops, asm, cstr, pattern> {
984 let Inst{24} = op24;
985 let Inst{23} = op23;
986 let Inst{21-20} = op21_20;
987 let Inst{11-8} = op11_8;
988 let Inst{6} = op6;
989 let Inst{4} = op4;
990}
991
992// NEON VMOVs between scalar and core registers.
993class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
994 dag oops, dag iops, Format f, string opc, string asm,
995 list<dag> pattern>
996 : AI<oops, iops, f, opc, asm, pattern> {
997 let Inst{27-20} = opcod1;
998 let Inst{11-8} = opcod2;
999 let Inst{6-5} = opcod3;
1000 let Inst{4} = 1;
1001 list<Predicate> Predicates = [HasNEON];
1002}
1003class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1004 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1005 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, opc, asm,
1006 pattern>;
1007class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1008 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1009 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, opc, asm,
1010 pattern>;
1011class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1012 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1013 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, opc, asm, pattern>;