ARMInstrFormats.td revision 194710
1234353Sdim//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
2206083Srdivacky// 
3193323Sed//                     The LLVM Compiler Infrastructure
4193323Sed//
5193323Sed// This file is distributed under the University of Illinois Open Source
6193323Sed// License. See LICENSE.TXT for details.
7206083Srdivacky// 
8193323Sed//===----------------------------------------------------------------------===//
9193323Sed
10193323Sed//===----------------------------------------------------------------------===//
11193323Sed//
12193323Sed// ARM Instruction Format Definitions.
13193323Sed//
14193323Sed
15193323Sed// Format specifies the encoding used by the instruction.  This is part of the
16193323Sed// ad-hoc solution used to emit machine instruction encodings by our machine
17193323Sed// code emitter.
18205407Srdivackyclass Format<bits<5> val> {
19205407Srdivacky  bits<5> Value = val;
20193323Sed}
21193323Sed
22193323Seddef Pseudo        : Format<0>;
23193323Seddef MulFrm        : Format<1>;
24193323Seddef BrFrm         : Format<2>;
25193323Seddef BrMiscFrm     : Format<3>;
26193323Sed
27193323Seddef DPFrm         : Format<4>;
28226633Sdimdef DPSoRegFrm    : Format<5>;
29193323Sed
30193323Seddef LdFrm         : Format<6>;
31193323Seddef StFrm         : Format<7>;
32193323Seddef LdMiscFrm     : Format<8>;
33193323Seddef StMiscFrm     : Format<9>;
34193323Seddef LdStMulFrm    : Format<10>;
35193323Sed
36205407Srdivackydef ArithMiscFrm  : Format<11>;
37200581Srdivackydef ExtFrm        : Format<12>;
38205407Srdivacky
39212904Sdimdef VFPUnaryFrm   : Format<13>;
40212904Sdimdef VFPBinaryFrm  : Format<14>;
41193323Seddef VFPConv1Frm   : Format<15>;
42212904Sdimdef VFPConv2Frm   : Format<16>;
43212904Sdimdef VFPConv3Frm   : Format<17>;
44212904Sdimdef VFPConv4Frm   : Format<18>;
45212904Sdimdef VFPConv5Frm   : Format<19>;
46212904Sdimdef VFPLdStFrm    : Format<20>;
47212904Sdimdef VFPLdStMulFrm : Format<21>;
48212904Sdimdef VFPMiscFrm    : Format<22>;
49212904Sdim
50212904Sdimdef ThumbFrm      : Format<23>;
51212904Sdim
52193323Seddef NEONFrm       : Format<24>;
53212904Sdimdef NEONGetLnFrm  : Format<25>;
54212904Sdimdef NEONSetLnFrm  : Format<26>;
55193323Seddef NEONDupFrm    : Format<27>;
56212904Sdim
57212904Sdim// Misc flag for data processing instructions that indicates whether
58212904Sdim// the instruction has a Rn register operand.
59212904Sdimclass UnaryDP  { bit isUnaryDataProc = 1; }
60212904Sdim
61212904Sdim//===----------------------------------------------------------------------===//
62212904Sdim
63212904Sdim// ARM Instruction templates.
64212904Sdim//
65212904Sdim
66212904Sdimclass InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
67212904Sdim              Format f, string cstr>
68212904Sdim  : Instruction {
69212904Sdim  field bits<32> Inst;
70212904Sdim
71226633Sdim  let Namespace = "ARM";
72194710Sed
73198090Srdivacky  // TSFlagsFields
74198090Srdivacky  AddrMode AM = am;
75218893Sdim  bits<4> AddrModeBits = AM.Value;
76198090Srdivacky  
77198090Srdivacky  SizeFlagVal SZ = sz;
78198090Srdivacky  bits<3> SizeFlag = SZ.Value;
79193323Sed
80198090Srdivacky  IndexMode IM = im;
81198090Srdivacky  bits<2> IndexModeBits = IM.Value;
82198090Srdivacky  
83198090Srdivacky  Format F = f;
84193323Sed  bits<5> Form = F.Value;
85205407Srdivacky
86195340Sed  //
87193323Sed  // Attributes specific to ARM instructions...
88218893Sdim  //
89195340Sed  bit isUnaryDataProc = 0;
90218893Sdim  
91218893Sdim  let Constraints = cstr;
92195340Sed}
93212904Sdim
94212904Sdimclass PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
95212904Sdim  : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
96212904Sdim  let OutOperandList = oops;
97212904Sdim  let InOperandList = iops;
98212904Sdim  let AsmString   = asm;
99212904Sdim  let Pattern = pattern;
100212904Sdim}
101212904Sdim
102212904Sdim// Almost all ARM instructions are predicable.
103212904Sdimclass I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
104212904Sdim        IndexMode im, Format f, string opc, string asm, string cstr,
105212904Sdim        list<dag> pattern>
106212904Sdim  : InstARM<am, sz, im, f, cstr> {
107212904Sdim  let OutOperandList = oops;
108195340Sed  let InOperandList = !con(iops, (ops pred:$p));
109218893Sdim  let AsmString   = !strconcat(opc, !strconcat("${p}", asm));
110195340Sed  let Pattern = pattern;
111195340Sed  list<Predicate> Predicates = [IsARM];
112195340Sed}
113195340Sed
114195340Sed// Same as I except it can optionally modify CPSR. Note it's modeled as
115195340Sed// an input operand since by default it's a zero register. It will
116195340Sed// become an implicit def once it's "flipped".
117195340Sedclass sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
118205218Srdivacky         IndexMode im, Format f, string opc, string asm, string cstr,
119195340Sed         list<dag> pattern>
120198892Srdivacky  : InstARM<am, sz, im, f, cstr> {
121219077Sdim  let OutOperandList = oops;
122219077Sdim  let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
123198892Srdivacky  let AsmString   = !strconcat(opc, !strconcat("${p}${s}", asm));
124198892Srdivacky  let Pattern = pattern;
125198892Srdivacky  list<Predicate> Predicates = [IsARM];
126198892Srdivacky}
127198892Srdivacky
128219077Sdim// Special cases
129198892Srdivackyclass XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
130195340Sed         IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
131198090Srdivacky  : InstARM<am, sz, im, f, cstr> {
132198090Srdivacky  let OutOperandList = oops;
133198090Srdivacky  let InOperandList = iops;
134226633Sdim  let AsmString   = asm;
135226633Sdim  let Pattern = pattern;
136226633Sdim  list<Predicate> Predicates = [IsARM];
137212904Sdim}
138212904Sdim
139218893Sdimclass AI<dag oops, dag iops, Format f, string opc,
140218893Sdim         string asm, list<dag> pattern>
141226633Sdim  : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
142218893Sdim      asm, "", pattern>;
143218893Sdimclass AsI<dag oops, dag iops, Format f, string opc,
144218893Sdim          string asm, list<dag> pattern>
145218893Sdim  : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
146218893Sdim       asm, "", pattern>;
147218893Sdimclass AXI<dag oops, dag iops, Format f, string asm,
148198090Srdivacky          list<dag> pattern>
149198090Srdivacky  : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
150226633Sdim       "", pattern>;
151226633Sdim
152198090Srdivacky// Ctrl flow instructions
153198090Srdivackyclass ABI<bits<4> opcod, dag oops, dag iops, string opc,
154212904Sdim         string asm, list<dag> pattern>
155226633Sdim  : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
156198090Srdivacky      asm, "", pattern> {
157198090Srdivacky  let Inst{27-24} = opcod;
158261991Sdim}
159261991Sdimclass ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
160261991Sdim  : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
161261991Sdim       "", pattern> {
162261991Sdim  let Inst{27-24} = opcod;
163261991Sdim}
164261991Sdimclass ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
165261991Sdim  : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
166261991Sdim       "", pattern>;
167261991Sdim
168198090Srdivacky// BR_JT instructions
169226633Sdimclass JTI<dag oops, dag iops, string asm, list<dag> pattern>
170198090Srdivacky  : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
171218893Sdim       asm, "", pattern>;
172198090Srdivacky
173218893Sdim// addrmode1 instructions
174226633Sdimclass AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
175198090Srdivacky          string asm, list<dag> pattern>
176198090Srdivacky  : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
177198090Srdivacky      asm, "", pattern> {
178198090Srdivacky  let Inst{24-21} = opcod;
179218893Sdim  let Inst{27-26} = {0,0};
180198090Srdivacky}
181218893Sdimclass AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
182226633Sdim           string asm, list<dag> pattern>
183198090Srdivacky  : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
184198090Srdivacky       asm, "", pattern> {
185205218Srdivacky  let Inst{24-21} = opcod;
186205218Srdivacky  let Inst{27-26} = {0,0};
187234353Sdim}
188226633Sdimclass AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
189226633Sdim           list<dag> pattern>
190226633Sdim  : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
191218893Sdim       "", pattern> {
192218893Sdim  let Inst{24-21} = opcod;
193226633Sdim  let Inst{27-26} = {0,0};
194218893Sdim}
195205218Srdivackyclass AI1x2<dag oops, dag iops, Format f, string opc,
196226633Sdim            string asm, list<dag> pattern>
197226633Sdim  : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
198226633Sdim      asm, "", pattern>;
199226633Sdim
200205218Srdivacky
201205218Srdivacky// addrmode2 loads and stores
202226633Sdimclass AI2<dag oops, dag iops, Format f, string opc,
203218893Sdim          string asm, list<dag> pattern>
204205218Srdivacky  : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
205205218Srdivacky      asm, "", pattern> {
206221345Sdim  let Inst{27-26} = {0,1};
207221345Sdim}
208221345Sdim
209221345Sdim// loads
210221345Sdimclass AI2ldw<dag oops, dag iops, Format f, string opc,
211221345Sdim          string asm, list<dag> pattern>
212221345Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
213221345Sdim      asm, "", pattern> {
214234353Sdim  let Inst{20}    = 1; // L bit
215221345Sdim  let Inst{21}    = 0; // W bit
216221345Sdim  let Inst{22}    = 0; // B bit
217226633Sdim  let Inst{24}    = 1; // P bit
218234353Sdim  let Inst{27-26} = {0,1};
219205218Srdivacky}
220234353Sdimclass AXI2ldw<dag oops, dag iops, Format f, string asm,
221221345Sdim           list<dag> pattern>
222221345Sdim  : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
223226633Sdim       asm, "", pattern> {
224234353Sdim  let Inst{20}    = 1; // L bit
225221345Sdim  let Inst{21}    = 0; // W bit
226234353Sdim  let Inst{22}    = 0; // B bit
227221345Sdim  let Inst{24}    = 1; // P bit
228221345Sdim  let Inst{27-26} = {0,1};
229226633Sdim}
230234353Sdimclass AI2ldb<dag oops, dag iops, Format f, string opc,
231221345Sdim          string asm, list<dag> pattern>
232234353Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
233221345Sdim      asm, "", pattern> {
234221345Sdim  let Inst{20}    = 1; // L bit
235226633Sdim  let Inst{21}    = 0; // W bit
236234353Sdim  let Inst{22}    = 1; // B bit
237221345Sdim  let Inst{24}    = 1; // P bit
238205218Srdivacky  let Inst{27-26} = {0,1};
239198090Srdivacky}
240226633Sdimclass AXI2ldb<dag oops, dag iops, Format f, string asm,
241226633Sdim           list<dag> pattern>
242226633Sdim  : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
243226633Sdim       asm, "", pattern> {
244226633Sdim  let Inst{20}    = 1; // L bit
245226633Sdim  let Inst{21}    = 0; // W bit
246226633Sdim  let Inst{22}    = 1; // B bit
247226633Sdim  let Inst{24}    = 1; // P bit
248226633Sdim  let Inst{27-26} = {0,1};
249226633Sdim}
250261991Sdim
251261991Sdim// stores
252226633Sdimclass AI2stw<dag oops, dag iops, Format f, string opc,
253226633Sdim          string asm, list<dag> pattern>
254234353Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
255234353Sdim      asm, "", pattern> {
256226633Sdim  let Inst{20}    = 0; // L bit
257234353Sdim  let Inst{21}    = 0; // W bit
258234353Sdim  let Inst{22}    = 0; // B bit
259234353Sdim  let Inst{24}    = 1; // P bit
260234353Sdim  let Inst{27-26} = {0,1};
261234353Sdim}
262234353Sdimclass AXI2stw<dag oops, dag iops, Format f, string asm,
263226633Sdim           list<dag> pattern>
264193323Sed  : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
265193323Sed       asm, "", pattern> {
266193323Sed  let Inst{20}    = 0; // L bit
267226633Sdim  let Inst{21}    = 0; // W bit
268224145Sdim  let Inst{22}    = 0; // B bit
269201360Srdivacky  let Inst{24}    = 1; // P bit
270193323Sed  let Inst{27-26} = {0,1};
271193323Sed}
272193323Sedclass AI2stb<dag oops, dag iops, Format f, string opc,
273193323Sed          string asm, list<dag> pattern>
274224145Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
275193323Sed      asm, "", pattern> {
276193323Sed  let Inst{20}    = 0; // L bit
277193323Sed  let Inst{21}    = 0; // W bit
278205407Srdivacky  let Inst{22}    = 1; // B bit
279198892Srdivacky  let Inst{24}    = 1; // P bit
280193323Sed  let Inst{27-26} = {0,1};
281198090Srdivacky}
282226633Sdimclass AXI2stb<dag oops, dag iops, Format f, string asm,
283226633Sdim           list<dag> pattern>
284226633Sdim  : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
285226633Sdim       asm, "", pattern> {
286206083Srdivacky  let Inst{20}    = 0; // L bit
287218893Sdim  let Inst{21}    = 0; // W bit
288218893Sdim  let Inst{22}    = 1; // B bit
289218893Sdim  let Inst{24}    = 1; // P bit
290226633Sdim  let Inst{27-26} = {0,1};
291218893Sdim}
292224145Sdim
293224145Sdim// Pre-indexed loads
294224145Sdimclass AI2ldwpr<dag oops, dag iops, Format f, string opc,
295224145Sdim            string asm, string cstr, list<dag> pattern>
296224145Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
297226633Sdim      asm, cstr, pattern> {
298206274Srdivacky  let Inst{20}    = 1; // L bit
299193323Sed  let Inst{21}    = 1; // W bit
300198090Srdivacky  let Inst{22}    = 0; // B bit
301193323Sed  let Inst{24}    = 1; // P bit
302193323Sed  let Inst{27-26} = {0,1};
303201360Srdivacky}
304201360Srdivackyclass AI2ldbpr<dag oops, dag iops, Format f, string opc,
305234353Sdim            string asm, string cstr, list<dag> pattern>
306234353Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
307234353Sdim      asm, cstr, pattern> {
308234353Sdim  let Inst{20}    = 1; // L bit
309234353Sdim  let Inst{21}    = 1; // W bit
310234353Sdim  let Inst{22}    = 1; // B bit
311234353Sdim  let Inst{24}    = 1; // P bit
312234353Sdim  let Inst{27-26} = {0,1};
313201360Srdivacky}
314201360Srdivacky
315224145Sdim// Pre-indexed stores
316201360Srdivackyclass AI2stwpr<dag oops, dag iops, Format f, string opc,
317226633Sdim            string asm, string cstr, list<dag> pattern>
318226633Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
319226633Sdim      asm, cstr, pattern> {
320201360Srdivacky  let Inst{20}    = 0; // L bit
321201360Srdivacky  let Inst{21}    = 1; // W bit
322201360Srdivacky  let Inst{22}    = 0; // B bit
323224145Sdim  let Inst{24}    = 1; // P bit
324201360Srdivacky  let Inst{27-26} = {0,1};
325226633Sdim}
326226633Sdimclass AI2stbpr<dag oops, dag iops, Format f, string opc,
327226633Sdim            string asm, string cstr, list<dag> pattern>
328201360Srdivacky  : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
329234353Sdim      asm, cstr, pattern> {
330234353Sdim  let Inst{20}    = 0; // L bit
331234353Sdim  let Inst{21}    = 1; // W bit
332234353Sdim  let Inst{22}    = 1; // B bit
333234353Sdim  let Inst{24}    = 1; // P bit
334234353Sdim  let Inst{27-26} = {0,1};
335234353Sdim}
336234353Sdim
337234353Sdim// Post-indexed loads
338234353Sdimclass AI2ldwpo<dag oops, dag iops, Format f, string opc,
339234353Sdim            string asm, string cstr, list<dag> pattern>
340234353Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
341234353Sdim      asm, cstr,pattern> {
342234353Sdim  let Inst{20}    = 1; // L bit
343234353Sdim  let Inst{21}    = 0; // W bit
344234353Sdim  let Inst{22}    = 0; // B bit
345234353Sdim  let Inst{24}    = 0; // P bit
346234353Sdim  let Inst{27-26} = {0,1};
347234353Sdim}
348234353Sdimclass AI2ldbpo<dag oops, dag iops, Format f, string opc,
349234353Sdim            string asm, string cstr, list<dag> pattern>
350234353Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
351234353Sdim      asm, cstr,pattern> {
352234353Sdim  let Inst{20}    = 1; // L bit
353234353Sdim  let Inst{21}    = 0; // W bit
354234353Sdim  let Inst{22}    = 1; // B bit
355218893Sdim  let Inst{24}    = 0; // P bit
356224145Sdim  let Inst{27-26} = {0,1};
357224145Sdim}
358193323Sed
359193323Sed// Post-indexed stores
360193323Sedclass AI2stwpo<dag oops, dag iops, Format f, string opc,
361221345Sdim            string asm, string cstr, list<dag> pattern>
362224145Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
363193323Sed      asm, cstr,pattern> {
364193323Sed  let Inst{20}    = 0; // L bit
365218893Sdim  let Inst{21}    = 0; // W bit
366224145Sdim  let Inst{22}    = 0; // B bit
367218893Sdim  let Inst{24}    = 0; // P bit
368218893Sdim  let Inst{27-26} = {0,1};
369224145Sdim}
370218893Sdimclass AI2stbpo<dag oops, dag iops, Format f, string opc,
371218893Sdim            string asm, string cstr, list<dag> pattern>
372218893Sdim  : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
373218893Sdim      asm, cstr,pattern> {
374224145Sdim  let Inst{20}    = 0; // L bit
375218893Sdim  let Inst{21}    = 0; // W bit
376218893Sdim  let Inst{22}    = 1; // B bit
377224145Sdim  let Inst{24}    = 0; // P bit
378218893Sdim  let Inst{27-26} = {0,1};
379218893Sdim}
380218893Sdim
381218893Sdim// addrmode3 instructions
382224145Sdimclass AI3<dag oops, dag iops, Format f, string opc,
383218893Sdim          string asm, list<dag> pattern>
384218893Sdim  : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
385224145Sdim      asm, "", pattern>;
386218893Sdimclass AXI3<dag oops, dag iops, Format f, string asm,
387218893Sdim           list<dag> pattern>
388224145Sdim  : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
389224145Sdim       "", pattern>;
390224145Sdim
391224145Sdim// loads
392224145Sdimclass AI3ldh<dag oops, dag iops, Format f, string opc,
393224145Sdim          string asm, list<dag> pattern>
394224145Sdim  : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
395224145Sdim      asm, "", pattern> {
396224145Sdim  let Inst{4}     = 1;
397224145Sdim  let Inst{5}     = 1; // H bit
398224145Sdim  let Inst{6}     = 0; // S bit
399224145Sdim  let Inst{7}     = 1;
400224145Sdim  let Inst{20}    = 1; // L bit
401224145Sdim  let Inst{21}    = 0; // W bit
402224145Sdim  let Inst{24}    = 1; // P bit
403224145Sdim}
404224145Sdimclass AXI3ldh<dag oops, dag iops, Format f, string asm,
405224145Sdim           list<dag> pattern>
406224145Sdim  : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
407193323Sed       asm, "", pattern> {
408224145Sdim  let Inst{4}     = 1;
409206083Srdivacky  let Inst{5}     = 1; // H bit
410198090Srdivacky  let Inst{6}     = 0; // S bit
411193323Sed  let Inst{7}     = 1;
412198892Srdivacky  let Inst{20}    = 1; // L bit
413218893Sdim  let Inst{21}    = 0; // W bit
414218893Sdim  let Inst{24}    = 1; // P bit
415193323Sed}
416205407Srdivackyclass AI3ldsh<dag oops, dag iops, Format f, string opc,
417218893Sdim          string asm, list<dag> pattern>
418193323Sed  : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
419193323Sed      asm, "", pattern> {
420193323Sed  let Inst{4}     = 1;
421212904Sdim  let Inst{5}     = 1; // H bit
422200581Srdivacky  let Inst{6}     = 1; // S bit
423224145Sdim  let Inst{7}     = 1;
424206083Srdivacky  let Inst{20}    = 1; // L bit
425206083Srdivacky  let Inst{21}    = 0; // W bit
426206083Srdivacky  let Inst{24}    = 1; // P bit
427200581Srdivacky}
428200581Srdivackyclass AXI3ldsh<dag oops, dag iops, Format f, string asm,
429200581Srdivacky           list<dag> pattern>
430208599Srdivacky  : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
431200581Srdivacky       asm, "", pattern> {
432200581Srdivacky  let Inst{4}     = 1;
433200581Srdivacky  let Inst{5}     = 1; // H bit
434200581Srdivacky  let Inst{6}     = 1; // S bit
435193323Sed  let Inst{7}     = 1;
436212904Sdim  let Inst{20}    = 1; // L bit
437212904Sdim  let Inst{21}    = 0; // W bit
438212904Sdim  let Inst{24}    = 1; // P bit
439224145Sdim}
440198090Srdivackyclass AI3ldsb<dag oops, dag iops, Format f, string opc,
441198090Srdivacky          string asm, list<dag> pattern>
442193323Sed  : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
443198892Srdivacky      asm, "", pattern> {
444218893Sdim  let Inst{4}     = 1;
445218893Sdim  let Inst{5}     = 0; // H bit
446218893Sdim  let Inst{6}     = 1; // S bit
447218893Sdim  let Inst{7}     = 1;
448218893Sdim  let Inst{20}    = 1; // L bit
449193323Sed  let Inst{21}    = 0; // W bit
450205407Srdivacky  let Inst{24}    = 1; // P bit
451218893Sdim}
452193323Sedclass AXI3ldsb<dag oops, dag iops, Format f, string asm,
453193323Sed           list<dag> pattern>
454193323Sed  : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
455193323Sed       asm, "", pattern> {
456193323Sed  let Inst{4}     = 1;
457224145Sdim  let Inst{5}     = 0; // H bit
458198090Srdivacky  let Inst{6}     = 1; // S bit
459198090Srdivacky  let Inst{7}     = 1;
460198892Srdivacky  let Inst{20}    = 1; // L bit
461193323Sed  let Inst{21}    = 0; // W bit
462193323Sed  let Inst{24}    = 1; // P bit
463208599Srdivacky}
464193323Sedclass AI3ldd<dag oops, dag iops, Format f, string opc,
465193323Sed          string asm, list<dag> pattern>
466193323Sed  : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
467193323Sed      asm, "", pattern> {
468198090Srdivacky  let Inst{4}     = 1;
469198090Srdivacky  let Inst{5}     = 0; // H bit
470224145Sdim  let Inst{6}     = 1; // S bit
471198090Srdivacky  let Inst{7}     = 1;
472198090Srdivacky  let Inst{20}    = 0; // L bit
473198090Srdivacky  let Inst{21}    = 0; // W bit
474224145Sdim  let Inst{24}    = 1; // P bit
475198090Srdivacky}
476198090Srdivacky
477193323Sed// stores
478224145Sdimclass AI3sth<dag oops, dag iops, Format f, string opc,
479193323Sed          string asm, list<dag> pattern>
480200581Srdivacky  : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
481206083Srdivacky      asm, "", pattern> {
482224145Sdim  let Inst{4}     = 1;
483206083Srdivacky  let Inst{5}     = 1; // H bit
484193323Sed  let Inst{6}     = 0; // S bit
485193323Sed  let Inst{7}     = 1;
486198090Srdivacky  let Inst{20}    = 0; // L bit
487198090Srdivacky  let Inst{21}    = 0; // W bit
488224145Sdim  let Inst{24}    = 1; // P bit
489198090Srdivacky}
490193323Sedclass AXI3sth<dag oops, dag iops, Format f, string asm,
491193323Sed           list<dag> pattern>
492198090Srdivacky  : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
493198090Srdivacky       asm, "", pattern> {
494224145Sdim  let Inst{4}     = 1;
495198090Srdivacky  let Inst{5}     = 1; // H bit
496193323Sed  let Inst{6}     = 0; // S bit
497193323Sed  let Inst{7}     = 1;
498193323Sed  let Inst{20}    = 0; // L bit
499193323Sed  let Inst{21}    = 0; // W bit
500198090Srdivacky  let Inst{24}    = 1; // P bit
501198090Srdivacky}
502224145Sdimclass AI3std<dag oops, dag iops, Format f, string opc,
503193323Sed          string asm, list<dag> pattern>
504193323Sed  : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
505261991Sdim      asm, "", pattern> {
506200581Srdivacky  let Inst{4}     = 1;
507224145Sdim  let Inst{5}     = 1; // H bit
508200581Srdivacky  let Inst{6}     = 1; // S bit
509218893Sdim  let Inst{7}     = 1;
510226633Sdim  let Inst{20}    = 0; // L bit
511200581Srdivacky  let Inst{21}    = 0; // W bit
512200581Srdivacky  let Inst{24}    = 1; // P bit
513212904Sdim}
514226633Sdim
515218893Sdim// Pre-indexed loads
516261991Sdimclass AI3ldhpr<dag oops, dag iops, Format f, string opc,
517261991Sdim            string asm, string cstr, list<dag> pattern>
518261991Sdim  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
519200581Srdivacky      asm, cstr, pattern> {
520261991Sdim  let Inst{4}     = 1;
521200581Srdivacky  let Inst{5}     = 1; // H bit
522224145Sdim  let Inst{6}     = 0; // S bit
523200581Srdivacky  let Inst{7}     = 1;
524218893Sdim  let Inst{20}    = 1; // L bit
525221345Sdim  let Inst{21}    = 1; // W bit
526200581Srdivacky  let Inst{24}    = 1; // P bit
527200581Srdivacky}
528212904Sdimclass AI3ldshpr<dag oops, dag iops, Format f, string opc,
529221345Sdim            string asm, string cstr, list<dag> pattern>
530261991Sdim  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
531261991Sdim      asm, cstr, pattern> {
532261991Sdim  let Inst{4}     = 1;
533218893Sdim  let Inst{5}     = 1; // H bit
534200581Srdivacky  let Inst{6}     = 1; // S bit
535261991Sdim  let Inst{7}     = 1;
536261991Sdim  let Inst{20}    = 1; // L bit
537261991Sdim  let Inst{21}    = 1; // W bit
538261991Sdim  let Inst{24}    = 1; // P bit
539261991Sdim}
540261991Sdimclass AI3ldsbpr<dag oops, dag iops, Format f, string opc,
541261991Sdim            string asm, string cstr, list<dag> pattern>
542261991Sdim  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
543261991Sdim      asm, cstr, pattern> {
544261991Sdim  let Inst{4}     = 1;
545261991Sdim  let Inst{5}     = 0; // H bit
546261991Sdim  let Inst{6}     = 1; // S bit
547261991Sdim  let Inst{7}     = 1;
548261991Sdim  let Inst{20}    = 1; // L bit
549261991Sdim  let Inst{21}    = 1; // W bit
550261991Sdim  let Inst{24}    = 1; // P bit
551261991Sdim}
552261991Sdim
553261991Sdim// Pre-indexed stores
554261991Sdimclass AI3sthpr<dag oops, dag iops, Format f, string opc,
555261991Sdim            string asm, string cstr, list<dag> pattern>
556261991Sdim  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
557261991Sdim      asm, cstr, pattern> {
558261991Sdim  let Inst{4}     = 1;
559261991Sdim  let Inst{5}     = 1; // H bit
560261991Sdim  let Inst{6}     = 0; // S bit
561261991Sdim  let Inst{7}     = 1;
562218893Sdim  let Inst{20}    = 0; // L bit
563226633Sdim  let Inst{21}    = 1; // W bit
564218893Sdim  let Inst{24}    = 1; // P bit
565218893Sdim}
566226633Sdim
567218893Sdim// Post-indexed loads
568218893Sdimclass AI3ldhpo<dag oops, dag iops, Format f, string opc,
569218893Sdim            string asm, string cstr, list<dag> pattern>
570226633Sdim  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
571218893Sdim      asm, cstr,pattern> {
572218893Sdim  let Inst{4}     = 1;
573218893Sdim  let Inst{5}     = 1; // H bit
574234353Sdim  let Inst{6}     = 0; // S bit
575234982Sdim  let Inst{7}     = 1;
576234353Sdim  let Inst{20}    = 1; // L bit
577218893Sdim  let Inst{21}    = 1; // W bit
578261991Sdim  let Inst{24}    = 0; // P bit
579261991Sdim}
580261991Sdimclass AI3ldshpo<dag oops, dag iops, Format f, string opc,
581261991Sdim            string asm, string cstr, list<dag> pattern>
582261991Sdim  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
583200581Srdivacky      asm, cstr,pattern> {
584261991Sdim  let Inst{4}     = 1;
585261991Sdim  let Inst{5}     = 1; // H bit
586261991Sdim  let Inst{6}     = 1; // S bit
587261991Sdim  let Inst{7}     = 1;
588261991Sdim  let Inst{20}    = 1; // L bit
589261991Sdim  let Inst{21}    = 1; // W bit
590261991Sdim  let Inst{24}    = 0; // P bit
591193323Sed}
592198090Srdivackyclass AI3ldsbpo<dag oops, dag iops, Format f, string opc,
593198090Srdivacky            string asm, string cstr, list<dag> pattern>
594224145Sdim  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
595198090Srdivacky      asm, cstr,pattern> {
596193323Sed  let Inst{4}     = 1;
597212904Sdim  let Inst{5}     = 0; // H bit
598193323Sed  let Inst{6}     = 1; // S bit
599198090Srdivacky  let Inst{7}     = 1;
600198090Srdivacky  let Inst{20}    = 1; // L bit
601224145Sdim  let Inst{21}    = 1; // W bit
602198090Srdivacky  let Inst{24}    = 0; // P bit
603193323Sed}
604212904Sdim
605193323Sed// Post-indexed stores
606198090Srdivackyclass AI3sthpo<dag oops, dag iops, Format f, string opc,
607198090Srdivacky            string asm, string cstr, list<dag> pattern>
608224145Sdim  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
609198090Srdivacky      asm, cstr,pattern> {
610193323Sed  let Inst{4}     = 1;
611212904Sdim  let Inst{5}     = 1; // H bit
612193323Sed  let Inst{6}     = 0; // S bit
613193323Sed  let Inst{7}     = 1;
614193323Sed  let Inst{20}    = 0; // L bit
615193323Sed  let Inst{21}    = 1; // W bit
616218893Sdim  let Inst{24}    = 0; // P bit
617218893Sdim}
618218893Sdim
619218893Sdim
620224145Sdim// addrmode4 instructions
621218893Sdimclass AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
622218893Sdim  : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
623218893Sdim       "", pattern> {
624218893Sdim  let Inst{20}    = 1; // L bit
625218893Sdim  let Inst{22}    = 0; // S bit
626218893Sdim  let Inst{27-25} = 0b100;
627218893Sdim}
628193323Sedclass AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
629218893Sdim  : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
630218893Sdim       "", pattern> {
631218893Sdim  let Inst{20}    = 0; // L bit
632218893Sdim  let Inst{22}    = 0; // S bit
633224145Sdim  let Inst{27-25} = 0b100;
634198090Srdivacky}
635218893Sdim
636212904Sdim// Unsigned multiply, multiply-accumulate instructions.
637218893Sdimclass AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
638218893Sdim         string asm, list<dag> pattern>
639218893Sdim  : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
640218893Sdim      asm, "", pattern> {
641218893Sdim  let Inst{7-4}   = 0b1001;
642193323Sed  let Inst{20}    = 0; // S bit
643226633Sdim  let Inst{27-21} = opcod;
644218893Sdim}
645218893Sdimclass AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
646218893Sdim          string asm, list<dag> pattern>
647218893Sdim  : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
648218893Sdim       asm, "", pattern> {
649218893Sdim  let Inst{7-4}   = 0b1001;
650218893Sdim  let Inst{27-21} = opcod;
651218893Sdim}
652218893Sdim
653226633Sdim// Most significant word multiply
654218893Sdimclass AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
655218893Sdim         string asm, list<dag> pattern>
656226633Sdim  : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
657226633Sdim      asm, "", pattern> {
658226633Sdim  let Inst{7-4}   = 0b1001;
659226633Sdim  let Inst{20}    = 1;
660226633Sdim  let Inst{27-21} = opcod;
661226633Sdim}
662226633Sdim
663226633Sdim// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
664226633Sdimclass AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
665226633Sdim         string asm, list<dag> pattern>
666226633Sdim  : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
667226633Sdim      asm, "", pattern> {
668226633Sdim  let Inst{4}     = 0;
669226633Sdim  let Inst{7}     = 1;
670226633Sdim  let Inst{20}    = 0;
671226633Sdim  let Inst{27-21} = opcod;
672226633Sdim}
673226633Sdim
674218893Sdim// Extend instructions.
675193323Sedclass AExtI<bits<8> opcod, dag oops, dag iops, string opc,
676226633Sdim            string asm, list<dag> pattern>
677226633Sdim  : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
678221345Sdim      asm, "", pattern> {
679221345Sdim  let Inst{7-4}   = 0b0111;
680221345Sdim  let Inst{27-20} = opcod;
681221345Sdim}
682221345Sdim
683221345Sdim// Misc Arithmetic instructions.
684221345Sdimclass AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
685221345Sdim               string asm, list<dag> pattern>
686221345Sdim  : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
687221345Sdim      asm, "", pattern> {
688221345Sdim  let Inst{27-20} = opcod;
689221345Sdim}
690221345Sdim
691221345Sdim//===----------------------------------------------------------------------===//
692221345Sdim
693221345Sdim// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
694221345Sdimclass ARMPat<dag pattern, dag result> : Pat<pattern, result> {
695221345Sdim  list<Predicate> Predicates = [IsARM];
696193323Sed}
697193323Sedclass ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
698218893Sdim  list<Predicate> Predicates = [IsARM, HasV5TE];
699218893Sdim}
700224145Sdimclass ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
701198090Srdivacky  list<Predicate> Predicates = [IsARM, HasV6];
702218893Sdim}
703218893Sdim
704198090Srdivacky//===----------------------------------------------------------------------===//
705218893Sdim//
706218893Sdim// Thumb Instruction Format Definitions.
707218893Sdim//
708218893Sdim
709218893Sdim
710218893Sdim// TI - Thumb instruction.
711218893Sdim
712218893Sdimclass ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
713218893Sdim             string asm, string cstr, list<dag> pattern>
714218893Sdim  : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
715226633Sdim  let OutOperandList = outs;
716226633Sdim  let InOperandList = ins;
717193323Sed  let AsmString   = asm;
718218893Sdim  let Pattern = pattern;
719226633Sdim  list<Predicate> Predicates = [IsThumb];
720218893Sdim}
721218893Sdim
722224145Sdimclass TI<dag outs, dag ins, string asm, list<dag> pattern>
723218893Sdim  : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
724218893Sdimclass TI1<dag outs, dag ins, string asm, list<dag> pattern>
725198090Srdivacky  : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
726218893Sdimclass TI2<dag outs, dag ins, string asm, list<dag> pattern>
727218893Sdim  : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
728218893Sdimclass TI4<dag outs, dag ins, string asm, list<dag> pattern>
729218893Sdim  : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
730218893Sdimclass TIs<dag outs, dag ins, string asm, list<dag> pattern>
731193323Sed  : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
732221345Sdim
733221345Sdim// Two-address instructions
734221345Sdimclass TIt<dag outs, dag ins, string asm, list<dag> pattern>
735226633Sdim  : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
736221345Sdim
737221345Sdim// BL, BLX(1) are translated by assembler into two instructions
738226633Sdimclass TIx2<dag outs, dag ins, string asm, list<dag> pattern>
739221345Sdim  : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
740221345Sdim
741221345Sdim// BR_JT instructions
742221345Sdimclass TJTI<dag outs, dag ins, string asm, list<dag> pattern>
743221345Sdim  : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
744226633Sdim
745221345Sdim// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
746221345Sdimclass ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
747226633Sdim  list<Predicate> Predicates = [IsThumb];
748226633Sdim}
749226633Sdim
750226633Sdimclass ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
751221345Sdim  list<Predicate> Predicates = [IsThumb, HasV5T];
752221345Sdim}
753221345Sdim
754221345Sdim//===----------------------------------------------------------------------===//
755193323Sed
756218893Sdim//===----------------------------------------------------------------------===//
757198090Srdivacky// ARM VFP Instruction templates.
758224145Sdim//
759198090Srdivacky
760218893Sdim// ARM VFP addrmode5 loads and stores
761218893Sdimclass ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
762198090Srdivacky           string opc, string asm, list<dag> pattern>
763218893Sdim  : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
764218893Sdim      VFPLdStFrm, opc, asm, "", pattern> {
765218893Sdim  // TODO: Mark the instructions with the appropriate subtarget info.
766218893Sdim  let Inst{27-24} = opcod1;
767218893Sdim  let Inst{21-20} = opcod2;
768218893Sdim  let Inst{11-8}  = 0b1011;
769218893Sdim}
770218893Sdim
771218893Sdimclass ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
772218893Sdim           string opc, string asm, list<dag> pattern>
773226633Sdim  : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
774193323Sed      VFPLdStFrm, opc, asm, "", pattern> {
775193323Sed  // TODO: Mark the instructions with the appropriate subtarget info.
776193323Sed  let Inst{27-24} = opcod1;
777218893Sdim  let Inst{21-20} = opcod2;
778218893Sdim  let Inst{11-8}  = 0b1010;
779224145Sdim}
780218893Sdim
781218893Sdim// Load / store multiple
782218893Sdimclass AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
783218893Sdim  : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
784193323Sed       VFPLdStMulFrm, asm, "", pattern> {
785193323Sed  // TODO: Mark the instructions with the appropriate subtarget info.
786218893Sdim  let Inst{27-25} = 0b110;
787218893Sdim  let Inst{11-8}  = 0b1011;
788193323Sed}
789193323Sed
790193323Sedclass AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
791198090Srdivacky  : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
792198090Srdivacky       VFPLdStMulFrm, asm, "", pattern> {
793224145Sdim  // TODO: Mark the instructions with the appropriate subtarget info.
794198090Srdivacky  let Inst{27-25} = 0b110;
795193323Sed  let Inst{11-8}  = 0b1010;
796193323Sed}
797193323Sed
798193323Sed
799198090Srdivacky// Double precision, unary
800198090Srdivackyclass ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
801224145Sdim           string opc, string asm, list<dag> pattern>
802198090Srdivacky  : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
803193323Sed  let Inst{27-20} = opcod1;
804193323Sed  let Inst{19-16} = opcod2;
805193323Sed  let Inst{11-8}  = 0b1011;
806193323Sed  let Inst{7-4}   = opcod3;
807193323Sed}
808218893Sdim
809218893Sdim// Double precision, binary
810224145Sdimclass ADbI<bits<8> opcod, dag oops, dag iops, string opc,
811198090Srdivacky           string asm, list<dag> pattern>
812218893Sdim  : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
813218893Sdim  let Inst{27-20} = opcod;
814218893Sdim  let Inst{11-8}  = 0b1011;
815218893Sdim}
816193323Sed
817193323Sed// Single precision, unary
818218893Sdimclass ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
819218893Sdim           string opc, string asm, list<dag> pattern>
820218893Sdim  : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
821193323Sed  // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
822218893Sdim  let Inst{27-20} = opcod1;
823218893Sdim  let Inst{19-16} = opcod2;
824218893Sdim  let Inst{11-8}  = 0b1010;
825218893Sdim  let Inst{7-4}   = opcod3;
826218893Sdim}
827218893Sdim
828218893Sdim// Single precision, binary
829193323Sedclass ASbI<bits<8> opcod, dag oops, dag iops, string opc,
830193323Sed           string asm, list<dag> pattern>
831218893Sdim  : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
832218893Sdim  // Bit 22 (D bit) can be changed during instruction encoding.
833224145Sdim  let Inst{27-20} = opcod;
834198090Srdivacky  let Inst{11-8}  = 0b1010;
835218893Sdim}
836218893Sdim
837193323Sed// VFP conversion instructions
838193323Sedclass AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
839193323Sed               dag oops, dag iops, string opc, string asm, list<dag> pattern>
840193323Sed  : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
841218893Sdim  let Inst{27-20} = opcod1;
842218893Sdim  let Inst{19-16} = opcod2;
843218893Sdim  let Inst{11-8}  = opcod3;
844193323Sed  let Inst{6}     = 1;
845218893Sdim}
846218893Sdim
847218893Sdimclass AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
848218893Sdim             string opc, string asm, list<dag> pattern>
849218893Sdim  : AI<oops, iops, f, opc, asm, pattern> {
850218893Sdim  let Inst{27-20} = opcod1;
851193323Sed  let Inst{11-8}  = opcod2;
852218893Sdim  let Inst{4}     = 1;
853218893Sdim}
854218893Sdim
855218893Sdimclass AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
856218893Sdim              string asm, list<dag> pattern>
857218893Sdim  : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, opc, asm, pattern>;
858218893Sdim
859218893Sdimclass AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
860218893Sdim              string asm, list<dag> pattern>
861218893Sdim  : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, opc, asm, pattern>;
862218893Sdim
863218893Sdimclass AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
864218893Sdim              string asm, list<dag> pattern>
865218893Sdim  : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, opc, asm, pattern>;
866218893Sdim
867218893Sdimclass AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
868218893Sdim              string asm, list<dag> pattern>
869193323Sed  : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, opc, asm, pattern>;
870198090Srdivacky
871198090Srdivacky//===----------------------------------------------------------------------===//
872224145Sdim
873198090Srdivacky//===----------------------------------------------------------------------===//
874218893Sdim// ARM NEON Instruction templates.
875218893Sdim//
876218893Sdim
877218893Sdimclass NeonI<dag oops, dag iops, AddrMode am, IndexMode im, string asm,
878218893Sdim            string cstr, list<dag> pattern>
879193323Sed  : InstARM<am, Size4Bytes, im, NEONFrm, cstr> {
880218893Sdim  let OutOperandList = oops;
881193323Sed  let InOperandList = iops;
882239462Sdim  let AsmString = asm;
883239462Sdim  let Pattern = pattern;
884193323Sed  list<Predicate> Predicates = [HasNEON];
885193323Sed}
886193323Sed
887218893Sdimclass NI<dag oops, dag iops, string asm, list<dag> pattern>
888218893Sdim  : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, "", pattern> {
889224145Sdim}
890198090Srdivacky
891218893Sdimclass NDataI<dag oops, dag iops, string asm, string cstr, list<dag> pattern>
892218893Sdim  : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, cstr, pattern> {
893193323Sed  let Inst{31-25} = 0b1111001;
894218893Sdim}
895218893Sdim
896218893Sdim// NEON "one register and a modified immediate" format.
897218893Sdimclass N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
898218893Sdim               bit op5, bit op4,
899193323Sed               dag oops, dag iops, string asm, string cstr, list<dag> pattern>
900193323Sed  : NDataI<oops, iops, asm, cstr, pattern> {
901243830Sdim  let Inst{23} = op23;
902243830Sdim  let Inst{21-19} = op21_19;
903243830Sdim  let Inst{11-8} = op11_8;
904243830Sdim  let Inst{7} = op7;
905243830Sdim  let Inst{6} = op6;
906243830Sdim  let Inst{5} = op5;
907243830Sdim  let Inst{4} = op4;
908243830Sdim}
909243830Sdim
910243830Sdim// NEON 2 vector register format.
911243830Sdimclass N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
912243830Sdim          bits<5> op11_7, bit op6, bit op4,
913243830Sdim          dag oops, dag iops, string asm, string cstr, list<dag> pattern>
914243830Sdim  : NDataI<oops, iops, asm, cstr, pattern> {
915243830Sdim  let Inst{24-23} = op24_23;
916243830Sdim  let Inst{21-20} = op21_20;
917243830Sdim  let Inst{19-18} = op19_18;
918218893Sdim  let Inst{17-16} = op17_16;
919234353Sdim  let Inst{11-7} = op11_7;
920226633Sdim  let Inst{6} = op6;
921226633Sdim  let Inst{4} = op4;
922226633Sdim}
923226633Sdim
924226633Sdim// NEON 2 vector register with immediate.
925226633Sdimclass N2VImm<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
926226633Sdim             bit op6, bit op4,
927226633Sdim             dag oops, dag iops, string asm, string cstr, list<dag> pattern>
928226633Sdim  : NDataI<oops, iops, asm, cstr, pattern> {
929226633Sdim  let Inst{24} = op24;
930226633Sdim  let Inst{23} = op23;
931226633Sdim  let Inst{21-16} = op21_16;
932226633Sdim  let Inst{11-8} = op11_8;
933226633Sdim  let Inst{7} = op7;
934226633Sdim  let Inst{6} = op6;
935226633Sdim  let Inst{4} = op4;
936218893Sdim}
937218893Sdim
938224145Sdim// NEON 3 vector register format.
939218893Sdimclass N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
940218893Sdim          dag oops, dag iops, string asm, string cstr, list<dag> pattern>
941218893Sdim  : NDataI<oops, iops, asm, cstr, pattern> {
942218893Sdim  let Inst{24} = op24;
943226633Sdim  let Inst{23} = op23;
944218893Sdim  let Inst{21-20} = op21_20;
945218893Sdim  let Inst{11-8} = op11_8;
946218893Sdim  let Inst{6} = op6;
947226633Sdim  let Inst{4} = op4;
948218893Sdim}
949218893Sdim
950218893Sdim// NEON VMOVs between scalar and core registers.
951218893Sdimclass NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
952218893Sdim               dag oops, dag iops, Format f, string opc, string asm,
953193323Sed               list<dag> pattern>
954193323Sed  : AI<oops, iops, f, opc, asm, pattern> {
955193323Sed  let Inst{27-20} = opcod1;
956193323Sed  let Inst{11-8} = opcod2;
957193323Sed  let Inst{6-5} = opcod3;
958193323Sed  let Inst{4} = 1;
959223017Sdim  list<Predicate> Predicates = [HasNEON];
960223017Sdim}
961223017Sdimclass NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
962193323Sed                dag oops, dag iops, string opc, string asm, list<dag> pattern>
963193323Sed  : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, opc, asm,
964193323Sed             pattern>;
965243830Sdimclass NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
966243830Sdim                dag oops, dag iops, string opc, string asm, list<dag> pattern>
967243830Sdim  : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, opc, asm,
968243830Sdim             pattern>;
969193323Sedclass NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
970193323Sed            dag oops, dag iops, string opc, string asm, list<dag> pattern>
971193323Sed  : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, opc, asm, pattern>;
972193323Sed