blob: 6ca931d69390f621ddf64c0990047f52d1dd4822 [file] [log] [blame]
Evan Cheng7b0249b2008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10//===----------------------------------------------------------------------===//
11//
12// ARM Instruction Format Definitions.
13//
14
15// Format specifies the encoding used by the instruction. This is part of the
16// ad-hoc solution used to emit machine instruction encodings by our machine
17// code emitter.
18class Format<bits<5> val> {
19 bits<5> Value = val;
20}
21
Evan Chengbb786b32008-11-11 21:48:44 +000022def Pseudo : Format<1>;
23def MulFrm : Format<2>;
24def BrFrm : Format<3>;
25def BrMiscFrm : Format<4>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000026
Evan Chengbb786b32008-11-11 21:48:44 +000027def DPFrm : Format<5>;
28def DPSoRegFrm : Format<6>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000029
Evan Chengbb786b32008-11-11 21:48:44 +000030def LdFrm : Format<7>;
31def StFrm : Format<8>;
32def LdMiscFrm : Format<9>;
33def StMiscFrm : Format<10>;
34def LdMulFrm : Format<11>;
35def StMulFrm : Format<12>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000036
Evan Chengbb786b32008-11-11 21:48:44 +000037def ArithMiscFrm : Format<13>;
38def ExtFrm : Format<14>;
39
40def VFPUnaryFrm : Format<15>;
41def VFPBinaryFrm : Format<16>;
42def VFPConv1Frm : Format<17>;
43def VFPConv2Frm : Format<18>;
Evan Cheng828ccdc2008-11-11 22:46:12 +000044def VFPConv3Frm : Format<19>;
Evan Cheng74273382008-11-12 06:41:41 +000045def VFPConv4Frm : Format<20>;
46def VFPConv5Frm : Format<21>;
47def VFPLdStFrm : Format<22>;
48def VFPLdStMulFrm : Format<23>;
49def VFPMiscFrm : Format<24>;
Evan Chengbb786b32008-11-11 21:48:44 +000050
Evan Cheng74273382008-11-12 06:41:41 +000051def ThumbFrm : Format<25>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000052
Evan Cheng86a926a2008-11-05 18:35:52 +000053// Misc flag for data processing instructions that indicates whether
54// the instruction has a Rn register operand.
55class UnaryDP { bit isUnaryDataProc = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000056
Evan Cheng7b0249b2008-08-28 23:39:26 +000057//===----------------------------------------------------------------------===//
58
59// ARM Instruction templates.
60//
61
Evan Chengbe998242008-11-06 08:47:38 +000062class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +000063 Format f, string cstr>
64 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +000065 field bits<32> Inst;
66
Evan Cheng7b0249b2008-08-28 23:39:26 +000067 let Namespace = "ARM";
68
Evan Cheng86a926a2008-11-05 18:35:52 +000069 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +000070 AddrMode AM = am;
71 bits<4> AddrModeBits = AM.Value;
72
73 SizeFlagVal SZ = sz;
74 bits<3> SizeFlag = SZ.Value;
75
76 IndexMode IM = im;
77 bits<2> IndexModeBits = IM.Value;
78
79 Format F = f;
80 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +000081
82 //
83 // Attributes specific to ARM instructions...
84 //
85 bit isUnaryDataProc = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +000086
87 let Constraints = cstr;
88}
89
90class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000091 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000092 let OutOperandList = oops;
93 let InOperandList = iops;
94 let AsmString = asm;
95 let Pattern = pattern;
96}
97
98// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +000099class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000100 IndexMode im, Format f, string opc, string asm, string cstr,
101 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000102 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000103 let OutOperandList = oops;
104 let InOperandList = !con(iops, (ops pred:$p));
105 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
106 let Pattern = pattern;
107 list<Predicate> Predicates = [IsARM];
108}
109
110// Same as I except it can optionally modify CPSR. Note it's modeled as
111// an input operand since by default it's a zero register. It will
112// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000113class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000114 IndexMode im, Format f, string opc, string asm, string cstr,
115 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000116 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000117 let OutOperandList = oops;
118 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
119 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
120 let Pattern = pattern;
121 list<Predicate> Predicates = [IsARM];
122}
123
Evan Chengc5409a82008-09-01 07:19:00 +0000124// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000125class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000126 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000127 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000128 let OutOperandList = oops;
129 let InOperandList = iops;
130 let AsmString = asm;
131 let Pattern = pattern;
132 list<Predicate> Predicates = [IsARM];
133}
134
Evan Chengbe998242008-11-06 08:47:38 +0000135class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000136 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000137 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000138 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000139class AsI<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 : sI<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 AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000144 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000145 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000146 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000147
148// Ctrl flow instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000149class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000150 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000151 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000152 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000153 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000154}
Evan Chengf8e8b622008-11-06 17:48:05 +0000155class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
156 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000157 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000158 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000159}
Evan Chengf8e8b622008-11-06 17:48:05 +0000160class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
161 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000162 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000163
164// BR_JT instructions
Evan Cheng0f63ae12008-11-07 09:06:08 +0000165class JTI<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000166 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000167 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000168
169// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000170class AI1<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 : I<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 Cheng7b0249b2008-08-28 23:39:26 +0000177class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
178 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000179 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000180 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000181 let Inst{24-21} = opcod;
182 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000183}
Evan Chengc5409a82008-09-01 07:19:00 +0000184class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
185 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000186 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000187 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000188 let Inst{24-21} = opcod;
189 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000190}
Evan Chengbe998242008-11-06 08:47:38 +0000191class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000192 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000193 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000194 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000195
Evan Cheng2e62b662008-09-01 01:51:14 +0000196
197// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000198class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000199 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000200 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000201 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000202 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000203}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000204
205// loads
Evan Chengbe998242008-11-06 08:47:38 +0000206class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000207 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000208 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000209 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000210 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000211 let Inst{21} = 0; // W bit
212 let Inst{22} = 0; // B bit
213 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000214 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000215}
Evan Chengbe998242008-11-06 08:47:38 +0000216class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000217 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000218 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000219 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000220 let Inst{20} = 1; // L bit
221 let Inst{21} = 0; // W bit
222 let Inst{22} = 0; // B bit
223 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000224 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000225}
Evan Chengbe998242008-11-06 08:47:38 +0000226class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000227 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000228 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000229 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000230 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000231 let Inst{21} = 0; // W bit
232 let Inst{22} = 1; // B bit
233 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000234 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000235}
Evan Chengbe998242008-11-06 08:47:38 +0000236class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000237 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000238 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000239 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000240 let Inst{20} = 1; // L bit
241 let Inst{21} = 0; // W bit
242 let Inst{22} = 1; // B bit
243 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000244 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000245}
Evan Chengda020022008-08-31 19:02:21 +0000246
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000247// stores
Evan Chengbe998242008-11-06 08:47:38 +0000248class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000249 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000250 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000251 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000252 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000253 let Inst{21} = 0; // W bit
254 let Inst{22} = 0; // B bit
255 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000256 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000257}
Evan Chengbe998242008-11-06 08:47:38 +0000258class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000259 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000260 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000261 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000262 let Inst{20} = 0; // L bit
263 let Inst{21} = 0; // W bit
264 let Inst{22} = 0; // B bit
265 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000266 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000267}
Evan Chengbe998242008-11-06 08:47:38 +0000268class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000269 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000270 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000271 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000272 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000273 let Inst{21} = 0; // W bit
274 let Inst{22} = 1; // B bit
275 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000276 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000277}
Evan Chengbe998242008-11-06 08:47:38 +0000278class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000279 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000280 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000281 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000282 let Inst{20} = 0; // L bit
283 let Inst{21} = 0; // W bit
284 let Inst{22} = 1; // B bit
285 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000286 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000287}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000288
Evan Chengac92c3f2008-09-01 07:00:14 +0000289// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000290class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000291 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000292 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000293 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000294 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000295 let Inst{21} = 1; // W bit
296 let Inst{22} = 0; // B bit
297 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000298 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000299}
Evan Chengbe998242008-11-06 08:47:38 +0000300class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000301 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000302 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000303 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000304 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000305 let Inst{21} = 1; // W bit
306 let Inst{22} = 1; // B bit
307 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000308 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000309}
310
Evan Chengac92c3f2008-09-01 07:00:14 +0000311// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000312class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000313 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000314 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000315 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000316 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000317 let Inst{21} = 1; // W bit
318 let Inst{22} = 0; // B bit
319 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000320 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000321}
Evan Chengbe998242008-11-06 08:47:38 +0000322class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000323 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000324 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000325 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000326 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000327 let Inst{21} = 1; // W bit
328 let Inst{22} = 1; // B bit
329 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000330 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000331}
332
Evan Chengac92c3f2008-09-01 07:00:14 +0000333// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000334class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000335 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000336 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000337 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000338 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000339 let Inst{21} = 0; // W bit
340 let Inst{22} = 0; // B bit
341 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000342 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000343}
Evan Chengbe998242008-11-06 08:47:38 +0000344class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000345 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000346 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000347 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000348 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000349 let Inst{21} = 0; // W bit
350 let Inst{22} = 1; // B bit
351 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000352 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000353}
354
Evan Chengac92c3f2008-09-01 07:00:14 +0000355// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000356class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000357 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000358 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000359 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000360 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000361 let Inst{21} = 0; // W bit
362 let Inst{22} = 0; // B bit
363 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000364 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000365}
Evan Chengbe998242008-11-06 08:47:38 +0000366class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000367 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000368 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000369 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000370 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000371 let Inst{21} = 0; // W bit
372 let Inst{22} = 1; // B bit
373 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000374 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000375}
376
Evan Cheng2e62b662008-09-01 01:51:14 +0000377// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000378class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000379 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000380 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000381 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000382class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000383 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000384 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000385 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000386
Evan Chengac92c3f2008-09-01 07:00:14 +0000387// loads
Evan Chengbe998242008-11-06 08:47:38 +0000388class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000389 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000390 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000391 asm, "", pattern> {
392 let Inst{4} = 1;
393 let Inst{5} = 1; // H bit
394 let Inst{6} = 0; // S bit
395 let Inst{7} = 1;
396 let Inst{20} = 1; // L bit
397 let Inst{21} = 0; // W bit
398 let Inst{24} = 1; // P bit
399}
Evan Chengbe998242008-11-06 08:47:38 +0000400class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000401 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000402 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000403 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000404 let Inst{4} = 1;
405 let Inst{5} = 1; // H bit
406 let Inst{6} = 0; // S bit
407 let Inst{7} = 1;
408 let Inst{20} = 1; // L bit
409 let Inst{21} = 0; // W bit
410 let Inst{24} = 1; // P bit
411}
Evan Chengbe998242008-11-06 08:47:38 +0000412class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000413 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000414 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000415 asm, "", pattern> {
416 let Inst{4} = 1;
417 let Inst{5} = 1; // H bit
418 let Inst{6} = 1; // S bit
419 let Inst{7} = 1;
420 let Inst{20} = 1; // L bit
421 let Inst{21} = 0; // W bit
422 let Inst{24} = 1; // P bit
423}
Evan Chengbe998242008-11-06 08:47:38 +0000424class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000425 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000426 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000427 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000428 let Inst{4} = 1;
429 let Inst{5} = 1; // H bit
430 let Inst{6} = 1; // S bit
431 let Inst{7} = 1;
432 let Inst{20} = 1; // L bit
433 let Inst{21} = 0; // W bit
434 let Inst{24} = 1; // P bit
435}
Evan Chengbe998242008-11-06 08:47:38 +0000436class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000437 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000438 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000439 asm, "", pattern> {
440 let Inst{4} = 1;
441 let Inst{5} = 0; // H bit
442 let Inst{6} = 1; // S bit
443 let Inst{7} = 1;
444 let Inst{20} = 1; // L bit
445 let Inst{21} = 0; // W bit
446 let Inst{24} = 1; // P bit
447}
Evan Chengbe998242008-11-06 08:47:38 +0000448class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000449 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000450 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000451 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000452 let Inst{4} = 1;
453 let Inst{5} = 0; // H bit
454 let Inst{6} = 1; // S bit
455 let Inst{7} = 1;
456 let Inst{20} = 1; // L bit
457 let Inst{21} = 0; // W bit
458 let Inst{24} = 1; // P bit
459}
Evan Chengbe998242008-11-06 08:47:38 +0000460class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000461 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000462 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000463 asm, "", pattern> {
464 let Inst{4} = 1;
465 let Inst{5} = 0; // H bit
466 let Inst{6} = 1; // S bit
467 let Inst{7} = 1;
468 let Inst{20} = 0; // L bit
469 let Inst{21} = 0; // W bit
470 let Inst{24} = 1; // P bit
471}
472
473// stores
Evan Chengbe998242008-11-06 08:47:38 +0000474class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000475 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000476 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000477 asm, "", pattern> {
478 let Inst{4} = 1;
479 let Inst{5} = 1; // H bit
480 let Inst{6} = 0; // S bit
481 let Inst{7} = 1;
482 let Inst{20} = 0; // L bit
483 let Inst{21} = 0; // W bit
484 let Inst{24} = 1; // P bit
485}
Evan Chengbe998242008-11-06 08:47:38 +0000486class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000487 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000488 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000489 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000490 let Inst{4} = 1;
491 let Inst{5} = 1; // H bit
492 let Inst{6} = 0; // S bit
493 let Inst{7} = 1;
494 let Inst{20} = 0; // L bit
495 let Inst{21} = 0; // W bit
496 let Inst{24} = 1; // P bit
497}
Evan Chengbe998242008-11-06 08:47:38 +0000498class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000499 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000500 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000501 asm, "", pattern> {
502 let Inst{4} = 1;
503 let Inst{5} = 1; // H bit
504 let Inst{6} = 1; // S bit
505 let Inst{7} = 1;
506 let Inst{20} = 0; // L bit
507 let Inst{21} = 0; // W bit
508 let Inst{24} = 1; // P bit
509}
510
511// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000512class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000513 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000514 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000515 asm, cstr, pattern> {
516 let Inst{4} = 1;
517 let Inst{5} = 1; // H bit
518 let Inst{6} = 0; // S bit
519 let Inst{7} = 1;
520 let Inst{20} = 1; // L bit
521 let Inst{21} = 1; // W bit
522 let Inst{24} = 1; // P bit
523}
Evan Chengbe998242008-11-06 08:47:38 +0000524class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000525 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000526 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000527 asm, cstr, pattern> {
528 let Inst{4} = 1;
529 let Inst{5} = 1; // H bit
530 let Inst{6} = 1; // S bit
531 let Inst{7} = 1;
532 let Inst{20} = 1; // L bit
533 let Inst{21} = 1; // W bit
534 let Inst{24} = 1; // P bit
535}
Evan Chengbe998242008-11-06 08:47:38 +0000536class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000537 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000538 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000539 asm, cstr, pattern> {
540 let Inst{4} = 1;
541 let Inst{5} = 0; // H bit
542 let Inst{6} = 1; // S bit
543 let Inst{7} = 1;
544 let Inst{20} = 1; // L bit
545 let Inst{21} = 1; // W bit
546 let Inst{24} = 1; // P bit
547}
548
549// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000550class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000551 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000552 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000553 asm, cstr, pattern> {
554 let Inst{4} = 1;
555 let Inst{5} = 1; // H bit
556 let Inst{6} = 0; // S bit
557 let Inst{7} = 1;
558 let Inst{20} = 0; // L bit
559 let Inst{21} = 1; // W bit
560 let Inst{24} = 1; // P bit
561}
562
563// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000564class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000565 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000566 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000567 asm, cstr,pattern> {
568 let Inst{4} = 1;
569 let Inst{5} = 1; // H bit
570 let Inst{6} = 0; // S bit
571 let Inst{7} = 1;
572 let Inst{20} = 1; // L bit
573 let Inst{21} = 1; // W bit
574 let Inst{24} = 0; // P bit
575}
Evan Chengbe998242008-11-06 08:47:38 +0000576class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000577 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000578 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000579 asm, cstr,pattern> {
580 let Inst{4} = 1;
581 let Inst{5} = 1; // H bit
582 let Inst{6} = 1; // S bit
583 let Inst{7} = 1;
584 let Inst{20} = 1; // L bit
585 let Inst{21} = 1; // W bit
586 let Inst{24} = 0; // P bit
587}
Evan Chengbe998242008-11-06 08:47:38 +0000588class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000589 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000590 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000591 asm, cstr,pattern> {
592 let Inst{4} = 1;
593 let Inst{5} = 0; // H bit
594 let Inst{6} = 1; // S bit
595 let Inst{7} = 1;
596 let Inst{20} = 1; // L bit
597 let Inst{21} = 1; // W bit
598 let Inst{24} = 0; // P bit
599}
600
601// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000602class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000603 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000604 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000605 asm, cstr,pattern> {
606 let Inst{4} = 1;
607 let Inst{5} = 1; // H bit
608 let Inst{6} = 0; // S bit
609 let Inst{7} = 1;
610 let Inst{20} = 0; // L bit
611 let Inst{21} = 1; // W bit
612 let Inst{24} = 0; // P bit
613}
614
615
Evan Cheng2e62b662008-09-01 01:51:14 +0000616// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000617class AXI4ld<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} = 1; // 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 Chengf8e8b622008-11-06 17:48:05 +0000624class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000625 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000626 "", pattern> {
627 let Inst{20} = 0; // L bit
628 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000629 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000630}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000631
Jim Grosbach1feed042008-11-03 18:38:31 +0000632// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000633class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000634 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000635 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000636 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000637 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000638 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000639 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000640}
Evan Chengbe998242008-11-06 08:47:38 +0000641class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000642 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000643 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000644 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000645 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000646 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000647}
648
649// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000650class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000651 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000652 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000653 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000654 let Inst{7-4} = 0b1001;
655 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000656 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000657}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000658
Evan Cheng38396be2008-11-06 03:35:07 +0000659// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000660class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000661 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000662 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000663 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000664 let Inst{4} = 0;
665 let Inst{7} = 1;
666 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000667 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000668}
669
Evan Cheng37afa432008-11-06 22:15:19 +0000670// Extend instructions.
671class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
672 string asm, list<dag> pattern>
673 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
674 asm, "", pattern> {
675 let Inst{7-4} = 0b0111;
676 let Inst{27-20} = opcod;
677}
678
Evan Chengc2121a22008-11-07 01:41:35 +0000679// Misc Arithmetic instructions.
680class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
681 string asm, list<dag> pattern>
682 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
683 asm, "", pattern> {
684 let Inst{27-20} = opcod;
685}
686
Evan Cheng7b0249b2008-08-28 23:39:26 +0000687//===----------------------------------------------------------------------===//
688
689// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
690class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
691 list<Predicate> Predicates = [IsARM];
692}
693class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
694 list<Predicate> Predicates = [IsARM, HasV5TE];
695}
696class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
697 list<Predicate> Predicates = [IsARM, HasV6];
698}
Evan Cheng34a46e12008-08-29 06:41:12 +0000699
700//===----------------------------------------------------------------------===//
701//
702// Thumb Instruction Format Definitions.
703//
704
705
706// TI - Thumb instruction.
707
708class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
709 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000710 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000711 let OutOperandList = outs;
712 let InOperandList = ins;
713 let AsmString = asm;
714 let Pattern = pattern;
715 list<Predicate> Predicates = [IsThumb];
716}
717
718class TI<dag outs, dag ins, string asm, list<dag> pattern>
719 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
720class TI1<dag outs, dag ins, string asm, list<dag> pattern>
721 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
722class TI2<dag outs, dag ins, string asm, list<dag> pattern>
723 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
724class TI4<dag outs, dag ins, string asm, list<dag> pattern>
725 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
726class TIs<dag outs, dag ins, string asm, list<dag> pattern>
727 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
728
729// Two-address instructions
730class TIt<dag outs, dag ins, string asm, list<dag> pattern>
731 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
732
733// BL, BLX(1) are translated by assembler into two instructions
734class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
735 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
736
737// BR_JT instructions
738class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
739 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
740
741
742//===----------------------------------------------------------------------===//
743
Evan Chengc63e15e2008-11-11 02:11:05 +0000744//===----------------------------------------------------------------------===//
745// ARM VFP Instruction templates.
746//
747
Evan Chengbb786b32008-11-11 21:48:44 +0000748// ARM VFP addrmode5 loads and stores
749class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
750 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000751 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000752 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000753 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000754 let Inst{27-24} = opcod1;
755 let Inst{21-20} = opcod2;
756 let Inst{11-8} = 0b1011;
Evan Chengc63e15e2008-11-11 02:11:05 +0000757}
758
Evan Chengbb786b32008-11-11 21:48:44 +0000759class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
760 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000761 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000762 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000763 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000764 let Inst{27-24} = opcod1;
765 let Inst{21-20} = opcod2;
766 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +0000767}
768
Evan Chengbb786b32008-11-11 21:48:44 +0000769// Load / store multiple
770class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
771 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
772 VFPLdStMulFrm, asm, "", pattern> {
773 // TODO: Mark the instructions with the appropriate subtarget info.
774 let Inst{27-25} = 0b110;
775 let Inst{11-8} = 0b1011;
776}
777
778class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
779 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
780 VFPLdStMulFrm, asm, "", pattern> {
781 // TODO: Mark the instructions with the appropriate subtarget info.
782 let Inst{27-25} = 0b110;
783 let Inst{11-8} = 0b1010;
784}
785
786
Evan Chengc63e15e2008-11-11 02:11:05 +0000787// Double precision, unary
788class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
789 string opc, string asm, list<dag> pattern>
790 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
791 let Inst{27-20} = opcod1;
792 let Inst{19-16} = opcod2;
793 let Inst{11-8} = 0b1011;
794 let Inst{7-4} = opcod3;
795}
796
797// Double precision, binary
798class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
799 string asm, list<dag> pattern>
800 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
801 let Inst{27-20} = opcod;
802 let Inst{11-8} = 0b1011;
803}
804
805// Single precision, unary
806class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
807 string opc, string asm, list<dag> pattern>
808 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
809 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
810 let Inst{27-20} = opcod1;
811 let Inst{19-16} = opcod2;
812 let Inst{11-8} = 0b1010;
813 let Inst{7-4} = opcod3;
814}
815
816// Single precision, binary
817class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
818 string asm, list<dag> pattern>
819 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
820 // Bit 22 (D bit) can be changed during instruction encoding.
821 let Inst{27-20} = opcod;
822 let Inst{11-8} = 0b1010;
823}
824
Evan Cheng74273382008-11-12 06:41:41 +0000825// VFP conversion instructions
826class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
827 dag oops, dag iops, string opc, string asm, list<dag> pattern>
Evan Cheng9d3cc182008-11-11 19:40:26 +0000828 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
829 let Inst{27-20} = opcod1;
Evan Cheng74273382008-11-12 06:41:41 +0000830 let Inst{19-16} = opcod2;
831 let Inst{11-8} = opcod3;
832 let Inst{6} = 1;
833}
834
835class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
836 string opc, string asm, list<dag> pattern>
837 : AI<oops, iops, f, opc, asm, pattern> {
838 let Inst{27-20} = opcod1;
Evan Cheng9d3cc182008-11-11 19:40:26 +0000839 let Inst{11-8} = opcod2;
840 let Inst{4} = 1;
841}
842
Evan Cheng828ccdc2008-11-11 22:46:12 +0000843class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
Evan Cheng74273382008-11-12 06:41:41 +0000844 string asm, list<dag> pattern>
845 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, opc, asm, pattern>;
Evan Cheng828ccdc2008-11-11 22:46:12 +0000846
Evan Cheng74273382008-11-12 06:41:41 +0000847class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
848 string asm, list<dag> pattern>
849 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, opc, asm, pattern>;
850
851class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
852 string asm, list<dag> pattern>
853 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, opc, asm, pattern>;
854
855class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
856 string asm, list<dag> pattern>
857 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, opc, asm, pattern>;
Evan Cheng9d3cc182008-11-11 19:40:26 +0000858
Evan Chengc63e15e2008-11-11 02:11:05 +0000859//===----------------------------------------------------------------------===//
860
Evan Cheng34a46e12008-08-29 06:41:12 +0000861
862// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
863class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
864 list<Predicate> Predicates = [IsThumb];
865}
866
867class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
868 list<Predicate> Predicates = [IsThumb, HasV5T];
869}