xref: /freebsd/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZInstrFormats.td (revision 0ad011ececb978e22a9bff2acf76633b094f1ff6)
1//==- SystemZInstrFormats.td - SystemZ Instruction Formats --*- tablegen -*-==//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Basic SystemZ instruction definition
11//===----------------------------------------------------------------------===//
12
13class InstSystemZ<int size, dag outs, dag ins, string asmstr,
14                  list<dag> pattern> : Instruction {
15  let Namespace = "SystemZ";
16
17  dag OutOperandList = outs;
18  dag InOperandList = ins;
19  let Size = size;
20  let Pattern = pattern;
21  let AsmString = asmstr;
22
23  let hasSideEffects = 0;
24  let mayLoad = 0;
25  let mayStore = 0;
26
27  // Some instructions come in pairs, one having a 12-bit displacement
28  // and the other having a 20-bit displacement.  Both instructions in
29  // the pair have the same DispKey and their DispSizes are "12" and "20"
30  // respectively.
31  string DispKey = "";
32  string DispSize = "none";
33
34  // Many register-based <INSN>R instructions have a memory-based <INSN>
35  // counterpart.  OpKey uniquely identifies <INSN>R, while OpType is
36  // "reg" for <INSN>R and "mem" for <INSN>.
37  string OpKey = "";
38  string OpType = "none";
39
40  // MemKey identifies a targe reg-mem opcode, while MemType can be either
41  // "pseudo" or "target". This is used to map a pseduo memory instruction to
42  // its corresponding target opcode. See comment at MemFoldPseudo.
43  string MemKey = "";
44  string MemType = "none";
45
46  // Many distinct-operands instructions have older 2-operand equivalents.
47  // NumOpsKey uniquely identifies one of these 2-operand and 3-operand pairs,
48  // with NumOpsValue being "2" or "3" as appropriate.
49  string NumOpsKey = "";
50  string NumOpsValue = "none";
51
52  // True if this instruction is a simple D(X,B) load of a register
53  // (with no sign or zero extension).
54  bit SimpleBDXLoad = 0;
55
56  // True if this instruction is a simple D(X,B) store of a register
57  // (with no truncation).
58  bit SimpleBDXStore = 0;
59
60  // True if this instruction has a 20-bit displacement field.
61  bit Has20BitOffset = 0;
62
63  // True if addresses in this instruction have an index register.
64  bit HasIndex = 0;
65
66  // True if this is a 128-bit pseudo instruction that combines two 64-bit
67  // operations.
68  bit Is128Bit = 0;
69
70  // The access size of all memory operands in bytes, or 0 if not known.
71  bits<5> AccessBytes = 0;
72
73  // If the instruction sets CC to a useful value, this gives the mask
74  // of all possible CC results.  The mask has the same form as
75  // SystemZ::CCMASK_*.
76  bits<4> CCValues = 0;
77
78  // The subset of CCValues that have the same meaning as they would after a
79  // comparison of the first operand against zero. "Logical" instructions
80  // leave this blank as they set CC in a different way.
81  bits<4> CompareZeroCCMask = 0;
82
83  // True if the instruction is conditional and if the CC mask operand
84  // comes first (as for BRC, etc.).
85  bit CCMaskFirst = 0;
86
87  // Similar, but true if the CC mask operand comes last (as for LOC, etc.).
88  bit CCMaskLast = 0;
89
90  // True if the instruction is the "logical" rather than "arithmetic" form,
91  // in cases where a distinction exists. Except for logical compares, if the
92  // instruction sets this flag along with a non-zero CCValues field, it is
93  // assumed to set CC to either CCMASK_LOGICAL_ZERO or
94  // CCMASK_LOGICAL_NONZERO.
95  bit IsLogical = 0;
96
97  // True if the (add or sub) instruction sets CC like a compare of the
98  // result against zero, but only if the 'nsw' flag is set.
99  bit CCIfNoSignedWrap = 0;
100
101  let TSFlags{0}     = SimpleBDXLoad;
102  let TSFlags{1}     = SimpleBDXStore;
103  let TSFlags{2}     = Has20BitOffset;
104  let TSFlags{3}     = HasIndex;
105  let TSFlags{4}     = Is128Bit;
106  let TSFlags{9-5}   = AccessBytes;
107  let TSFlags{13-10} = CCValues;
108  let TSFlags{17-14} = CompareZeroCCMask;
109  let TSFlags{18}    = CCMaskFirst;
110  let TSFlags{19}    = CCMaskLast;
111  let TSFlags{20}    = IsLogical;
112  let TSFlags{21}    = CCIfNoSignedWrap;
113}
114
115//===----------------------------------------------------------------------===//
116// Mappings between instructions
117//===----------------------------------------------------------------------===//
118
119// Return the version of an instruction that has an unsigned 12-bit
120// displacement.
121def getDisp12Opcode : InstrMapping {
122  let FilterClass = "InstSystemZ";
123  let RowFields = ["DispKey"];
124  let ColFields = ["DispSize"];
125  let KeyCol = ["20"];
126  let ValueCols = [["12"]];
127}
128
129// Return the version of an instruction that has a signed 20-bit displacement.
130def getDisp20Opcode : InstrMapping {
131  let FilterClass = "InstSystemZ";
132  let RowFields = ["DispKey"];
133  let ColFields = ["DispSize"];
134  let KeyCol = ["12"];
135  let ValueCols = [["20"]];
136}
137
138// Return the memory form of a register instruction. Note that this may
139// return a MemFoldPseudo instruction (see below).
140def getMemOpcode : InstrMapping {
141  let FilterClass = "InstSystemZ";
142  let RowFields = ["OpKey"];
143  let ColFields = ["OpType"];
144  let KeyCol = ["reg"];
145  let ValueCols = [["mem"]];
146}
147
148// Return the target memory instruction for a MemFoldPseudo.
149def getTargetMemOpcode : InstrMapping {
150  let FilterClass = "InstSystemZ";
151  let RowFields = ["MemKey"];
152  let ColFields = ["MemType"];
153  let KeyCol = ["pseudo"];
154  let ValueCols = [["target"]];
155}
156
157// Return the 2-operand form of a 3-operand instruction.
158def getTwoOperandOpcode : InstrMapping {
159  let FilterClass = "InstSystemZ";
160  let RowFields = ["NumOpsKey"];
161  let ColFields = ["NumOpsValue"];
162  let KeyCol = ["3"];
163  let ValueCols = [["2"]];
164}
165
166//===----------------------------------------------------------------------===//
167// Instruction formats
168//===----------------------------------------------------------------------===//
169//
170// Formats are specified using operand field declarations of the form:
171//
172//   bits<4> Rn   : register input or output for operand n
173//   bits<5> Vn   : vector register input or output for operand n
174//   bits<m> In   : immediate value of width m for operand n
175//   bits<4> Bn   : base register for address operand n
176//   bits<m> Dn   : displacement for address operand n
177//   bits<5> Vn   : vector index for address operand n
178//   bits<4> Xn   : index register for address operand n
179//   bits<4> Mn   : mode value for operand n
180//
181// The operand numbers ("n" in the list above) follow the architecture manual.
182// Assembly operands sometimes have a different order; in particular, R3 often
183// is often written between operands 1 and 2.
184//
185//===----------------------------------------------------------------------===//
186
187class InstE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
188  : InstSystemZ<2, outs, ins, asmstr, pattern> {
189  field bits<16> Inst;
190  field bits<16> SoftFail = 0;
191
192  let Inst = op;
193}
194
195class InstI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
196  : InstSystemZ<2, outs, ins, asmstr, pattern> {
197  field bits<16> Inst;
198  field bits<16> SoftFail = 0;
199
200  bits<8> I1;
201
202  let Inst{15-8} = op;
203  let Inst{7-0}  = I1;
204}
205
206class InstIE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
207  : InstSystemZ<4, outs, ins, asmstr, pattern> {
208  field bits<32> Inst;
209  field bits<32> SoftFail = 0;
210
211  bits<4> I1;
212  bits<4> I2;
213
214  let Inst{31-16} = op;
215  let Inst{15-8}  = 0;
216  let Inst{7-4}   = I1;
217  let Inst{3-0}   = I2;
218}
219
220class InstMII<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
221  : InstSystemZ<6, outs, ins, asmstr, pattern> {
222  field bits<48> Inst;
223  field bits<48> SoftFail = 0;
224
225  bits<4> M1;
226  bits<12> RI2;
227  bits<24> RI3;
228
229  let Inst{47-40} = op;
230  let Inst{39-36} = M1;
231  let Inst{35-24} = RI2;
232  let Inst{23-0}  = RI3;
233}
234
235class InstRIa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
236  : InstSystemZ<4, outs, ins, asmstr, pattern> {
237  field bits<32> Inst;
238  field bits<32> SoftFail = 0;
239
240  bits<4> R1;
241  bits<16> I2;
242
243  let Inst{31-24} = op{11-4};
244  let Inst{23-20} = R1;
245  let Inst{19-16} = op{3-0};
246  let Inst{15-0}  = I2;
247}
248
249class InstRIb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
250  : InstSystemZ<4, outs, ins, asmstr, pattern> {
251  field bits<32> Inst;
252  field bits<32> SoftFail = 0;
253
254  bits<4> R1;
255  bits<16> RI2;
256
257  let Inst{31-24} = op{11-4};
258  let Inst{23-20} = R1;
259  let Inst{19-16} = op{3-0};
260  let Inst{15-0}  = RI2;
261}
262
263class InstRIc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
264  : InstSystemZ<4, outs, ins, asmstr, pattern> {
265  field bits<32> Inst;
266  field bits<32> SoftFail = 0;
267
268  bits<4> M1;
269  bits<16> RI2;
270
271  let Inst{31-24} = op{11-4};
272  let Inst{23-20} = M1;
273  let Inst{19-16} = op{3-0};
274  let Inst{15-0}  = RI2;
275}
276
277class InstRIEa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
278  : InstSystemZ<6, outs, ins, asmstr, pattern> {
279  field bits<48> Inst;
280  field bits<48> SoftFail = 0;
281
282  bits<4> R1;
283  bits<16> I2;
284  bits<4> M3;
285
286  let Inst{47-40} = op{15-8};
287  let Inst{39-36} = R1;
288  let Inst{35-32} = 0;
289  let Inst{31-16} = I2;
290  let Inst{15-12} = M3;
291  let Inst{11-8}  = 0;
292  let Inst{7-0}   = op{7-0};
293}
294
295class InstRIEb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
296  : InstSystemZ<6, outs, ins, asmstr, pattern> {
297  field bits<48> Inst;
298  field bits<48> SoftFail = 0;
299
300  bits<4> R1;
301  bits<4> R2;
302  bits<4> M3;
303  bits<16> RI4;
304
305  let Inst{47-40} = op{15-8};
306  let Inst{39-36} = R1;
307  let Inst{35-32} = R2;
308  let Inst{31-16} = RI4;
309  let Inst{15-12} = M3;
310  let Inst{11-8}  = 0;
311  let Inst{7-0}   = op{7-0};
312}
313
314class InstRIEc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
315  : InstSystemZ<6, outs, ins, asmstr, pattern> {
316  field bits<48> Inst;
317  field bits<48> SoftFail = 0;
318
319  bits<4> R1;
320  bits<8> I2;
321  bits<4> M3;
322  bits<16> RI4;
323
324  let Inst{47-40} = op{15-8};
325  let Inst{39-36} = R1;
326  let Inst{35-32} = M3;
327  let Inst{31-16} = RI4;
328  let Inst{15-8}  = I2;
329  let Inst{7-0}   = op{7-0};
330}
331
332class InstRIEd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
333  : InstSystemZ<6, outs, ins, asmstr, pattern> {
334  field bits<48> Inst;
335  field bits<48> SoftFail = 0;
336
337  bits<4> R1;
338  bits<4> R3;
339  bits<16> I2;
340
341  let Inst{47-40} = op{15-8};
342  let Inst{39-36} = R1;
343  let Inst{35-32} = R3;
344  let Inst{31-16} = I2;
345  let Inst{15-8}  = 0;
346  let Inst{7-0}   = op{7-0};
347}
348
349class InstRIEe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
350  : InstSystemZ<6, outs, ins, asmstr, pattern> {
351  field bits<48> Inst;
352  field bits<48> SoftFail = 0;
353
354  bits<4> R1;
355  bits<4> R3;
356  bits<16> RI2;
357
358  let Inst{47-40} = op{15-8};
359  let Inst{39-36} = R1;
360  let Inst{35-32} = R3;
361  let Inst{31-16} = RI2;
362  let Inst{15-8}  = 0;
363  let Inst{7-0}   = op{7-0};
364}
365
366class InstRIEf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
367  : InstSystemZ<6, outs, ins, asmstr, pattern> {
368  field bits<48> Inst;
369  field bits<48> SoftFail = 0;
370
371  bits<4> R1;
372  bits<4> R2;
373  bits<8> I3;
374  bits<8> I4;
375  bits<8> I5;
376
377  let Inst{47-40} = op{15-8};
378  let Inst{39-36} = R1;
379  let Inst{35-32} = R2;
380  let Inst{31-24} = I3;
381  let Inst{23-16} = I4;
382  let Inst{15-8}  = I5;
383  let Inst{7-0}   = op{7-0};
384}
385
386class InstRIEg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
387  : InstSystemZ<6, outs, ins, asmstr, pattern> {
388  field bits<48> Inst;
389  field bits<48> SoftFail = 0;
390
391  bits<4> R1;
392  bits<4> M3;
393  bits<16> I2;
394
395  let Inst{47-40} = op{15-8};
396  let Inst{39-36} = R1;
397  let Inst{35-32} = M3;
398  let Inst{31-16} = I2;
399  let Inst{15-8}  = 0;
400  let Inst{7-0}   = op{7-0};
401}
402
403class InstRILa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
404  : InstSystemZ<6, outs, ins, asmstr, pattern> {
405  field bits<48> Inst;
406  field bits<48> SoftFail = 0;
407
408  bits<4> R1;
409  bits<32> I2;
410
411  let Inst{47-40} = op{11-4};
412  let Inst{39-36} = R1;
413  let Inst{35-32} = op{3-0};
414  let Inst{31-0}  = I2;
415}
416
417class InstRILb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
418  : InstSystemZ<6, outs, ins, asmstr, pattern> {
419  field bits<48> Inst;
420  field bits<48> SoftFail = 0;
421
422  bits<4> R1;
423  bits<32> RI2;
424
425  let Inst{47-40} = op{11-4};
426  let Inst{39-36} = R1;
427  let Inst{35-32} = op{3-0};
428  let Inst{31-0}  = RI2;
429}
430
431class InstRILc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
432  : InstSystemZ<6, outs, ins, asmstr, pattern> {
433  field bits<48> Inst;
434  field bits<48> SoftFail = 0;
435
436  bits<4> M1;
437  bits<32> RI2;
438
439  let Inst{47-40} = op{11-4};
440  let Inst{39-36} = M1;
441  let Inst{35-32} = op{3-0};
442  let Inst{31-0}  = RI2;
443}
444
445class InstRIS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
446  : InstSystemZ<6, outs, ins, asmstr, pattern> {
447  field bits<48> Inst;
448  field bits<48> SoftFail = 0;
449
450  bits<4> R1;
451  bits<8> I2;
452  bits<4> M3;
453  bits<4> B4;
454  bits<12> D4;
455
456  let Inst{47-40} = op{15-8};
457  let Inst{39-36} = R1;
458  let Inst{35-32} = M3;
459  let Inst{31-28} = B4;
460  let Inst{27-16} = D4;
461  let Inst{15-8}  = I2;
462  let Inst{7-0}   = op{7-0};
463}
464
465class InstRR<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
466  : InstSystemZ<2, outs, ins, asmstr, pattern> {
467  field bits<16> Inst;
468  field bits<16> SoftFail = 0;
469
470  bits<4> R1;
471  bits<4> R2;
472
473  let Inst{15-8} = op;
474  let Inst{7-4}  = R1;
475  let Inst{3-0}  = R2;
476}
477
478class InstRRD<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
479  : InstSystemZ<4, outs, ins, asmstr, pattern> {
480  field bits<32> Inst;
481  field bits<32> SoftFail = 0;
482
483  bits<4> R1;
484  bits<4> R3;
485  bits<4> R2;
486
487  let Inst{31-16} = op;
488  let Inst{15-12} = R1;
489  let Inst{11-8}  = 0;
490  let Inst{7-4}   = R3;
491  let Inst{3-0}   = R2;
492}
493
494class InstRRE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
495  : InstSystemZ<4, outs, ins, asmstr, pattern> {
496  field bits<32> Inst;
497  field bits<32> SoftFail = 0;
498
499  bits<4> R1;
500  bits<4> R2;
501
502  let Inst{31-16} = op;
503  let Inst{15-8}  = 0;
504  let Inst{7-4}   = R1;
505  let Inst{3-0}   = R2;
506}
507
508class InstRRFa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
509  : InstSystemZ<4, outs, ins, asmstr, pattern> {
510  field bits<32> Inst;
511  field bits<32> SoftFail = 0;
512
513  bits<4> R1;
514  bits<4> R2;
515  bits<4> R3;
516  bits<4> M4;
517
518  let Inst{31-16} = op;
519  let Inst{15-12} = R3;
520  let Inst{11-8}  = M4;
521  let Inst{7-4}   = R1;
522  let Inst{3-0}   = R2;
523}
524
525class InstRRFb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
526  : InstSystemZ<4, outs, ins, asmstr, pattern> {
527  field bits<32> Inst;
528  field bits<32> SoftFail = 0;
529
530  bits<4> R1;
531  bits<4> R2;
532  bits<4> R3;
533  bits<4> M4;
534
535  let Inst{31-16} = op;
536  let Inst{15-12} = R3;
537  let Inst{11-8}  = M4;
538  let Inst{7-4}   = R1;
539  let Inst{3-0}   = R2;
540}
541
542class InstRRFc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
543  : InstSystemZ<4, outs, ins, asmstr, pattern> {
544  field bits<32> Inst;
545  field bits<32> SoftFail = 0;
546
547  bits<4> R1;
548  bits<4> R2;
549  bits<4> M3;
550
551  let Inst{31-16} = op;
552  let Inst{15-12} = M3;
553  let Inst{11-8}  = 0;
554  let Inst{7-4}   = R1;
555  let Inst{3-0}   = R2;
556}
557
558class InstRRFd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
559  : InstSystemZ<4, outs, ins, asmstr, pattern> {
560  field bits<32> Inst;
561  field bits<32> SoftFail = 0;
562
563  bits<4> R1;
564  bits<4> R2;
565  bits<4> M4;
566
567  let Inst{31-16} = op;
568  let Inst{15-12} = 0;
569  let Inst{11-8}  = M4;
570  let Inst{7-4}   = R1;
571  let Inst{3-0}   = R2;
572}
573
574class InstRRFe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
575  : InstSystemZ<4, outs, ins, asmstr, pattern> {
576  field bits<32> Inst;
577  field bits<32> SoftFail = 0;
578
579  bits<4> R1;
580  bits<4> R2;
581  bits<4> M3;
582  bits<4> M4;
583
584  let Inst{31-16} = op;
585  let Inst{15-12} = M3;
586  let Inst{11-8}  = M4;
587  let Inst{7-4}   = R1;
588  let Inst{3-0}   = R2;
589}
590
591class InstRRS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
592  : InstSystemZ<6, outs, ins, asmstr, pattern> {
593  field bits<48> Inst;
594  field bits<48> SoftFail = 0;
595
596  bits<4> R1;
597  bits<4> R2;
598  bits<4> M3;
599  bits<4> B4;
600  bits<12> D4;
601
602  let Inst{47-40} = op{15-8};
603  let Inst{39-36} = R1;
604  let Inst{35-32} = R2;
605  let Inst{31-28} = B4;
606  let Inst{27-16} = D4;
607  let Inst{15-12} = M3;
608  let Inst{11-8}  = 0;
609  let Inst{7-0}   = op{7-0};
610}
611
612class InstRXa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
613  : InstSystemZ<4, outs, ins, asmstr, pattern> {
614  field bits<32> Inst;
615  field bits<32> SoftFail = 0;
616
617  bits<4> R1;
618  bits<4> X2;
619  bits<4> B2;
620  bits<12> D2;
621
622  let Inst{31-24} = op;
623  let Inst{23-20} = R1;
624  let Inst{19-16} = X2;
625  let Inst{15-12} = B2;
626  let Inst{11-0}  = D2;
627
628  let HasIndex = 1;
629}
630
631class InstRXb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
632  : InstSystemZ<4, outs, ins, asmstr, pattern> {
633  field bits<32> Inst;
634  field bits<32> SoftFail = 0;
635
636  bits<4> M1;
637  bits<4> X2;
638  bits<4> B2;
639  bits<12> D2;
640
641  let Inst{31-24} = op;
642  let Inst{23-20} = M1;
643  let Inst{19-16} = X2;
644  let Inst{15-12} = B2;
645  let Inst{11-0}  = D2;
646
647  let HasIndex = 1;
648}
649
650class InstRXE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
651  : InstSystemZ<6, outs, ins, asmstr, pattern> {
652  field bits<48> Inst;
653  field bits<48> SoftFail = 0;
654
655  bits<4> R1;
656  bits<4> X2;
657  bits<4> B2;
658  bits<12> D2;
659  bits<4> M3;
660
661  let Inst{47-40} = op{15-8};
662  let Inst{39-36} = R1;
663  let Inst{35-32} = X2;
664  let Inst{31-28} = B2;
665  let Inst{27-16} = D2;
666  let Inst{15-12} = M3;
667  let Inst{11-8}  = 0;
668  let Inst{7-0}   = op{7-0};
669
670  let HasIndex = 1;
671}
672
673class InstRXF<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
674  : InstSystemZ<6, outs, ins, asmstr, pattern> {
675  field bits<48> Inst;
676  field bits<48> SoftFail = 0;
677
678  bits<4> R1;
679  bits<4> R3;
680  bits<4> X2;
681  bits<4> B2;
682  bits<12> D2;
683
684  let Inst{47-40} = op{15-8};
685  let Inst{39-36} = R3;
686  let Inst{35-32} = X2;
687  let Inst{31-28} = B2;
688  let Inst{27-16} = D2;
689  let Inst{15-12} = R1;
690  let Inst{11-8}  = 0;
691  let Inst{7-0}   = op{7-0};
692
693  let HasIndex = 1;
694}
695
696class InstRXYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
697  : InstSystemZ<6, outs, ins, asmstr, pattern> {
698  field bits<48> Inst;
699  field bits<48> SoftFail = 0;
700
701  bits<4> R1;
702  bits<4> X2;
703  bits<4> B2;
704  bits<20> D2;
705
706  let Inst{47-40} = op{15-8};
707  let Inst{39-36} = R1;
708  let Inst{35-32} = X2;
709  let Inst{31-28} = B2;
710  let Inst{27-16} = D2{11-0};
711  let Inst{15-8}  = D2{19-12};
712  let Inst{7-0}   = op{7-0};
713
714  let Has20BitOffset = 1;
715  let HasIndex = 1;
716}
717
718class InstRXYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
719  : InstSystemZ<6, outs, ins, asmstr, pattern> {
720  field bits<48> Inst;
721  field bits<48> SoftFail = 0;
722
723  bits<4> M1;
724  bits<4> X2;
725  bits<4> B2;
726  bits<20> D2;
727
728  let Inst{47-40} = op{15-8};
729  let Inst{39-36} = M1;
730  let Inst{35-32} = X2;
731  let Inst{31-28} = B2;
732  let Inst{27-16} = D2{11-0};
733  let Inst{15-8}  = D2{19-12};
734  let Inst{7-0}   = op{7-0};
735
736  let Has20BitOffset = 1;
737  let HasIndex = 1;
738}
739
740class InstRSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
741  : InstSystemZ<4, outs, ins, asmstr, pattern> {
742  field bits<32> Inst;
743  field bits<32> SoftFail = 0;
744
745  bits<4> R1;
746  bits<4> R3;
747  bits<4> B2;
748  bits<12> D2;
749
750  let Inst{31-24} = op;
751  let Inst{23-20} = R1;
752  let Inst{19-16} = R3;
753  let Inst{15-12} = B2;
754  let Inst{11-0}  = D2;
755}
756
757class InstRSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
758  : InstSystemZ<4, outs, ins, asmstr, pattern> {
759  field bits<32> Inst;
760  field bits<32> SoftFail = 0;
761
762  bits<4> R1;
763  bits<4> M3;
764  bits<4> B2;
765  bits<12> D2;
766
767  let Inst{31-24} = op;
768  let Inst{23-20} = R1;
769  let Inst{19-16} = M3;
770  let Inst{15-12} = B2;
771  let Inst{11-0}  = D2;
772}
773
774class InstRSEa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
775  : InstSystemZ<6, outs, ins, asmstr, pattern> {
776  field bits<48> Inst;
777  field bits<48> SoftFail = 0;
778
779  bits<4> R1;
780  bits<4> R3;
781  bits<4> B2;
782  bits<12> D2;
783
784  let Inst{47-40} = op{15-8};
785  let Inst{39-36} = R1;
786  let Inst{35-32} = R3;
787  let Inst{31-28} = B2;
788  let Inst{27-16} = D2;
789  let Inst{15-8}  = 0;
790  let Inst{7-0}   = op{7-0};
791}
792
793class InstRSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
794  : InstSystemZ<4, outs, ins, asmstr, pattern> {
795  field bits<32> Inst;
796  field bits<32> SoftFail = 0;
797
798  bits<4> R1;
799  bits<4> R3;
800  bits<16> RI2;
801
802  let Inst{31-24} = op;
803  let Inst{23-20} = R1;
804  let Inst{19-16} = R3;
805  let Inst{15-0}  = RI2;
806}
807
808class InstRSLa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
809  : InstSystemZ<6, outs, ins, asmstr, pattern> {
810  field bits<48> Inst;
811  field bits<48> SoftFail = 0;
812
813  bits<4> B1;
814  bits<12> D1;
815  bits<4> L1;
816
817  let Inst{47-40} = op{15-8};
818  let Inst{39-36} = L1;
819  let Inst{35-32} = 0;
820  let Inst{31-28} = B1;
821  let Inst{27-16} = D1;
822  let Inst{15-8}  = 0;
823  let Inst{7-0}   = op{7-0};
824}
825
826class InstRSLb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
827  : InstSystemZ<6, outs, ins, asmstr, pattern> {
828  field bits<48> Inst;
829  field bits<48> SoftFail = 0;
830
831  bits<4> R1;
832  bits<4> B2;
833  bits<12> D2;
834  bits<8> L2;
835  bits<4> M3;
836
837  let Inst{47-40} = op{15-8};
838  let Inst{39-32} = L2;
839  let Inst{31-28} = B2;
840  let Inst{27-16} = D2;
841  let Inst{15-12} = R1;
842  let Inst{11-8}  = M3;
843  let Inst{7-0}   = op{7-0};
844}
845
846class InstRSYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
847  : InstSystemZ<6, outs, ins, asmstr, pattern> {
848  field bits<48> Inst;
849  field bits<48> SoftFail = 0;
850
851  bits<4> R1;
852  bits<4> R3;
853  bits<4> B2;
854  bits<20> D2;
855
856  let Inst{47-40} = op{15-8};
857  let Inst{39-36} = R1;
858  let Inst{35-32} = R3;
859  let Inst{31-28} = B2;
860  let Inst{27-16} = D2{11-0};
861  let Inst{15-8}  = D2{19-12};
862  let Inst{7-0}   = op{7-0};
863
864  let Has20BitOffset = 1;
865}
866
867class InstRSYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
868  : InstSystemZ<6, outs, ins, asmstr, pattern> {
869  field bits<48> Inst;
870  field bits<48> SoftFail = 0;
871
872  bits<4> R1;
873  bits<4> M3;
874  bits<4> B2;
875  bits<20> D2;
876
877  let Inst{47-40} = op{15-8};
878  let Inst{39-36} = R1;
879  let Inst{35-32} = M3;
880  let Inst{31-28} = B2;
881  let Inst{27-16} = D2{11-0};
882  let Inst{15-8}  = D2{19-12};
883  let Inst{7-0}   = op{7-0};
884
885  let Has20BitOffset = 1;
886}
887
888class InstSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
889  : InstSystemZ<4, outs, ins, asmstr, pattern> {
890  field bits<32> Inst;
891  field bits<32> SoftFail = 0;
892
893  bits<4> B1;
894  bits<12> D1;
895  bits<8> I2;
896
897  let Inst{31-24} = op;
898  let Inst{23-16} = I2;
899  let Inst{15-12} = B1;
900  let Inst{11-0}  = D1;
901}
902
903class InstSIL<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
904  : InstSystemZ<6, outs, ins, asmstr, pattern> {
905  field bits<48> Inst;
906  field bits<48> SoftFail = 0;
907
908  bits<4> B1;
909  bits<12> D1;
910  bits<16> I2;
911
912  let Inst{47-32} = op;
913  let Inst{31-28} = B1;
914  let Inst{27-16} = D1;
915  let Inst{15-0}  = I2;
916}
917
918class InstSIY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
919  : InstSystemZ<6, outs, ins, asmstr, pattern> {
920  field bits<48> Inst;
921  field bits<48> SoftFail = 0;
922
923  bits<4> B1;
924  bits<20> D1;
925  bits<8> I2;
926
927  let Inst{47-40} = op{15-8};
928  let Inst{39-32} = I2;
929  let Inst{31-28} = B1;
930  let Inst{27-16} = D1{11-0};
931  let Inst{15-8}  = D1{19-12};
932  let Inst{7-0}   = op{7-0};
933
934  let Has20BitOffset = 1;
935}
936
937class InstSMI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
938  : InstSystemZ<6, outs, ins, asmstr, pattern> {
939  field bits<48> Inst;
940  field bits<48> SoftFail = 0;
941
942  bits<4> M1;
943  bits<16> RI2;
944  bits<4> B3;
945  bits<12> D3;
946
947  let Inst{47-40} = op;
948  let Inst{39-36} = M1;
949  let Inst{35-32} = 0;
950  let Inst{31-28} = B3;
951  let Inst{27-16} = D3;
952  let Inst{15-0}  = RI2;
953}
954
955class InstSSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
956  : InstSystemZ<6, outs, ins, asmstr, pattern> {
957  field bits<48> Inst;
958  field bits<48> SoftFail = 0;
959
960  bits<4> B1;
961  bits<12> D1;
962  bits<8> L1;
963  bits<4> B2;
964  bits<12> D2;
965
966  let Inst{47-40} = op;
967  let Inst{39-32} = L1;
968  let Inst{31-28} = B1;
969  let Inst{27-16} = D1;
970  let Inst{15-12} = B2;
971  let Inst{11-0}  = D2;
972}
973
974class InstSSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
975  : InstSystemZ<6, outs, ins, asmstr, pattern> {
976  field bits<48> Inst;
977  field bits<48> SoftFail = 0;
978
979  bits<4> B1;
980  bits<12> D1;
981  bits<4> L1;
982  bits<4> B2;
983  bits<12> D2;
984  bits<4> L2;
985
986  let Inst{47-40} = op;
987  let Inst{39-36} = L1;
988  let Inst{35-32} = L2;
989  let Inst{31-28} = B1;
990  let Inst{27-16} = D1;
991  let Inst{15-12} = B2;
992  let Inst{11-0} = D2;
993}
994
995class InstSSc<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
996  : InstSystemZ<6, outs, ins, asmstr, pattern> {
997  field bits<48> Inst;
998  field bits<48> SoftFail = 0;
999
1000  bits<4> B1;
1001  bits<12> D1;
1002  bits<4> L1;
1003  bits<4> B2;
1004  bits<12> D2;
1005  bits<4> I3;
1006
1007  let Inst{47-40} = op;
1008  let Inst{39-36} = L1;
1009  let Inst{35-32} = I3;
1010  let Inst{31-28} = B1;
1011  let Inst{27-16} = D1;
1012  let Inst{15-12} = B2;
1013  let Inst{11-0}  = D2;
1014}
1015
1016class InstSSd<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1017  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1018  field bits<48> Inst;
1019  field bits<48> SoftFail = 0;
1020
1021  bits<4> R1;
1022  bits<4> B1;
1023  bits<12> D1;
1024  bits<4> B2;
1025  bits<12> D2;
1026  bits<4> R3;
1027
1028  let Inst{47-40} = op;
1029  let Inst{39-36} = R1;
1030  let Inst{35-32} = R3;
1031  let Inst{31-28} = B1;
1032  let Inst{27-16} = D1;
1033  let Inst{15-12} = B2;
1034  let Inst{11-0}  = D2;
1035}
1036
1037class InstSSe<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1038  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1039  field bits<48> Inst;
1040  field bits<48> SoftFail = 0;
1041
1042  bits<4> R1;
1043  bits<4> B2;
1044  bits<12> D2;
1045  bits<4> R3;
1046  bits<4> B4;
1047  bits<12> D4;
1048
1049  let Inst{47-40} = op;
1050  let Inst{39-36} = R1;
1051  let Inst{35-32} = R3;
1052  let Inst{31-28} = B2;
1053  let Inst{27-16} = D2;
1054  let Inst{15-12} = B4;
1055  let Inst{11-0}  = D4;
1056}
1057
1058class InstSSf<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1059  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1060  field bits<48> Inst;
1061  field bits<48> SoftFail = 0;
1062
1063  bits<4> B1;
1064  bits<12> D1;
1065  bits<4> B2;
1066  bits<12> D2;
1067  bits<8> L2;
1068
1069  let Inst{47-40} = op;
1070  let Inst{39-32} = L2;
1071  let Inst{31-28} = B1;
1072  let Inst{27-16} = D1;
1073  let Inst{15-12} = B2;
1074  let Inst{11-0}  = D2;
1075}
1076
1077class InstSSE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1078  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1079  field bits<48> Inst;
1080  field bits<48> SoftFail = 0;
1081
1082  bits<4> B1;
1083  bits<12> D1;
1084  bits<4> B2;
1085  bits<12> D2;
1086
1087  let Inst{47-32} = op;
1088  let Inst{31-28} = B1;
1089  let Inst{27-16} = D1;
1090  let Inst{15-12} = B2;
1091  let Inst{11-0}  = D2;
1092}
1093
1094class InstSSF<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1095  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1096  field bits<48> Inst;
1097  field bits<48> SoftFail = 0;
1098
1099  bits<4> B1;
1100  bits<12> D1;
1101  bits<4> B2;
1102  bits<12> D2;
1103  bits<4>  R3;
1104
1105  let Inst{47-40} = op{11-4};
1106  let Inst{39-36} = R3;
1107  let Inst{35-32} = op{3-0};
1108  let Inst{31-28} = B1;
1109  let Inst{27-16} = D1;
1110  let Inst{15-12} = B2;
1111  let Inst{11-0}  = D2;
1112}
1113
1114class InstS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1115  : InstSystemZ<4, outs, ins, asmstr, pattern> {
1116  field bits<32> Inst;
1117  field bits<32> SoftFail = 0;
1118
1119  bits<4> B2;
1120  bits<12> D2;
1121
1122  let Inst{31-16} = op;
1123  let Inst{15-12} = B2;
1124  let Inst{11-0}  = D2;
1125}
1126
1127class InstVRIa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1128  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1129  field bits<48> Inst;
1130  field bits<48> SoftFail = 0;
1131
1132  bits<5> V1;
1133  bits<16> I2;
1134  bits<4> M3;
1135
1136  let Inst{47-40} = op{15-8};
1137  let Inst{39-36} = V1{3-0};
1138  let Inst{35-32} = 0;
1139  let Inst{31-16} = I2;
1140  let Inst{15-12} = M3;
1141  let Inst{11}    = V1{4};
1142  let Inst{10-8}  = 0;
1143  let Inst{7-0}   = op{7-0};
1144}
1145
1146class InstVRIb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1147  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1148  field bits<48> Inst;
1149  field bits<48> SoftFail = 0;
1150
1151  bits<5> V1;
1152  bits<8> I2;
1153  bits<8> I3;
1154  bits<4> M4;
1155
1156  let Inst{47-40} = op{15-8};
1157  let Inst{39-36} = V1{3-0};
1158  let Inst{35-32} = 0;
1159  let Inst{31-24} = I2;
1160  let Inst{23-16} = I3;
1161  let Inst{15-12} = M4;
1162  let Inst{11}    = V1{4};
1163  let Inst{10-8}  = 0;
1164  let Inst{7-0}   = op{7-0};
1165}
1166
1167class InstVRIc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1168  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1169  field bits<48> Inst;
1170  field bits<48> SoftFail = 0;
1171
1172  bits<5> V1;
1173  bits<5> V3;
1174  bits<16> I2;
1175  bits<4> M4;
1176
1177  let Inst{47-40} = op{15-8};
1178  let Inst{39-36} = V1{3-0};
1179  let Inst{35-32} = V3{3-0};
1180  let Inst{31-16} = I2;
1181  let Inst{15-12} = M4;
1182  let Inst{11}    = V1{4};
1183  let Inst{10}    = V3{4};
1184  let Inst{9-8}   = 0;
1185  let Inst{7-0}   = op{7-0};
1186}
1187
1188class InstVRId<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1189  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1190  field bits<48> Inst;
1191  field bits<48> SoftFail = 0;
1192
1193  bits<5> V1;
1194  bits<5> V2;
1195  bits<5> V3;
1196  bits<8> I4;
1197  bits<4> M5;
1198
1199  let Inst{47-40} = op{15-8};
1200  let Inst{39-36} = V1{3-0};
1201  let Inst{35-32} = V2{3-0};
1202  let Inst{31-28} = V3{3-0};
1203  let Inst{27-24} = 0;
1204  let Inst{23-16} = I4;
1205  let Inst{15-12} = M5;
1206  let Inst{11}    = V1{4};
1207  let Inst{10}    = V2{4};
1208  let Inst{9}     = V3{4};
1209  let Inst{8}     = 0;
1210  let Inst{7-0}   = op{7-0};
1211}
1212
1213class InstVRIe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1214  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1215  field bits<48> Inst;
1216  field bits<48> SoftFail = 0;
1217
1218  bits<5> V1;
1219  bits<5> V2;
1220  bits<12> I3;
1221  bits<4> M4;
1222  bits<4> M5;
1223
1224  let Inst{47-40} = op{15-8};
1225  let Inst{39-36} = V1{3-0};
1226  let Inst{35-32} = V2{3-0};
1227  let Inst{31-20} = I3;
1228  let Inst{19-16} = M5;
1229  let Inst{15-12} = M4;
1230  let Inst{11}    = V1{4};
1231  let Inst{10}    = V2{4};
1232  let Inst{9-8}   = 0;
1233  let Inst{7-0}   = op{7-0};
1234}
1235
1236class InstVRIf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1237  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1238  field bits<48> Inst;
1239  field bits<48> SoftFail = 0;
1240
1241  bits<5> V1;
1242  bits<5> V2;
1243  bits<5> V3;
1244  bits<8> I4;
1245  bits<4> M5;
1246
1247  let Inst{47-40} = op{15-8};
1248  let Inst{39-36} = V1{3-0};
1249  let Inst{35-32} = V2{3-0};
1250  let Inst{31-28} = V3{3-0};
1251  let Inst{27-24} = 0;
1252  let Inst{23-20} = M5;
1253  let Inst{19-12} = I4;
1254  let Inst{11}    = V1{4};
1255  let Inst{10}    = V2{4};
1256  let Inst{9}     = V3{4};
1257  let Inst{8}     = 0;
1258  let Inst{7-0}   = op{7-0};
1259}
1260
1261class InstVRIg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1262  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1263  field bits<48> Inst;
1264  field bits<48> SoftFail = 0;
1265
1266  bits<5> V1;
1267  bits<5> V2;
1268  bits<8> I3;
1269  bits<8> I4;
1270  bits<4> M5;
1271
1272  let Inst{47-40} = op{15-8};
1273  let Inst{39-36} = V1{3-0};
1274  let Inst{35-32} = V2{3-0};
1275  let Inst{31-24} = I4;
1276  let Inst{23-20} = M5;
1277  let Inst{19-12} = I3;
1278  let Inst{11}    = V1{4};
1279  let Inst{10}    = V2{4};
1280  let Inst{9-8}   = 0;
1281  let Inst{7-0}   = op{7-0};
1282}
1283
1284class InstVRIh<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1285  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1286  field bits<48> Inst;
1287  field bits<48> SoftFail = 0;
1288
1289  bits<5> V1;
1290  bits<16> I2;
1291  bits<4> I3;
1292
1293  let Inst{47-40} = op{15-8};
1294  let Inst{39-36} = V1{3-0};
1295  let Inst{35-32} = 0;
1296  let Inst{31-16} = I2;
1297  let Inst{15-12} = I3;
1298  let Inst{11}    = V1{4};
1299  let Inst{10-8}  = 0;
1300  let Inst{7-0}   = op{7-0};
1301}
1302
1303class InstVRIi<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1304  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1305  field bits<48> Inst;
1306  field bits<48> SoftFail = 0;
1307
1308  bits<5> V1;
1309  bits<4> R2;
1310  bits<8> I3;
1311  bits<4> M4;
1312
1313  let Inst{47-40} = op{15-8};
1314  let Inst{39-36} = V1{3-0};
1315  let Inst{35-32} = R2;
1316  let Inst{31-24} = 0;
1317  let Inst{23-20} = M4;
1318  let Inst{19-12} = I3;
1319  let Inst{11}    = V1{4};
1320  let Inst{10-8}  = 0;
1321  let Inst{7-0}   = op{7-0};
1322}
1323
1324// Depending on the instruction mnemonic, certain bits may be or-ed into
1325// the M4 value provided as explicit operand.  These are passed as m4or.
1326class InstVRRa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1327               bits<4> m4or = 0>
1328  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1329  field bits<48> Inst;
1330  field bits<48> SoftFail = 0;
1331
1332  bits<5> V1;
1333  bits<5> V2;
1334  bits<4> M3;
1335  bits<4> M4;
1336  bits<4> M5;
1337
1338  let Inst{47-40} = op{15-8};
1339  let Inst{39-36} = V1{3-0};
1340  let Inst{35-32} = V2{3-0};
1341  let Inst{31-24} = 0;
1342  let Inst{23-20} = M5;
1343  let Inst{19}    = !if (!eq (m4or{3}, 1), 1, M4{3});
1344  let Inst{18}    = !if (!eq (m4or{2}, 1), 1, M4{2});
1345  let Inst{17}    = !if (!eq (m4or{1}, 1), 1, M4{1});
1346  let Inst{16}    = !if (!eq (m4or{0}, 1), 1, M4{0});
1347  let Inst{15-12} = M3;
1348  let Inst{11}    = V1{4};
1349  let Inst{10}    = V2{4};
1350  let Inst{9-8}   = 0;
1351  let Inst{7-0}   = op{7-0};
1352}
1353
1354// Depending on the instruction mnemonic, certain bits may be or-ed into
1355// the M5 value provided as explicit operand.  These are passed as m5or.
1356class InstVRRb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1357               bits<4> m5or = 0>
1358  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1359  field bits<48> Inst;
1360  field bits<48> SoftFail = 0;
1361
1362  bits<5> V1;
1363  bits<5> V2;
1364  bits<5> V3;
1365  bits<4> M4;
1366  bits<4> M5;
1367
1368  let Inst{47-40} = op{15-8};
1369  let Inst{39-36} = V1{3-0};
1370  let Inst{35-32} = V2{3-0};
1371  let Inst{31-28} = V3{3-0};
1372  let Inst{27-24} = 0;
1373  let Inst{23}    = !if (!eq (m5or{3}, 1), 1, M5{3});
1374  let Inst{22}    = !if (!eq (m5or{2}, 1), 1, M5{2});
1375  let Inst{21}    = !if (!eq (m5or{1}, 1), 1, M5{1});
1376  let Inst{20}    = !if (!eq (m5or{0}, 1), 1, M5{0});
1377  let Inst{19-16} = 0;
1378  let Inst{15-12} = M4;
1379  let Inst{11}    = V1{4};
1380  let Inst{10}    = V2{4};
1381  let Inst{9}     = V3{4};
1382  let Inst{8}     = 0;
1383  let Inst{7-0}   = op{7-0};
1384}
1385
1386class InstVRRc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1387  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1388  field bits<48> Inst;
1389  field bits<48> SoftFail = 0;
1390
1391  bits<5> V1;
1392  bits<5> V2;
1393  bits<5> V3;
1394  bits<4> M4;
1395  bits<4> M5;
1396  bits<4> M6;
1397
1398  let Inst{47-40} = op{15-8};
1399  let Inst{39-36} = V1{3-0};
1400  let Inst{35-32} = V2{3-0};
1401  let Inst{31-28} = V3{3-0};
1402  let Inst{27-24} = 0;
1403  let Inst{23-20} = M6;
1404  let Inst{19-16} = M5;
1405  let Inst{15-12} = M4;
1406  let Inst{11}    = V1{4};
1407  let Inst{10}    = V2{4};
1408  let Inst{9}     = V3{4};
1409  let Inst{8}     = 0;
1410  let Inst{7-0}   = op{7-0};
1411}
1412
1413// Depending on the instruction mnemonic, certain bits may be or-ed into
1414// the M6 value provided as explicit operand.  These are passed as m6or.
1415class InstVRRd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1416               bits<4> m6or = 0>
1417  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1418  field bits<48> Inst;
1419  field bits<48> SoftFail = 0;
1420
1421  bits<5> V1;
1422  bits<5> V2;
1423  bits<5> V3;
1424  bits<5> V4;
1425  bits<4> M5;
1426  bits<4> M6;
1427
1428  let Inst{47-40} = op{15-8};
1429  let Inst{39-36} = V1{3-0};
1430  let Inst{35-32} = V2{3-0};
1431  let Inst{31-28} = V3{3-0};
1432  let Inst{27-24} = M5;
1433  let Inst{23}    = !if (!eq (m6or{3}, 1), 1, M6{3});
1434  let Inst{22}    = !if (!eq (m6or{2}, 1), 1, M6{2});
1435  let Inst{21}    = !if (!eq (m6or{1}, 1), 1, M6{1});
1436  let Inst{20}    = !if (!eq (m6or{0}, 1), 1, M6{0});
1437  let Inst{19-16} = 0;
1438  let Inst{15-12} = V4{3-0};
1439  let Inst{11}    = V1{4};
1440  let Inst{10}    = V2{4};
1441  let Inst{9}     = V3{4};
1442  let Inst{8}     = V4{4};
1443  let Inst{7-0}   = op{7-0};
1444}
1445
1446class InstVRRe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1447  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1448  field bits<48> Inst;
1449  field bits<48> SoftFail = 0;
1450
1451  bits<5> V1;
1452  bits<5> V2;
1453  bits<5> V3;
1454  bits<5> V4;
1455  bits<4> M5;
1456  bits<4> M6;
1457
1458  let Inst{47-40} = op{15-8};
1459  let Inst{39-36} = V1{3-0};
1460  let Inst{35-32} = V2{3-0};
1461  let Inst{31-28} = V3{3-0};
1462  let Inst{27-24} = M6;
1463  let Inst{23-20} = 0;
1464  let Inst{19-16} = M5;
1465  let Inst{15-12} = V4{3-0};
1466  let Inst{11}    = V1{4};
1467  let Inst{10}    = V2{4};
1468  let Inst{9}     = V3{4};
1469  let Inst{8}     = V4{4};
1470  let Inst{7-0}   = op{7-0};
1471}
1472
1473class InstVRRf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1474  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1475  field bits<48> Inst;
1476  field bits<48> SoftFail = 0;
1477
1478  bits<5> V1;
1479  bits<4> R2;
1480  bits<4> R3;
1481
1482  let Inst{47-40} = op{15-8};
1483  let Inst{39-36} = V1{3-0};
1484  let Inst{35-32} = R2;
1485  let Inst{31-28} = R3;
1486  let Inst{27-12} = 0;
1487  let Inst{11}    = V1{4};
1488  let Inst{10-8}  = 0;
1489  let Inst{7-0}   = op{7-0};
1490}
1491
1492class InstVRRg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1493  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1494  field bits<48> Inst;
1495  field bits<48> SoftFail = 0;
1496
1497  bits<5> V1;
1498
1499  let Inst{47-40} = op{15-8};
1500  let Inst{39-36} = 0;
1501  let Inst{35-32} = V1{3-0};
1502  let Inst{31-12} = 0;
1503  let Inst{11}    = 0;
1504  let Inst{10}    = V1{4};
1505  let Inst{9-8}   = 0;
1506  let Inst{7-0}   = op{7-0};
1507}
1508
1509class InstVRRh<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1510  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1511  field bits<48> Inst;
1512  field bits<48> SoftFail = 0;
1513
1514  bits<5> V1;
1515  bits<5> V2;
1516  bits<4> M3;
1517
1518  let Inst{47-40} = op{15-8};
1519  let Inst{39-36} = 0;
1520  let Inst{35-32} = V1{3-0};
1521  let Inst{31-28} = V2{3-0};
1522  let Inst{27-24} = 0;
1523  let Inst{23-20} = M3;
1524  let Inst{19-12} = 0;
1525  let Inst{11}    = 0;
1526  let Inst{10}    = V1{4};
1527  let Inst{9}     = V2{4};
1528  let Inst{8}     = 0;
1529  let Inst{7-0}   = op{7-0};
1530}
1531
1532class InstVRRi<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1533  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1534  field bits<48> Inst;
1535  field bits<48> SoftFail = 0;
1536
1537  bits<4> R1;
1538  bits<5> V2;
1539  bits<4> M3;
1540  bits<4> M4;
1541
1542  let Inst{47-40} = op{15-8};
1543  let Inst{39-36} = R1;
1544  let Inst{35-32} = V2{3-0};
1545  let Inst{31-24} = 0;
1546  let Inst{23-20} = M3;
1547  let Inst{19-16} = M4;
1548  let Inst{15-12} = 0;
1549  let Inst{11}    = 0;
1550  let Inst{10}    = V2{4};
1551  let Inst{9-8}   = 0;
1552  let Inst{7-0}   = op{7-0};
1553}
1554
1555class InstVRRj<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1556  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1557  field bits<48> Inst;
1558  field bits<48> SoftFail = 0;
1559
1560  bits<5> V1;
1561  bits<5> V2;
1562  bits<5> V3;
1563  bits<4> M4;
1564
1565  let Inst{47-40} = op{15-8};
1566  let Inst{39-36} = V1{3-0};
1567  let Inst{35-32} = V2{3-0};
1568  let Inst{31-28} = V3{3-0};
1569  let Inst{27-24} = 0;
1570  let Inst{23-20} = M4;
1571  let Inst{19-16} = 0;
1572  let Inst{15-12} = 0;
1573  let Inst{11}    = V1{4};
1574  let Inst{10}    = V2{4};
1575  let Inst{9}     = V3{4};
1576  let Inst{8}     = 0;
1577  let Inst{7-0}   = op{7-0};
1578}
1579
1580class InstVRRk<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1581  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1582  field bits<48> Inst;
1583  field bits<48> SoftFail = 0;
1584
1585  bits<5> V1;
1586  bits<5> V2;
1587  bits<4> M3;
1588
1589  let Inst{47-40} = op{15-8};
1590  let Inst{39-36} = V1{3-0};
1591  let Inst{35-32} = V2{3-0};
1592  let Inst{31-28} = 0;
1593  let Inst{27-24} = 0;
1594  let Inst{23-20} = M3;
1595  let Inst{19-16} = 0;
1596  let Inst{15-12} = 0;
1597  let Inst{11}    = V1{4};
1598  let Inst{10}    = V2{4};
1599  let Inst{9}     = 0;
1600  let Inst{8}     = 0;
1601  let Inst{7-0}   = op{7-0};
1602}
1603
1604class InstVRSa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1605  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1606  field bits<48> Inst;
1607  field bits<48> SoftFail = 0;
1608
1609  bits<5> V1;
1610  bits<4> B2;
1611  bits<12> D2;
1612  bits<5> V3;
1613  bits<4> M4;
1614
1615  let Inst{47-40} = op{15-8};
1616  let Inst{39-36} = V1{3-0};
1617  let Inst{35-32} = V3{3-0};
1618  let Inst{31-28} = B2;
1619  let Inst{27-16} = D2;
1620  let Inst{15-12} = M4;
1621  let Inst{11}    = V1{4};
1622  let Inst{10}    = V3{4};
1623  let Inst{9-8}   = 0;
1624  let Inst{7-0}   = op{7-0};
1625}
1626
1627class InstVRSb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1628  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1629  field bits<48> Inst;
1630  field bits<48> SoftFail = 0;
1631
1632  bits<5> V1;
1633  bits<4> B2;
1634  bits<12> D2;
1635  bits<4> R3;
1636  bits<4> M4;
1637
1638  let Inst{47-40} = op{15-8};
1639  let Inst{39-36} = V1{3-0};
1640  let Inst{35-32} = R3;
1641  let Inst{31-28} = B2;
1642  let Inst{27-16} = D2;
1643  let Inst{15-12} = M4;
1644  let Inst{11}    = V1{4};
1645  let Inst{10-8}  = 0;
1646  let Inst{7-0}   = op{7-0};
1647}
1648
1649class InstVRSc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1650  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1651  field bits<48> Inst;
1652  field bits<48> SoftFail = 0;
1653
1654  bits<4> R1;
1655  bits<4> B2;
1656  bits<12> D2;
1657  bits<5> V3;
1658  bits<4> M4;
1659
1660  let Inst{47-40} = op{15-8};
1661  let Inst{39-36} = R1;
1662  let Inst{35-32} = V3{3-0};
1663  let Inst{31-28} = B2;
1664  let Inst{27-16} = D2;
1665  let Inst{15-12} = M4;
1666  let Inst{11}    = 0;
1667  let Inst{10}    = V3{4};
1668  let Inst{9-8}   = 0;
1669  let Inst{7-0}   = op{7-0};
1670}
1671
1672class InstVRSd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1673  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1674  field bits<48> Inst;
1675  field bits<48> SoftFail = 0;
1676
1677  bits<5> V1;
1678  bits<4> B2;
1679  bits<12> D2;
1680  bits<4> R3;
1681
1682  let Inst{47-40} = op{15-8};
1683  let Inst{39-36} = 0;
1684  let Inst{35-32} = R3;
1685  let Inst{31-28} = B2;
1686  let Inst{27-16} = D2;
1687  let Inst{15-12} = V1{3-0};
1688  let Inst{11-9}  = 0;
1689  let Inst{8}     = V1{4};
1690  let Inst{7-0}   = op{7-0};
1691}
1692
1693class InstVRV<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1694  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1695  field bits<48> Inst;
1696  field bits<48> SoftFail = 0;
1697
1698  bits<5> V1;
1699  bits<5> V2;
1700  bits<4> B2;
1701  bits<12> D2;
1702  bits<4> M3;
1703
1704  let Inst{47-40} = op{15-8};
1705  let Inst{39-36} = V1{3-0};
1706  let Inst{35-32} = V2{3-0};
1707  let Inst{31-28} = B2;
1708  let Inst{27-16} = D2;
1709  let Inst{15-12} = M3;
1710  let Inst{11}    = V1{4};
1711  let Inst{10}    = V2{4};
1712  let Inst{9-8}   = 0;
1713  let Inst{7-0}   = op{7-0};
1714}
1715
1716class InstVRX<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1717  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1718  field bits<48> Inst;
1719  field bits<48> SoftFail = 0;
1720
1721  bits<5> V1;
1722  bits<4> X2;
1723  bits<4> B2;
1724  bits<12> D2;
1725  bits<4> M3;
1726
1727  let Inst{47-40} = op{15-8};
1728  let Inst{39-36} = V1{3-0};
1729  let Inst{35-32} = X2;
1730  let Inst{31-28} = B2;
1731  let Inst{27-16} = D2;
1732  let Inst{15-12} = M3;
1733  let Inst{11}    = V1{4};
1734  let Inst{10-8}  = 0;
1735  let Inst{7-0}   = op{7-0};
1736}
1737
1738class InstVSI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1739  : InstSystemZ<6, outs, ins, asmstr, pattern> {
1740  field bits<48> Inst;
1741  field bits<48> SoftFail = 0;
1742
1743  bits<5> V1;
1744  bits<4> B2;
1745  bits<12> D2;
1746  bits<8> I3;
1747
1748  let Inst{47-40} = op{15-8};
1749  let Inst{39-32} = I3;
1750  let Inst{31-28} = B2;
1751  let Inst{27-16} = D2;
1752  let Inst{15-12} = V1{3-0};
1753  let Inst{11-9}  = 0;
1754  let Inst{8}     = V1{4};
1755  let Inst{7-0}   = op{7-0};
1756}
1757
1758//===----------------------------------------------------------------------===//
1759// Instruction classes for .insn directives
1760//===----------------------------------------------------------------------===//
1761
1762class DirectiveInsnE<dag outs, dag ins, string asmstr, list<dag> pattern>
1763  : InstE<0, outs, ins, asmstr, pattern> {
1764  bits<16> enc;
1765
1766  let Inst = enc;
1767}
1768
1769class DirectiveInsnRI<dag outs, dag ins, string asmstr, list<dag> pattern>
1770  : InstRIa<0, outs, ins, asmstr, pattern> {
1771  bits<32> enc;
1772
1773  let Inst{31-24} = enc{31-24};
1774  let Inst{19-16} = enc{19-16};
1775}
1776
1777class DirectiveInsnRIE<dag outs, dag ins, string asmstr, list<dag> pattern>
1778  : InstRIEd<0, outs, ins, asmstr, pattern> {
1779  bits<48> enc;
1780
1781  let Inst{47-40} = enc{47-40};
1782  let Inst{7-0}   = enc{7-0};
1783}
1784
1785class DirectiveInsnRIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1786  : InstRILa<0, outs, ins, asmstr, pattern> {
1787  bits<48> enc;
1788  string type;
1789
1790  let Inst{47-40} = enc{47-40};
1791  let Inst{35-32} = enc{35-32};
1792}
1793
1794class DirectiveInsnRIS<dag outs, dag ins, string asmstr, list<dag> pattern>
1795  : InstRIS<0, outs, ins, asmstr, pattern> {
1796  bits<48> enc;
1797
1798  let Inst{47-40} = enc{47-40};
1799  let Inst{7-0}   = enc{7-0};
1800}
1801
1802class DirectiveInsnRR<dag outs, dag ins, string asmstr, list<dag> pattern>
1803  : InstRR<0, outs, ins, asmstr, pattern> {
1804  bits<16> enc;
1805
1806  let Inst{15-8} = enc{15-8};
1807}
1808
1809class DirectiveInsnRRE<dag outs, dag ins, string asmstr, list<dag> pattern>
1810  : InstRRE<0, outs, ins, asmstr, pattern> {
1811  bits<32> enc;
1812
1813  let Inst{31-16} = enc{31-16};
1814}
1815
1816class DirectiveInsnRRF<dag outs, dag ins, string asmstr, list<dag> pattern>
1817  : InstRRFa<0, outs, ins, asmstr, pattern> {
1818  bits<32> enc;
1819
1820  let Inst{31-16} = enc{31-16};
1821}
1822
1823class DirectiveInsnRRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1824  : InstRRS<0, outs, ins, asmstr, pattern> {
1825  bits<48> enc;
1826
1827  let Inst{47-40} = enc{47-40};
1828  let Inst{7-0}   = enc{7-0};
1829}
1830
1831class DirectiveInsnRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1832  : InstRSa<0, outs, ins, asmstr, pattern> {
1833  bits<32> enc;
1834
1835  let Inst{31-24} = enc{31-24};
1836}
1837
1838class DirectiveInsnRSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1839  : InstRSEa<6, outs, ins, asmstr, pattern> {
1840  bits <48> enc;
1841
1842  let Inst{47-40} = enc{47-40};
1843  let Inst{7-0}   = enc{7-0};
1844}
1845
1846class DirectiveInsnRSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1847  : InstRSI<0, outs, ins, asmstr, pattern> {
1848  bits<32> enc;
1849
1850  let Inst{31-24} = enc{31-24};
1851}
1852
1853class DirectiveInsnRSY<dag outs, dag ins, string asmstr, list<dag> pattern>
1854  : InstRSYa<0, outs, ins, asmstr, pattern> {
1855  bits<48> enc;
1856
1857  let Inst{47-40} = enc{47-40};
1858  let Inst{7-0}   = enc{7-0};
1859}
1860
1861class DirectiveInsnRX<dag outs, dag ins, string asmstr, list<dag> pattern>
1862  : InstRXa<0, outs, ins, asmstr, pattern> {
1863  bits<32> enc;
1864
1865  let Inst{31-24} = enc{31-24};
1866}
1867
1868class DirectiveInsnRXE<dag outs, dag ins, string asmstr, list<dag> pattern>
1869  : InstRXE<0, outs, ins, asmstr, pattern> {
1870  bits<48> enc;
1871
1872  let M3 = 0;
1873
1874  let Inst{47-40} = enc{47-40};
1875  let Inst{7-0}   = enc{7-0};
1876}
1877
1878class DirectiveInsnRXF<dag outs, dag ins, string asmstr, list<dag> pattern>
1879  : InstRXF<0, outs, ins, asmstr, pattern> {
1880  bits<48> enc;
1881
1882  let Inst{47-40} = enc{47-40};
1883  let Inst{7-0}   = enc{7-0};
1884}
1885
1886class DirectiveInsnRXY<dag outs, dag ins, string asmstr, list<dag> pattern>
1887  : InstRXYa<0, outs, ins, asmstr, pattern> {
1888  bits<48> enc;
1889
1890  let Inst{47-40} = enc{47-40};
1891  let Inst{7-0}   = enc{7-0};
1892}
1893
1894class DirectiveInsnS<dag outs, dag ins, string asmstr, list<dag> pattern>
1895  : InstS<0, outs, ins, asmstr, pattern> {
1896  bits<32> enc;
1897
1898  let Inst{31-16} = enc{31-16};
1899}
1900
1901class DirectiveInsnSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1902  : InstSI<0, outs, ins, asmstr, pattern> {
1903  bits<32> enc;
1904
1905  let Inst{31-24} = enc{31-24};
1906}
1907
1908class DirectiveInsnSIY<dag outs, dag ins, string asmstr, list<dag> pattern>
1909  : InstSIY<0, outs, ins, asmstr, pattern> {
1910  bits<48> enc;
1911
1912  let Inst{47-40} = enc{47-40};
1913  let Inst{7-0}   = enc{7-0};
1914}
1915
1916class DirectiveInsnSIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1917  : InstSIL<0, outs, ins, asmstr, pattern> {
1918  bits<48> enc;
1919
1920  let Inst{47-32} = enc{47-32};
1921}
1922
1923class DirectiveInsnSS<dag outs, dag ins, string asmstr, list<dag> pattern>
1924  : InstSSd<0, outs, ins, asmstr, pattern> {
1925  bits<48> enc;
1926
1927  let Inst{47-40} = enc{47-40};
1928}
1929
1930class DirectiveInsnSSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1931  : InstSSE<0, outs, ins, asmstr, pattern> {
1932  bits<48> enc;
1933
1934  let Inst{47-32} = enc{47-32};
1935}
1936
1937class DirectiveInsnSSF<dag outs, dag ins, string asmstr, list<dag> pattern>
1938  : InstSSF<0, outs, ins, asmstr, pattern> {
1939  bits<48> enc;
1940
1941  let Inst{47-40} = enc{47-40};
1942  let Inst{35-32} = enc{35-32};
1943}
1944
1945class DirectiveInsnVRI<dag outs, dag ins, string asmstr, list<dag> pattern>
1946  : InstVRIe<0, outs, ins, asmstr, pattern> {
1947  bits<48> enc;
1948
1949  let Inst{47-40} = enc{47-40};
1950  let Inst{7-0}   = enc{7-0};
1951}
1952
1953class DirectiveInsnVRR<dag outs, dag ins, string asmstr, list<dag> pattern>
1954  : InstVRRc<0, outs, ins, asmstr, pattern> {
1955  bits<48> enc;
1956
1957  let Inst{47-40} = enc{47-40};
1958  let Inst{7-0}   = enc{7-0};
1959}
1960
1961class DirectiveInsnVRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1962  : InstVRSc<0, outs, ins, asmstr, pattern> {
1963  bits<48> enc;
1964
1965  let Inst{47-40} = enc{47-40};
1966  let Inst{7-0}   = enc{7-0};
1967}
1968
1969class DirectiveInsnVRV<dag outs, dag ins, string asmstr, list<dag> pattern>
1970  : InstVRV<0, outs, ins, asmstr, pattern> {
1971  bits<48> enc;
1972
1973  let Inst{47-40} = enc{47-40};
1974  let Inst{7-0}   = enc{7-0};
1975}
1976
1977class DirectiveInsnVRX<dag outs, dag ins, string asmstr, list<dag> pattern>
1978  : InstVRX<0, outs, ins, asmstr, pattern> {
1979  bits<48> enc;
1980
1981  let Inst{47-40} = enc{47-40};
1982  let Inst{7-0}   = enc{7-0};
1983}
1984
1985class DirectiveInsnVSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1986  : InstVSI<0, outs, ins, asmstr, pattern> {
1987  bits<48> enc;
1988
1989  let Inst{47-40} = enc{47-40};
1990  let Inst{7-0}   = enc{7-0};
1991}
1992
1993
1994//===----------------------------------------------------------------------===//
1995// Variants of instructions with condition mask
1996//===----------------------------------------------------------------------===//
1997//
1998// For instructions using a condition mask (e.g. conditional branches,
1999// compare-and-branch instructions, or conditional move instructions),
2000// we generally need to create multiple instruction patterns:
2001//
2002// - One used for code generation, which encodes the condition mask as an
2003//   MI operand, but writes out an extended mnemonic for better readability.
2004// - One pattern for the base form of the instruction with an explicit
2005//   condition mask (encoded as a plain integer MI operand).
2006// - Specific patterns for each extended mnemonic, where the condition mask
2007//   is implied by the pattern name and not otherwise encoded at all.
2008//
2009// We need the latter primarily for the assembler and disassembler, since the
2010// assembler parser is not able to decode part of an instruction mnemonic
2011// into an operand.  Thus we provide separate patterns for each mnemonic.
2012//
2013// Note that in some cases there are two different mnemonics for the same
2014// condition mask.  In this case we cannot have both instructions available
2015// to the disassembler at the same time since the encodings are not distinct.
2016// Therefore the alternate forms are marked isAsmParserOnly.
2017//
2018// We don't make one of the two names an alias of the other because
2019// we need the custom parsing routines to select the correct register class.
2020//
2021// This section provides helpers for generating the specific forms.
2022//
2023//===----------------------------------------------------------------------===//
2024
2025// A class to describe a variant of an instruction with condition mask.
2026class CondVariant<bits<4> ccmaskin, string suffixin, bit alternatein,
2027                  string asmvariantin = ""> {
2028  // The fixed condition mask to use.
2029  bits<4> ccmask = ccmaskin;
2030
2031  // The suffix to use for the extended assembler mnemonic.
2032  string suffix = suffixin;
2033
2034  // Whether this is an alternate that needs to be marked isAsmParserOnly.
2035  bit alternate = alternatein;
2036
2037  // Whether this needs be to restricted to a specific dialect.
2038  // Valid values are "att" and "hlasm", which when passed in
2039  // will set AsmVariantName.
2040  string asmvariant = asmvariantin;
2041}
2042
2043// Condition mask 15 means "always true", which is used to define
2044// unconditional branches as a variant of conditional branches.
2045def CondAlways : CondVariant<15, "", 0>;
2046
2047// Condition masks for general instructions that can set all 4 bits.
2048def CondVariantO   : CondVariant<1,  "o",   0>;
2049def CondVariantH   : CondVariant<2,  "h",   0>;
2050def CondVariantP   : CondVariant<2,  "p",   1>;
2051def CondVariantNLE : CondVariant<3,  "nle", 0, "att">;
2052def CondVariantL   : CondVariant<4,  "l",   0>;
2053def CondVariantM   : CondVariant<4,  "m",   1>;
2054def CondVariantNHE : CondVariant<5,  "nhe", 0, "att">;
2055def CondVariantLH  : CondVariant<6,  "lh",  0, "att">;
2056def CondVariantNE  : CondVariant<7,  "ne",  0>;
2057def CondVariantNZ  : CondVariant<7,  "nz",  1>;
2058def CondVariantE   : CondVariant<8,  "e",   0>;
2059def CondVariantZ   : CondVariant<8,  "z",   1>;
2060def CondVariantNLH : CondVariant<9,  "nlh", 0, "att">;
2061def CondVariantHE  : CondVariant<10, "he",  0, "att">;
2062def CondVariantNL  : CondVariant<11, "nl",  0>;
2063def CondVariantNM  : CondVariant<11, "nm",  1>;
2064def CondVariantLE  : CondVariant<12, "le",  0, "att">;
2065def CondVariantNH  : CondVariant<13, "nh",  0>;
2066def CondVariantNP  : CondVariant<13, "np",  1>;
2067def CondVariantNO  : CondVariant<14, "no",  0>;
2068
2069// A helper class to look up one of the above by name.
2070class CV<string name>
2071  : CondVariant<!cast<CondVariant>("CondVariant"#name).ccmask,
2072                !cast<CondVariant>("CondVariant"#name).suffix,
2073                !cast<CondVariant>("CondVariant"#name).alternate,
2074                !cast<CondVariant>("CondVariant"#name).asmvariant>;
2075
2076// Condition masks for integer instructions (e.g. compare-and-branch).
2077// This is like the list above, except that condition 3 is not possible
2078// and that the low bit of the mask is therefore always 0.  This means
2079// that each condition has two names.  Conditions "o" and "no" are not used.
2080def IntCondVariantH   : CondVariant<2,  "h",   0>;
2081def IntCondVariantNLE : CondVariant<2,  "nle", 1, "att">;
2082def IntCondVariantL   : CondVariant<4,  "l",   0>;
2083def IntCondVariantNHE : CondVariant<4,  "nhe", 1, "att">;
2084def IntCondVariantLH  : CondVariant<6,  "lh",  0, "att">;
2085def IntCondVariantNE  : CondVariant<6,  "ne",  1>;
2086def IntCondVariantE   : CondVariant<8,  "e",   0>;
2087def IntCondVariantNLH : CondVariant<8,  "nlh", 1, "att">;
2088def IntCondVariantHE  : CondVariant<10, "he",  0, "att">;
2089def IntCondVariantNL  : CondVariant<10, "nl",  1>;
2090def IntCondVariantLE  : CondVariant<12, "le",  0, "att">;
2091def IntCondVariantNH  : CondVariant<12, "nh",  1>;
2092
2093// A helper class to look up one of the above by name.
2094class ICV<string name>
2095  : CondVariant<!cast<CondVariant>("IntCondVariant"#name).ccmask,
2096                !cast<CondVariant>("IntCondVariant"#name).suffix,
2097                !cast<CondVariant>("IntCondVariant"#name).alternate,
2098                !cast<CondVariant>("IntCondVariant"#name).asmvariant>;
2099
2100// Defines a class that makes it easier to define
2101// a MnemonicAlias when CondVariant's are involved.
2102multiclass MnemonicCondBranchAlias<CondVariant V, string from, string to,
2103                                   string asmvariant = V.asmvariant> {
2104  if !or(!eq(V.asmvariant, ""), !eq(V.asmvariant, asmvariant)) then
2105    def "" : MnemonicAlias<!subst("#", V.suffix, from),
2106                           !subst("#", V.suffix, to),
2107                           asmvariant>;
2108}
2109
2110//===----------------------------------------------------------------------===//
2111// Instruction definitions with semantics
2112//===----------------------------------------------------------------------===//
2113//
2114// These classes have the form [Cond]<Category><Format>, where <Format> is one
2115// of the formats defined above and where <Category> describes the inputs
2116// and outputs.  "Cond" is used if the instruction is conditional,
2117// in which case the 4-bit condition-code mask is added as a final operand.
2118// <Category> can be one of:
2119//
2120//   Inherent:
2121//     One register output operand and no input operands.
2122//
2123//   InherentDual:
2124//     Two register output operands and no input operands.
2125//
2126//   StoreInherent:
2127//     One address operand.  The instruction stores to the address.
2128//
2129//   SideEffectInherent:
2130//     No input or output operands, but causes some side effect.
2131//
2132//   Branch:
2133//     One branch target.  The instruction branches to the target.
2134//
2135//   Call:
2136//     One output operand and one branch target.  The instruction stores
2137//     the return address to the output operand and branches to the target.
2138//
2139//   CmpBranch:
2140//     Two input operands and one optional branch target.  The instruction
2141//     compares the two input operands and branches or traps on the result.
2142//
2143//   BranchUnary:
2144//     One register output operand, one register input operand and one branch
2145//     target.  The instructions stores a modified form of the source register
2146//     in the destination register and branches on the result.
2147//
2148//   BranchBinary:
2149//     One register output operand, two register input operands and one branch
2150//     target. The instructions stores a modified form of one of the source
2151//     registers in the destination register and branches on the result.
2152//
2153//   LoadMultiple:
2154//     One address input operand and two explicit output operands.
2155//     The instruction loads a range of registers from the address,
2156//     with the explicit operands giving the first and last register
2157//     to load.  Other loaded registers are added as implicit definitions.
2158//
2159//   StoreMultiple:
2160//     Two explicit input register operands and an address operand.
2161//     The instruction stores a range of registers to the address,
2162//     with the explicit operands giving the first and last register
2163//     to store.  Other stored registers are added as implicit uses.
2164//
2165//   StoreLength:
2166//     One value operand, one length operand and one address operand.
2167//     The instruction stores the value operand to the address but
2168//     doesn't write more than the number of bytes specified by the
2169//     length operand.
2170//
2171//   LoadAddress:
2172//     One register output operand and one address operand.
2173//
2174//   SideEffectAddress:
2175//     One address operand.  No output operands, but causes some side effect.
2176//
2177//   Unary:
2178//     One register output operand and one input operand.
2179//
2180//   Store:
2181//     One address operand and one other input operand.  The instruction
2182//     stores to the address.
2183//
2184//   SideEffectUnary:
2185//     One input operand.  No output operands, but causes some side effect.
2186//
2187//   Binary:
2188//     One register output operand and two input operands.
2189//
2190//   StoreBinary:
2191//     One address operand and two other input operands.  The instruction
2192//     stores to the address.
2193//
2194//   SideEffectBinary:
2195//     Two input operands.  No output operands, but causes some side effect.
2196//
2197//   Compare:
2198//     Two input operands and an implicit CC output operand.
2199//
2200//   Test:
2201//     One or two input operands and an implicit CC output operand.  If
2202//     present, the second input operand is an "address" operand used as
2203//     a test class mask.
2204//
2205//   Ternary:
2206//     One register output operand and three input operands.
2207//
2208//   SideEffectTernary:
2209//     Three input operands.  No output operands, but causes some side effect.
2210//
2211//   Quaternary:
2212//     One register output operand and four input operands.
2213//
2214//   LoadAndOp:
2215//     One output operand and two input operands, one of which is an address.
2216//     The instruction both reads from and writes to the address.
2217//
2218//   CmpSwap:
2219//     One output operand and three input operands, one of which is an address.
2220//     The instruction both reads from and writes to the address.
2221//
2222//   RotateSelect:
2223//     One output operand and five input operands.  The first two operands
2224//     are registers and the other three are immediates.
2225//
2226//   Prefetch:
2227//     One 4-bit immediate operand and one address operand.  The immediate
2228//     operand is 1 for a load prefetch and 2 for a store prefetch.
2229//
2230//   BranchPreload:
2231//     One 4-bit immediate operand and two address operands.
2232//
2233// The format determines which input operands are tied to output operands,
2234// and also determines the shape of any address operand.
2235//
2236// Multiclasses of the form <Category><Format>Pair define two instructions,
2237// one with <Category><Format> and one with <Category><Format>Y.  The name
2238// of the first instruction has no suffix, the name of the second has
2239// an extra "y".
2240//
2241//===----------------------------------------------------------------------===//
2242
2243class InherentRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
2244                  SDPatternOperator operator>
2245  : InstRRE<opcode, (outs cls:$R1), (ins),
2246            mnemonic#"\t$R1",
2247            [(set cls:$R1, (operator))]> {
2248  let R2 = 0;
2249}
2250
2251class InherentDualRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2252  : InstRRE<opcode, (outs cls:$R1, cls:$R2), (ins),
2253            mnemonic#"\t$R1, $R2", []>;
2254
2255class InherentVRIa<string mnemonic, bits<16> opcode, bits<16> value>
2256  : InstVRIa<opcode, (outs VR128:$V1), (ins), mnemonic#"\t$V1", []> {
2257  let I2 = value;
2258  let M3 = 0;
2259}
2260
2261class StoreInherentS<string mnemonic, bits<16> opcode,
2262                     SDPatternOperator operator, bits<5> bytes>
2263  : InstS<opcode, (outs), (ins (bdaddr12only $B2, $D2):$BD2),
2264          mnemonic#"\t$BD2", [(operator bdaddr12only:$BD2)]> {
2265  let mayStore = 1;
2266  let AccessBytes = bytes;
2267}
2268
2269class SideEffectInherentE<string mnemonic, bits<16>opcode>
2270  : InstE<opcode, (outs), (ins), mnemonic, []>;
2271
2272class SideEffectInherentS<string mnemonic, bits<16> opcode,
2273                          SDPatternOperator operator>
2274  : InstS<opcode, (outs), (ins), mnemonic, [(operator)]> {
2275  let B2 = 0;
2276  let D2 = 0;
2277}
2278
2279class SideEffectInherentRRE<string mnemonic, bits<16> opcode>
2280  : InstRRE<opcode, (outs), (ins), mnemonic, []> {
2281  let R1 = 0;
2282  let R2 = 0;
2283}
2284
2285// Allow an optional TLS marker symbol to generate TLS call relocations.
2286class CallRI<string mnemonic, bits<12> opcode>
2287  : InstRIb<opcode, (outs), (ins GR64:$R1, brtarget16tls:$RI2),
2288            mnemonic#"\t$R1, $RI2", []>;
2289
2290// Allow an optional TLS marker symbol to generate TLS call relocations.
2291class CallRIL<string mnemonic, bits<12> opcode>
2292  : InstRILb<opcode, (outs), (ins GR64:$R1, brtarget32tls:$RI2),
2293             mnemonic#"\t$R1, $RI2", []>;
2294
2295class CallRR<string mnemonic, bits<8> opcode>
2296  : InstRR<opcode, (outs), (ins GR64:$R1, ADDR64:$R2),
2297           mnemonic#"\t$R1, $R2", []>;
2298
2299class CallRX<string mnemonic, bits<8> opcode>
2300  : InstRXa<opcode, (outs), (ins GR64:$R1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2301            mnemonic#"\t$R1, $XBD2", []>;
2302
2303class CondBranchRI<string mnemonic, bits<12> opcode,
2304                   SDPatternOperator operator = null_frag>
2305  : InstRIc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget16:$RI2),
2306            !subst("#", "${M1}", mnemonic)#"\t$RI2",
2307            [(operator cond4:$valid, cond4:$M1, bb:$RI2)]> {
2308  let CCMaskFirst = 1;
2309}
2310
2311class AsmCondBranchRI<string mnemonic, bits<12> opcode>
2312  : InstRIc<opcode, (outs), (ins imm32zx4:$M1, brtarget16:$RI2),
2313            mnemonic#"\t$M1, $RI2", []>;
2314
2315class FixedCondBranchRI<CondVariant V, string mnemonic, bits<12> opcode,
2316                        SDPatternOperator operator = null_frag>
2317  : InstRIc<opcode, (outs), (ins brtarget16:$RI2),
2318            !subst("#", V.suffix, mnemonic)#"\t$RI2", [(operator bb:$RI2)]> {
2319  let isAsmParserOnly = V.alternate;
2320  let AsmVariantName = V.asmvariant;
2321  let M1 = V.ccmask;
2322}
2323
2324class CondBranchRIL<string mnemonic, bits<12> opcode>
2325  : InstRILc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget32:$RI2),
2326             !subst("#", "${M1}", mnemonic)#"\t$RI2", []> {
2327  let CCMaskFirst = 1;
2328}
2329
2330class AsmCondBranchRIL<string mnemonic, bits<12> opcode>
2331  : InstRILc<opcode, (outs), (ins imm32zx4:$M1, brtarget32:$RI2),
2332             mnemonic#"\t$M1, $RI2", []>;
2333
2334class FixedCondBranchRIL<CondVariant V, string mnemonic, bits<12> opcode>
2335  : InstRILc<opcode, (outs), (ins brtarget32:$RI2),
2336             !subst("#", V.suffix, mnemonic)#"\t$RI2", []> {
2337  let isAsmParserOnly = V.alternate;
2338  let AsmVariantName = V.asmvariant;
2339  let M1 = V.ccmask;
2340}
2341
2342class CondBranchRR<string mnemonic, bits<8> opcode>
2343  : InstRR<opcode, (outs), (ins cond4:$valid, cond4:$R1, GR64:$R2),
2344           !subst("#", "${R1}", mnemonic)#"\t$R2", []> {
2345  let CCMaskFirst = 1;
2346}
2347
2348class AsmCondBranchRR<string mnemonic, bits<8> opcode>
2349  : InstRR<opcode, (outs), (ins imm32zx4:$R1, GR64:$R2),
2350           mnemonic#"\t$R1, $R2", []>;
2351
2352class FixedCondBranchRR<CondVariant V, string mnemonic, bits<8> opcode,
2353                      SDPatternOperator operator = null_frag>
2354  : InstRR<opcode, (outs), (ins ADDR64:$R2),
2355           !subst("#", V.suffix, mnemonic)#"\t$R2", [(operator ADDR64:$R2)]> {
2356  let isAsmParserOnly = V.alternate;
2357  let AsmVariantName = V.asmvariant;
2358  let R1 = V.ccmask;
2359}
2360
2361class CondBranchRX<string mnemonic, bits<8> opcode>
2362  : InstRXb<opcode, (outs),
2363            (ins cond4:$valid, cond4:$M1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2364            !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
2365  let CCMaskFirst = 1;
2366}
2367
2368class AsmCondBranchRX<string mnemonic, bits<8> opcode>
2369  : InstRXb<opcode, (outs),
2370            (ins imm32zx4:$M1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2371            mnemonic#"\t$M1, $XBD2", []>;
2372
2373class FixedCondBranchRX<CondVariant V, string mnemonic, bits<8> opcode>
2374  : InstRXb<opcode, (outs), (ins (bdxaddr12only $B2, $D2, $X2):$XBD2),
2375            !subst("#", V.suffix, mnemonic)#"\t$XBD2", []> {
2376  let isAsmParserOnly = V.alternate;
2377  let AsmVariantName = V.asmvariant;
2378  let M1 = V.ccmask;
2379}
2380
2381class CondBranchRXY<string mnemonic, bits<16> opcode>
2382  : InstRXYb<opcode, (outs), (ins cond4:$valid, cond4:$M1,
2383             (bdxaddr20only $B2, $D2, $X2):$XBD2),
2384             !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
2385  let CCMaskFirst = 1;
2386  let mayLoad = 1;
2387}
2388
2389class AsmCondBranchRXY<string mnemonic, bits<16> opcode>
2390  : InstRXYb<opcode, (outs),
2391             (ins imm32zx4:$M1, (bdxaddr20only $B2, $D2, $X2):$XBD2),
2392             mnemonic#"\t$M1, $XBD2", []> {
2393  let mayLoad = 1;
2394}
2395
2396class FixedCondBranchRXY<CondVariant V, string mnemonic, bits<16> opcode,
2397                         SDPatternOperator operator = null_frag>
2398  : InstRXYb<opcode, (outs), (ins (bdxaddr20only $B2, $D2, $X2):$XBD2),
2399             !subst("#", V.suffix, mnemonic)#"\t$XBD2",
2400             [(operator (load bdxaddr20only:$XBD2))]> {
2401  let isAsmParserOnly = V.alternate;
2402  let AsmVariantName = V.asmvariant;
2403  let M1 = V.ccmask;
2404  let mayLoad = 1;
2405}
2406
2407class CmpBranchRIEa<string mnemonic, bits<16> opcode,
2408                    RegisterOperand cls, ImmOpWithPattern imm>
2409  : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, cond4:$M3),
2410             mnemonic#"$M3\t$R1, $I2", []>;
2411
2412class AsmCmpBranchRIEa<string mnemonic, bits<16> opcode,
2413                       RegisterOperand cls, ImmOpWithPattern imm>
2414  : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, imm32zx4:$M3),
2415             mnemonic#"\t$R1, $I2, $M3", []>;
2416
2417class FixedCmpBranchRIEa<CondVariant V, string mnemonic, bits<16> opcode,
2418                          RegisterOperand cls, ImmOpWithPattern imm>
2419  : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2),
2420             mnemonic#V.suffix#"\t$R1, $I2", []> {
2421  let isAsmParserOnly = V.alternate;
2422  let AsmVariantName = V.asmvariant;
2423  let M3 = V.ccmask;
2424}
2425
2426multiclass CmpBranchRIEaPair<string mnemonic, bits<16> opcode,
2427                             RegisterOperand cls, ImmOpWithPattern imm> {
2428  let isCodeGenOnly = 1 in
2429    def "" : CmpBranchRIEa<mnemonic, opcode, cls, imm>;
2430  def Asm : AsmCmpBranchRIEa<mnemonic, opcode, cls, imm>;
2431}
2432
2433class CmpBranchRIEb<string mnemonic, bits<16> opcode,
2434                    RegisterOperand cls>
2435  : InstRIEb<opcode, (outs),
2436             (ins cls:$R1, cls:$R2, cond4:$M3, brtarget16:$RI4),
2437             mnemonic#"$M3\t$R1, $R2, $RI4", []>;
2438
2439class AsmCmpBranchRIEb<string mnemonic, bits<16> opcode,
2440                       RegisterOperand cls>
2441  : InstRIEb<opcode, (outs),
2442             (ins cls:$R1, cls:$R2, imm32zx4:$M3, brtarget16:$RI4),
2443             mnemonic#"\t$R1, $R2, $M3, $RI4", []>;
2444
2445class FixedCmpBranchRIEb<CondVariant V, string mnemonic, bits<16> opcode,
2446                         RegisterOperand cls>
2447  : InstRIEb<opcode, (outs), (ins cls:$R1, cls:$R2, brtarget16:$RI4),
2448             mnemonic#V.suffix#"\t$R1, $R2, $RI4", []> {
2449  let isAsmParserOnly = V.alternate;
2450  let AsmVariantName = V.asmvariant;
2451  let M3 = V.ccmask;
2452}
2453
2454multiclass CmpBranchRIEbPair<string mnemonic, bits<16> opcode,
2455                             RegisterOperand cls> {
2456  let isCodeGenOnly = 1 in
2457    def "" : CmpBranchRIEb<mnemonic, opcode, cls>;
2458  def Asm : AsmCmpBranchRIEb<mnemonic, opcode, cls>;
2459}
2460
2461class CmpBranchRIEc<string mnemonic, bits<16> opcode,
2462                    RegisterOperand cls, ImmOpWithPattern imm>
2463  : InstRIEc<opcode, (outs),
2464             (ins cls:$R1, imm:$I2, cond4:$M3, brtarget16:$RI4),
2465             mnemonic#"$M3\t$R1, $I2, $RI4", []>;
2466
2467class AsmCmpBranchRIEc<string mnemonic, bits<16> opcode,
2468                       RegisterOperand cls, ImmOpWithPattern imm>
2469  : InstRIEc<opcode, (outs),
2470             (ins cls:$R1, imm:$I2, imm32zx4:$M3, brtarget16:$RI4),
2471             mnemonic#"\t$R1, $I2, $M3, $RI4", []>;
2472
2473class FixedCmpBranchRIEc<CondVariant V, string mnemonic, bits<16> opcode,
2474                         RegisterOperand cls, ImmOpWithPattern imm>
2475  : InstRIEc<opcode, (outs), (ins cls:$R1, imm:$I2, brtarget16:$RI4),
2476             mnemonic#V.suffix#"\t$R1, $I2, $RI4", []> {
2477  let isAsmParserOnly = V.alternate;
2478  let AsmVariantName = V.asmvariant;
2479  let M3 = V.ccmask;
2480}
2481
2482multiclass CmpBranchRIEcPair<string mnemonic, bits<16> opcode,
2483                            RegisterOperand cls, ImmOpWithPattern imm> {
2484  let isCodeGenOnly = 1 in
2485    def "" : CmpBranchRIEc<mnemonic, opcode, cls, imm>;
2486  def Asm : AsmCmpBranchRIEc<mnemonic, opcode, cls, imm>;
2487}
2488
2489class CmpBranchRRFc<string mnemonic, bits<16> opcode,
2490                    RegisterOperand cls>
2491  : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, cond4:$M3),
2492             mnemonic#"$M3\t$R1, $R2", []>;
2493
2494class AsmCmpBranchRRFc<string mnemonic, bits<16> opcode,
2495                       RegisterOperand cls>
2496  : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, imm32zx4:$M3),
2497             mnemonic#"\t$R1, $R2, $M3", []>;
2498
2499multiclass CmpBranchRRFcPair<string mnemonic, bits<16> opcode,
2500                             RegisterOperand cls> {
2501  let isCodeGenOnly = 1 in
2502    def "" : CmpBranchRRFc<mnemonic, opcode, cls>;
2503  def Asm : AsmCmpBranchRRFc<mnemonic, opcode, cls>;
2504}
2505
2506class FixedCmpBranchRRFc<CondVariant V, string mnemonic, bits<16> opcode,
2507                          RegisterOperand cls>
2508  : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2),
2509             mnemonic#V.suffix#"\t$R1, $R2", []> {
2510  let isAsmParserOnly = V.alternate;
2511  let AsmVariantName = V.asmvariant;
2512  let M3 = V.ccmask;
2513}
2514
2515class CmpBranchRRS<string mnemonic, bits<16> opcode,
2516                   RegisterOperand cls>
2517  : InstRRS<opcode, (outs),
2518            (ins cls:$R1, cls:$R2, cond4:$M3, (bdaddr12only $B4, $D4):$BD4),
2519            mnemonic#"$M3\t$R1, $R2, $BD4", []>;
2520
2521class AsmCmpBranchRRS<string mnemonic, bits<16> opcode,
2522                      RegisterOperand cls>
2523  : InstRRS<opcode, (outs),
2524            (ins cls:$R1, cls:$R2, imm32zx4:$M3, (bdaddr12only $B4, $D4):$BD4),
2525            mnemonic#"\t$R1, $R2, $M3, $BD4", []>;
2526
2527class FixedCmpBranchRRS<CondVariant V, string mnemonic, bits<16> opcode,
2528                        RegisterOperand cls>
2529  : InstRRS<opcode, (outs),
2530            (ins cls:$R1, cls:$R2, (bdaddr12only $B4, $D4):$BD4),
2531            mnemonic#V.suffix#"\t$R1, $R2, $BD4", []> {
2532  let isAsmParserOnly = V.alternate;
2533  let AsmVariantName = V.asmvariant;
2534  let M3 = V.ccmask;
2535}
2536
2537multiclass CmpBranchRRSPair<string mnemonic, bits<16> opcode,
2538                            RegisterOperand cls> {
2539  let isCodeGenOnly = 1 in
2540    def "" : CmpBranchRRS<mnemonic, opcode, cls>;
2541  def Asm : AsmCmpBranchRRS<mnemonic, opcode, cls>;
2542}
2543
2544class CmpBranchRIS<string mnemonic, bits<16> opcode,
2545                   RegisterOperand cls, ImmOpWithPattern imm>
2546  : InstRIS<opcode, (outs),
2547            (ins cls:$R1, imm:$I2, cond4:$M3, (bdaddr12only $B4, $D4):$BD4),
2548            mnemonic#"$M3\t$R1, $I2, $BD4", []>;
2549
2550class AsmCmpBranchRIS<string mnemonic, bits<16> opcode,
2551                      RegisterOperand cls, ImmOpWithPattern imm>
2552  : InstRIS<opcode, (outs),
2553            (ins cls:$R1, imm:$I2, imm32zx4:$M3, (bdaddr12only $B4, $D4):$BD4),
2554            mnemonic#"\t$R1, $I2, $M3, $BD4", []>;
2555
2556class FixedCmpBranchRIS<CondVariant V, string mnemonic, bits<16> opcode,
2557                        RegisterOperand cls, ImmOpWithPattern imm>
2558  : InstRIS<opcode, (outs),
2559            (ins cls:$R1, imm:$I2, (bdaddr12only $B4, $D4):$BD4),
2560            mnemonic#V.suffix#"\t$R1, $I2, $BD4", []> {
2561  let isAsmParserOnly = V.alternate;
2562  let AsmVariantName = V.asmvariant;
2563  let M3 = V.ccmask;
2564}
2565
2566multiclass CmpBranchRISPair<string mnemonic, bits<16> opcode,
2567                            RegisterOperand cls, ImmOpWithPattern imm> {
2568  let isCodeGenOnly = 1 in
2569    def "" : CmpBranchRIS<mnemonic, opcode, cls, imm>;
2570  def Asm : AsmCmpBranchRIS<mnemonic, opcode, cls, imm>;
2571}
2572
2573class CmpBranchRSYb<string mnemonic, bits<16> opcode,
2574                    RegisterOperand cls>
2575  : InstRSYb<opcode, (outs),
2576             (ins cls:$R1, (bdaddr20only $B2, $D2):$BD2, cond4:$M3),
2577             mnemonic#"$M3\t$R1, $BD2", []>;
2578
2579class AsmCmpBranchRSYb<string mnemonic, bits<16> opcode,
2580                       RegisterOperand cls>
2581  : InstRSYb<opcode, (outs),
2582             (ins cls:$R1, (bdaddr20only $B2, $D2):$BD2, imm32zx4:$M3),
2583             mnemonic#"\t$R1, $M3, $BD2", []>;
2584
2585multiclass CmpBranchRSYbPair<string mnemonic, bits<16> opcode,
2586                             RegisterOperand cls> {
2587  let isCodeGenOnly = 1 in
2588    def "" : CmpBranchRSYb<mnemonic, opcode, cls>;
2589  def Asm : AsmCmpBranchRSYb<mnemonic, opcode, cls>;
2590}
2591
2592class FixedCmpBranchRSYb<CondVariant V, string mnemonic, bits<16> opcode,
2593                          RegisterOperand cls>
2594  : InstRSYb<opcode, (outs), (ins cls:$R1, (bdaddr20only $B2, $D2):$BD2),
2595             mnemonic#V.suffix#"\t$R1, $BD2", []> {
2596  let isAsmParserOnly = V.alternate;
2597  let AsmVariantName = V.asmvariant;
2598  let M3 = V.ccmask;
2599}
2600
2601class BranchUnaryRI<string mnemonic, bits<12> opcode, RegisterOperand cls>
2602  : InstRIb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget16:$RI2),
2603            mnemonic#"\t$R1, $RI2", []> {
2604  let Constraints = "$R1 = $R1src";
2605  let DisableEncoding = "$R1src";
2606}
2607
2608class BranchUnaryRIL<string mnemonic, bits<12> opcode, RegisterOperand cls>
2609  : InstRILb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget32:$RI2),
2610             mnemonic#"\t$R1, $RI2", []> {
2611  let Constraints = "$R1 = $R1src";
2612  let DisableEncoding = "$R1src";
2613}
2614
2615class BranchUnaryRR<string mnemonic, bits<8> opcode, RegisterOperand cls>
2616  : InstRR<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2617           mnemonic#"\t$R1, $R2", []> {
2618  let Constraints = "$R1 = $R1src";
2619  let DisableEncoding = "$R1src";
2620}
2621
2622class BranchUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2623  : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2624            mnemonic#"\t$R1, $R2", []> {
2625  let Constraints = "$R1 = $R1src";
2626  let DisableEncoding = "$R1src";
2627}
2628
2629class BranchUnaryRX<string mnemonic, bits<8> opcode, RegisterOperand cls>
2630  : InstRXa<opcode, (outs cls:$R1),
2631            (ins cls:$R1src, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2632            mnemonic#"\t$R1, $XBD2", []> {
2633  let Constraints = "$R1 = $R1src";
2634  let DisableEncoding = "$R1src";
2635}
2636
2637class BranchUnaryRXY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2638  : InstRXYa<opcode, (outs cls:$R1),
2639             (ins cls:$R1src, (bdxaddr20only $B2, $D2, $X2):$XBD2),
2640             mnemonic#"\t$R1, $XBD2", []> {
2641  let Constraints = "$R1 = $R1src";
2642  let DisableEncoding = "$R1src";
2643}
2644
2645class BranchBinaryRSI<string mnemonic, bits<8> opcode, RegisterOperand cls>
2646  : InstRSI<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2647            mnemonic#"\t$R1, $R3, $RI2", []> {
2648  let Constraints = "$R1 = $R1src";
2649  let DisableEncoding = "$R1src";
2650}
2651
2652class BranchBinaryRIEe<string mnemonic, bits<16> opcode, RegisterOperand cls>
2653  : InstRIEe<opcode, (outs cls:$R1),
2654             (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2655             mnemonic#"\t$R1, $R3, $RI2", []> {
2656  let Constraints = "$R1 = $R1src";
2657  let DisableEncoding = "$R1src";
2658}
2659
2660class BranchBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls>
2661  : InstRSa<opcode, (outs cls:$R1),
2662            (ins cls:$R1src, cls:$R3, (bdaddr12only $B2, $D2):$BD2),
2663            mnemonic#"\t$R1, $R3, $BD2", []> {
2664  let Constraints = "$R1 = $R1src";
2665  let DisableEncoding = "$R1src";
2666}
2667
2668class BranchBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2669  : InstRSYa<opcode,
2670             (outs cls:$R1),
2671             (ins cls:$R1src, cls:$R3, (bdaddr20only $B2, $D2):$BD2),
2672             mnemonic#"\t$R1, $R3, $BD2", []> {
2673  let Constraints = "$R1 = $R1src";
2674  let DisableEncoding = "$R1src";
2675}
2676
2677class LoadMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2678                     AddressingMode mode = bdaddr12only>
2679  : InstRSa<opcode, (outs cls:$R1, cls:$R3), (ins (mode $B2, $D2):$BD2),
2680            mnemonic#"\t$R1, $R3, $BD2", []> {
2681  let mayLoad = 1;
2682}
2683
2684class LoadMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2685                      AddressingMode mode = bdaddr20only>
2686  : InstRSYa<opcode, (outs cls:$R1, cls:$R3), (ins (mode $B2, $D2):$BD2),
2687             mnemonic#"\t$R1, $R3, $BD2", []> {
2688  let mayLoad = 1;
2689}
2690
2691multiclass LoadMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2692                              bits<16> rsyOpcode, RegisterOperand cls> {
2693  let DispKey = mnemonic # cls in {
2694    let DispSize = "12" in
2695      def "" : LoadMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2696    let DispSize = "20" in
2697      def Y  : LoadMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2698  }
2699}
2700
2701class LoadMultipleSSe<string mnemonic, bits<8> opcode, RegisterOperand cls>
2702  : InstSSe<opcode, (outs cls:$R1, cls:$R3),
2703            (ins (bdaddr12only $B2, $D2):$BD2, (bdaddr12only $B4, $D4):$BD4),
2704            mnemonic#"\t$R1, $R3, $BD2, $BD4", []> {
2705  let mayLoad = 1;
2706}
2707
2708multiclass LoadMultipleVRSaAlign<string mnemonic, bits<16> opcode> {
2709  let mayLoad = 1 in {
2710    def Align : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3),
2711                        (ins (bdaddr12only $B2, $D2):$BD2, imm32zx4:$M4),
2712                        mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
2713    let M4 = 0 in
2714      def "" : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3),
2715                        (ins (bdaddr12only $B2, $D2):$BD2),
2716                        mnemonic#"\t$V1, $V3, $BD2", []>;
2717  }
2718}
2719
2720class StoreRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2721                 RegisterOperand cls>
2722  : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
2723             mnemonic#"\t$R1, $RI2",
2724             [(operator cls:$R1, pcrel32:$RI2)]> {
2725  let mayStore = 1;
2726  // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2727  // However, BDXs have two extra operands and are therefore 6 units more
2728  // complex.
2729  let AddedComplexity = 7;
2730}
2731
2732class StoreRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2733              RegisterOperand cls, bits<5> bytes,
2734              AddressingMode mode = bdxaddr12only>
2735  : InstRXa<opcode, (outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
2736            mnemonic#"\t$R1, $XBD2",
2737            [(operator cls:$R1, mode:$XBD2)]> {
2738  let OpKey = mnemonic#"r"#cls;
2739  let OpType = "mem";
2740  let mayStore = 1;
2741  let AccessBytes = bytes;
2742}
2743
2744class StoreRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2745               RegisterOperand cls, bits<5> bytes,
2746               AddressingMode mode = bdxaddr20only>
2747  : InstRXYa<opcode, (outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
2748             mnemonic#"\t$R1, $XBD2",
2749             [(operator cls:$R1, mode:$XBD2)]> {
2750  let OpKey = mnemonic#"r"#cls;
2751  let OpType = "mem";
2752  let mayStore = 1;
2753  let AccessBytes = bytes;
2754}
2755
2756multiclass StoreRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
2757                       SDPatternOperator operator, RegisterOperand cls,
2758                       bits<5> bytes> {
2759  let DispKey = mnemonic # cls in {
2760    let DispSize = "12" in
2761      def "" : StoreRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
2762    let DispSize = "20" in
2763      def Y  : StoreRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
2764                        bdxaddr20pair>;
2765  }
2766}
2767
2768class StoreVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2769               TypedReg tr, bits<5> bytes, bits<4> type = 0>
2770  : InstVRX<opcode, (outs),
2771            (ins tr.op:$V1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2772            mnemonic#"\t$V1, $XBD2",
2773            [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2)]> {
2774  let M3 = type;
2775  let mayStore = 1;
2776  let AccessBytes = bytes;
2777}
2778
2779class StoreVRXGeneric<string mnemonic, bits<16> opcode>
2780  : InstVRX<opcode, (outs),
2781            (ins VR128:$V1, (bdxaddr12only $B2, $D2, $X2):$XBD2, imm32zx4:$M3),
2782            mnemonic#"\t$V1, $XBD2, $M3", []> {
2783  let mayStore = 1;
2784}
2785
2786multiclass StoreVRXAlign<string mnemonic, bits<16> opcode> {
2787  let mayStore = 1, AccessBytes = 16 in {
2788    def Align : InstVRX<opcode, (outs),
2789                        (ins VR128:$V1, (bdxaddr12only $B2, $D2, $X2):$XBD2,
2790                             imm32zx4:$M3),
2791                        mnemonic#"\t$V1, $XBD2, $M3", []>;
2792    let M3 = 0 in
2793      def "" : InstVRX<opcode, (outs),
2794                       (ins VR128:$V1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2795                       mnemonic#"\t$V1, $XBD2", []>;
2796  }
2797}
2798
2799class StoreLengthVRSb<string mnemonic, bits<16> opcode,
2800                      SDPatternOperator operator, bits<5> bytes>
2801  : InstVRSb<opcode, (outs),
2802             (ins VR128:$V1, GR32:$R3, (bdaddr12only $B2, $D2):$BD2),
2803             mnemonic#"\t$V1, $R3, $BD2",
2804             [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2805  let M4 = 0;
2806  let mayStore = 1;
2807  let AccessBytes = bytes;
2808}
2809
2810class StoreLengthVRSd<string mnemonic, bits<16> opcode,
2811                      SDPatternOperator operator, bits<5> bytes>
2812  : InstVRSd<opcode, (outs),
2813             (ins VR128:$V1, GR32:$R3, (bdaddr12only $B2, $D2):$BD2),
2814             mnemonic#"\t$V1, $R3, $BD2",
2815             [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2816  let mayStore = 1;
2817  let AccessBytes = bytes;
2818}
2819
2820class StoreLengthVSI<string mnemonic, bits<16> opcode,
2821                     SDPatternOperator operator, bits<5> bytes>
2822  : InstVSI<opcode, (outs),
2823            (ins VR128:$V1, (bdaddr12only $B2, $D2):$BD2, imm32zx8:$I3),
2824            mnemonic#"\t$V1, $BD2, $I3",
2825            [(operator VR128:$V1, imm32zx8:$I3, bdaddr12only:$BD2)]> {
2826  let mayStore = 1;
2827  let AccessBytes = bytes;
2828}
2829
2830class StoreMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2831                      AddressingMode mode = bdaddr12only>
2832  : InstRSa<opcode, (outs), (ins cls:$R1, cls:$R3, (mode $B2, $D2):$BD2),
2833            mnemonic#"\t$R1, $R3, $BD2", []> {
2834  let mayStore = 1;
2835}
2836
2837class StoreMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2838                       AddressingMode mode = bdaddr20only>
2839  : InstRSYa<opcode, (outs), (ins cls:$R1, cls:$R3, (mode $B2, $D2):$BD2),
2840             mnemonic#"\t$R1, $R3, $BD2", []> {
2841  let mayStore = 1;
2842}
2843
2844multiclass StoreMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2845                               bits<16> rsyOpcode, RegisterOperand cls> {
2846  let DispKey = mnemonic # cls in {
2847    let DispSize = "12" in
2848      def "" : StoreMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2849    let DispSize = "20" in
2850      def Y  : StoreMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2851  }
2852}
2853
2854multiclass StoreMultipleVRSaAlign<string mnemonic, bits<16> opcode> {
2855  let mayStore = 1 in {
2856    def Align : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3,
2857                                              (bdaddr12only $B2, $D2):$BD2,
2858                                              imm32zx4:$M4),
2859                         mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
2860    let M4 = 0 in
2861      def "" : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3,
2862                                             (bdaddr12only $B2, $D2):$BD2),
2863                        mnemonic#"\t$V1, $V3, $BD2", []>;
2864  }
2865}
2866
2867// StoreSI* instructions are used to store an integer to memory, but the
2868// addresses are more restricted than for normal stores.  If we are in the
2869// situation of having to force either the address into a register or the
2870// constant into a register, it's usually better to do the latter.
2871// We therefore match the address in the same way as a normal store and
2872// only use the StoreSI* instruction if the matched address is suitable.
2873class StoreSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2874              ImmOpWithPattern imm>
2875  : InstSI<opcode, (outs), (ins (mviaddr12pair $B1, $D1):$BD1, imm:$I2),
2876           mnemonic#"\t$BD1, $I2",
2877           [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2878  let mayStore = 1;
2879}
2880
2881class StoreSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2882               ImmOpWithPattern imm>
2883  : InstSIY<opcode, (outs), (ins (mviaddr20pair $B1, $D1):$BD1, imm:$I2),
2884            mnemonic#"\t$BD1, $I2",
2885            [(operator imm:$I2, mviaddr20pair:$BD1)]> {
2886  let mayStore = 1;
2887}
2888
2889class StoreSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2890               ImmOpWithPattern imm>
2891  : InstSIL<opcode, (outs), (ins (mviaddr12pair $B1, $D1):$BD1, imm:$I2),
2892            mnemonic#"\t$BD1, $I2",
2893            [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2894  let mayStore = 1;
2895}
2896
2897multiclass StoreSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
2898                       SDPatternOperator operator, ImmOpWithPattern imm> {
2899  let DispKey = mnemonic in {
2900    let DispSize = "12" in
2901      def "" : StoreSI<mnemonic, siOpcode, operator, imm>;
2902    let DispSize = "20" in
2903      def Y  : StoreSIY<mnemonic#"y", siyOpcode, operator, imm>;
2904  }
2905}
2906
2907class StoreSSE<string mnemonic, bits<16> opcode>
2908  : InstSSE<opcode, (outs),
2909            (ins (bdaddr12only $B1, $D1):$BD1, (bdaddr12only $B2, $D2):$BD2),
2910            mnemonic#"\t$BD1, $BD2", []> {
2911  let mayStore = 1;
2912}
2913
2914class CondStoreRSY<string mnemonic, bits<16> opcode,
2915                   RegisterOperand cls, bits<5> bytes,
2916                   AddressingMode mode = bdaddr20only>
2917  : InstRSYb<opcode, (outs),
2918             (ins cls:$R1, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$M3),
2919             mnemonic#"$M3\t$R1, $BD2", []> {
2920  let mayStore = 1;
2921  let AccessBytes = bytes;
2922  let CCMaskLast = 1;
2923}
2924
2925// Like CondStoreRSY, but used for the raw assembly form.  The condition-code
2926// mask is the third operand rather than being part of the mnemonic.
2927class AsmCondStoreRSY<string mnemonic, bits<16> opcode,
2928                      RegisterOperand cls, bits<5> bytes,
2929                      AddressingMode mode = bdaddr20only>
2930  : InstRSYb<opcode, (outs), (ins cls:$R1, (mode $B2, $D2):$BD2, imm32zx4:$M3),
2931             mnemonic#"\t$R1, $BD2, $M3", []> {
2932  let mayStore = 1;
2933  let AccessBytes = bytes;
2934}
2935
2936// Like CondStoreRSY, but with a fixed CC mask.
2937class FixedCondStoreRSY<CondVariant V, string mnemonic, bits<16> opcode,
2938                        RegisterOperand cls, bits<5> bytes,
2939                        AddressingMode mode = bdaddr20only>
2940  : InstRSYb<opcode, (outs), (ins cls:$R1, (mode $B2, $D2):$BD2),
2941             mnemonic#V.suffix#"\t$R1, $BD2", []> {
2942  let mayStore = 1;
2943  let AccessBytes = bytes;
2944  let isAsmParserOnly = V.alternate;
2945  let AsmVariantName = V.asmvariant;
2946  let M3 = V.ccmask;
2947}
2948
2949multiclass CondStoreRSYPair<string mnemonic, bits<16> opcode,
2950                            RegisterOperand cls, bits<5> bytes,
2951                            AddressingMode mode = bdaddr20only> {
2952  let isCodeGenOnly = 1 in
2953    def "" : CondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
2954  def Asm : AsmCondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
2955}
2956
2957class SideEffectUnaryI<string mnemonic, bits<8> opcode, ImmOpWithPattern imm>
2958  : InstI<opcode, (outs), (ins imm:$I1),
2959          mnemonic#"\t$I1", []>;
2960
2961class SideEffectUnaryRR<string mnemonic, bits<8>opcode, RegisterOperand cls>
2962  : InstRR<opcode, (outs), (ins cls:$R1),
2963           mnemonic#"\t$R1", []> {
2964  let R2 = 0;
2965}
2966
2967class SideEffectUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
2968                         SDPatternOperator operator>
2969  : InstRRE<opcode, (outs), (ins cls:$R1),
2970            mnemonic#"\t$R1", [(operator cls:$R1)]> {
2971  let R2 = 0;
2972}
2973
2974class SideEffectUnaryS<string mnemonic, bits<16> opcode,
2975                       SDPatternOperator operator, bits<5> bytes,
2976                       AddressingMode mode = bdaddr12only>
2977  : InstS<opcode, (outs), (ins (mode $B2, $D2):$BD2),
2978          mnemonic#"\t$BD2", [(operator mode:$BD2)]> {
2979  let mayLoad = 1;
2980  let AccessBytes = bytes;
2981}
2982
2983class SideEffectUnarySIY<string mnemonic, bits<16> opcode,
2984                         bits<5> bytes,
2985                         AddressingMode mode = bdaddr20only>
2986  : InstSIY<opcode, (outs), (ins (mode $B1, $D1):$BD1),
2987            mnemonic#"\t$BD1", []> {
2988  let mayLoad = 1;
2989  let AccessBytes = bytes;
2990  let I2 = 0;
2991}
2992
2993class SideEffectAddressS<string mnemonic, bits<16> opcode,
2994                        SDPatternOperator operator,
2995                        AddressingMode mode = bdaddr12only>
2996  : InstS<opcode, (outs), (ins (mode $B2, $D2):$BD2),
2997          mnemonic#"\t$BD2", [(operator mode:$BD2)]>;
2998
2999class LoadAddressRX<string mnemonic, bits<8> opcode,
3000                    SDPatternOperator operator, AddressingMode mode>
3001  : InstRXa<opcode, (outs GR64:$R1), (ins (mode $B2, $D2, $X2):$XBD2),
3002            mnemonic#"\t$R1, $XBD2",
3003            [(set GR64:$R1, (operator mode:$XBD2))]>;
3004
3005class LoadAddressRXY<string mnemonic, bits<16> opcode,
3006                     SDPatternOperator operator, AddressingMode mode>
3007  : InstRXYa<opcode, (outs GR64:$R1), (ins (mode $B2, $D2, $X2):$XBD2),
3008             mnemonic#"\t$R1, $XBD2",
3009             [(set GR64:$R1, (operator mode:$XBD2))]>;
3010
3011multiclass LoadAddressRXPair<string mnemonic, bits<8> rxOpcode,
3012                             bits<16> rxyOpcode, SDPatternOperator operator> {
3013  let DispKey = mnemonic in {
3014    let DispSize = "12" in
3015      def "" : LoadAddressRX<mnemonic, rxOpcode, operator, laaddr12pair>;
3016    let DispSize = "20" in
3017      def Y  : LoadAddressRXY<mnemonic#"y", rxyOpcode, operator, laaddr20pair>;
3018  }
3019}
3020
3021class LoadAddressRIL<string mnemonic, bits<12> opcode,
3022                     SDPatternOperator operator>
3023  : InstRILb<opcode, (outs GR64:$R1), (ins pcrel32:$RI2),
3024             mnemonic#"\t$R1, $RI2",
3025             [(set GR64:$R1, (operator pcrel32:$RI2))]>;
3026
3027class UnaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3028              RegisterOperand cls1, RegisterOperand cls2>
3029  : InstRR<opcode, (outs cls1:$R1), (ins cls2:$R2),
3030           mnemonic#"\t$R1, $R2",
3031           [(set cls1:$R1, (operator cls2:$R2))]> {
3032  let OpKey = mnemonic#cls1;
3033  let OpType = "reg";
3034}
3035
3036class UnaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3037               RegisterOperand cls1, RegisterOperand cls2>
3038  : InstRRE<opcode, (outs cls1:$R1), (ins cls2:$R2),
3039            mnemonic#"\t$R1, $R2",
3040            [(set cls1:$R1, (operator cls2:$R2))]> {
3041  let OpKey = mnemonic#cls1;
3042  let OpType = "reg";
3043}
3044
3045class UnaryTiedRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
3046  : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src),
3047            mnemonic#"\t$R1", []> {
3048  let Constraints = "$R1 = $R1src";
3049  let DisableEncoding = "$R1src";
3050  let R2 = 0;
3051}
3052
3053class UnaryMemRRFc<string mnemonic, bits<16> opcode,
3054                   RegisterOperand cls1, RegisterOperand cls2>
3055  : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src),
3056            mnemonic#"\t$R1, $R2", []> {
3057  let Constraints = "$R1 = $R1src";
3058  let DisableEncoding = "$R1src";
3059  let M3 = 0;
3060}
3061
3062class UnaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3063              RegisterOperand cls, ImmOpWithPattern imm>
3064  : InstRIa<opcode, (outs cls:$R1), (ins imm:$I2),
3065            mnemonic#"\t$R1, $I2",
3066            [(set cls:$R1, (operator imm:$I2))]>;
3067
3068class UnaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3069               RegisterOperand cls, ImmOpWithPattern imm>
3070  : InstRILa<opcode, (outs cls:$R1), (ins imm:$I2),
3071             mnemonic#"\t$R1, $I2",
3072             [(set cls:$R1, (operator imm:$I2))]>;
3073
3074class UnaryRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3075                 RegisterOperand cls>
3076  : InstRILb<opcode, (outs cls:$R1), (ins pcrel32:$RI2),
3077             mnemonic#"\t$R1, $RI2",
3078             [(set cls:$R1, (operator pcrel32:$RI2))]> {
3079  let mayLoad = 1;
3080  // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
3081  // However, BDXs have two extra operands and are therefore 6 units more
3082  // complex.
3083  let AddedComplexity = 7;
3084}
3085
3086class CondUnaryRSY<string mnemonic, bits<16> opcode,
3087                   SDPatternOperator operator, RegisterOperand cls,
3088                   bits<5> bytes, AddressingMode mode = bdaddr20only>
3089  : InstRSYb<opcode, (outs cls:$R1),
3090             (ins cls:$R1src, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$M3),
3091             mnemonic#"$M3\t$R1, $BD2",
3092             [(set cls:$R1,
3093                   (z_select_ccmask (operator bdaddr20only:$BD2), cls:$R1src,
3094                                    cond4:$valid, cond4:$M3))]> {
3095  let Constraints = "$R1 = $R1src";
3096  let DisableEncoding = "$R1src";
3097  let mayLoad = 1;
3098  let AccessBytes = bytes;
3099  let CCMaskLast = 1;
3100  let OpKey = mnemonic#"r"#cls;
3101  let OpType = "mem";
3102  let MemKey = mnemonic#cls;
3103  let MemType = "target";
3104}
3105
3106// Like CondUnaryRSY, but used for the raw assembly form.  The condition-code
3107// mask is the third operand rather than being part of the mnemonic.
3108class AsmCondUnaryRSY<string mnemonic, bits<16> opcode,
3109                      RegisterOperand cls, bits<5> bytes,
3110                      AddressingMode mode = bdaddr20only>
3111  : InstRSYb<opcode, (outs cls:$R1),
3112             (ins cls:$R1src, (mode $B2, $D2):$BD2, imm32zx4:$M3),
3113             mnemonic#"\t$R1, $BD2, $M3", []> {
3114  let mayLoad = 1;
3115  let AccessBytes = bytes;
3116  let Constraints = "$R1 = $R1src";
3117  let DisableEncoding = "$R1src";
3118}
3119
3120// Like CondUnaryRSY, but with a fixed CC mask.
3121class FixedCondUnaryRSY<CondVariant V, string mnemonic, bits<16> opcode,
3122                        RegisterOperand cls, bits<5> bytes,
3123                        AddressingMode mode = bdaddr20only>
3124  : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, (mode $B2, $D2):$BD2),
3125             mnemonic#V.suffix#"\t$R1, $BD2", []> {
3126  let Constraints = "$R1 = $R1src";
3127  let DisableEncoding = "$R1src";
3128  let mayLoad = 1;
3129  let AccessBytes = bytes;
3130  let isAsmParserOnly = V.alternate;
3131  let AsmVariantName = V.asmvariant;
3132  let M3 = V.ccmask;
3133}
3134
3135multiclass CondUnaryRSYPair<string mnemonic, bits<16> opcode,
3136                            SDPatternOperator operator,
3137                            RegisterOperand cls, bits<5> bytes,
3138                            AddressingMode mode = bdaddr20only> {
3139  let isCodeGenOnly = 1 in
3140    def "" : CondUnaryRSY<mnemonic, opcode, operator, cls, bytes, mode>;
3141  def Asm : AsmCondUnaryRSY<mnemonic, opcode, cls, bytes, mode>;
3142}
3143
3144class UnaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3145              RegisterOperand cls, bits<5> bytes,
3146              AddressingMode mode = bdxaddr12only>
3147  : InstRXa<opcode, (outs cls:$R1), (ins (mode $B2, $D2, $X2):$XBD2),
3148            mnemonic#"\t$R1, $XBD2",
3149            [(set cls:$R1, (operator mode:$XBD2))]> {
3150  let OpKey = mnemonic#"r"#cls;
3151  let OpType = "mem";
3152  let mayLoad = 1;
3153  let AccessBytes = bytes;
3154}
3155
3156class UnaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3157               RegisterOperand cls, bits<5> bytes>
3158  : InstRXE<opcode, (outs cls:$R1), (ins (bdxaddr12only $B2, $D2, $X2):$XBD2),
3159            mnemonic#"\t$R1, $XBD2",
3160            [(set cls:$R1, (operator bdxaddr12only:$XBD2))]> {
3161  let OpKey = mnemonic#"r"#cls;
3162  let OpType = "mem";
3163  let mayLoad = 1;
3164  let AccessBytes = bytes;
3165  let M3 = 0;
3166}
3167
3168class UnaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3169               RegisterOperand cls, bits<5> bytes,
3170               AddressingMode mode = bdxaddr20only>
3171  : InstRXYa<opcode, (outs cls:$R1), (ins (mode $B2, $D2, $X2):$XBD2),
3172             mnemonic#"\t$R1, $XBD2",
3173             [(set cls:$R1, (operator mode:$XBD2))]> {
3174  let OpKey = mnemonic#"r"#cls;
3175  let OpType = "mem";
3176  let mayLoad = 1;
3177  let AccessBytes = bytes;
3178}
3179
3180multiclass UnaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3181                       SDPatternOperator operator, RegisterOperand cls,
3182                       bits<5> bytes> {
3183  let DispKey = mnemonic # cls in {
3184    let DispSize = "12" in
3185      def "" : UnaryRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
3186    let DispSize = "20" in
3187      def Y  : UnaryRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
3188                        bdxaddr20pair>;
3189  }
3190}
3191
3192class UnaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3193                TypedReg tr, ImmOpWithPattern imm, bits<4> type = 0>
3194  : InstVRIa<opcode, (outs tr.op:$V1), (ins imm:$I2),
3195             mnemonic#"\t$V1, $I2",
3196             [(set (tr.vt tr.op:$V1), (operator (i32 timm:$I2)))]> {
3197  let M3 = type;
3198}
3199
3200class UnaryVRIaGeneric<string mnemonic, bits<16> opcode, ImmOpWithPattern imm>
3201  : InstVRIa<opcode, (outs VR128:$V1), (ins imm:$I2, imm32zx4:$M3),
3202             mnemonic#"\t$V1, $I2, $M3", []>;
3203
3204class UnaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3205                TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0,
3206                bits<4> m5 = 0, string fp_mnemonic = "">
3207  : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2),
3208             mnemonic#"\t$V1, $V2",
3209             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]> {
3210  let M3 = type;
3211  let M4 = m4;
3212  let M5 = m5;
3213  let OpKey = fp_mnemonic#!subst("VR", "FP", !cast<string>(tr1.op));
3214  let OpType = "reg";
3215}
3216
3217class UnaryVRRaGeneric<string mnemonic, bits<16> opcode, bits<4> m4 = 0,
3218                       bits<4> m5 = 0>
3219  : InstVRRa<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3),
3220             mnemonic#"\t$V1, $V2, $M3", []> {
3221  let M4 = m4;
3222  let M5 = m5;
3223}
3224
3225class UnaryVRRaFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0>
3226  : InstVRRa<opcode, (outs VR128:$V1),
3227             (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4),
3228             mnemonic#"\t$V1, $V2, $M3, $M4", []> {
3229  let M5 = m5;
3230}
3231
3232// Declare a pair of instructions, one which sets CC and one which doesn't.
3233// The CC-setting form ends with "S" and sets the low bit of M5.
3234// The form that does not set CC has an extra operand to optionally allow
3235// specifying arbitrary M5 values in assembler.
3236multiclass UnaryExtraVRRaSPair<string mnemonic, bits<16> opcode,
3237                               SDPatternOperator operator,
3238                               SDPatternOperator operator_cc,
3239                               TypedReg tr1, TypedReg tr2, bits<4> type> {
3240  let M3 = type, M4 = 0 in
3241    def "" : InstVRRa<opcode, (outs tr1.op:$V1),
3242                      (ins tr2.op:$V2, imm32zx4:$M5),
3243                      mnemonic#"\t$V1, $V2, $M5", []>;
3244  def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2))),
3245            (!cast<Instruction>(NAME) tr2.op:$V2, 0)>;
3246  def : InstAlias<mnemonic#"\t$V1, $V2",
3247                  (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 0)>;
3248  let Defs = [CC] in
3249    def S : UnaryVRRa<mnemonic#"s", opcode, operator_cc, tr1, tr2,
3250                      type, 0, 1>;
3251}
3252
3253multiclass UnaryExtraVRRaSPairGeneric<string mnemonic, bits<16> opcode> {
3254  let M4 = 0, Defs = [CC] in
3255    def "" : InstVRRa<opcode, (outs VR128:$V1),
3256                     (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M5),
3257                     mnemonic#"\t$V1, $V2, $M3, $M5", []>;
3258  def : InstAlias<mnemonic#"\t$V1, $V2, $M3",
3259                  (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2,
3260                                            imm32zx4:$M3, 0)>;
3261}
3262
3263class UnaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3264               TypedReg tr, bits<5> bytes, bits<4> type = 0>
3265  : InstVRX<opcode, (outs tr.op:$V1), (ins (bdxaddr12only $B2, $D2, $X2):$XBD2),
3266            mnemonic#"\t$V1, $XBD2",
3267            [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2))]> {
3268  let M3 = type;
3269  let mayLoad = 1;
3270  let AccessBytes = bytes;
3271}
3272
3273class UnaryVRXGeneric<string mnemonic, bits<16> opcode>
3274  : InstVRX<opcode, (outs VR128:$V1),
3275            (ins (bdxaddr12only $B2, $D2, $X2):$XBD2, imm32zx4:$M3),
3276            mnemonic#"\t$V1, $XBD2, $M3", []> {
3277  let mayLoad = 1;
3278}
3279
3280multiclass UnaryVRXAlign<string mnemonic, bits<16> opcode> {
3281  let mayLoad = 1, AccessBytes = 16 in {
3282    def Align : InstVRX<opcode, (outs VR128:$V1),
3283                        (ins (bdxaddr12only $B2, $D2, $X2):$XBD2, imm32zx4:$M3),
3284                        mnemonic#"\t$V1, $XBD2, $M3", []>;
3285    let M3 = 0 in
3286      def "" : InstVRX<opcode, (outs VR128:$V1),
3287                       (ins (bdxaddr12only $B2, $D2, $X2):$XBD2),
3288                       mnemonic#"\t$V1, $XBD2", []>;
3289  }
3290}
3291
3292class SideEffectBinaryRX<string mnemonic, bits<8> opcode,
3293                         RegisterOperand cls>
3294  : InstRXa<opcode, (outs), (ins cls:$R1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
3295            mnemonic#"\t$R1, $XBD2", []>;
3296
3297class SideEffectBinaryRXY<string mnemonic, bits<16> opcode,
3298                          RegisterOperand cls>
3299  : InstRXYa<opcode, (outs), (ins cls:$R1, (bdxaddr20only $B2, $D2, $X2):$XBD2),
3300             mnemonic#"\t$R1, $XBD2", []>;
3301
3302class SideEffectBinaryRILPC<string mnemonic, bits<12> opcode,
3303                            RegisterOperand cls>
3304  : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
3305             mnemonic#"\t$R1, $RI2", []> {
3306  // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
3307  // However, BDXs have two extra operands and are therefore 6 units more
3308  // complex.
3309  let AddedComplexity = 7;
3310}
3311
3312class SideEffectBinaryRRE<string mnemonic, bits<16> opcode,
3313                          RegisterOperand cls1, RegisterOperand cls2>
3314  : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3315            mnemonic#"\t$R1, $R2", []>;
3316
3317class SideEffectBinaryRRFa<string mnemonic, bits<16> opcode,
3318                           RegisterOperand cls1, RegisterOperand cls2>
3319  : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3320             mnemonic#"\t$R1, $R2", []> {
3321  let R3 = 0;
3322  let M4 = 0;
3323}
3324
3325class SideEffectBinaryRRFc<string mnemonic, bits<16> opcode,
3326                           RegisterOperand cls1, RegisterOperand cls2>
3327  : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3328             mnemonic#"\t$R1, $R2", []> {
3329  let M3 = 0;
3330}
3331
3332class SideEffectBinaryIE<string mnemonic, bits<16> opcode,
3333                         ImmOpWithPattern imm1, ImmOpWithPattern imm2>
3334  : InstIE<opcode, (outs), (ins imm1:$I1, imm2:$I2),
3335           mnemonic#"\t$I1, $I2", []>;
3336
3337class SideEffectBinarySI<string mnemonic, bits<8> opcode, Operand imm>
3338  : InstSI<opcode, (outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2),
3339           mnemonic#"\t$BD1, $I2", []>;
3340
3341class SideEffectBinarySIL<string mnemonic, bits<16> opcode,
3342                          SDPatternOperator operator, ImmOpWithPattern imm>
3343  : InstSIL<opcode, (outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2),
3344            mnemonic#"\t$BD1, $I2", [(operator bdaddr12only:$BD1, imm:$I2)]>;
3345
3346class SideEffectBinarySSa<string mnemonic, bits<8> opcode>
3347  : InstSSa<opcode, (outs), (ins (bdladdr12onlylen8 $B1, $D1, $L1):$BDL1,
3348                                 (bdaddr12only $B2, $D2):$BD2),
3349            mnemonic#"\t$BDL1, $BD2", []>;
3350
3351class SideEffectBinarySSb<string mnemonic, bits<8> opcode>
3352  : InstSSb<opcode,
3353            (outs), (ins (bdladdr12onlylen4 $B1, $D1, $L1):$BDL1,
3354                         (bdladdr12onlylen4 $B2, $D2, $L2):$BDL2),
3355            mnemonic#"\t$BDL1, $BDL2", []>;
3356
3357class SideEffectBinarySSf<string mnemonic, bits<8> opcode>
3358  : InstSSf<opcode, (outs), (ins (bdaddr12only $B1, $D1):$BD1,
3359                                 (bdladdr12onlylen8 $B2, $D2, $L2):$BDL2),
3360            mnemonic#"\t$BD1, $BDL2", []>;
3361
3362class SideEffectBinarySSE<string mnemonic, bits<16> opcode>
3363  : InstSSE<opcode, (outs),
3364            (ins (bdaddr12only $B1, $D1):$BD1, (bdaddr12only $B2, $D2):$BD2),
3365            mnemonic#"\t$BD1, $BD2", []>;
3366
3367class SideEffectBinaryMemMemRR<string mnemonic, bits<8> opcode,
3368                               RegisterOperand cls1, RegisterOperand cls2>
3369  : InstRR<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3370           mnemonic#"\t$R1, $R2", []> {
3371    let Constraints = "$R1 = $R1src, $R2 = $R2src";
3372    let DisableEncoding = "$R1src, $R2src";
3373}
3374
3375class SideEffectBinaryMemRRE<string mnemonic, bits<16> opcode,
3376                             RegisterOperand cls1, RegisterOperand cls2>
3377  : InstRRE<opcode, (outs cls2:$R2), (ins cls1:$R1, cls2:$R2src),
3378            mnemonic#"\t$R1, $R2", []> {
3379  let Constraints = "$R2 = $R2src";
3380  let DisableEncoding = "$R2src";
3381}
3382
3383class SideEffectBinaryMemMemRRE<string mnemonic, bits<16> opcode,
3384                                RegisterOperand cls1, RegisterOperand cls2>
3385  : InstRRE<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3386            mnemonic#"\t$R1, $R2", []> {
3387    let Constraints = "$R1 = $R1src, $R2 = $R2src";
3388    let DisableEncoding = "$R1src, $R2src";
3389}
3390
3391class SideEffectBinaryMemMemRRFc<string mnemonic, bits<16> opcode,
3392                                 RegisterOperand cls1, RegisterOperand cls2>
3393  : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3394             mnemonic#"\t$R1, $R2", []> {
3395  let Constraints = "$R1 = $R1src, $R2 = $R2src";
3396  let DisableEncoding = "$R1src, $R2src";
3397  let M3 = 0;
3398}
3399
3400class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3401               RegisterOperand cls1, RegisterOperand cls2>
3402  : InstRR<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3403           mnemonic#"\t$R1, $R2",
3404           [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
3405  let OpKey = mnemonic#cls1;
3406  let OpType = "reg";
3407  let Constraints = "$R1 = $R1src";
3408  let DisableEncoding = "$R1src";
3409}
3410
3411class BinaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3412                RegisterOperand cls1, RegisterOperand cls2>
3413  : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3414            mnemonic#"\t$R1, $R2",
3415            [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
3416  let OpKey = mnemonic#cls1;
3417  let OpType = "reg";
3418  let Constraints = "$R1 = $R1src";
3419  let DisableEncoding = "$R1src";
3420}
3421
3422class BinaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3423                RegisterOperand cls1, RegisterOperand cls2>
3424  : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R3, cls2:$R2),
3425            mnemonic#"\t$R1, $R3, $R2",
3426            [(set cls1:$R1, (operator cls2:$R3, cls2:$R2))]> {
3427  let OpKey = mnemonic#cls;
3428  let OpType = "reg";
3429}
3430
3431class BinaryRRFa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3432                 RegisterOperand cls1, RegisterOperand cls2,
3433                 RegisterOperand cls3>
3434  : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
3435             mnemonic#"\t$R1, $R2, $R3",
3436             [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
3437  let M4 = 0;
3438  let OpKey = mnemonic#cls1;
3439  let OpType = "reg";
3440}
3441
3442multiclass BinaryRRAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
3443                        SDPatternOperator operator, RegisterOperand cls1,
3444                        RegisterOperand cls2> {
3445  let NumOpsKey = mnemonic in {
3446    let NumOpsValue = "3" in
3447      def K : BinaryRRFa<mnemonic#"k", opcode2, operator, cls1, cls1, cls2>,
3448              Requires<[FeatureDistinctOps]>;
3449    let NumOpsValue = "2" in
3450      def "" : BinaryRR<mnemonic, opcode1, operator, cls1, cls2>;
3451  }
3452}
3453
3454multiclass BinaryRREAndK<string mnemonic, bits<16> opcode1, bits<16> opcode2,
3455                         SDPatternOperator operator, RegisterOperand cls1,
3456                         RegisterOperand cls2> {
3457  let NumOpsKey = mnemonic in {
3458    let NumOpsValue = "3" in
3459      def K : BinaryRRFa<mnemonic#"k", opcode2, operator, cls1, cls1, cls2>,
3460              Requires<[FeatureDistinctOps]>;
3461    let NumOpsValue = "2" in
3462      def "" : BinaryRRE<mnemonic, opcode1, operator, cls1, cls2>;
3463  }
3464}
3465
3466class BinaryRRFb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3467                 RegisterOperand cls1, RegisterOperand cls2,
3468                 RegisterOperand cls3>
3469  : InstRRFb<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
3470             mnemonic#"\t$R1, $R3, $R2",
3471             [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
3472  let M4 = 0;
3473}
3474
3475class BinaryRRFc<string mnemonic, bits<16> opcode,
3476                 RegisterOperand cls1, RegisterOperand cls2>
3477  : InstRRFc<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M3),
3478             mnemonic#"\t$R1, $R2, $M3", []>;
3479
3480class BinaryMemRRFc<string mnemonic, bits<16> opcode,
3481                    RegisterOperand cls1, RegisterOperand cls2, ImmOpWithPattern imm>
3482  : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src, imm:$M3),
3483            mnemonic#"\t$R1, $R2, $M3", []> {
3484  let Constraints = "$R1 = $R1src";
3485  let DisableEncoding = "$R1src";
3486}
3487
3488multiclass BinaryMemRRFcOpt<string mnemonic, bits<16> opcode,
3489                            RegisterOperand cls1, RegisterOperand cls2> {
3490  def "" : BinaryMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
3491  def Opt : UnaryMemRRFc<mnemonic, opcode, cls1, cls2>;
3492}
3493
3494class BinaryRRFd<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3495                RegisterOperand cls2>
3496  : InstRRFd<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M4),
3497             mnemonic#"\t$R1, $R2, $M4", []>;
3498
3499class BinaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3500                RegisterOperand cls2>
3501  : InstRRFe<opcode, (outs cls1:$R1), (ins imm32zx4:$M3, cls2:$R2),
3502             mnemonic#"\t$R1, $M3, $R2", []> {
3503  let M4 = 0;
3504}
3505
3506class CondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3507                   RegisterOperand cls2>
3508  : InstRRFc<opcode, (outs cls1:$R1),
3509             (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
3510             mnemonic#"$M3\t$R1, $R2",
3511             [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src,
3512                                              cond4:$valid, cond4:$M3))]> {
3513  let Constraints = "$R1 = $R1src";
3514  let DisableEncoding = "$R1src";
3515  let CCMaskLast = 1;
3516  let NumOpsKey = !subst("loc", "sel", mnemonic);
3517  let NumOpsValue = "2";
3518  let OpKey = mnemonic#cls1;
3519  let OpType = "reg";
3520}
3521
3522// Like CondBinaryRRF, but used for the raw assembly form.  The condition-code
3523// mask is the third operand rather than being part of the mnemonic.
3524class AsmCondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3525                       RegisterOperand cls2>
3526  : InstRRFc<opcode, (outs cls1:$R1),
3527             (ins cls1:$R1src, cls2:$R2, imm32zx4:$M3),
3528             mnemonic#"\t$R1, $R2, $M3", []> {
3529  let Constraints = "$R1 = $R1src";
3530  let DisableEncoding = "$R1src";
3531}
3532
3533// Like CondBinaryRRF, but with a fixed CC mask.
3534class FixedCondBinaryRRF<CondVariant V, string mnemonic, bits<16> opcode,
3535                         RegisterOperand cls1, RegisterOperand cls2>
3536  : InstRRFc<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3537             mnemonic#V.suffix#"\t$R1, $R2", []> {
3538  let Constraints = "$R1 = $R1src";
3539  let DisableEncoding = "$R1src";
3540  let isAsmParserOnly = V.alternate;
3541  let AsmVariantName = V.asmvariant;
3542  let M3 = V.ccmask;
3543}
3544
3545multiclass CondBinaryRRFPair<string mnemonic, bits<16> opcode,
3546                             RegisterOperand cls1, RegisterOperand cls2> {
3547  let isCodeGenOnly = 1 in
3548    def "" : CondBinaryRRF<mnemonic, opcode, cls1, cls2>;
3549  def Asm : AsmCondBinaryRRF<mnemonic, opcode, cls1, cls2>;
3550}
3551
3552class CondBinaryRRFa<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3553                    RegisterOperand cls2, RegisterOperand cls3>
3554  : InstRRFa<opcode, (outs cls1:$R1),
3555             (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4),
3556             mnemonic#"$M4\t$R1, $R2, $R3",
3557             [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3,
3558                                              cond4:$valid, cond4:$M4))]> {
3559  let CCMaskLast = 1;
3560  let NumOpsKey = mnemonic;
3561  let NumOpsValue = "3";
3562  let OpKey = mnemonic#cls1;
3563  let OpType = "reg";
3564}
3565
3566// Like CondBinaryRRFa, but used for the raw assembly form.  The condition-code
3567// mask is the third operand rather than being part of the mnemonic.
3568class AsmCondBinaryRRFa<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3569                        RegisterOperand cls2, RegisterOperand cls3>
3570  : InstRRFa<opcode, (outs cls1:$R1), (ins cls3:$R3, cls2:$R2, imm32zx4:$M4),
3571             mnemonic#"\t$R1, $R2, $R3, $M4", []>;
3572
3573// Like CondBinaryRRFa, but with a fixed CC mask.
3574class FixedCondBinaryRRFa<CondVariant V, string mnemonic, bits<16> opcode,
3575                         RegisterOperand cls1, RegisterOperand cls2,
3576                         RegisterOperand cls3>
3577  : InstRRFa<opcode, (outs cls1:$R1), (ins cls3:$R3, cls2:$R2),
3578             mnemonic#V.suffix#"\t$R1, $R2, $R3", []> {
3579  let isAsmParserOnly = V.alternate;
3580  let AsmVariantName = V.asmvariant;
3581  let M4 = V.ccmask;
3582}
3583
3584multiclass CondBinaryRRFaPair<string mnemonic, bits<16> opcode,
3585                             RegisterOperand cls1, RegisterOperand cls2,
3586                             RegisterOperand cls3> {
3587  let isCodeGenOnly = 1 in
3588    def "" : CondBinaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
3589  def Asm : AsmCondBinaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
3590}
3591
3592class BinaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3593               RegisterOperand cls, ImmOpWithPattern imm>
3594  : InstRIa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3595            mnemonic#"\t$R1, $I2",
3596            [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
3597  let Constraints = "$R1 = $R1src";
3598  let DisableEncoding = "$R1src";
3599}
3600
3601class BinaryRIE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3602                RegisterOperand cls, ImmOpWithPattern imm>
3603  : InstRIEd<opcode, (outs cls:$R1), (ins cls:$R3, imm:$I2),
3604             mnemonic#"\t$R1, $R3, $I2",
3605             [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
3606
3607multiclass BinaryRIAndK<string mnemonic, bits<12> opcode1, bits<16> opcode2,
3608                        SDPatternOperator operator, RegisterOperand cls,
3609                        ImmOpWithPattern imm> {
3610  let NumOpsKey = mnemonic in {
3611    let NumOpsValue = "3" in
3612      def K : BinaryRIE<mnemonic#"k", opcode2, operator, cls, imm>,
3613              Requires<[FeatureDistinctOps]>;
3614    let NumOpsValue = "2" in
3615      def "" : BinaryRI<mnemonic, opcode1, operator, cls, imm>;
3616  }
3617}
3618
3619class CondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3620                    ImmOpWithPattern imm>
3621  : InstRIEg<opcode, (outs cls:$R1),
3622             (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
3623             mnemonic#"$M3\t$R1, $I2",
3624             [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
3625                                             cond4:$valid, cond4:$M3))]> {
3626  let Constraints = "$R1 = $R1src";
3627  let DisableEncoding = "$R1src";
3628  let CCMaskLast = 1;
3629}
3630
3631// Like CondBinaryRIE, but used for the raw assembly form.  The condition-code
3632// mask is the third operand rather than being part of the mnemonic.
3633class AsmCondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3634                       ImmOpWithPattern imm>
3635  : InstRIEg<opcode, (outs cls:$R1),
3636             (ins cls:$R1src, imm:$I2, imm32zx4:$M3),
3637             mnemonic#"\t$R1, $I2, $M3", []> {
3638  let Constraints = "$R1 = $R1src";
3639  let DisableEncoding = "$R1src";
3640}
3641
3642// Like CondBinaryRIE, but with a fixed CC mask.
3643class FixedCondBinaryRIE<CondVariant V, string mnemonic, bits<16> opcode,
3644                         RegisterOperand cls, ImmOpWithPattern imm>
3645  : InstRIEg<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3646             mnemonic#V.suffix#"\t$R1, $I2", []> {
3647  let Constraints = "$R1 = $R1src";
3648  let DisableEncoding = "$R1src";
3649  let isAsmParserOnly = V.alternate;
3650  let AsmVariantName = V.asmvariant;
3651  let M3 = V.ccmask;
3652}
3653
3654multiclass CondBinaryRIEPair<string mnemonic, bits<16> opcode,
3655                             RegisterOperand cls, ImmOpWithPattern imm> {
3656  let isCodeGenOnly = 1 in
3657    def "" : CondBinaryRIE<mnemonic, opcode, cls, imm>;
3658  def Asm : AsmCondBinaryRIE<mnemonic, opcode, cls, imm>;
3659}
3660
3661class BinaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3662                RegisterOperand cls, ImmOpWithPattern imm>
3663  : InstRILa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3664             mnemonic#"\t$R1, $I2",
3665             [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
3666  let Constraints = "$R1 = $R1src";
3667  let DisableEncoding = "$R1src";
3668}
3669
3670class BinaryRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3671               RegisterOperand cls>
3672  : InstRSa<opcode, (outs cls:$R1),
3673            (ins cls:$R1src, (shift12only $B2, $D2):$BD2),
3674            mnemonic#"\t$R1, $BD2",
3675            [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> {
3676  let R3 = 0;
3677  let Constraints = "$R1 = $R1src";
3678  let DisableEncoding = "$R1src";
3679}
3680
3681class BinaryRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3682                RegisterOperand cls>
3683  : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, (shift20only $B2, $D2):$BD2),
3684             mnemonic#"\t$R1, $R3, $BD2",
3685             [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>;
3686
3687multiclass BinaryRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
3688                        SDPatternOperator operator, RegisterOperand cls> {
3689  let NumOpsKey = mnemonic in {
3690    let NumOpsValue = "3" in
3691      def K  : BinaryRSY<mnemonic#"k", opcode2, operator, cls>,
3692               Requires<[FeatureDistinctOps]>;
3693    let NumOpsValue = "2" in
3694      def "" : BinaryRS<mnemonic, opcode1, operator, cls>;
3695  }
3696}
3697
3698class BinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
3699  : InstRSLb<opcode, (outs cls:$R1),
3700             (ins (bdladdr12onlylen8 $B2, $D2, $L2):$BDL2, imm32zx4:$M3),
3701             mnemonic#"\t$R1, $BDL2, $M3", []> {
3702  let mayLoad = 1;
3703}
3704
3705class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3706               RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3707               AddressingMode mode = bdxaddr12only>
3708  : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, (mode $B2, $D2, $X2):$XBD2),
3709            mnemonic#"\t$R1, $XBD2",
3710            [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3711  let OpKey = mnemonic#"r"#cls;
3712  let OpType = "mem";
3713  let Constraints = "$R1 = $R1src";
3714  let DisableEncoding = "$R1src";
3715  let mayLoad = 1;
3716  let AccessBytes = bytes;
3717}
3718
3719class BinaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3720                  RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
3721  : InstRXE<opcode, (outs cls:$R1),
3722            (ins cls:$R1src, (bdxaddr12only $B2, $D2, $X2):$XBD2),
3723            mnemonic#"\t$R1, $XBD2",
3724            [(set cls:$R1, (operator cls:$R1src,
3725                                     (load bdxaddr12only:$XBD2)))]> {
3726  let OpKey = mnemonic#"r"#cls;
3727  let OpType = "mem";
3728  let Constraints = "$R1 = $R1src";
3729  let DisableEncoding = "$R1src";
3730  let mayLoad = 1;
3731  let AccessBytes = bytes;
3732  let M3 = 0;
3733}
3734
3735class BinaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3736                RegisterOperand cls1, RegisterOperand cls2,
3737                SDPatternOperator load, bits<5> bytes>
3738  : InstRXF<opcode, (outs cls1:$R1),
3739            (ins cls2:$R3, (bdxaddr12only $B2, $D2, $X2):$XBD2),
3740            mnemonic#"\t$R1, $R3, $XBD2",
3741            [(set cls1:$R1, (operator cls2:$R3, (load bdxaddr12only:$XBD2)))]> {
3742  let OpKey = mnemonic#"r"#cls;
3743  let OpType = "mem";
3744  let mayLoad = 1;
3745  let AccessBytes = bytes;
3746}
3747
3748class BinaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3749                RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3750                AddressingMode mode = bdxaddr20only>
3751  : InstRXYa<opcode, (outs cls:$R1),
3752             (ins cls:$R1src, (mode $B2, $D2, $X2):$XBD2),
3753             mnemonic#"\t$R1, $XBD2",
3754             [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3755  let OpKey = mnemonic#"r"#cls;
3756  let OpType = "mem";
3757  let Constraints = "$R1 = $R1src";
3758  let DisableEncoding = "$R1src";
3759  let mayLoad = 1;
3760  let AccessBytes = bytes;
3761}
3762
3763multiclass BinaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3764                        SDPatternOperator operator, RegisterOperand cls,
3765                        SDPatternOperator load, bits<5> bytes> {
3766  let DispKey = mnemonic # cls in {
3767    let DispSize = "12" in
3768      def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes,
3769                        bdxaddr12pair>;
3770    let DispSize = "20" in
3771      def Y  : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load, bytes,
3772                         bdxaddr20pair>;
3773  }
3774}
3775
3776class BinarySI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3777               Operand imm, AddressingMode mode = bdaddr12only>
3778  : InstSI<opcode, (outs), (ins (mode $B1, $D1):$BD1, imm:$I2),
3779           mnemonic#"\t$BD1, $I2",
3780           [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
3781  let mayLoad = 1;
3782  let mayStore = 1;
3783}
3784
3785class BinarySIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3786                Operand imm, AddressingMode mode = bdaddr20only>
3787  : InstSIY<opcode, (outs), (ins (mode $B1, $D1):$BD1, imm:$I2),
3788            mnemonic#"\t$BD1, $I2",
3789            [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
3790  let mayLoad = 1;
3791  let mayStore = 1;
3792}
3793
3794multiclass BinarySIPair<string mnemonic, bits<8> siOpcode,
3795                        bits<16> siyOpcode, SDPatternOperator operator,
3796                        Operand imm> {
3797  let DispKey = mnemonic # cls in {
3798    let DispSize = "12" in
3799      def "" : BinarySI<mnemonic, siOpcode, operator, imm, bdaddr12pair>;
3800    let DispSize = "20" in
3801      def Y  : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>;
3802  }
3803}
3804
3805class BinarySSF<string mnemonic, bits<12> opcode, RegisterOperand cls>
3806  : InstSSF<opcode, (outs cls:$R3),
3807            (ins (bdaddr12pair $B1, $D1):$BD1, (bdaddr12pair $B2, $D2):$BD2),
3808            mnemonic#"\t$R3, $BD1, $BD2", []> {
3809  let mayLoad = 1;
3810}
3811
3812class BinaryVRIb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3813                 TypedReg tr, bits<4> type>
3814  : InstVRIb<opcode, (outs tr.op:$V1), (ins imm32zx8:$I2, imm32zx8:$I3),
3815             mnemonic#"\t$V1, $I2, $I3",
3816             [(set (tr.vt tr.op:$V1), (operator imm32zx8_timm:$I2, imm32zx8_timm:$I3))]> {
3817  let M4 = type;
3818}
3819
3820class BinaryVRIbGeneric<string mnemonic, bits<16> opcode>
3821  : InstVRIb<opcode, (outs VR128:$V1),
3822             (ins imm32zx8:$I2, imm32zx8:$I3, imm32zx4:$M4),
3823             mnemonic#"\t$V1, $I2, $I3, $M4", []>;
3824
3825class BinaryVRIc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3826                 TypedReg tr1, TypedReg tr2, bits<4> type>
3827  : InstVRIc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, imm32zx16:$I2),
3828             mnemonic#"\t$V1, $V3, $I2",
3829             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3),
3830                                                  imm32zx16_timm:$I2))]> {
3831  let M4 = type;
3832}
3833
3834class BinaryVRIcGeneric<string mnemonic, bits<16> opcode>
3835  : InstVRIc<opcode, (outs VR128:$V1),
3836             (ins VR128:$V3, imm32zx16:$I2, imm32zx4:$M4),
3837             mnemonic#"\t$V1, $V3, $I2, $M4", []>;
3838
3839class BinaryVRIe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3840                 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5>
3841  : InstVRIe<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx12:$I3),
3842             mnemonic#"\t$V1, $V2, $I3",
3843             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3844                                                  imm32zx12_timm:$I3))]> {
3845  let M4 = type;
3846  let M5 = m5;
3847}
3848
3849class BinaryVRIeFloatGeneric<string mnemonic, bits<16> opcode>
3850  : InstVRIe<opcode, (outs VR128:$V1),
3851             (ins VR128:$V2, imm32zx12:$I3, imm32zx4:$M4, imm32zx4:$M5),
3852             mnemonic#"\t$V1, $V2, $I3, $M4, $M5", []>;
3853
3854class BinaryVRIh<string mnemonic, bits<16> opcode>
3855  : InstVRIh<opcode, (outs VR128:$V1),
3856             (ins imm32zx16:$I2, imm32zx4:$I3),
3857             mnemonic#"\t$V1, $I2, $I3", []>;
3858
3859class BinaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3860                 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0>
3861  : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx4:$M5),
3862             mnemonic#"\t$V1, $V2, $M5",
3863             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3864                                                  imm32zx12:$M5))]> {
3865  let M3 = type;
3866  let M4 = m4;
3867}
3868
3869class BinaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
3870  : InstVRRa<opcode, (outs VR128:$V1),
3871             (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
3872             mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
3873
3874class BinaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3875                 TypedReg tr1, TypedReg tr2, bits<4> type = 0,
3876                 bits<4> modifier = 0>
3877  : InstVRRb<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3878             mnemonic#"\t$V1, $V2, $V3",
3879             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3880                                                  (tr2.vt tr2.op:$V3)))]> {
3881  let M4 = type;
3882  let M5 = modifier;
3883}
3884
3885class BinaryExtraVRRb<string mnemonic, bits<16> opcode, bits<4> type = 0>
3886  : InstVRRb<opcode, (outs VR128:$V1), (ins VR128:$V2, VR128:$V3, imm32zx4:$M5),
3887             mnemonic#"\t$V1, $V2, $V3, $M5", []> {
3888  let M4 = type;
3889}
3890
3891class BinaryExtraVRRbGeneric<string mnemonic, bits<16> opcode>
3892  : InstVRRb<opcode, (outs VR128:$V1),
3893             (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3894             mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
3895
3896// Declare a pair of instructions, one which sets CC and one which doesn't.
3897// The CC-setting form ends with "S" and sets the low bit of M5.
3898multiclass BinaryVRRbSPair<string mnemonic, bits<16> opcode,
3899                           SDPatternOperator operator,
3900                           SDPatternOperator operator_cc, TypedReg tr1,
3901                           TypedReg tr2, bits<4> type, bits<4> modifier = 0> {
3902  def "" : BinaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
3903                      !and (modifier, 14)>;
3904  let Defs = [CC] in
3905    def S : BinaryVRRb<mnemonic#"s", opcode, operator_cc, tr1, tr2, type,
3906                       !add (!and (modifier, 14), 1)>;
3907}
3908
3909class BinaryVRRbSPairGeneric<string mnemonic, bits<16> opcode>
3910  : InstVRRb<opcode, (outs VR128:$V1),
3911             (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3912             mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> {
3913  let Defs = [CC];
3914}
3915
3916// Declare a pair of instructions, one which sets CC and one which doesn't.
3917// The CC-setting form ends with "S" and sets the low bit of M5.
3918// The form that does not set CC has an extra operand to optionally allow
3919// specifying arbitrary M5 values in assembler.
3920multiclass BinaryExtraVRRbSPair<string mnemonic, bits<16> opcode,
3921                                SDPatternOperator operator,
3922                                SDPatternOperator operator_cc,
3923                                TypedReg tr1, TypedReg tr2, bits<4> type> {
3924  let M4 = type in
3925    def "" : InstVRRb<opcode, (outs tr1.op:$V1),
3926                      (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M5),
3927                      mnemonic#"\t$V1, $V2, $V3, $M5", []>;
3928  def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3))),
3929            (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, 0)>;
3930  def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
3931                  (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
3932                                            tr2.op:$V3, 0)>;
3933  let Defs = [CC] in
3934    def S : BinaryVRRb<mnemonic#"s", opcode, operator_cc, tr1, tr2, type, 1>;
3935}
3936
3937multiclass BinaryExtraVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
3938  let Defs = [CC] in
3939    def "" : InstVRRb<opcode, (outs VR128:$V1),
3940                     (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3941                     mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
3942  def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
3943                  (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
3944                                            imm32zx4:$M4, 0)>;
3945}
3946
3947class BinaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3948                 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0,
3949                 bits<4> m6 = 0, string fp_mnemonic = "">
3950  : InstVRRc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3951             mnemonic#"\t$V1, $V2, $V3",
3952             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3953                                                  (tr2.vt tr2.op:$V3)))]> {
3954  let M4 = type;
3955  let M5 = m5;
3956  let M6 = m6;
3957  let OpKey = fp_mnemonic#"MemFold"#!subst("VR", "FP", !cast<string>(tr1.op));
3958  let OpType = "reg";
3959}
3960
3961class BinaryVRRcGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0,
3962                        bits<4> m6 = 0>
3963  : InstVRRc<opcode, (outs VR128:$V1),
3964             (ins VR128:$V2, VR128:$V3, imm32zx4:$M4),
3965             mnemonic#"\t$V1, $V2, $V3, $M4", []> {
3966  let M5 = m5;
3967  let M6 = m6;
3968}
3969
3970class BinaryVRRcFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m6 = 0>
3971  : InstVRRc<opcode, (outs VR128:$V1),
3972             (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3973             mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> {
3974  let M6 = m6;
3975}
3976
3977// Declare a pair of instructions, one which sets CC and one which doesn't.
3978// The CC-setting form ends with "S" and sets the low bit of M5.
3979multiclass BinaryVRRcSPair<string mnemonic, bits<16> opcode,
3980                           SDPatternOperator operator,
3981                           SDPatternOperator operator_cc, TypedReg tr1,
3982                           TypedReg tr2, bits<4> type, bits<4> m5,
3983                           bits<4> modifier = 0> {
3984  def "" : BinaryVRRc<mnemonic, opcode, operator, tr1, tr2, type,
3985                      m5, !and (modifier, 14)>;
3986  let Defs = [CC] in
3987    def S : BinaryVRRc<mnemonic#"s", opcode, operator_cc, tr1, tr2, type,
3988                       m5, !add (!and (modifier, 14), 1)>;
3989}
3990
3991class BinaryVRRcSPairFloatGeneric<string mnemonic, bits<16> opcode>
3992  : InstVRRc<opcode, (outs VR128:$V1),
3993             (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
3994                  imm32zx4:$M6),
3995             mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
3996
3997class BinaryVRRf<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3998                 TypedReg tr>
3999  : InstVRRf<opcode, (outs tr.op:$V1), (ins GR64:$R2, GR64:$R3),
4000             mnemonic#"\t$V1, $R2, $R3",
4001             [(set (tr.vt tr.op:$V1), (operator GR64:$R2, GR64:$R3))]>;
4002
4003class BinaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4004  : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2, imm32zx4:$M3),
4005             mnemonic#"\t$R1, $V2, $M3", []> {
4006  let M4 = 0;
4007}
4008
4009class BinaryVRRk<string mnemonic, bits<16> opcode>
4010  : InstVRRk<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3),
4011             mnemonic#"\t$V1, $V2, $M3", []>;
4012
4013class BinaryVRSa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4014                 TypedReg tr1, TypedReg tr2, bits<4> type>
4015  : InstVRSa<opcode, (outs tr1.op:$V1),
4016             (ins tr2.op:$V3, (shift12only $B2, $D2):$BD2),
4017             mnemonic#"\t$V1, $V3, $BD2",
4018             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3),
4019                                                  shift12only:$BD2))]> {
4020  let M4 = type;
4021}
4022
4023class BinaryVRSaGeneric<string mnemonic, bits<16> opcode>
4024  : InstVRSa<opcode, (outs VR128:$V1),
4025             (ins VR128:$V3, (shift12only $B2, $D2):$BD2, imm32zx4:$M4),
4026             mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
4027
4028class BinaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4029                 bits<5> bytes>
4030  : InstVRSb<opcode, (outs VR128:$V1),
4031             (ins GR32:$R3, (bdaddr12only $B2, $D2):$BD2),
4032             mnemonic#"\t$V1, $R3, $BD2",
4033             [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
4034  let M4 = 0;
4035  let mayLoad = 1;
4036  let AccessBytes = bytes;
4037}
4038
4039class BinaryVRSc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4040                 TypedReg tr, bits<4> type>
4041  : InstVRSc<opcode, (outs GR64:$R1),
4042             (ins tr.op:$V3, (shift12only $B2, $D2):$BD2),
4043             mnemonic#"\t$R1, $V3, $BD2",
4044             [(set GR64:$R1, (operator (tr.vt tr.op:$V3), shift12only:$BD2))]> {
4045  let M4 = type;
4046}
4047
4048class BinaryVRScGeneric<string mnemonic, bits<16> opcode>
4049  : InstVRSc<opcode, (outs GR64:$R1),
4050             (ins VR128:$V3, (shift12only $B2, $D2):$BD2, imm32zx4: $M4),
4051             mnemonic#"\t$R1, $V3, $BD2, $M4", []>;
4052
4053class BinaryVRSd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4054                 bits<5> bytes>
4055  : InstVRSd<opcode, (outs VR128:$V1),
4056             (ins GR32:$R3, (bdaddr12only $B2, $D2):$BD2),
4057             mnemonic#"\t$V1, $R3, $BD2",
4058             [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
4059  let mayLoad = 1;
4060  let AccessBytes = bytes;
4061}
4062
4063class BinaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4064                TypedReg tr, bits<5> bytes>
4065  : InstVRX<opcode, (outs VR128:$V1),
4066            (ins (bdxaddr12only $B2, $D2, $X2):$XBD2, imm32zx4:$M3),
4067            mnemonic#"\t$V1, $XBD2, $M3",
4068            [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2,
4069                                               imm32zx4_timm:$M3))]> {
4070  let mayLoad = 1;
4071  let AccessBytes = bytes;
4072}
4073
4074class StoreBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
4075                    bits<5> bytes, AddressingMode mode = bdaddr12only>
4076  : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4077            mnemonic#"\t$R1, $M3, $BD2", []> {
4078  let mayStore = 1;
4079  let AccessBytes = bytes;
4080}
4081
4082class StoreBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
4083                     bits<5> bytes, AddressingMode mode = bdaddr20only>
4084  : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4085             mnemonic#"\t$R1, $M3, $BD2", []> {
4086  let mayStore = 1;
4087  let AccessBytes = bytes;
4088}
4089
4090multiclass StoreBinaryRSPair<string mnemonic, bits<8> rsOpcode,
4091                             bits<16> rsyOpcode, RegisterOperand cls,
4092                             bits<5> bytes> {
4093  let DispKey = mnemonic # cls in {
4094    let DispSize = "12" in
4095      def "" : StoreBinaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
4096    let DispSize = "20" in
4097      def Y  : StoreBinaryRSY<mnemonic#"y", rsyOpcode, cls, bytes,
4098                              bdaddr20pair>;
4099  }
4100}
4101
4102class StoreBinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
4103  : InstRSLb<opcode, (outs),
4104             (ins cls:$R1, (bdladdr12onlylen8 $B2, $D2, $L2):$BDL2,
4105                  imm32zx4:$M3),
4106             mnemonic#"\t$R1, $BDL2, $M3", []> {
4107  let mayStore = 1;
4108}
4109
4110class BinaryVSI<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4111                bits<5> bytes>
4112  : InstVSI<opcode, (outs VR128:$V1),
4113            (ins (bdaddr12only $B2, $D2):$BD2, imm32zx8:$I3),
4114            mnemonic#"\t$V1, $BD2, $I3",
4115            [(set VR128:$V1, (operator imm32zx8:$I3, bdaddr12only:$BD2))]> {
4116  let mayLoad = 1;
4117  let AccessBytes = bytes;
4118}
4119
4120class StoreBinaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
4121                     ImmOpWithPattern index>
4122  : InstVRV<opcode, (outs),
4123            (ins VR128:$V1, (bdvaddr12only $B2, $D2, $V2):$VBD2, index:$M3),
4124            mnemonic#"\t$V1, $VBD2, $M3", []> {
4125  let mayStore = 1;
4126  let AccessBytes = bytes;
4127}
4128
4129class StoreBinaryVRX<string mnemonic, bits<16> opcode,
4130                     SDPatternOperator operator, TypedReg tr, bits<5> bytes,
4131                     ImmOpWithPattern index>
4132  : InstVRX<opcode, (outs),
4133            (ins tr.op:$V1, (bdxaddr12only $B2, $D2, $X2):$XBD2, index:$M3),
4134            mnemonic#"\t$V1, $XBD2, $M3",
4135            [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2, index:$M3)]> {
4136  let mayStore = 1;
4137  let AccessBytes = bytes;
4138}
4139
4140class MemoryBinarySSd<string mnemonic, bits<8> opcode,
4141                      RegisterOperand cls>
4142  : InstSSd<opcode, (outs),
4143            (ins (bdraddr12only $B1, $D1, $R1):$RBD1,
4144                 (bdaddr12only $B2, $D2):$BD2, cls:$R3),
4145            mnemonic#"\t$RBD1, $BD2, $R3", []>;
4146
4147class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4148                RegisterOperand cls1, RegisterOperand cls2>
4149  : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2),
4150           mnemonic#"\t$R1, $R2",
4151           [(set CC, (operator cls1:$R1, cls2:$R2))]> {
4152  let OpKey = mnemonic#cls1;
4153  let OpType = "reg";
4154  let isCompare = 1;
4155}
4156
4157class CompareRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4158                 RegisterOperand cls1, RegisterOperand cls2>
4159  : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
4160            mnemonic#"\t$R1, $R2",
4161            [(set CC, (operator cls1:$R1, cls2:$R2))]> {
4162  let OpKey = mnemonic#cls1;
4163  let OpType = "reg";
4164  let isCompare = 1;
4165}
4166
4167class CompareRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
4168                RegisterOperand cls, ImmOpWithPattern imm>
4169  : InstRIa<opcode, (outs), (ins cls:$R1, imm:$I2),
4170            mnemonic#"\t$R1, $I2",
4171            [(set CC, (operator cls:$R1, imm:$I2))]> {
4172  let isCompare = 1;
4173}
4174
4175class CompareRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
4176                 RegisterOperand cls, ImmOpWithPattern imm>
4177  : InstRILa<opcode, (outs), (ins cls:$R1, imm:$I2),
4178             mnemonic#"\t$R1, $I2",
4179             [(set CC, (operator cls:$R1, imm:$I2))]> {
4180  let isCompare = 1;
4181}
4182
4183class CompareRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
4184                   RegisterOperand cls, SDPatternOperator load>
4185  : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
4186             mnemonic#"\t$R1, $RI2",
4187             [(set CC, (operator cls:$R1, (load pcrel32:$RI2)))]> {
4188  let isCompare = 1;
4189  let mayLoad = 1;
4190  // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
4191  // However, BDXs have two extra operands and are therefore 6 units more
4192  // complex.
4193  let AddedComplexity = 7;
4194}
4195
4196class CompareRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4197                RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
4198                AddressingMode mode = bdxaddr12only>
4199  : InstRXa<opcode, (outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
4200            mnemonic#"\t$R1, $XBD2",
4201            [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
4202  let OpKey = mnemonic#"r"#cls;
4203  let OpType = "mem";
4204  let isCompare = 1;
4205  let mayLoad = 1;
4206  let AccessBytes = bytes;
4207}
4208
4209class CompareRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4210                 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
4211  : InstRXE<opcode, (outs), (ins cls:$R1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
4212            mnemonic#"\t$R1, $XBD2",
4213            [(set CC, (operator cls:$R1, (load bdxaddr12only:$XBD2)))]> {
4214  let OpKey = mnemonic#"r"#cls;
4215  let OpType = "mem";
4216  let isCompare = 1;
4217  let mayLoad = 1;
4218  let AccessBytes = bytes;
4219  let M3 = 0;
4220}
4221
4222class CompareRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4223                 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
4224                 AddressingMode mode = bdxaddr20only>
4225  : InstRXYa<opcode, (outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
4226             mnemonic#"\t$R1, $XBD2",
4227             [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
4228  let OpKey = mnemonic#"r"#cls;
4229  let OpType = "mem";
4230  let isCompare = 1;
4231  let mayLoad = 1;
4232  let AccessBytes = bytes;
4233}
4234
4235multiclass CompareRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
4236                         SDPatternOperator operator, RegisterOperand cls,
4237                         SDPatternOperator load, bits<5> bytes> {
4238  let DispKey = mnemonic # cls in {
4239    let DispSize = "12" in
4240      def "" : CompareRX<mnemonic, rxOpcode, operator, cls,
4241                         load, bytes, bdxaddr12pair>;
4242    let DispSize = "20" in
4243      def Y  : CompareRXY<mnemonic#"y", rxyOpcode, operator, cls,
4244                          load, bytes, bdxaddr20pair>;
4245  }
4246}
4247
4248class CompareRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
4249                bits<5> bytes, AddressingMode mode = bdaddr12only>
4250  : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4251            mnemonic#"\t$R1, $M3, $BD2", []> {
4252  let mayLoad = 1;
4253  let AccessBytes = bytes;
4254}
4255
4256class CompareRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
4257                 bits<5> bytes, AddressingMode mode = bdaddr20only>
4258  : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4259             mnemonic#"\t$R1, $M3, $BD2", []> {
4260  let mayLoad = 1;
4261  let AccessBytes = bytes;
4262}
4263
4264multiclass CompareRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4265                         RegisterOperand cls, bits<5> bytes> {
4266  let DispKey = mnemonic # cls in {
4267    let DispSize = "12" in
4268      def "" : CompareRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
4269    let DispSize = "20" in
4270      def Y  : CompareRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
4271  }
4272}
4273
4274class CompareSSb<string mnemonic, bits<8> opcode>
4275  : InstSSb<opcode,
4276            (outs), (ins (bdladdr12onlylen4 $B1, $D1, $L1):$BDL1,
4277                         (bdladdr12onlylen4 $B2, $D2, $L2):$BDL2),
4278            mnemonic#"\t$BDL1, $BDL2", []> {
4279  let isCompare = 1;
4280  let mayLoad = 1;
4281}
4282
4283class CompareSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4284                SDPatternOperator load, ImmOpWithPattern imm,
4285                AddressingMode mode = bdaddr12only>
4286  : InstSI<opcode, (outs), (ins (mode $B1, $D1):$BD1, imm:$I2),
4287           mnemonic#"\t$BD1, $I2",
4288           [(set CC, (operator (load mode:$BD1), imm:$I2))]> {
4289  let isCompare = 1;
4290  let mayLoad = 1;
4291}
4292
4293class CompareSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4294                 SDPatternOperator load, ImmOpWithPattern imm>
4295  : InstSIL<opcode, (outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2),
4296            mnemonic#"\t$BD1, $I2",
4297            [(set CC, (operator (load bdaddr12only:$BD1), imm:$I2))]> {
4298  let isCompare = 1;
4299  let mayLoad = 1;
4300}
4301
4302class CompareSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4303                 SDPatternOperator load, ImmOpWithPattern imm,
4304                 AddressingMode mode = bdaddr20only>
4305  : InstSIY<opcode, (outs), (ins (mode $B1, $D1):$BD1, imm:$I2),
4306            mnemonic#"\t$BD1, $I2",
4307            [(set CC, (operator (load mode:$BD1), imm:$I2))]> {
4308  let isCompare = 1;
4309  let mayLoad = 1;
4310}
4311
4312multiclass CompareSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
4313                         SDPatternOperator operator, SDPatternOperator load,
4314                         ImmOpWithPattern imm> {
4315  let DispKey = mnemonic in {
4316    let DispSize = "12" in
4317      def "" : CompareSI<mnemonic, siOpcode, operator, load, imm, bdaddr12pair>;
4318    let DispSize = "20" in
4319      def Y  : CompareSIY<mnemonic#"y", siyOpcode, operator, load, imm,
4320                          bdaddr20pair>;
4321  }
4322}
4323
4324class CompareVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4325                  TypedReg tr, bits<4> type, string fp_mnemonic = "">
4326  : InstVRRa<opcode, (outs), (ins tr.op:$V1, tr.op:$V2),
4327             mnemonic#"\t$V1, $V2",
4328             [(set CC, (operator (tr.vt tr.op:$V1), (tr.vt tr.op:$V2)))]> {
4329  let isCompare = 1;
4330  let M3 = type;
4331  let M4 = 0;
4332  let M5 = 0;
4333  let OpKey = fp_mnemonic#!subst("VR", "FP", !cast<string>(tr.op));
4334  let OpType = "reg";
4335}
4336
4337class CompareVRRaGeneric<string mnemonic, bits<16> opcode>
4338  : InstVRRa<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
4339             mnemonic#"\t$V1, $V2, $M3", []> {
4340  let isCompare = 1;
4341  let M4 = 0;
4342  let M5 = 0;
4343}
4344
4345class CompareVRRaFloatGeneric<string mnemonic, bits<16> opcode>
4346  : InstVRRa<opcode, (outs),
4347             (ins VR64:$V1, VR64:$V2, imm32zx4:$M3, imm32zx4:$M4),
4348             mnemonic#"\t$V1, $V2, $M3, $M4", []> {
4349  let isCompare = 1;
4350  let M5 = 0;
4351}
4352
4353class CompareVRRh<string mnemonic, bits<16> opcode>
4354  : InstVRRh<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
4355             mnemonic#"\t$V1, $V2, $M3", []> {
4356  let isCompare = 1;
4357}
4358
4359class TestInherentS<string mnemonic, bits<16> opcode,
4360                    SDPatternOperator operator>
4361  : InstS<opcode, (outs), (ins), mnemonic, [(set CC, (operator))]> {
4362  let B2 = 0;
4363  let D2 = 0;
4364}
4365
4366class TestRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4367              RegisterOperand cls>
4368  : InstRXE<opcode, (outs), (ins cls:$R1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
4369            mnemonic#"\t$R1, $XBD2",
4370            [(set CC, (operator cls:$R1, bdxaddr12only:$XBD2))]> {
4371  let M3 = 0;
4372}
4373
4374class TestBinarySIL<string mnemonic, bits<16> opcode,
4375                    SDPatternOperator operator, ImmOpWithPattern imm>
4376  : InstSIL<opcode, (outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2),
4377            mnemonic#"\t$BD1, $I2",
4378            [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>;
4379
4380class TestRSL<string mnemonic, bits<16> opcode>
4381  : InstRSLa<opcode, (outs), (ins (bdladdr12onlylen4 $B1, $D1, $L1):$BDL1),
4382             mnemonic#"\t$BDL1", []> {
4383  let mayLoad = 1;
4384}
4385
4386class TestVRRg<string mnemonic, bits<16> opcode>
4387  : InstVRRg<opcode, (outs), (ins VR128:$V1),
4388             mnemonic#"\t$V1", []>;
4389
4390class SideEffectTernarySSc<string mnemonic, bits<8> opcode>
4391  : InstSSc<opcode, (outs), (ins (bdladdr12onlylen4 $B1, $D1, $L1):$BDL1,
4392                                 (shift12only $B2, $D2):$BD2, imm32zx4:$I3),
4393            mnemonic#"\t$BDL1, $BD2, $I3", []>;
4394
4395class SideEffectTernaryRRFa<string mnemonic, bits<16> opcode,
4396                            RegisterOperand cls1, RegisterOperand cls2,
4397                            RegisterOperand cls3>
4398  : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3),
4399             mnemonic#"\t$R1, $R2, $R3", []> {
4400  let M4 = 0;
4401}
4402
4403class SideEffectTernaryMemMemRRFa<string mnemonic, bits<16> opcode,
4404                                  RegisterOperand cls1, RegisterOperand cls2,
4405                                  RegisterOperand cls3>
4406  : InstRRFa<opcode, (outs cls1:$R1, cls2:$R2),
4407             (ins cls1:$R1src, cls2:$R2src, cls3:$R3),
4408             mnemonic#"\t$R1, $R2, $R3", []> {
4409  let Constraints = "$R1 = $R1src, $R2 = $R2src";
4410  let DisableEncoding = "$R1src, $R2src";
4411  let M4 = 0;
4412}
4413
4414class SideEffectTernaryRRFb<string mnemonic, bits<16> opcode,
4415                            RegisterOperand cls1, RegisterOperand cls2,
4416                            RegisterOperand cls3>
4417  : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3),
4418             mnemonic#"\t$R1, $R3, $R2", []> {
4419  let M4 = 0;
4420}
4421
4422class SideEffectTernaryMemMemMemRRFb<string mnemonic, bits<16> opcode,
4423                                     RegisterOperand cls1,
4424                                     RegisterOperand cls2,
4425                                     RegisterOperand cls3>
4426  : InstRRFb<opcode, (outs cls1:$R1, cls2:$R2, cls3:$R3),
4427             (ins cls1:$R1src, cls2:$R2src, cls3:$R3src),
4428             mnemonic#"\t$R1, $R3, $R2", []> {
4429  let Constraints = "$R1 = $R1src, $R2 = $R2src, $R3 = $R3src";
4430  let DisableEncoding = "$R1src, $R2src, $R3src";
4431  let M4 = 0;
4432}
4433
4434class SideEffectTernaryRRFc<string mnemonic, bits<16> opcode,
4435                            RegisterOperand cls1, RegisterOperand cls2,
4436                            ImmOpWithPattern imm>
4437  : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2, imm:$M3),
4438             mnemonic#"\t$R1, $R2, $M3", []>;
4439
4440multiclass SideEffectTernaryRRFcOpt<string mnemonic, bits<16> opcode,
4441                                    RegisterOperand cls1,
4442                                    RegisterOperand cls2> {
4443  def "" : SideEffectTernaryRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
4444  def Opt : SideEffectBinaryRRFc<mnemonic, opcode, cls1, cls2>;
4445}
4446
4447class SideEffectTernaryMemMemRRFc<string mnemonic, bits<16> opcode,
4448                                  RegisterOperand cls1, RegisterOperand cls2,
4449                                  ImmOpWithPattern imm>
4450  : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2),
4451             (ins cls1:$R1src, cls2:$R2src, imm:$M3),
4452             mnemonic#"\t$R1, $R2, $M3", []> {
4453  let Constraints = "$R1 = $R1src, $R2 = $R2src";
4454  let DisableEncoding = "$R1src, $R2src";
4455}
4456
4457multiclass SideEffectTernaryMemMemRRFcOpt<string mnemonic, bits<16> opcode,
4458                                          RegisterOperand cls1,
4459                                          RegisterOperand cls2> {
4460  def "" : SideEffectTernaryMemMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
4461  def Opt : SideEffectBinaryMemMemRRFc<mnemonic, opcode, cls1, cls2>;
4462}
4463
4464class SideEffectTernarySSF<string mnemonic, bits<12> opcode,
4465                           RegisterOperand cls>
4466  : InstSSF<opcode, (outs),
4467            (ins (bdaddr12only $B1, $D1):$BD1,
4468                 (bdaddr12only $B2, $D2):$BD2, cls:$R3),
4469            mnemonic#"\t$BD1, $BD2, $R3", []>;
4470
4471class TernaryRRFa<string mnemonic, bits<16> opcode,
4472                 RegisterOperand cls1, RegisterOperand cls2,
4473                 RegisterOperand cls3>
4474  : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3, imm32zx4:$M4),
4475             mnemonic#"\t$R1, $R2, $R3, $M4", []>;
4476
4477class TernaryRRFb<string mnemonic, bits<16> opcode,
4478                  RegisterOperand cls1, RegisterOperand cls2,
4479                  RegisterOperand cls3>
4480  : InstRRFb<opcode, (outs cls1:$R1, cls3:$R3),
4481             (ins cls1:$R1src, cls2:$R2, imm32zx4:$M4),
4482             mnemonic#"\t$R1, $R3, $R2, $M4", []> {
4483  let Constraints = "$R1 = $R1src";
4484  let DisableEncoding = "$R1src";
4485}
4486
4487class TernaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
4488                  RegisterOperand cls2>
4489  : InstRRFe<opcode, (outs cls1:$R1),
4490             (ins imm32zx4:$M3, cls2:$R2, imm32zx4:$M4),
4491             mnemonic#"\t$R1, $M3, $R2, $M4", []>;
4492
4493class TernaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4494                 RegisterOperand cls1, RegisterOperand cls2>
4495  : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R1src, cls2:$R3, cls2:$R2),
4496            mnemonic#"\t$R1, $R3, $R2",
4497            [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3, cls2:$R2))]> {
4498  let OpKey = mnemonic#cls;
4499  let OpType = "reg";
4500  let Constraints = "$R1 = $R1src";
4501  let DisableEncoding = "$R1src";
4502}
4503
4504class TernaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
4505                bits<5> bytes, AddressingMode mode = bdaddr12only>
4506  : InstRSb<opcode, (outs cls:$R1),
4507            (ins cls:$R1src, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4508            mnemonic#"\t$R1, $M3, $BD2", []> {
4509
4510  let Constraints = "$R1 = $R1src";
4511  let DisableEncoding = "$R1src";
4512  let mayLoad = 1;
4513  let AccessBytes = bytes;
4514}
4515
4516class TernaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
4517                bits<5> bytes, AddressingMode mode = bdaddr20only>
4518  : InstRSYb<opcode, (outs cls:$R1),
4519             (ins cls:$R1src, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4520             mnemonic#"\t$R1, $M3, $BD2", []> {
4521
4522  let Constraints = "$R1 = $R1src";
4523  let DisableEncoding = "$R1src";
4524  let mayLoad = 1;
4525  let AccessBytes = bytes;
4526}
4527
4528multiclass TernaryRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4529                         RegisterOperand cls, bits<5> bytes> {
4530  let DispKey = mnemonic # cls in {
4531    let DispSize = "12" in
4532      def "" : TernaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
4533    let DispSize = "20" in
4534      def Y  : TernaryRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
4535  }
4536}
4537
4538class SideEffectTernaryRS<string mnemonic, bits<8> opcode,
4539                          RegisterOperand cls1, RegisterOperand cls2>
4540  : InstRSa<opcode, (outs),
4541            (ins cls1:$R1, cls2:$R3, (bdaddr12only $B2, $D2):$BD2),
4542            mnemonic#"\t$R1, $R3, $BD2", []>;
4543
4544class SideEffectTernaryRSY<string mnemonic, bits<16> opcode,
4545                           RegisterOperand cls1, RegisterOperand cls2>
4546  : InstRSYa<opcode, (outs),
4547             (ins cls1:$R1, cls2:$R3, (bdaddr20only $B2, $D2):$BD2),
4548             mnemonic#"\t$R1, $R3, $BD2", []>;
4549
4550class SideEffectTernaryMemMemRS<string mnemonic, bits<8> opcode,
4551                                RegisterOperand cls1, RegisterOperand cls2>
4552  : InstRSa<opcode, (outs cls1:$R1, cls2:$R3),
4553            (ins cls1:$R1src, cls2:$R3src, (shift12only $B2, $D2):$BD2),
4554            mnemonic#"\t$R1, $R3, $BD2", []> {
4555    let Constraints = "$R1 = $R1src, $R3 = $R3src";
4556    let DisableEncoding = "$R1src, $R3src";
4557}
4558
4559class SideEffectTernaryMemMemRSY<string mnemonic, bits<16> opcode,
4560                                 RegisterOperand cls1, RegisterOperand cls2>
4561  : InstRSYa<opcode, (outs cls1:$R1, cls2:$R3),
4562             (ins cls1:$R1src, cls2:$R3src, (shift20only $B2, $D2):$BD2),
4563             mnemonic#"\t$R1, $R3, $BD2", []> {
4564    let Constraints = "$R1 = $R1src, $R3 = $R3src";
4565    let DisableEncoding = "$R1src, $R3src";
4566}
4567
4568class TernaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4569                 RegisterOperand cls1, RegisterOperand cls2,
4570                 SDPatternOperator load, bits<5> bytes>
4571  : InstRXF<opcode, (outs cls1:$R1),
4572            (ins cls2:$R1src, cls2:$R3, (bdxaddr12only $B2, $D2, $X2):$XBD2),
4573            mnemonic#"\t$R1, $R3, $XBD2",
4574            [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3,
4575                                      (load bdxaddr12only:$XBD2)))]> {
4576  let OpKey = mnemonic#"r"#cls;
4577  let OpType = "mem";
4578  let Constraints = "$R1 = $R1src";
4579  let DisableEncoding = "$R1src";
4580  let mayLoad = 1;
4581  let AccessBytes = bytes;
4582}
4583
4584class TernaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4585                  TypedReg tr1, TypedReg tr2, ImmOpWithPattern imm, ImmOpWithPattern index>
4586  : InstVRIa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V1src, imm:$I2, index:$M3),
4587             mnemonic#"\t$V1, $I2, $M3",
4588             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4589                                                  imm:$I2, index:$M3))]> {
4590  let Constraints = "$V1 = $V1src";
4591  let DisableEncoding = "$V1src";
4592}
4593
4594class TernaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4595                  TypedReg tr1, TypedReg tr2, bits<4> type>
4596  : InstVRId<opcode, (outs tr1.op:$V1),
4597             (ins tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
4598             mnemonic#"\t$V1, $V2, $V3, $I4",
4599             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4600                                                  (tr2.vt tr2.op:$V3),
4601                                                  imm32zx8_timm:$I4))]> {
4602  let M5 = type;
4603}
4604
4605class TernaryVRIi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4606  : InstVRIi<opcode, (outs VR128:$V1),
4607             (ins cls:$R2, imm32zx8:$I3, imm32zx4:$M4),
4608             mnemonic#"\t$V1, $R2, $I3, $M4", []>;
4609
4610class TernaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4611                  TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m4or>
4612  : InstVRRa<opcode, (outs tr1.op:$V1),
4613             (ins tr2.op:$V2, imm32zx4:$M4, imm32zx4:$M5),
4614             mnemonic#"\t$V1, $V2, $M4, $M5",
4615             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4616                                                  imm32zx4_timm:$M4,
4617                                                  imm32zx4_timm:$M5))],
4618             m4or> {
4619  let M3 = type;
4620}
4621
4622class TernaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
4623  : InstVRRa<opcode, (outs VR128:$V1),
4624             (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
4625             mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
4626
4627class TernaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4628                  TypedReg tr1, TypedReg tr2, bits<4> type,
4629                  SDPatternOperator m5mask, bits<4> m5or>
4630  : InstVRRb<opcode, (outs tr1.op:$V1),
4631             (ins tr2.op:$V2, tr2.op:$V3, m5mask:$M5),
4632             mnemonic#"\t$V1, $V2, $V3, $M5",
4633             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4634                                                  (tr2.vt tr2.op:$V3),
4635                                                  m5mask:$M5))],
4636             m5or> {
4637  let M4 = type;
4638}
4639
4640// Declare a pair of instructions, one which sets CC and one which doesn't.
4641// The CC-setting form ends with "S" and sets the low bit of M5.
4642// Also create aliases to make use of M5 operand optional in assembler.
4643multiclass TernaryOptVRRbSPair<string mnemonic, bits<16> opcode,
4644                               SDPatternOperator operator,
4645                               SDPatternOperator operator_cc,
4646                               TypedReg tr1, TypedReg tr2, bits<4> type,
4647                               bits<4> modifier = 0> {
4648  def "" : TernaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
4649                       imm32zx4even_timm, !and (modifier, 14)>;
4650  def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
4651                  (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4652                                            tr2.op:$V3, 0)>;
4653  let Defs = [CC] in
4654    def S : TernaryVRRb<mnemonic#"s", opcode, operator_cc, tr1, tr2, type,
4655                        imm32zx4even_timm, !add(!and (modifier, 14), 1)>;
4656  def : InstAlias<mnemonic#"s\t$V1, $V2, $V3",
4657                  (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
4658                                                tr2.op:$V3, 0)>;
4659}
4660
4661multiclass TernaryOptVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
4662  let Defs = [CC] in
4663    def "" : InstVRRb<opcode, (outs VR128:$V1),
4664                     (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
4665                     mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
4666  def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
4667                  (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4668                                            imm32zx4:$M4, 0)>;
4669}
4670
4671class TernaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4672                  TypedReg tr1, TypedReg tr2>
4673  : InstVRRc<opcode, (outs tr1.op:$V1),
4674             (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M4),
4675             mnemonic#"\t$V1, $V2, $V3, $M4",
4676             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4677                                                  (tr2.vt tr2.op:$V3),
4678                                                  imm32zx4_timm:$M4))]> {
4679  let M5 = 0;
4680  let M6 = 0;
4681}
4682
4683class TernaryVRRcFloat<string mnemonic, bits<16> opcode,
4684                       SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
4685                       bits<4> type = 0, bits<4> m5 = 0>
4686  : InstVRRc<opcode, (outs tr1.op:$V1),
4687             (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M6),
4688             mnemonic#"\t$V1, $V2, $V3, $M6",
4689             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4690                                                  (tr2.vt tr2.op:$V3),
4691                                                  imm32zx4_timm:$M6))]> {
4692  let M4 = type;
4693  let M5 = m5;
4694}
4695
4696class TernaryVRRcFloatGeneric<string mnemonic, bits<16> opcode>
4697  : InstVRRc<opcode, (outs VR128:$V1),
4698             (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
4699                  imm32zx4:$M6),
4700             mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
4701
4702class TernaryVRRd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4703                  TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m6 = 0>
4704  : InstVRRd<opcode, (outs tr1.op:$V1),
4705             (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
4706             mnemonic#"\t$V1, $V2, $V3, $V4",
4707             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4708                                                  (tr2.vt tr2.op:$V3),
4709                                                  (tr1.vt tr1.op:$V4)))]> {
4710  let M5 = type;
4711  let M6 = m6;
4712}
4713
4714class TernaryVRRdGeneric<string mnemonic, bits<16> opcode>
4715  : InstVRRd<opcode, (outs VR128:$V1),
4716             (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5),
4717             mnemonic#"\t$V1, $V2, $V3, $V4, $M5", []> {
4718  let M6 = 0;
4719}
4720
4721// Ternary operation where the assembler mnemonic has an extra operand to
4722// optionally allow specifying arbitrary M6 values.
4723multiclass TernaryExtraVRRd<string mnemonic, bits<16> opcode,
4724                             SDPatternOperator operator,
4725                             TypedReg tr1, TypedReg tr2, bits<4> type> {
4726  let M5 = type, Defs = [CC] in
4727    def "" : InstVRRd<opcode, (outs tr1.op:$V1),
4728                      (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, imm32zx4:$M6),
4729                      mnemonic#"\t$V1, $V2, $V3, $V4, $M6", []>;
4730  def : Pat<(operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3),
4731                      (tr1.vt tr1.op:$V4)),
4732            (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, 0)>;
4733  def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4",
4734                  (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4735                                            tr2.op:$V3, tr1.op:$V4, 0)>;
4736}
4737
4738multiclass TernaryExtraVRRdGeneric<string mnemonic, bits<16> opcode> {
4739  let Defs = [CC] in
4740    def "" : InstVRRd<opcode, (outs VR128:$V1),
4741                      (ins VR128:$V2, VR128:$V3, VR128:$V4,
4742                       imm32zx4:$M5, imm32zx4:$M6),
4743                      mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4744  def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5",
4745                  (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4746                                            VR128:$V4, imm32zx4:$M5, 0)>;
4747}
4748
4749class TernaryVRRe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4750                  TypedReg tr1, TypedReg tr2, bits<4> m5 = 0, bits<4> type = 0,
4751                  string fp_mnemonic = "">
4752  : InstVRRe<opcode, (outs tr1.op:$V1),
4753             (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
4754             mnemonic#"\t$V1, $V2, $V3, $V4",
4755             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4756                                                  (tr2.vt tr2.op:$V3),
4757                                                  (tr1.vt tr1.op:$V4)))]> {
4758  let M5 = m5;
4759  let M6 = type;
4760  let OpKey = fp_mnemonic#"MemFold"#!subst("VR", "FP", !cast<string>(tr1.op));
4761  let OpType = "reg";
4762}
4763
4764class TernaryVRReFloatGeneric<string mnemonic, bits<16> opcode>
4765  : InstVRRe<opcode, (outs VR128:$V1),
4766             (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
4767             mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4768
4769class TernaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4770                  TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type>
4771  : InstVRSb<opcode, (outs tr1.op:$V1),
4772             (ins tr2.op:$V1src, cls:$R3, (shift12only $B2, $D2):$BD2),
4773             mnemonic#"\t$V1, $R3, $BD2",
4774             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4775                                                  cls:$R3,
4776                                                  shift12only:$BD2))]> {
4777  let Constraints = "$V1 = $V1src";
4778  let DisableEncoding = "$V1src";
4779  let M4 = type;
4780}
4781
4782class TernaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4783  : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2,
4784                                      imm32zx4:$M3, imm32zx4:$M4),
4785             mnemonic#"\t$R1, $V2, $M3, $M4", []>;
4786
4787class TernaryVRRj<string mnemonic, bits<16> opcode>
4788  : InstVRRj<opcode, (outs VR128:$V1), (ins VR128:$V2,
4789                                        VR128:$V3, imm32zx4:$M4),
4790             mnemonic#"\t$V1, $V2, $V3, $M4", []>;
4791
4792class TernaryVRSbGeneric<string mnemonic, bits<16> opcode>
4793  : InstVRSb<opcode, (outs VR128:$V1),
4794             (ins VR128:$V1src, GR64:$R3, (shift12only $B2, $D2):$BD2,
4795                  imm32zx4:$M4),
4796             mnemonic#"\t$V1, $R3, $BD2, $M4", []> {
4797  let Constraints = "$V1 = $V1src";
4798  let DisableEncoding = "$V1src";
4799}
4800
4801class TernaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
4802                 ImmOpWithPattern index>
4803  : InstVRV<opcode, (outs VR128:$V1),
4804           (ins VR128:$V1src, (bdvaddr12only $B2, $D2, $V2):$VBD2, index:$M3),
4805           mnemonic#"\t$V1, $VBD2, $M3", []> {
4806  let Constraints = "$V1 = $V1src";
4807  let DisableEncoding = "$V1src";
4808  let mayLoad = 1;
4809  let AccessBytes = bytes;
4810}
4811
4812class TernaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4813                 TypedReg tr1, TypedReg tr2, bits<5> bytes, ImmOpWithPattern index>
4814  : InstVRX<opcode, (outs tr1.op:$V1),
4815           (ins tr2.op:$V1src, (bdxaddr12only $B2, $D2, $X2):$XBD2, index:$M3),
4816           mnemonic#"\t$V1, $XBD2, $M3",
4817           [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4818                                                bdxaddr12only:$XBD2,
4819                                                index:$M3))]> {
4820  let Constraints = "$V1 = $V1src";
4821  let DisableEncoding = "$V1src";
4822  let mayLoad = 1;
4823  let AccessBytes = bytes;
4824}
4825
4826class QuaternaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4827                     TypedReg tr1, TypedReg tr2, bits<4> type>
4828  : InstVRId<opcode, (outs tr1.op:$V1),
4829             (ins tr2.op:$V1src, tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
4830             mnemonic#"\t$V1, $V2, $V3, $I4",
4831             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4832                                                  (tr2.vt tr2.op:$V2),
4833                                                  (tr2.vt tr2.op:$V3),
4834                                                  imm32zx8_timm:$I4))]> {
4835  let Constraints = "$V1 = $V1src";
4836  let DisableEncoding = "$V1src";
4837  let M5 = type;
4838}
4839
4840class QuaternaryVRIdGeneric<string mnemonic, bits<16> opcode>
4841  : InstVRId<opcode, (outs VR128:$V1),
4842             (ins VR128:$V1src, VR128:$V2, VR128:$V3,
4843                  imm32zx8:$I4, imm32zx4:$M5),
4844             mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []> {
4845  let Constraints = "$V1 = $V1src";
4846  let DisableEncoding = "$V1src";
4847}
4848
4849class QuaternaryVRIf<string mnemonic, bits<16> opcode>
4850  : InstVRIf<opcode, (outs VR128:$V1),
4851             (ins VR128:$V2, VR128:$V3,
4852                  imm32zx8:$I4, imm32zx4:$M5),
4853            mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []>;
4854
4855class QuaternaryVRIg<string mnemonic, bits<16> opcode>
4856  : InstVRIg<opcode, (outs VR128:$V1),
4857             (ins VR128:$V2, imm32zx8:$I3,
4858                  imm32zx8:$I4, imm32zx4:$M5),
4859             mnemonic#"\t$V1, $V2, $I3, $I4, $M5", []>;
4860
4861class QuaternaryVRRd<string mnemonic, bits<16> opcode,
4862                     SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
4863                     TypedReg tr3, TypedReg tr4, bits<4> type,
4864                     SDPatternOperator m6mask = imm32zx4_timm, bits<4> m6or = 0>
4865  : InstVRRd<opcode, (outs tr1.op:$V1),
4866             (ins tr2.op:$V2, tr3.op:$V3, tr4.op:$V4, m6mask:$M6),
4867             mnemonic#"\t$V1, $V2, $V3, $V4, $M6",
4868             [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4869                                                  (tr3.vt tr3.op:$V3),
4870                                                  (tr4.vt tr4.op:$V4),
4871                                                  m6mask:$M6))],
4872             m6or> {
4873  let M5 = type;
4874}
4875
4876class QuaternaryVRRdGeneric<string mnemonic, bits<16> opcode>
4877  : InstVRRd<opcode, (outs VR128:$V1),
4878             (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
4879             mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4880
4881// Declare a pair of instructions, one which sets CC and one which doesn't.
4882// The CC-setting form ends with "S" and sets the low bit of M6.
4883// Also create aliases to make use of M6 operand optional in assembler.
4884multiclass QuaternaryOptVRRdSPair<string mnemonic, bits<16> opcode,
4885                                  SDPatternOperator operator,
4886                                SDPatternOperator operator_cc,
4887                                TypedReg tr1, TypedReg tr2, bits<4> type,
4888                                bits<4> modifier = 0> {
4889  def "" : QuaternaryVRRd<mnemonic, opcode, operator,
4890                          tr1, tr2, tr2, tr2, type,
4891                          imm32zx4even_timm, !and (modifier, 14)>;
4892  def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4",
4893                  (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4894                                            tr2.op:$V3, tr2.op:$V4, 0)>;
4895  let Defs = [CC] in
4896    def S : QuaternaryVRRd<mnemonic#"s", opcode, operator_cc,
4897                           tr1, tr2, tr2, tr2, type,
4898                           imm32zx4even_timm, !add (!and (modifier, 14), 1)>;
4899  def : InstAlias<mnemonic#"s\t$V1, $V2, $V3, $V4",
4900                  (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
4901                                                tr2.op:$V3, tr2.op:$V4, 0)>;
4902}
4903
4904multiclass QuaternaryOptVRRdSPairGeneric<string mnemonic, bits<16> opcode> {
4905  let Defs = [CC] in
4906    def "" : QuaternaryVRRdGeneric<mnemonic, opcode>;
4907  def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5",
4908                  (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4909                                            VR128:$V4, imm32zx4_timm:$M5, 0)>;
4910}
4911
4912class SideEffectQuaternaryRRFa<string mnemonic, bits<16> opcode,
4913                               RegisterOperand cls1, RegisterOperand cls2,
4914                               RegisterOperand cls3>
4915  : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4),
4916             mnemonic#"\t$R1, $R2, $R3, $M4", []>;
4917
4918multiclass SideEffectQuaternaryRRFaOptOpt<string mnemonic, bits<16> opcode,
4919                                          RegisterOperand cls1,
4920                                          RegisterOperand cls2,
4921                                          RegisterOperand cls3> {
4922  def "" : SideEffectQuaternaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
4923  def Opt : SideEffectTernaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
4924  def OptOpt : SideEffectBinaryRRFa<mnemonic, opcode, cls1, cls2>;
4925}
4926
4927class SideEffectQuaternaryRRFb<string mnemonic, bits<16> opcode,
4928                               RegisterOperand cls1, RegisterOperand cls2,
4929                               RegisterOperand cls3>
4930  : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4),
4931             mnemonic#"\t$R1, $R3, $R2, $M4", []>;
4932
4933multiclass SideEffectQuaternaryRRFbOpt<string mnemonic, bits<16> opcode,
4934                                       RegisterOperand cls1,
4935                                       RegisterOperand cls2,
4936                                       RegisterOperand cls3> {
4937  def "" : SideEffectQuaternaryRRFb<mnemonic, opcode, cls1, cls2, cls3>;
4938  def Opt : SideEffectTernaryRRFb<mnemonic, opcode, cls1, cls2, cls3>;
4939}
4940
4941class SideEffectQuaternarySSe<string mnemonic, bits<8> opcode,
4942                              RegisterOperand cls>
4943  : InstSSe<opcode, (outs),
4944            (ins cls:$R1, (bdaddr12only $B2, $D2):$BD2, cls:$R3,
4945                 (bdaddr12only $B4, $D4):$BD4),
4946            mnemonic#"\t$R1, $BD2, $R3, $BD4", []>;
4947
4948class LoadAndOpRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4949                  RegisterOperand cls, AddressingMode mode = bdaddr20only>
4950  : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, (mode $B2, $D2):$BD2),
4951             mnemonic#"\t$R1, $R3, $BD2",
4952             [(set cls:$R1, (operator mode:$BD2, cls:$R3))]> {
4953  let mayLoad = 1;
4954  let mayStore = 1;
4955}
4956
4957class CmpSwapRRE<string mnemonic, bits<16> opcode,
4958                 RegisterOperand cls1, RegisterOperand cls2>
4959  : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
4960            mnemonic#"\t$R1, $R2", []> {
4961  let Constraints = "$R1 = $R1src";
4962  let DisableEncoding = "$R1src";
4963  let mayLoad = 1;
4964  let mayStore = 1;
4965}
4966
4967class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4968                RegisterOperand cls, AddressingMode mode = bdaddr12only>
4969  : InstRSa<opcode, (outs cls:$R1),
4970            (ins cls:$R1src, cls:$R3, (mode $B2, $D2):$BD2),
4971            mnemonic#"\t$R1, $R3, $BD2",
4972            [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
4973  let Constraints = "$R1 = $R1src";
4974  let DisableEncoding = "$R1src";
4975  let mayLoad = 1;
4976  let mayStore = 1;
4977}
4978
4979class CmpSwapRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4980                 RegisterOperand cls, AddressingMode mode = bdaddr20only>
4981  : InstRSYa<opcode, (outs cls:$R1),
4982             (ins cls:$R1src, cls:$R3, (mode $B2, $D2):$BD2),
4983             mnemonic#"\t$R1, $R3, $BD2",
4984             [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
4985  let Constraints = "$R1 = $R1src";
4986  let DisableEncoding = "$R1src";
4987  let mayLoad = 1;
4988  let mayStore = 1;
4989}
4990
4991multiclass CmpSwapRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4992                         SDPatternOperator operator, RegisterOperand cls> {
4993  let DispKey = mnemonic # cls in {
4994    let DispSize = "12" in
4995      def "" : CmpSwapRS<mnemonic, rsOpcode, operator, cls, bdaddr12pair>;
4996    let DispSize = "20" in
4997      def Y  : CmpSwapRSY<mnemonic#"y", rsyOpcode, operator, cls, bdaddr20pair>;
4998  }
4999}
5000
5001class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1,
5002                       RegisterOperand cls2>
5003  : InstRIEf<opcode, (outs cls1:$R1),
5004             (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
5005                  imm32zx8:$I5),
5006             mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> {
5007  let Constraints = "$R1 = $R1src";
5008  let DisableEncoding = "$R1src";
5009}
5010
5011class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator>
5012  : InstRXYb<opcode, (outs),
5013             (ins imm32zx4:$M1, (bdxaddr20only $B2, $D2, $X2):$XBD2),
5014             mnemonic#"\t$M1, $XBD2",
5015             [(operator imm32zx4_timm:$M1, bdxaddr20only:$XBD2)]>;
5016
5017class PrefetchRILPC<string mnemonic, bits<12> opcode,
5018                    SDPatternOperator operator>
5019  : InstRILc<opcode, (outs), (ins imm32zx4_timm:$M1, pcrel32:$RI2),
5020             mnemonic#"\t$M1, $RI2",
5021             [(operator imm32zx4_timm:$M1, pcrel32:$RI2)]> {
5022  // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
5023  // However, BDXs have two extra operands and are therefore 6 units more
5024  // complex.
5025  let AddedComplexity = 7;
5026}
5027
5028class BranchPreloadSMI<string mnemonic, bits<8> opcode>
5029  : InstSMI<opcode, (outs),
5030            (ins imm32zx4:$M1, brtarget16bpp:$RI2,
5031                 (bdaddr12only $B3, $D3):$BD3),
5032            mnemonic#"\t$M1, $RI2, $BD3", []>;
5033
5034class BranchPreloadMII<string mnemonic, bits<8> opcode>
5035  : InstMII<opcode, (outs),
5036            (ins imm32zx4:$M1, brtarget12bpp:$RI2, brtarget24bpp:$RI3),
5037            mnemonic#"\t$M1, $RI2, $RI3", []>;
5038
5039// A floating-point load-and test operation.  Create both a normal unary
5040// operation and one that acts as a comparison against zero.
5041// Note that the comparison against zero operation is not available if we
5042// have vector support, since load-and-test instructions will partially
5043// clobber the target (vector) register.
5044multiclass LoadAndTestRRE<string mnemonic, bits<16> opcode,
5045                          RegisterOperand cls> {
5046  def "" : UnaryRRE<mnemonic, opcode, null_frag, cls, cls>;
5047  let isCodeGenOnly = 1, Predicates = [FeatureNoVector] in
5048    def Compare : CompareRRE<mnemonic, opcode, null_frag, cls, cls>;
5049}
5050
5051//===----------------------------------------------------------------------===//
5052// Pseudo instructions
5053//===----------------------------------------------------------------------===//
5054//
5055// Convenience instructions that get lowered to real instructions
5056// by either SystemZTargetLowering::EmitInstrWithCustomInserter()
5057// or SystemZInstrInfo::expandPostRAPseudo().
5058//
5059//===----------------------------------------------------------------------===//
5060
5061class Pseudo<dag outs, dag ins, list<dag> pattern>
5062  : InstSystemZ<0, outs, ins, "", pattern> {
5063  let isPseudo = 1;
5064  let isCodeGenOnly = 1;
5065}
5066
5067// Like UnaryRI, but expanded after RA depending on the choice of register.
5068class UnaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
5069                    ImmOpWithPattern imm>
5070  : Pseudo<(outs cls:$R1), (ins imm:$I2),
5071           [(set cls:$R1, (operator imm:$I2))]>;
5072
5073// Like UnaryRXY, but expanded after RA depending on the choice of register.
5074class UnaryRXYPseudo<string key, SDPatternOperator operator,
5075                     RegisterOperand cls, bits<5> bytes,
5076                     AddressingMode mode = bdxaddr20only>
5077  : Pseudo<(outs cls:$R1), (ins (mode $B2, $D2, $X2):$XBD2),
5078           [(set cls:$R1, (operator mode:$XBD2))]> {
5079  let OpKey = key#"r"#cls;
5080  let OpType = "mem";
5081  let mayLoad = 1;
5082  let Has20BitOffset = 1;
5083  let HasIndex = 1;
5084  let AccessBytes = bytes;
5085}
5086
5087// Like UnaryRR, but expanded after RA depending on the choice of registers.
5088class UnaryRRPseudo<string key, SDPatternOperator operator,
5089                    RegisterOperand cls1, RegisterOperand cls2>
5090  : Pseudo<(outs cls1:$R1), (ins cls2:$R2),
5091           [(set cls1:$R1, (operator cls2:$R2))]> {
5092  let OpKey = key#cls1;
5093  let OpType = "reg";
5094}
5095
5096// Like BinaryRI, but expanded after RA depending on the choice of register.
5097class BinaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
5098                     ImmOpWithPattern imm>
5099  : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2),
5100           [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
5101  let Constraints = "$R1 = $R1src";
5102}
5103
5104// Like BinaryRIE, but expanded after RA depending on the choice of register.
5105class BinaryRIEPseudo<SDPatternOperator operator, RegisterOperand cls,
5106                      ImmOpWithPattern imm>
5107  : Pseudo<(outs cls:$R1), (ins cls:$R3, imm:$I2),
5108           [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
5109
5110// Like BinaryRIAndK, but expanded after RA depending on the choice of register.
5111multiclass BinaryRIAndKPseudo<string key, SDPatternOperator operator,
5112                              RegisterOperand cls, ImmOpWithPattern imm> {
5113  let NumOpsKey = key in {
5114    let NumOpsValue = "3" in
5115      def K : BinaryRIEPseudo<operator, cls, imm>,
5116              Requires<[FeatureHighWord, FeatureDistinctOps]>;
5117    let NumOpsValue = "2" in
5118      def "" : BinaryRIPseudo<operator, cls, imm>,
5119               Requires<[FeatureHighWord]>;
5120  }
5121}
5122
5123// A pseudo that is used during register allocation when folding a memory
5124// operand. The 3-address register instruction with a spilled source cannot
5125// be converted directly to a target 2-address reg/mem instruction.
5126// Mapping:  <INSN>R  ->  MemFoldPseudo  ->  <INSN>
5127class MemFoldPseudo<string mnemonic, RegisterOperand cls, bits<5> bytes,
5128                    AddressingMode mode>
5129  : Pseudo<(outs cls:$R1), (ins cls:$R2, (mode $B2, $D2, $X2):$XBD2), []> {
5130    let OpKey = !subst("mscrk", "msrkc",
5131                !subst("msgcrk", "msgrkc",
5132                mnemonic#"rk"#cls));
5133    let OpType = "mem";
5134    let MemKey = mnemonic#cls;
5135    let MemType = "pseudo";
5136    let mayLoad = 1;
5137    let AccessBytes = bytes;
5138    let HasIndex = 1;
5139    let hasNoSchedulingInfo = 1;
5140}
5141
5142// Same as MemFoldPseudo but for mapping a W... vector instruction
5143class MemFoldPseudo_FP<string mnemonic, RegisterOperand cls, bits<5> bytes,
5144                    AddressingMode mode>
5145  : MemFoldPseudo<mnemonic, cls, bytes, mode> {
5146    let OpKey = mnemonic#"r"#"MemFold"#cls;
5147}
5148
5149class MemFoldPseudo_FPTern<string mnemonic, RegisterOperand cls, bits<5> bytes,
5150                           AddressingMode mode>
5151  : Pseudo<(outs cls:$R1),
5152           (ins cls:$R2, cls:$R3, (mode $B2, $D2, $X2):$XBD2), []> {
5153    let OpKey = mnemonic#"r"#"MemFold"#cls;
5154    let OpType = "mem";
5155    let MemKey = mnemonic#cls;
5156    let MemType = "pseudo";
5157    let mayLoad = 1;
5158    let AccessBytes = bytes;
5159    let HasIndex = 1;
5160    let hasNoSchedulingInfo = 1;
5161}
5162
5163// Same as MemFoldPseudo but for Load On Condition with CC operands.
5164class MemFoldPseudo_CondMove<string mnemonic, RegisterOperand cls, bits<5> bytes,
5165                             AddressingMode mode>
5166  : Pseudo<(outs cls:$R1),
5167           (ins cls:$R2, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$M3), []> {
5168    let OpKey = !subst("loc", "sel", mnemonic)#"r"#cls;
5169    let OpType = "mem";
5170    let MemKey = mnemonic#cls;
5171    let MemType = "pseudo";
5172    let mayLoad = 1;
5173    let AccessBytes = bytes;
5174    let hasNoSchedulingInfo = 1;
5175}
5176
5177// Like CompareRI, but expanded after RA depending on the choice of register.
5178class CompareRIPseudo<SDPatternOperator operator, RegisterOperand cls,
5179                      ImmOpWithPattern imm>
5180  : Pseudo<(outs), (ins cls:$R1, imm:$I2),
5181           [(set CC, (operator cls:$R1, imm:$I2))]> {
5182  let isCompare = 1;
5183}
5184
5185// Like CompareRXY, but expanded after RA depending on the choice of register.
5186class CompareRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
5187                       SDPatternOperator load, bits<5> bytes,
5188                       AddressingMode mode = bdxaddr20only>
5189  : Pseudo<(outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
5190           [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
5191  let mayLoad = 1;
5192  let Has20BitOffset = 1;
5193  let HasIndex = 1;
5194  let AccessBytes = bytes;
5195}
5196
5197// Like TestBinarySIL, but expanded later.
5198class TestBinarySILPseudo<SDPatternOperator operator, ImmOpWithPattern imm>
5199  : Pseudo<(outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2),
5200           [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>;
5201
5202// Like CondBinaryRRF, but expanded after RA depending on the choice of
5203// register.
5204class CondBinaryRRFPseudo<string mnemonic, RegisterOperand cls1,
5205                          RegisterOperand cls2>
5206  : Pseudo<(outs cls1:$R1),
5207           (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
5208           [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src,
5209                                            cond4:$valid, cond4:$M3))]> {
5210  let Constraints = "$R1 = $R1src";
5211  let DisableEncoding = "$R1src";
5212  let CCMaskLast = 1;
5213  let NumOpsKey = !subst("loc", "sel", mnemonic);
5214  let NumOpsValue = "2";
5215  let OpKey = mnemonic#cls1;
5216  let OpType = "reg";
5217}
5218
5219// Like CondBinaryRRFa, but expanded after RA depending on the choice of
5220// register.
5221class CondBinaryRRFaPseudo<string mnemonic, RegisterOperand cls1,
5222                           RegisterOperand cls2, RegisterOperand cls3>
5223  : Pseudo<(outs cls1:$R1),
5224           (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4),
5225           [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3,
5226                                            cond4:$valid, cond4:$M4))]> {
5227  let CCMaskLast = 1;
5228  let NumOpsKey = mnemonic;
5229  let NumOpsValue = "3";
5230  let OpKey = mnemonic#cls1;
5231  let OpType = "reg";
5232}
5233
5234// Like CondBinaryRIE, but expanded after RA depending on the choice of
5235// register.
5236class CondBinaryRIEPseudo<RegisterOperand cls, ImmOpWithPattern imm>
5237  : Pseudo<(outs cls:$R1),
5238           (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
5239           [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
5240                                           cond4:$valid, cond4:$M3))]> {
5241  let Constraints = "$R1 = $R1src";
5242  let DisableEncoding = "$R1src";
5243  let CCMaskLast = 1;
5244}
5245
5246// Like CondUnaryRSY, but expanded after RA depending on the choice of
5247// register.
5248class CondUnaryRSYPseudo<string mnemonic, SDPatternOperator operator,
5249                         RegisterOperand cls, bits<5> bytes,
5250                         AddressingMode mode = bdaddr20only>
5251  : Pseudo<(outs cls:$R1),
5252           (ins cls:$R1src, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$R3),
5253           [(set cls:$R1,
5254                 (z_select_ccmask (operator mode:$BD2), cls:$R1src,
5255                                  cond4:$valid, cond4:$R3))]> {
5256  let Constraints = "$R1 = $R1src";
5257  let DisableEncoding = "$R1src";
5258  let mayLoad = 1;
5259  let AccessBytes = bytes;
5260  let CCMaskLast = 1;
5261  let OpKey = mnemonic#"r"#cls;
5262  let OpType = "mem";
5263  let MemKey = mnemonic#cls;
5264  let MemType = "target";
5265}
5266
5267// Like CondStoreRSY, but expanded after RA depending on the choice of
5268// register.
5269class CondStoreRSYPseudo<RegisterOperand cls, bits<5> bytes,
5270                         AddressingMode mode = bdaddr20only>
5271  : Pseudo<(outs),
5272           (ins cls:$R1, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$R3), []> {
5273  let mayStore = 1;
5274  let AccessBytes = bytes;
5275  let CCMaskLast = 1;
5276}
5277
5278// Like StoreRXY, but expanded after RA depending on the choice of register.
5279class StoreRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
5280                     bits<5> bytes, AddressingMode mode = bdxaddr20only>
5281  : Pseudo<(outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
5282           [(operator cls:$R1, mode:$XBD2)]> {
5283  let mayStore = 1;
5284  let Has20BitOffset = 1;
5285  let HasIndex = 1;
5286  let AccessBytes = bytes;
5287}
5288
5289// Like RotateSelectRIEf, but expanded after RA depending on the choice
5290// of registers.
5291class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2>
5292  : Pseudo<(outs cls1:$R1),
5293           (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
5294                imm32zx8:$I5),
5295           []> {
5296  let Constraints = "$R1 = $R1src";
5297  let DisableEncoding = "$R1src";
5298}
5299
5300// Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is
5301// the value of the PSW's 2-bit condition code field.
5302class SelectWrapper<ValueType vt, RegisterOperand cls>
5303  : Pseudo<(outs cls:$dst),
5304           (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc),
5305           [(set (vt cls:$dst), (z_select_ccmask cls:$src1, cls:$src2,
5306                                            imm32zx4_timm:$valid, imm32zx4_timm:$cc))]> {
5307  let usesCustomInserter = 1;
5308  let hasNoSchedulingInfo = 1;
5309  let Uses = [CC];
5310}
5311
5312// Stores $new to $addr if $cc is true ("" case) or false (Inv case).
5313multiclass CondStores<RegisterOperand cls, SDPatternOperator store,
5314                      SDPatternOperator load, AddressingMode mode> {
5315  let Uses = [CC], usesCustomInserter = 1, hasNoSchedulingInfo = 1,
5316      mayLoad = 1, mayStore = 1 in {
5317    def "" : Pseudo<(outs),
5318                    (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
5319                    [(store (z_select_ccmask cls:$new, (load mode:$addr),
5320                                             imm32zx4_timm:$valid, imm32zx4_timm:$cc),
5321                            mode:$addr)]>;
5322    def Inv : Pseudo<(outs),
5323                     (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
5324                     [(store (z_select_ccmask (load mode:$addr), cls:$new,
5325                                              imm32zx4_timm:$valid, imm32zx4_timm:$cc),
5326                              mode:$addr)]>;
5327  }
5328}
5329
5330// OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation.  PAT and OPERAND
5331// describe the second (non-memory) operand.
5332class AtomicLoadBinary<SDPatternOperator operator, RegisterOperand cls,
5333                       dag pat, DAGOperand operand>
5334  : Pseudo<(outs cls:$dst), (ins bdaddr20only:$ptr, operand:$src2),
5335           [(set cls:$dst, (operator bdaddr20only:$ptr, pat))]> {
5336  let Defs = [CC];
5337  let Has20BitOffset = 1;
5338  let mayLoad = 1;
5339  let mayStore = 1;
5340  let usesCustomInserter = 1;
5341  let hasNoSchedulingInfo = 1;
5342}
5343
5344// Specializations of AtomicLoadWBinary.
5345class AtomicLoadBinaryReg32<SDPatternOperator operator>
5346  : AtomicLoadBinary<operator, GR32, (i32 GR32:$src2), GR32>;
5347class AtomicLoadBinaryImm32<SDPatternOperator operator, ImmOpWithPattern imm>
5348  : AtomicLoadBinary<operator, GR32, (i32 imm:$src2), imm>;
5349class AtomicLoadBinaryReg64<SDPatternOperator operator>
5350  : AtomicLoadBinary<operator, GR64, (i64 GR64:$src2), GR64>;
5351class AtomicLoadBinaryImm64<SDPatternOperator operator, ImmOpWithPattern imm>
5352  : AtomicLoadBinary<operator, GR64, (i64 imm:$src2), imm>;
5353
5354// OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation.  PAT and OPERAND
5355// describe the second (non-memory) operand.
5356class AtomicLoadWBinary<SDPatternOperator operator, dag pat,
5357                        DAGOperand operand>
5358  : Pseudo<(outs GR32:$dst),
5359           (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift,
5360                ADDR32:$negbitshift, uimm32:$bitsize),
5361           [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift,
5362                                      ADDR32:$negbitshift, uimm32:$bitsize))]> {
5363  let Defs = [CC];
5364  let Has20BitOffset = 1;
5365  let mayLoad = 1;
5366  let mayStore = 1;
5367  let usesCustomInserter = 1;
5368  let hasNoSchedulingInfo = 1;
5369}
5370
5371// Specializations of AtomicLoadWBinary.
5372class AtomicLoadWBinaryReg<SDPatternOperator operator>
5373  : AtomicLoadWBinary<operator, (i32 GR32:$src2), GR32>;
5374class AtomicLoadWBinaryImm<SDPatternOperator operator, ImmOpWithPattern imm>
5375  : AtomicLoadWBinary<operator, (i32 imm:$src2), imm>;
5376
5377// A pseudo instruction that is a direct alias of a real instruction.
5378// These aliases are used in cases where a particular register operand is
5379// fixed or where the same instruction is used with different register sizes.
5380// The size parameter is the size in bytes of the associated real instruction.
5381class Alias<int size, dag outs, dag ins, list<dag> pattern>
5382  : InstSystemZ<size, outs, ins, "", pattern> {
5383  let isPseudo = 1;
5384  let isCodeGenOnly = 1;
5385}
5386
5387class UnaryAliasVRS<RegisterOperand cls1, RegisterOperand cls2>
5388 : Alias<6, (outs cls1:$src1), (ins cls2:$src2), []>;
5389
5390// An alias of a UnaryVRR*, but with different register sizes.
5391class UnaryAliasVRR<SDPatternOperator operator, TypedReg tr1, TypedReg tr2>
5392  : Alias<6, (outs tr1.op:$V1), (ins tr2.op:$V2),
5393          [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]>;
5394
5395// An alias of a UnaryVRX, but with different register sizes.
5396class UnaryAliasVRX<SDPatternOperator operator, TypedReg tr,
5397                    AddressingMode mode = bdxaddr12only>
5398  : Alias<6, (outs tr.op:$V1), (ins (mode $B2, $D2, $X2):$XBD2),
5399          [(set (tr.vt tr.op:$V1), (operator mode:$XBD2))]>;
5400
5401// An alias of a StoreVRX, but with different register sizes.
5402class StoreAliasVRX<SDPatternOperator operator, TypedReg tr,
5403                    AddressingMode mode = bdxaddr12only>
5404  : Alias<6, (outs), (ins tr.op:$V1, (mode $B2, $D2, $X2):$XBD2),
5405          [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>;
5406
5407// An alias of a BinaryRI, but with different register sizes.
5408class BinaryAliasRI<SDPatternOperator operator, RegisterOperand cls,
5409                    ImmOpWithPattern imm>
5410  : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
5411          [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
5412  let Constraints = "$R1 = $R1src";
5413}
5414
5415// An alias of a BinaryRIL, but with different register sizes.
5416class BinaryAliasRIL<SDPatternOperator operator, RegisterOperand cls,
5417                     ImmOpWithPattern imm>
5418  : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
5419          [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
5420  let Constraints = "$R1 = $R1src";
5421}
5422
5423// An alias of a BinaryVRRf, but with different register sizes.
5424class BinaryAliasVRRf<RegisterOperand cls>
5425  : Alias<6, (outs VR128:$V1), (ins cls:$R2, cls:$R3), []>;
5426
5427// An alias of a CompareRI, but with different register sizes.
5428class CompareAliasRI<SDPatternOperator operator, RegisterOperand cls,
5429                     ImmOpWithPattern imm>
5430  : Alias<4, (outs), (ins cls:$R1, imm:$I2),
5431          [(set CC, (operator cls:$R1, imm:$I2))]> {
5432  let isCompare = 1;
5433}
5434
5435// An alias of a RotateSelectRIEf, but with different register sizes.
5436class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2>
5437  : Alias<6, (outs cls1:$R1),
5438          (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
5439               imm32zx8:$I5), []> {
5440  let Constraints = "$R1 = $R1src";
5441}
5442
5443class MemsetPseudo<DAGOperand lenop, DAGOperand byteop>
5444  : Pseudo<(outs), (ins bdaddr12only:$dest, lenop:$length, byteop:$B),
5445           [(z_memset_mvc bdaddr12only:$dest, lenop:$length, byteop:$B)]> {
5446  let Defs = [CC];
5447  let mayLoad = 1;
5448  let mayStore = 1;
5449  let usesCustomInserter = 1;
5450  let hasNoSchedulingInfo = 1;
5451}
5452
5453//===----------------------------------------------------------------------===//
5454// Multiclasses that emit both real and pseudo instructions
5455//===----------------------------------------------------------------------===//
5456
5457multiclass BinaryRXYAndPseudo<string mnemonic, bits<16> opcode,
5458                              SDPatternOperator operator, RegisterOperand cls,
5459                              SDPatternOperator load, bits<5> bytes,
5460                              AddressingMode mode = bdxaddr20only> {
5461  def "" : BinaryRXY<mnemonic, opcode, operator, cls, load, bytes, mode> {
5462    let MemKey = mnemonic#cls;
5463    let MemType = "target";
5464  }
5465  let Has20BitOffset = 1 in
5466    def _MemFoldPseudo : MemFoldPseudo<mnemonic, cls, bytes, mode>;
5467}
5468
5469multiclass BinaryRXPairAndPseudo<string mnemonic, bits<8> rxOpcode,
5470                                 bits<16> rxyOpcode, SDPatternOperator operator,
5471                                 RegisterOperand cls,
5472                                 SDPatternOperator load, bits<5> bytes> {
5473  let DispKey = mnemonic # cls in {
5474    def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes,
5475                      bdxaddr12pair> {
5476      let DispSize = "12";
5477      let MemKey = mnemonic#cls;
5478      let MemType = "target";
5479    }
5480    let DispSize = "20" in
5481      def Y  : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load,
5482                         bytes, bdxaddr20pair>;
5483  }
5484  def _MemFoldPseudo : MemFoldPseudo<mnemonic, cls, bytes, bdxaddr12pair>;
5485}
5486
5487multiclass BinaryRXEAndPseudo<string mnemonic, bits<16> opcode,
5488                              SDPatternOperator operator, RegisterOperand cls,
5489                              SDPatternOperator load, bits<5> bytes> {
5490  def "" : BinaryRXE<mnemonic, opcode, operator, cls, load, bytes> {
5491    let MemKey = mnemonic#cls;
5492    let MemType = "target";
5493  }
5494  def _MemFoldPseudo : MemFoldPseudo_FP<mnemonic, cls, bytes, bdxaddr12pair>;
5495}
5496
5497multiclass TernaryRXFAndPseudo<string mnemonic, bits<16> opcode,
5498                               SDPatternOperator operator, RegisterOperand cls1,
5499                               RegisterOperand cls2, SDPatternOperator load,
5500                               bits<5> bytes> {
5501  def "" : TernaryRXF<mnemonic, opcode, operator, cls1, cls2, load, bytes> {
5502    let MemKey = mnemonic#cls1;
5503    let MemType = "target";
5504  }
5505  def _MemFoldPseudo : MemFoldPseudo_FPTern<mnemonic, cls1, bytes, bdxaddr12pair>;
5506}
5507
5508multiclass CondUnaryRSYPairAndMemFold<string mnemonic, bits<16> opcode,
5509                                      SDPatternOperator operator,
5510                                      RegisterOperand cls, bits<5> bytes,
5511                                      AddressingMode mode = bdaddr20only> {
5512  defm "" : CondUnaryRSYPair<mnemonic, opcode, operator, cls, bytes, mode>;
5513  def _MemFoldPseudo : MemFoldPseudo_CondMove<mnemonic, cls, bytes, mode>;
5514}
5515
5516multiclass CondUnaryRSYPseudoAndMemFold<string mnemonic,
5517                                        SDPatternOperator operator,
5518                                        RegisterOperand cls, bits<5> bytes,
5519                                        AddressingMode mode = bdaddr20only> {
5520  def "" : CondUnaryRSYPseudo<mnemonic, operator, cls, bytes, mode>;
5521  def _MemFoldPseudo : MemFoldPseudo_CondMove<mnemonic, cls, bytes, mode>;
5522}
5523
5524// Define an instruction that operates on two fixed-length blocks of memory,
5525// and associated pseudo instructions for operating on blocks of any size.
5526// There are two pseudos for the different cases of when the length is
5527// constant or variable. The length operand of a pseudo is actually one less
5528// than the intended number of bytes, since the register case needs to use an
5529// EXRL with a target instruction that adds one to the length always.
5530multiclass MemorySS<string mnemonic, bits<8> opcode, SDPatternOperator memop> {
5531  def "" : SideEffectBinarySSa<mnemonic, opcode>;
5532  let usesCustomInserter = 1, hasNoSchedulingInfo = 1, Defs = [CC] in {
5533    def Imm : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5534                                  imm64:$length),
5535                             [(memop bdaddr12only:$dest, bdaddr12only:$src,
5536                                     imm64:$length)]>;
5537    def Reg : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5538                                  ADDR64:$length),
5539                             [(memop bdaddr12only:$dest, bdaddr12only:$src,
5540                                     ADDR64:$length)]>;
5541  }
5542}
5543
5544// The same, but setting a CC result as comparison operator.
5545multiclass CompareMemorySS<string mnemonic, bits<8> opcode,
5546                           SDPatternOperator memop> {
5547  def "" : SideEffectBinarySSa<mnemonic, opcode>;
5548  let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in {
5549    def Imm : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5550                                  imm64:$length),
5551                          [(set CC, (memop bdaddr12only:$dest, bdaddr12only:$src,
5552                                           imm64:$length))]>;
5553    def Reg : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5554                                  ADDR64:$length),
5555                          [(set CC, (memop bdaddr12only:$dest, bdaddr12only:$src,
5556                                           ADDR64:$length))]>;
5557  }
5558}
5559
5560// Define an instruction that operates on two strings, both terminated
5561// by the character in R0.  The instruction processes a CPU-determinated
5562// number of bytes at a time and sets CC to 3 if the instruction needs
5563// to be repeated.  Also define a pseudo instruction that represents
5564// the full loop (the main instruction plus the branch on CC==3).
5565multiclass StringRRE<string mnemonic, bits<16> opcode,
5566                     SDPatternOperator operator> {
5567  let Uses = [R0L] in
5568    def "" : SideEffectBinaryMemMemRRE<mnemonic, opcode, GR64, GR64>;
5569  let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in
5570    def Loop : Pseudo<(outs GR64:$end),
5571                      (ins GR64:$start1, GR64:$start2, GR32:$char),
5572                      [(set GR64:$end, (operator GR64:$start1, GR64:$start2,
5573                                                 GR32:$char))]>;
5574}
5575