1 //==- SystemZInstrFormats.td - SystemZ Instruction Formats --*- tablegen -*-==//
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
7 //===----------------------------------------------------------------------===//
9 //===----------------------------------------------------------------------===//
10 // Basic SystemZ instruction definition
11 //===----------------------------------------------------------------------===//
13 class InstSystemZ<int size, dag outs, dag ins, string asmstr,
14 list<dag> pattern> : Instruction {
15 let Namespace = "SystemZ";
17 dag OutOperandList = outs;
18 dag InOperandList = ins;
20 let Pattern = pattern;
21 let AsmString = asmstr;
23 let hasSideEffects = 0;
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"
32 string DispSize = "none";
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>.
38 string OpType = "none";
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.
44 string MemType = "none";
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";
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;
56 // True if this instruction is a simple D(X,B) store of a register
57 // (with no truncation).
58 bit SimpleBDXStore = 0;
60 // True if this instruction has a 20-bit displacement field.
61 bit Has20BitOffset = 0;
63 // True if addresses in this instruction have an index register.
66 // True if this is a 128-bit pseudo instruction that combines two 64-bit
70 // The access size of all memory operands in bytes, or 0 if not known.
71 bits<5> AccessBytes = 0;
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
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;
83 // True if the instruction is conditional and if the CC mask operand
84 // comes first (as for BRC, etc.).
87 // Similar, but true if the CC mask operand comes last (as for LOC, etc.).
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.
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;
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;
115 //===----------------------------------------------------------------------===//
116 // Mappings between instructions
117 //===----------------------------------------------------------------------===//
119 // Return the version of an instruction that has an unsigned 12-bit
121 def getDisp12Opcode : InstrMapping {
122 let FilterClass = "InstSystemZ";
123 let RowFields = ["DispKey"];
124 let ColFields = ["DispSize"];
126 let ValueCols = [["12"]];
129 // Return the version of an instruction that has a signed 20-bit displacement.
130 def getDisp20Opcode : InstrMapping {
131 let FilterClass = "InstSystemZ";
132 let RowFields = ["DispKey"];
133 let ColFields = ["DispSize"];
135 let ValueCols = [["20"]];
138 // Return the memory form of a register instruction. Note that this may
139 // return a MemFoldPseudo instruction (see below).
140 def getMemOpcode : InstrMapping {
141 let FilterClass = "InstSystemZ";
142 let RowFields = ["OpKey"];
143 let ColFields = ["OpType"];
144 let KeyCol = ["reg"];
145 let ValueCols = [["mem"]];
148 // Return the target memory instruction for a MemFoldPseudo.
149 def getTargetMemOpcode : InstrMapping {
150 let FilterClass = "InstSystemZ";
151 let RowFields = ["MemKey"];
152 let ColFields = ["MemType"];
153 let KeyCol = ["pseudo"];
154 let ValueCols = [["target"]];
157 // Return the 2-operand form of a 3-operand instruction.
158 def getTwoOperandOpcode : InstrMapping {
159 let FilterClass = "InstSystemZ";
160 let RowFields = ["NumOpsKey"];
161 let ColFields = ["NumOpsValue"];
163 let ValueCols = [["2"]];
166 //===----------------------------------------------------------------------===//
167 // Instruction formats
168 //===----------------------------------------------------------------------===//
170 // Formats are specified using operand field declarations of the form:
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> BDn : address operand n, which has a base and a displacement
176 // bits<m> XBDn : address operand n, which has an index, a base and a
178 // bits<m> VBDn : address operand n, which has a vector index, a base and a
180 // bits<4> Xn : index register for address operand n
181 // bits<4> Mn : mode value for operand n
183 // The operand numbers ("n" in the list above) follow the architecture manual.
184 // Assembly operands sometimes have a different order; in particular, R3 often
185 // is often written between operands 1 and 2.
187 //===----------------------------------------------------------------------===//
189 class InstE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
190 : InstSystemZ<2, outs, ins, asmstr, pattern> {
192 field bits<16> SoftFail = 0;
197 class InstI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
198 : InstSystemZ<2, outs, ins, asmstr, pattern> {
200 field bits<16> SoftFail = 0;
208 class InstIE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
209 : InstSystemZ<4, outs, ins, asmstr, pattern> {
211 field bits<32> SoftFail = 0;
216 let Inst{31-16} = op;
222 class InstMII<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
223 : InstSystemZ<6, outs, ins, asmstr, pattern> {
225 field bits<48> SoftFail = 0;
231 let Inst{47-40} = op;
232 let Inst{39-36} = M1;
233 let Inst{35-24} = RI2;
234 let Inst{23-0} = RI3;
237 class InstRIa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
238 : InstSystemZ<4, outs, ins, asmstr, pattern> {
240 field bits<32> SoftFail = 0;
245 let Inst{31-24} = op{11-4};
246 let Inst{23-20} = R1;
247 let Inst{19-16} = op{3-0};
251 class InstRIb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
252 : InstSystemZ<4, outs, ins, asmstr, pattern> {
254 field bits<32> SoftFail = 0;
259 let Inst{31-24} = op{11-4};
260 let Inst{23-20} = R1;
261 let Inst{19-16} = op{3-0};
262 let Inst{15-0} = RI2;
265 class InstRIc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
266 : InstSystemZ<4, outs, ins, asmstr, pattern> {
268 field bits<32> SoftFail = 0;
273 let Inst{31-24} = op{11-4};
274 let Inst{23-20} = M1;
275 let Inst{19-16} = op{3-0};
276 let Inst{15-0} = RI2;
279 class InstRIEa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
280 : InstSystemZ<6, outs, ins, asmstr, pattern> {
282 field bits<48> SoftFail = 0;
288 let Inst{47-40} = op{15-8};
289 let Inst{39-36} = R1;
291 let Inst{31-16} = I2;
292 let Inst{15-12} = M3;
294 let Inst{7-0} = op{7-0};
297 class InstRIEb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
298 : InstSystemZ<6, outs, ins, asmstr, pattern> {
300 field bits<48> SoftFail = 0;
307 let Inst{47-40} = op{15-8};
308 let Inst{39-36} = R1;
309 let Inst{35-32} = R2;
310 let Inst{31-16} = RI4;
311 let Inst{15-12} = M3;
313 let Inst{7-0} = op{7-0};
316 class InstRIEc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
317 : InstSystemZ<6, outs, ins, asmstr, pattern> {
319 field bits<48> SoftFail = 0;
326 let Inst{47-40} = op{15-8};
327 let Inst{39-36} = R1;
328 let Inst{35-32} = M3;
329 let Inst{31-16} = RI4;
331 let Inst{7-0} = op{7-0};
334 class InstRIEd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
335 : InstSystemZ<6, outs, ins, asmstr, pattern> {
337 field bits<48> SoftFail = 0;
343 let Inst{47-40} = op{15-8};
344 let Inst{39-36} = R1;
345 let Inst{35-32} = R3;
346 let Inst{31-16} = I2;
348 let Inst{7-0} = op{7-0};
351 class InstRIEe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
352 : InstSystemZ<6, outs, ins, asmstr, pattern> {
354 field bits<48> SoftFail = 0;
360 let Inst{47-40} = op{15-8};
361 let Inst{39-36} = R1;
362 let Inst{35-32} = R3;
363 let Inst{31-16} = RI2;
365 let Inst{7-0} = op{7-0};
368 class InstRIEf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
369 : InstSystemZ<6, outs, ins, asmstr, pattern> {
371 field bits<48> SoftFail = 0;
379 let Inst{47-40} = op{15-8};
380 let Inst{39-36} = R1;
381 let Inst{35-32} = R2;
382 let Inst{31-24} = I3;
383 let Inst{23-16} = I4;
385 let Inst{7-0} = op{7-0};
388 class InstRIEg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
389 : InstSystemZ<6, outs, ins, asmstr, pattern> {
391 field bits<48> SoftFail = 0;
397 let Inst{47-40} = op{15-8};
398 let Inst{39-36} = R1;
399 let Inst{35-32} = M3;
400 let Inst{31-16} = I2;
402 let Inst{7-0} = op{7-0};
405 class InstRILa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
406 : InstSystemZ<6, outs, ins, asmstr, pattern> {
408 field bits<48> SoftFail = 0;
413 let Inst{47-40} = op{11-4};
414 let Inst{39-36} = R1;
415 let Inst{35-32} = op{3-0};
419 class InstRILb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
420 : InstSystemZ<6, outs, ins, asmstr, pattern> {
422 field bits<48> SoftFail = 0;
427 let Inst{47-40} = op{11-4};
428 let Inst{39-36} = R1;
429 let Inst{35-32} = op{3-0};
430 let Inst{31-0} = RI2;
433 class InstRILc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
434 : InstSystemZ<6, outs, ins, asmstr, pattern> {
436 field bits<48> SoftFail = 0;
441 let Inst{47-40} = op{11-4};
442 let Inst{39-36} = M1;
443 let Inst{35-32} = op{3-0};
444 let Inst{31-0} = RI2;
447 class InstRIS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
448 : InstSystemZ<6, outs, ins, asmstr, pattern> {
450 field bits<48> SoftFail = 0;
457 let Inst{47-40} = op{15-8};
458 let Inst{39-36} = R1;
459 let Inst{35-32} = M3;
460 let Inst{31-16} = BD4;
462 let Inst{7-0} = op{7-0};
465 class InstRR<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
466 : InstSystemZ<2, outs, ins, asmstr, pattern> {
468 field bits<16> SoftFail = 0;
478 class InstRRD<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
479 : InstSystemZ<4, outs, ins, asmstr, pattern> {
481 field bits<32> SoftFail = 0;
487 let Inst{31-16} = op;
488 let Inst{15-12} = R1;
494 class InstRRE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
495 : InstSystemZ<4, outs, ins, asmstr, pattern> {
497 field bits<32> SoftFail = 0;
502 let Inst{31-16} = op;
508 class InstRRFa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
509 : InstSystemZ<4, outs, ins, asmstr, pattern> {
511 field bits<32> SoftFail = 0;
518 let Inst{31-16} = op;
519 let Inst{15-12} = R3;
525 class InstRRFb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
526 : InstSystemZ<4, outs, ins, asmstr, pattern> {
528 field bits<32> SoftFail = 0;
535 let Inst{31-16} = op;
536 let Inst{15-12} = R3;
542 class InstRRFc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
543 : InstSystemZ<4, outs, ins, asmstr, pattern> {
545 field bits<32> SoftFail = 0;
551 let Inst{31-16} = op;
552 let Inst{15-12} = M3;
558 class InstRRFd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
559 : InstSystemZ<4, outs, ins, asmstr, pattern> {
561 field bits<32> SoftFail = 0;
567 let Inst{31-16} = op;
574 class InstRRFe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
575 : InstSystemZ<4, outs, ins, asmstr, pattern> {
577 field bits<32> SoftFail = 0;
584 let Inst{31-16} = op;
585 let Inst{15-12} = M3;
591 class InstRRS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
592 : InstSystemZ<6, outs, ins, asmstr, pattern> {
594 field bits<48> SoftFail = 0;
601 let Inst{47-40} = op{15-8};
602 let Inst{39-36} = R1;
603 let Inst{35-32} = R2;
604 let Inst{31-16} = BD4;
605 let Inst{15-12} = M3;
607 let Inst{7-0} = op{7-0};
610 class InstRXa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
611 : InstSystemZ<4, outs, ins, asmstr, pattern> {
613 field bits<32> SoftFail = 0;
618 let Inst{31-24} = op;
619 let Inst{23-20} = R1;
620 let Inst{19-0} = XBD2;
625 class InstRXb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
626 : InstSystemZ<4, outs, ins, asmstr, pattern> {
628 field bits<32> SoftFail = 0;
633 let Inst{31-24} = op;
634 let Inst{23-20} = M1;
635 let Inst{19-0} = XBD2;
640 class InstRXE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
641 : InstSystemZ<6, outs, ins, asmstr, pattern> {
643 field bits<48> SoftFail = 0;
649 let Inst{47-40} = op{15-8};
650 let Inst{39-36} = R1;
651 let Inst{35-16} = XBD2;
652 let Inst{15-12} = M3;
654 let Inst{7-0} = op{7-0};
659 class InstRXF<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
660 : InstSystemZ<6, outs, ins, asmstr, pattern> {
662 field bits<48> SoftFail = 0;
668 let Inst{47-40} = op{15-8};
669 let Inst{39-36} = R3;
670 let Inst{35-16} = XBD2;
671 let Inst{15-12} = R1;
673 let Inst{7-0} = op{7-0};
678 class InstRXYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
679 : InstSystemZ<6, outs, ins, asmstr, pattern> {
681 field bits<48> SoftFail = 0;
686 let Inst{47-40} = op{15-8};
687 let Inst{39-36} = R1;
688 let Inst{35-8} = XBD2;
689 let Inst{7-0} = op{7-0};
691 let Has20BitOffset = 1;
695 class InstRXYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
696 : InstSystemZ<6, outs, ins, asmstr, pattern> {
698 field bits<48> SoftFail = 0;
703 let Inst{47-40} = op{15-8};
704 let Inst{39-36} = M1;
705 let Inst{35-8} = XBD2;
706 let Inst{7-0} = op{7-0};
708 let Has20BitOffset = 1;
712 class InstRSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
713 : InstSystemZ<4, outs, ins, asmstr, pattern> {
715 field bits<32> SoftFail = 0;
721 let Inst{31-24} = op;
722 let Inst{23-20} = R1;
723 let Inst{19-16} = R3;
724 let Inst{15-0} = BD2;
727 class InstRSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
728 : InstSystemZ<4, outs, ins, asmstr, pattern> {
730 field bits<32> SoftFail = 0;
736 let Inst{31-24} = op;
737 let Inst{23-20} = R1;
738 let Inst{19-16} = M3;
739 let Inst{15-0} = BD2;
742 class InstRSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
743 : InstSystemZ<4, outs, ins, asmstr, pattern> {
745 field bits<32> SoftFail = 0;
751 let Inst{31-24} = op;
752 let Inst{23-20} = R1;
753 let Inst{19-16} = R3;
754 let Inst{15-0} = RI2;
757 class InstRSLa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
758 : InstSystemZ<6, outs, ins, asmstr, pattern> {
760 field bits<48> SoftFail = 0;
764 let Inst{47-40} = op{15-8};
765 let Inst{39-36} = BDL1{19-16};
767 let Inst{31-16} = BDL1{15-0};
769 let Inst{7-0} = op{7-0};
772 class InstRSLb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
773 : InstSystemZ<6, outs, ins, asmstr, pattern> {
775 field bits<48> SoftFail = 0;
781 let Inst{47-40} = op{15-8};
782 let Inst{39-16} = BDL2;
783 let Inst{15-12} = R1;
785 let Inst{7-0} = op{7-0};
788 class InstRSYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
789 : InstSystemZ<6, outs, ins, asmstr, pattern> {
791 field bits<48> SoftFail = 0;
797 let Inst{47-40} = op{15-8};
798 let Inst{39-36} = R1;
799 let Inst{35-32} = R3;
800 let Inst{31-8} = BD2;
801 let Inst{7-0} = op{7-0};
803 let Has20BitOffset = 1;
806 class InstRSYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
807 : InstSystemZ<6, outs, ins, asmstr, pattern> {
809 field bits<48> SoftFail = 0;
815 let Inst{47-40} = op{15-8};
816 let Inst{39-36} = R1;
817 let Inst{35-32} = M3;
818 let Inst{31-8} = BD2;
819 let Inst{7-0} = op{7-0};
821 let Has20BitOffset = 1;
824 class InstSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
825 : InstSystemZ<4, outs, ins, asmstr, pattern> {
827 field bits<32> SoftFail = 0;
832 let Inst{31-24} = op;
833 let Inst{23-16} = I2;
834 let Inst{15-0} = BD1;
837 class InstSIL<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
838 : InstSystemZ<6, outs, ins, asmstr, pattern> {
840 field bits<48> SoftFail = 0;
845 let Inst{47-32} = op;
846 let Inst{31-16} = BD1;
850 class InstSIY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
851 : InstSystemZ<6, outs, ins, asmstr, pattern> {
853 field bits<48> SoftFail = 0;
858 let Inst{47-40} = op{15-8};
859 let Inst{39-32} = I2;
860 let Inst{31-8} = BD1;
861 let Inst{7-0} = op{7-0};
863 let Has20BitOffset = 1;
866 class InstSMI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
867 : InstSystemZ<6, outs, ins, asmstr, pattern> {
869 field bits<48> SoftFail = 0;
875 let Inst{47-40} = op;
876 let Inst{39-36} = M1;
878 let Inst{31-16} = BD3;
879 let Inst{15-0} = RI2;
882 class InstSSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
883 : InstSystemZ<6, outs, ins, asmstr, pattern> {
885 field bits<48> SoftFail = 0;
890 let Inst{47-40} = op;
891 let Inst{39-16} = BDL1;
892 let Inst{15-0} = BD2;
895 class InstSSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
896 : InstSystemZ<6, outs, ins, asmstr, pattern> {
898 field bits<48> SoftFail = 0;
903 let Inst{47-40} = op;
904 let Inst{39-36} = BDL1{19-16};
905 let Inst{35-32} = BDL2{19-16};
906 let Inst{31-16} = BDL1{15-0};
907 let Inst{15-0} = BDL2{15-0};
910 class InstSSc<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
911 : InstSystemZ<6, outs, ins, asmstr, pattern> {
913 field bits<48> SoftFail = 0;
919 let Inst{47-40} = op;
920 let Inst{39-36} = BDL1{19-16};
921 let Inst{35-32} = I3;
922 let Inst{31-16} = BDL1{15-0};
923 let Inst{15-0} = BD2;
926 class InstSSd<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
927 : InstSystemZ<6, outs, ins, asmstr, pattern> {
929 field bits<48> SoftFail = 0;
935 let Inst{47-40} = op;
936 let Inst{39-36} = RBD1{19-16};
937 let Inst{35-32} = R3;
938 let Inst{31-16} = RBD1{15-0};
939 let Inst{15-0} = BD2;
942 class InstSSe<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
943 : InstSystemZ<6, outs, ins, asmstr, pattern> {
945 field bits<48> SoftFail = 0;
952 let Inst{47-40} = op;
953 let Inst{39-36} = R1;
954 let Inst{35-32} = R3;
955 let Inst{31-16} = BD2;
956 let Inst{15-0} = BD4;
959 class InstSSf<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
960 : InstSystemZ<6, outs, ins, asmstr, pattern> {
962 field bits<48> SoftFail = 0;
967 let Inst{47-40} = op;
968 let Inst{39-32} = BDL2{23-16};
969 let Inst{31-16} = BD1;
970 let Inst{15-0} = BDL2{15-0};
973 class InstSSE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
974 : InstSystemZ<6, outs, ins, asmstr, pattern> {
976 field bits<48> SoftFail = 0;
981 let Inst{47-32} = op;
982 let Inst{31-16} = BD1;
983 let Inst{15-0} = BD2;
986 class InstSSF<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
987 : InstSystemZ<6, outs, ins, asmstr, pattern> {
989 field bits<48> SoftFail = 0;
995 let Inst{47-40} = op{11-4};
996 let Inst{39-36} = R3;
997 let Inst{35-32} = op{3-0};
998 let Inst{31-16} = BD1;
999 let Inst{15-0} = BD2;
1002 class InstS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1003 : InstSystemZ<4, outs, ins, asmstr, pattern> {
1004 field bits<32> Inst;
1005 field bits<32> SoftFail = 0;
1009 let Inst{31-16} = op;
1010 let Inst{15-0} = BD2;
1013 class InstVRIa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1014 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1015 field bits<48> Inst;
1016 field bits<48> SoftFail = 0;
1022 let Inst{47-40} = op{15-8};
1023 let Inst{39-36} = V1{3-0};
1024 let Inst{35-32} = 0;
1025 let Inst{31-16} = I2;
1026 let Inst{15-12} = M3;
1027 let Inst{11} = V1{4};
1029 let Inst{7-0} = op{7-0};
1032 class InstVRIb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1033 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1034 field bits<48> Inst;
1035 field bits<48> SoftFail = 0;
1042 let Inst{47-40} = op{15-8};
1043 let Inst{39-36} = V1{3-0};
1044 let Inst{35-32} = 0;
1045 let Inst{31-24} = I2;
1046 let Inst{23-16} = I3;
1047 let Inst{15-12} = M4;
1048 let Inst{11} = V1{4};
1050 let Inst{7-0} = op{7-0};
1053 class InstVRIc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1054 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1055 field bits<48> Inst;
1056 field bits<48> SoftFail = 0;
1063 let Inst{47-40} = op{15-8};
1064 let Inst{39-36} = V1{3-0};
1065 let Inst{35-32} = V3{3-0};
1066 let Inst{31-16} = I2;
1067 let Inst{15-12} = M4;
1068 let Inst{11} = V1{4};
1069 let Inst{10} = V3{4};
1071 let Inst{7-0} = op{7-0};
1074 class InstVRId<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1075 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1076 field bits<48> Inst;
1077 field bits<48> SoftFail = 0;
1085 let Inst{47-40} = op{15-8};
1086 let Inst{39-36} = V1{3-0};
1087 let Inst{35-32} = V2{3-0};
1088 let Inst{31-28} = V3{3-0};
1089 let Inst{27-24} = 0;
1090 let Inst{23-16} = I4;
1091 let Inst{15-12} = M5;
1092 let Inst{11} = V1{4};
1093 let Inst{10} = V2{4};
1094 let Inst{9} = V3{4};
1096 let Inst{7-0} = op{7-0};
1099 class InstVRIe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1100 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1101 field bits<48> Inst;
1102 field bits<48> SoftFail = 0;
1110 let Inst{47-40} = op{15-8};
1111 let Inst{39-36} = V1{3-0};
1112 let Inst{35-32} = V2{3-0};
1113 let Inst{31-20} = I3;
1114 let Inst{19-16} = M5;
1115 let Inst{15-12} = M4;
1116 let Inst{11} = V1{4};
1117 let Inst{10} = V2{4};
1119 let Inst{7-0} = op{7-0};
1122 class InstVRIf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1123 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1124 field bits<48> Inst;
1125 field bits<48> SoftFail = 0;
1133 let Inst{47-40} = op{15-8};
1134 let Inst{39-36} = V1{3-0};
1135 let Inst{35-32} = V2{3-0};
1136 let Inst{31-28} = V3{3-0};
1137 let Inst{27-24} = 0;
1138 let Inst{23-20} = M5;
1139 let Inst{19-12} = I4;
1140 let Inst{11} = V1{4};
1141 let Inst{10} = V2{4};
1142 let Inst{9} = V3{4};
1144 let Inst{7-0} = op{7-0};
1147 class InstVRIg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1148 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1149 field bits<48> Inst;
1150 field bits<48> SoftFail = 0;
1158 let Inst{47-40} = op{15-8};
1159 let Inst{39-36} = V1{3-0};
1160 let Inst{35-32} = V2{3-0};
1161 let Inst{31-24} = I4;
1162 let Inst{23-20} = M5;
1163 let Inst{19-12} = I3;
1164 let Inst{11} = V1{4};
1165 let Inst{10} = V2{4};
1167 let Inst{7-0} = op{7-0};
1170 class InstVRIh<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1171 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1172 field bits<48> Inst;
1173 field bits<48> SoftFail = 0;
1179 let Inst{47-40} = op{15-8};
1180 let Inst{39-36} = V1{3-0};
1181 let Inst{35-32} = 0;
1182 let Inst{31-16} = I2;
1183 let Inst{15-12} = I3;
1184 let Inst{11} = V1{4};
1186 let Inst{7-0} = op{7-0};
1189 class InstVRIi<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1190 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1191 field bits<48> Inst;
1192 field bits<48> SoftFail = 0;
1199 let Inst{47-40} = op{15-8};
1200 let Inst{39-36} = V1{3-0};
1201 let Inst{35-32} = R2;
1202 let Inst{31-24} = 0;
1203 let Inst{23-20} = M4;
1204 let Inst{19-12} = I3;
1205 let Inst{11} = V1{4};
1207 let Inst{7-0} = op{7-0};
1210 // Depending on the instruction mnemonic, certain bits may be or-ed into
1211 // the M4 value provided as explicit operand. These are passed as m4or.
1212 class InstVRRa<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;
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-24} = 0;
1228 let Inst{23-20} = M5;
1229 let Inst{19} = !if (!eq (m4or{3}, 1), 1, M4{3});
1230 let Inst{18} = !if (!eq (m4or{2}, 1), 1, M4{2});
1231 let Inst{17} = !if (!eq (m4or{1}, 1), 1, M4{1});
1232 let Inst{16} = !if (!eq (m4or{0}, 1), 1, M4{0});
1233 let Inst{15-12} = M3;
1234 let Inst{11} = V1{4};
1235 let Inst{10} = V2{4};
1237 let Inst{7-0} = op{7-0};
1240 // Depending on the instruction mnemonic, certain bits may be or-ed into
1241 // the M5 value provided as explicit operand. These are passed as m5or.
1242 class InstVRRb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1244 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1245 field bits<48> Inst;
1246 field bits<48> SoftFail = 0;
1254 let Inst{47-40} = op{15-8};
1255 let Inst{39-36} = V1{3-0};
1256 let Inst{35-32} = V2{3-0};
1257 let Inst{31-28} = V3{3-0};
1258 let Inst{27-24} = 0;
1259 let Inst{23} = !if (!eq (m5or{3}, 1), 1, M5{3});
1260 let Inst{22} = !if (!eq (m5or{2}, 1), 1, M5{2});
1261 let Inst{21} = !if (!eq (m5or{1}, 1), 1, M5{1});
1262 let Inst{20} = !if (!eq (m5or{0}, 1), 1, M5{0});
1263 let Inst{19-16} = 0;
1264 let Inst{15-12} = M4;
1265 let Inst{11} = V1{4};
1266 let Inst{10} = V2{4};
1267 let Inst{9} = V3{4};
1269 let Inst{7-0} = op{7-0};
1272 class InstVRRc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1273 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1274 field bits<48> Inst;
1275 field bits<48> SoftFail = 0;
1284 let Inst{47-40} = op{15-8};
1285 let Inst{39-36} = V1{3-0};
1286 let Inst{35-32} = V2{3-0};
1287 let Inst{31-28} = V3{3-0};
1288 let Inst{27-24} = 0;
1289 let Inst{23-20} = M6;
1290 let Inst{19-16} = M5;
1291 let Inst{15-12} = M4;
1292 let Inst{11} = V1{4};
1293 let Inst{10} = V2{4};
1294 let Inst{9} = V3{4};
1296 let Inst{7-0} = op{7-0};
1299 // Depending on the instruction mnemonic, certain bits may be or-ed into
1300 // the M6 value provided as explicit operand. These are passed as m6or.
1301 class InstVRRd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1303 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1304 field bits<48> Inst;
1305 field bits<48> SoftFail = 0;
1314 let Inst{47-40} = op{15-8};
1315 let Inst{39-36} = V1{3-0};
1316 let Inst{35-32} = V2{3-0};
1317 let Inst{31-28} = V3{3-0};
1318 let Inst{27-24} = M5;
1319 let Inst{23} = !if (!eq (m6or{3}, 1), 1, M6{3});
1320 let Inst{22} = !if (!eq (m6or{2}, 1), 1, M6{2});
1321 let Inst{21} = !if (!eq (m6or{1}, 1), 1, M6{1});
1322 let Inst{20} = !if (!eq (m6or{0}, 1), 1, M6{0});
1323 let Inst{19-16} = 0;
1324 let Inst{15-12} = V4{3-0};
1325 let Inst{11} = V1{4};
1326 let Inst{10} = V2{4};
1327 let Inst{9} = V3{4};
1328 let Inst{8} = V4{4};
1329 let Inst{7-0} = op{7-0};
1332 class InstVRRe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1333 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1334 field bits<48> Inst;
1335 field bits<48> SoftFail = 0;
1344 let Inst{47-40} = op{15-8};
1345 let Inst{39-36} = V1{3-0};
1346 let Inst{35-32} = V2{3-0};
1347 let Inst{31-28} = V3{3-0};
1348 let Inst{27-24} = M6;
1349 let Inst{23-20} = 0;
1350 let Inst{19-16} = M5;
1351 let Inst{15-12} = V4{3-0};
1352 let Inst{11} = V1{4};
1353 let Inst{10} = V2{4};
1354 let Inst{9} = V3{4};
1355 let Inst{8} = V4{4};
1356 let Inst{7-0} = op{7-0};
1359 class InstVRRf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1360 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1361 field bits<48> Inst;
1362 field bits<48> SoftFail = 0;
1368 let Inst{47-40} = op{15-8};
1369 let Inst{39-36} = V1{3-0};
1370 let Inst{35-32} = R2;
1371 let Inst{31-28} = R3;
1372 let Inst{27-12} = 0;
1373 let Inst{11} = V1{4};
1375 let Inst{7-0} = op{7-0};
1378 class InstVRRg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1379 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1380 field bits<48> Inst;
1381 field bits<48> SoftFail = 0;
1385 let Inst{47-40} = op{15-8};
1386 let Inst{39-36} = 0;
1387 let Inst{35-32} = V1{3-0};
1388 let Inst{31-12} = 0;
1390 let Inst{10} = V1{4};
1392 let Inst{7-0} = op{7-0};
1395 class InstVRRh<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1396 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1397 field bits<48> Inst;
1398 field bits<48> SoftFail = 0;
1404 let Inst{47-40} = op{15-8};
1405 let Inst{39-36} = 0;
1406 let Inst{35-32} = V1{3-0};
1407 let Inst{31-28} = V2{3-0};
1408 let Inst{27-24} = 0;
1409 let Inst{23-20} = M3;
1410 let Inst{19-12} = 0;
1412 let Inst{10} = V1{4};
1413 let Inst{9} = V2{4};
1415 let Inst{7-0} = op{7-0};
1418 class InstVRRi<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1419 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1420 field bits<48> Inst;
1421 field bits<48> SoftFail = 0;
1428 let Inst{47-40} = op{15-8};
1429 let Inst{39-36} = R1;
1430 let Inst{35-32} = V2{3-0};
1431 let Inst{31-24} = 0;
1432 let Inst{23-20} = M3;
1433 let Inst{19-16} = M4;
1434 let Inst{15-12} = 0;
1436 let Inst{10} = V2{4};
1438 let Inst{7-0} = op{7-0};
1441 class InstVRSa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1442 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1443 field bits<48> Inst;
1444 field bits<48> SoftFail = 0;
1451 let Inst{47-40} = op{15-8};
1452 let Inst{39-36} = V1{3-0};
1453 let Inst{35-32} = V3{3-0};
1454 let Inst{31-16} = BD2;
1455 let Inst{15-12} = M4;
1456 let Inst{11} = V1{4};
1457 let Inst{10} = V3{4};
1459 let Inst{7-0} = op{7-0};
1462 class InstVRSb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1463 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1464 field bits<48> Inst;
1465 field bits<48> SoftFail = 0;
1472 let Inst{47-40} = op{15-8};
1473 let Inst{39-36} = V1{3-0};
1474 let Inst{35-32} = R3;
1475 let Inst{31-16} = BD2;
1476 let Inst{15-12} = M4;
1477 let Inst{11} = V1{4};
1479 let Inst{7-0} = op{7-0};
1482 class InstVRSc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1483 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1484 field bits<48> Inst;
1485 field bits<48> SoftFail = 0;
1492 let Inst{47-40} = op{15-8};
1493 let Inst{39-36} = R1;
1494 let Inst{35-32} = V3{3-0};
1495 let Inst{31-16} = BD2;
1496 let Inst{15-12} = M4;
1498 let Inst{10} = V3{4};
1500 let Inst{7-0} = op{7-0};
1503 class InstVRSd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1504 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1505 field bits<48> Inst;
1506 field bits<48> SoftFail = 0;
1512 let Inst{47-40} = op{15-8};
1513 let Inst{39-36} = 0;
1514 let Inst{35-32} = R3;
1515 let Inst{31-16} = BD2;
1516 let Inst{15-12} = V1{3-0};
1518 let Inst{8} = V1{4};
1519 let Inst{7-0} = op{7-0};
1522 class InstVRV<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1523 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1524 field bits<48> Inst;
1525 field bits<48> SoftFail = 0;
1531 let Inst{47-40} = op{15-8};
1532 let Inst{39-36} = V1{3-0};
1533 let Inst{35-16} = VBD2{19-0};
1534 let Inst{15-12} = M3;
1535 let Inst{11} = V1{4};
1536 let Inst{10} = VBD2{20};
1538 let Inst{7-0} = op{7-0};
1541 class InstVRX<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1542 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1543 field bits<48> Inst;
1544 field bits<48> SoftFail = 0;
1550 let Inst{47-40} = op{15-8};
1551 let Inst{39-36} = V1{3-0};
1552 let Inst{35-16} = XBD2;
1553 let Inst{15-12} = M3;
1554 let Inst{11} = V1{4};
1556 let Inst{7-0} = op{7-0};
1559 class InstVSI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1560 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1561 field bits<48> Inst;
1562 field bits<48> SoftFail = 0;
1568 let Inst{47-40} = op{15-8};
1569 let Inst{39-32} = I3;
1570 let Inst{31-16} = BD2;
1571 let Inst{15-12} = V1{3-0};
1573 let Inst{8} = V1{4};
1574 let Inst{7-0} = op{7-0};
1577 //===----------------------------------------------------------------------===//
1578 // Instruction classes for .insn directives
1579 //===----------------------------------------------------------------------===//
1581 class DirectiveInsnE<dag outs, dag ins, string asmstr, list<dag> pattern>
1582 : InstE<0, outs, ins, asmstr, pattern> {
1588 class DirectiveInsnRI<dag outs, dag ins, string asmstr, list<dag> pattern>
1589 : InstRIa<0, outs, ins, asmstr, pattern> {
1592 let Inst{31-24} = enc{31-24};
1593 let Inst{19-16} = enc{19-16};
1596 class DirectiveInsnRIE<dag outs, dag ins, string asmstr, list<dag> pattern>
1597 : InstRIEd<0, outs, ins, asmstr, pattern> {
1600 let Inst{47-40} = enc{47-40};
1601 let Inst{7-0} = enc{7-0};
1604 class DirectiveInsnRIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1605 : InstRILa<0, outs, ins, asmstr, pattern> {
1609 let Inst{47-40} = enc{47-40};
1610 let Inst{35-32} = enc{35-32};
1613 class DirectiveInsnRIS<dag outs, dag ins, string asmstr, list<dag> pattern>
1614 : InstRIS<0, outs, ins, asmstr, pattern> {
1617 let Inst{47-40} = enc{47-40};
1618 let Inst{7-0} = enc{7-0};
1621 class DirectiveInsnRR<dag outs, dag ins, string asmstr, list<dag> pattern>
1622 : InstRR<0, outs, ins, asmstr, pattern> {
1625 let Inst{15-8} = enc{15-8};
1628 class DirectiveInsnRRE<dag outs, dag ins, string asmstr, list<dag> pattern>
1629 : InstRRE<0, outs, ins, asmstr, pattern> {
1632 let Inst{31-16} = enc{31-16};
1635 class DirectiveInsnRRF<dag outs, dag ins, string asmstr, list<dag> pattern>
1636 : InstRRFa<0, outs, ins, asmstr, pattern> {
1639 let Inst{31-16} = enc{31-16};
1642 class DirectiveInsnRRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1643 : InstRRS<0, outs, ins, asmstr, pattern> {
1646 let Inst{47-40} = enc{47-40};
1647 let Inst{7-0} = enc{7-0};
1650 class DirectiveInsnRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1651 : InstRSa<0, outs, ins, asmstr, pattern> {
1654 let Inst{31-24} = enc{31-24};
1657 // RSE is like RSY except with a 12 bit displacement (instead of 20).
1658 class DirectiveInsnRSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1659 : InstRSYa<6, outs, ins, asmstr, pattern> {
1662 let Inst{47-40} = enc{47-40};
1663 let Inst{31-16} = BD2{15-0};
1665 let Inst{7-0} = enc{7-0};
1668 class DirectiveInsnRSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1669 : InstRSI<0, outs, ins, asmstr, pattern> {
1672 let Inst{31-24} = enc{31-24};
1675 class DirectiveInsnRSY<dag outs, dag ins, string asmstr, list<dag> pattern>
1676 : InstRSYa<0, outs, ins, asmstr, pattern> {
1679 let Inst{47-40} = enc{47-40};
1680 let Inst{7-0} = enc{7-0};
1683 class DirectiveInsnRX<dag outs, dag ins, string asmstr, list<dag> pattern>
1684 : InstRXa<0, outs, ins, asmstr, pattern> {
1687 let Inst{31-24} = enc{31-24};
1690 class DirectiveInsnRXE<dag outs, dag ins, string asmstr, list<dag> pattern>
1691 : InstRXE<0, outs, ins, asmstr, pattern> {
1696 let Inst{47-40} = enc{47-40};
1697 let Inst{7-0} = enc{7-0};
1700 class DirectiveInsnRXF<dag outs, dag ins, string asmstr, list<dag> pattern>
1701 : InstRXF<0, outs, ins, asmstr, pattern> {
1704 let Inst{47-40} = enc{47-40};
1705 let Inst{7-0} = enc{7-0};
1708 class DirectiveInsnRXY<dag outs, dag ins, string asmstr, list<dag> pattern>
1709 : InstRXYa<0, outs, ins, asmstr, pattern> {
1712 let Inst{47-40} = enc{47-40};
1713 let Inst{7-0} = enc{7-0};
1716 class DirectiveInsnS<dag outs, dag ins, string asmstr, list<dag> pattern>
1717 : InstS<0, outs, ins, asmstr, pattern> {
1720 let Inst{31-16} = enc{31-16};
1723 class DirectiveInsnSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1724 : InstSI<0, outs, ins, asmstr, pattern> {
1727 let Inst{31-24} = enc{31-24};
1730 class DirectiveInsnSIY<dag outs, dag ins, string asmstr, list<dag> pattern>
1731 : InstSIY<0, outs, ins, asmstr, pattern> {
1734 let Inst{47-40} = enc{47-40};
1735 let Inst{7-0} = enc{7-0};
1738 class DirectiveInsnSIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1739 : InstSIL<0, outs, ins, asmstr, pattern> {
1742 let Inst{47-32} = enc{47-32};
1745 class DirectiveInsnSS<dag outs, dag ins, string asmstr, list<dag> pattern>
1746 : InstSSd<0, outs, ins, asmstr, pattern> {
1749 let Inst{47-40} = enc{47-40};
1752 class DirectiveInsnSSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1753 : InstSSE<0, outs, ins, asmstr, pattern> {
1756 let Inst{47-32} = enc{47-32};
1759 class DirectiveInsnSSF<dag outs, dag ins, string asmstr, list<dag> pattern>
1760 : InstSSF<0, outs, ins, asmstr, pattern> {
1763 let Inst{47-40} = enc{47-40};
1764 let Inst{35-32} = enc{35-32};
1767 //===----------------------------------------------------------------------===//
1768 // Variants of instructions with condition mask
1769 //===----------------------------------------------------------------------===//
1771 // For instructions using a condition mask (e.g. conditional branches,
1772 // compare-and-branch instructions, or conditional move instructions),
1773 // we generally need to create multiple instruction patterns:
1775 // - One used for code generation, which encodes the condition mask as an
1776 // MI operand, but writes out an extended mnemonic for better readability.
1777 // - One pattern for the base form of the instruction with an explicit
1778 // condition mask (encoded as a plain integer MI operand).
1779 // - Specific patterns for each extended mnemonic, where the condition mask
1780 // is implied by the pattern name and not otherwise encoded at all.
1782 // We need the latter primarily for the assembler and disassembler, since the
1783 // assembler parser is not able to decode part of an instruction mnemonic
1784 // into an operand. Thus we provide separate patterns for each mnemonic.
1786 // Note that in some cases there are two different mnemonics for the same
1787 // condition mask. In this case we cannot have both instructions available
1788 // to the disassembler at the same time since the encodings are not distinct.
1789 // Therefore the alternate forms are marked isAsmParserOnly.
1791 // We don't make one of the two names an alias of the other because
1792 // we need the custom parsing routines to select the correct register class.
1794 // This section provides helpers for generating the specific forms.
1796 //===----------------------------------------------------------------------===//
1798 // A class to describe a variant of an instruction with condition mask.
1799 class CondVariant<bits<4> ccmaskin, string suffixin, bit alternatein> {
1800 // The fixed condition mask to use.
1801 bits<4> ccmask = ccmaskin;
1803 // The suffix to use for the extended assembler mnemonic.
1804 string suffix = suffixin;
1806 // Whether this is an alternate that needs to be marked isAsmParserOnly.
1807 bit alternate = alternatein;
1810 // Condition mask 15 means "always true", which is used to define
1811 // unconditional branches as a variant of conditional branches.
1812 def CondAlways : CondVariant<15, "", 0>;
1814 // Condition masks for general instructions that can set all 4 bits.
1815 def CondVariantO : CondVariant<1, "o", 0>;
1816 def CondVariantH : CondVariant<2, "h", 0>;
1817 def CondVariantP : CondVariant<2, "p", 1>;
1818 def CondVariantNLE : CondVariant<3, "nle", 0>;
1819 def CondVariantL : CondVariant<4, "l", 0>;
1820 def CondVariantM : CondVariant<4, "m", 1>;
1821 def CondVariantNHE : CondVariant<5, "nhe", 0>;
1822 def CondVariantLH : CondVariant<6, "lh", 0>;
1823 def CondVariantNE : CondVariant<7, "ne", 0>;
1824 def CondVariantNZ : CondVariant<7, "nz", 1>;
1825 def CondVariantE : CondVariant<8, "e", 0>;
1826 def CondVariantZ : CondVariant<8, "z", 1>;
1827 def CondVariantNLH : CondVariant<9, "nlh", 0>;
1828 def CondVariantHE : CondVariant<10, "he", 0>;
1829 def CondVariantNL : CondVariant<11, "nl", 0>;
1830 def CondVariantNM : CondVariant<11, "nm", 1>;
1831 def CondVariantLE : CondVariant<12, "le", 0>;
1832 def CondVariantNH : CondVariant<13, "nh", 0>;
1833 def CondVariantNP : CondVariant<13, "np", 1>;
1834 def CondVariantNO : CondVariant<14, "no", 0>;
1836 // A helper class to look up one of the above by name.
1837 class CV<string name>
1838 : CondVariant<!cast<CondVariant>("CondVariant"#name).ccmask,
1839 !cast<CondVariant>("CondVariant"#name).suffix,
1840 !cast<CondVariant>("CondVariant"#name).alternate>;
1842 // Condition masks for integer instructions (e.g. compare-and-branch).
1843 // This is like the list above, except that condition 3 is not possible
1844 // and that the low bit of the mask is therefore always 0. This means
1845 // that each condition has two names. Conditions "o" and "no" are not used.
1846 def IntCondVariantH : CondVariant<2, "h", 0>;
1847 def IntCondVariantNLE : CondVariant<2, "nle", 1>;
1848 def IntCondVariantL : CondVariant<4, "l", 0>;
1849 def IntCondVariantNHE : CondVariant<4, "nhe", 1>;
1850 def IntCondVariantLH : CondVariant<6, "lh", 0>;
1851 def IntCondVariantNE : CondVariant<6, "ne", 1>;
1852 def IntCondVariantE : CondVariant<8, "e", 0>;
1853 def IntCondVariantNLH : CondVariant<8, "nlh", 1>;
1854 def IntCondVariantHE : CondVariant<10, "he", 0>;
1855 def IntCondVariantNL : CondVariant<10, "nl", 1>;
1856 def IntCondVariantLE : CondVariant<12, "le", 0>;
1857 def IntCondVariantNH : CondVariant<12, "nh", 1>;
1859 // A helper class to look up one of the above by name.
1860 class ICV<string name>
1861 : CondVariant<!cast<CondVariant>("IntCondVariant"#name).ccmask,
1862 !cast<CondVariant>("IntCondVariant"#name).suffix,
1863 !cast<CondVariant>("IntCondVariant"#name).alternate>;
1865 //===----------------------------------------------------------------------===//
1866 // Instruction definitions with semantics
1867 //===----------------------------------------------------------------------===//
1869 // These classes have the form [Cond]<Category><Format>, where <Format> is one
1870 // of the formats defined above and where <Category> describes the inputs
1871 // and outputs. "Cond" is used if the instruction is conditional,
1872 // in which case the 4-bit condition-code mask is added as a final operand.
1873 // <Category> can be one of:
1876 // One register output operand and no input operands.
1879 // Two register output operands and no input operands.
1882 // One address operand. The instruction stores to the address.
1884 // SideEffectInherent:
1885 // No input or output operands, but causes some side effect.
1888 // One branch target. The instruction branches to the target.
1891 // One output operand and one branch target. The instruction stores
1892 // the return address to the output operand and branches to the target.
1895 // Two input operands and one optional branch target. The instruction
1896 // compares the two input operands and branches or traps on the result.
1899 // One register output operand, one register input operand and one branch
1900 // target. The instructions stores a modified form of the source register
1901 // in the destination register and branches on the result.
1904 // One register output operand, two register input operands and one branch
1905 // target. The instructions stores a modified form of one of the source
1906 // registers in the destination register and branches on the result.
1909 // One address input operand and two explicit output operands.
1910 // The instruction loads a range of registers from the address,
1911 // with the explicit operands giving the first and last register
1912 // to load. Other loaded registers are added as implicit definitions.
1915 // Two explicit input register operands and an address operand.
1916 // The instruction stores a range of registers to the address,
1917 // with the explicit operands giving the first and last register
1918 // to store. Other stored registers are added as implicit uses.
1921 // One value operand, one length operand and one address operand.
1922 // The instruction stores the value operand to the address but
1923 // doesn't write more than the number of bytes specified by the
1927 // One register output operand and one address operand.
1929 // SideEffectAddress:
1930 // One address operand. No output operands, but causes some side effect.
1933 // One register output operand and one input operand.
1936 // One address operand and one other input operand. The instruction
1937 // stores to the address.
1940 // One input operand. No output operands, but causes some side effect.
1943 // One register output operand and two input operands.
1946 // One address operand and two other input operands. The instruction
1947 // stores to the address.
1949 // SideEffectBinary:
1950 // Two input operands. No output operands, but causes some side effect.
1953 // Two input operands and an implicit CC output operand.
1956 // One or two input operands and an implicit CC output operand. If
1957 // present, the second input operand is an "address" operand used as
1958 // a test class mask.
1961 // One register output operand and three input operands.
1963 // SideEffectTernary:
1964 // Three input operands. No output operands, but causes some side effect.
1967 // One register output operand and four input operands.
1970 // One output operand and two input operands, one of which is an address.
1971 // The instruction both reads from and writes to the address.
1974 // One output operand and three input operands, one of which is an address.
1975 // The instruction both reads from and writes to the address.
1978 // One output operand and five input operands. The first two operands
1979 // are registers and the other three are immediates.
1982 // One 4-bit immediate operand and one address operand. The immediate
1983 // operand is 1 for a load prefetch and 2 for a store prefetch.
1986 // One 4-bit immediate operand and two address operands.
1988 // The format determines which input operands are tied to output operands,
1989 // and also determines the shape of any address operand.
1991 // Multiclasses of the form <Category><Format>Pair define two instructions,
1992 // one with <Category><Format> and one with <Category><Format>Y. The name
1993 // of the first instruction has no suffix, the name of the second has
1996 //===----------------------------------------------------------------------===//
1998 class InherentRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
1999 SDPatternOperator operator>
2000 : InstRRE<opcode, (outs cls:$R1), (ins),
2002 [(set cls:$R1, (operator))]> {
2006 class InherentDualRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2007 : InstRRE<opcode, (outs cls:$R1, cls:$R2), (ins),
2008 mnemonic#"\t$R1, $R2", []>;
2010 class InherentVRIa<string mnemonic, bits<16> opcode, bits<16> value>
2011 : InstVRIa<opcode, (outs VR128:$V1), (ins), mnemonic#"\t$V1", []> {
2016 class StoreInherentS<string mnemonic, bits<16> opcode,
2017 SDPatternOperator operator, bits<5> bytes>
2018 : InstS<opcode, (outs), (ins bdaddr12only:$BD2),
2019 mnemonic#"\t$BD2", [(operator bdaddr12only:$BD2)]> {
2021 let AccessBytes = bytes;
2024 class SideEffectInherentE<string mnemonic, bits<16>opcode>
2025 : InstE<opcode, (outs), (ins), mnemonic, []>;
2027 class SideEffectInherentS<string mnemonic, bits<16> opcode,
2028 SDPatternOperator operator>
2029 : InstS<opcode, (outs), (ins), mnemonic, [(operator)]> {
2033 class SideEffectInherentRRE<string mnemonic, bits<16> opcode>
2034 : InstRRE<opcode, (outs), (ins), mnemonic, []> {
2039 // Allow an optional TLS marker symbol to generate TLS call relocations.
2040 class CallRI<string mnemonic, bits<12> opcode>
2041 : InstRIb<opcode, (outs), (ins GR64:$R1, brtarget16tls:$RI2),
2042 mnemonic#"\t$R1, $RI2", []>;
2044 // Allow an optional TLS marker symbol to generate TLS call relocations.
2045 class CallRIL<string mnemonic, bits<12> opcode>
2046 : InstRILb<opcode, (outs), (ins GR64:$R1, brtarget32tls:$RI2),
2047 mnemonic#"\t$R1, $RI2", []>;
2049 class CallRR<string mnemonic, bits<8> opcode>
2050 : InstRR<opcode, (outs), (ins GR64:$R1, ADDR64:$R2),
2051 mnemonic#"\t$R1, $R2", []>;
2053 class CallRX<string mnemonic, bits<8> opcode>
2054 : InstRXa<opcode, (outs), (ins GR64:$R1, bdxaddr12only:$XBD2),
2055 mnemonic#"\t$R1, $XBD2", []>;
2057 class CondBranchRI<string mnemonic, bits<12> opcode,
2058 SDPatternOperator operator = null_frag>
2059 : InstRIc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget16:$RI2),
2060 !subst("#", "${M1}", mnemonic)#"\t$RI2",
2061 [(operator cond4:$valid, cond4:$M1, bb:$RI2)]> {
2062 let CCMaskFirst = 1;
2065 class AsmCondBranchRI<string mnemonic, bits<12> opcode>
2066 : InstRIc<opcode, (outs), (ins imm32zx4:$M1, brtarget16:$RI2),
2067 mnemonic#"\t$M1, $RI2", []>;
2069 class FixedCondBranchRI<CondVariant V, string mnemonic, bits<12> opcode,
2070 SDPatternOperator operator = null_frag>
2071 : InstRIc<opcode, (outs), (ins brtarget16:$RI2),
2072 !subst("#", V.suffix, mnemonic)#"\t$RI2", [(operator bb:$RI2)]> {
2073 let isAsmParserOnly = V.alternate;
2077 class CondBranchRIL<string mnemonic, bits<12> opcode>
2078 : InstRILc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget32:$RI2),
2079 !subst("#", "${M1}", mnemonic)#"\t$RI2", []> {
2080 let CCMaskFirst = 1;
2083 class AsmCondBranchRIL<string mnemonic, bits<12> opcode>
2084 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, brtarget32:$RI2),
2085 mnemonic#"\t$M1, $RI2", []>;
2087 class FixedCondBranchRIL<CondVariant V, string mnemonic, bits<12> opcode>
2088 : InstRILc<opcode, (outs), (ins brtarget32:$RI2),
2089 !subst("#", V.suffix, mnemonic)#"\t$RI2", []> {
2090 let isAsmParserOnly = V.alternate;
2094 class CondBranchRR<string mnemonic, bits<8> opcode>
2095 : InstRR<opcode, (outs), (ins cond4:$valid, cond4:$R1, GR64:$R2),
2096 !subst("#", "${R1}", mnemonic)#"\t$R2", []> {
2097 let CCMaskFirst = 1;
2100 class AsmCondBranchRR<string mnemonic, bits<8> opcode>
2101 : InstRR<opcode, (outs), (ins imm32zx4:$R1, GR64:$R2),
2102 mnemonic#"\t$R1, $R2", []>;
2104 class FixedCondBranchRR<CondVariant V, string mnemonic, bits<8> opcode,
2105 SDPatternOperator operator = null_frag>
2106 : InstRR<opcode, (outs), (ins ADDR64:$R2),
2107 !subst("#", V.suffix, mnemonic)#"\t$R2", [(operator ADDR64:$R2)]> {
2108 let isAsmParserOnly = V.alternate;
2112 class CondBranchRX<string mnemonic, bits<8> opcode>
2113 : InstRXb<opcode, (outs), (ins cond4:$valid, cond4:$M1, bdxaddr12only:$XBD2),
2114 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
2115 let CCMaskFirst = 1;
2118 class AsmCondBranchRX<string mnemonic, bits<8> opcode>
2119 : InstRXb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr12only:$XBD2),
2120 mnemonic#"\t$M1, $XBD2", []>;
2122 class FixedCondBranchRX<CondVariant V, string mnemonic, bits<8> opcode>
2123 : InstRXb<opcode, (outs), (ins bdxaddr12only:$XBD2),
2124 !subst("#", V.suffix, mnemonic)#"\t$XBD2", []> {
2125 let isAsmParserOnly = V.alternate;
2129 class CondBranchRXY<string mnemonic, bits<16> opcode>
2130 : InstRXYb<opcode, (outs), (ins cond4:$valid, cond4:$M1, bdxaddr20only:$XBD2),
2131 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
2132 let CCMaskFirst = 1;
2136 class AsmCondBranchRXY<string mnemonic, bits<16> opcode>
2137 : InstRXYb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr20only:$XBD2),
2138 mnemonic#"\t$M1, $XBD2", []> {
2142 class FixedCondBranchRXY<CondVariant V, string mnemonic, bits<16> opcode,
2143 SDPatternOperator operator = null_frag>
2144 : InstRXYb<opcode, (outs), (ins bdxaddr20only:$XBD2),
2145 !subst("#", V.suffix, mnemonic)#"\t$XBD2",
2146 [(operator (load bdxaddr20only:$XBD2))]> {
2147 let isAsmParserOnly = V.alternate;
2152 class CmpBranchRIEa<string mnemonic, bits<16> opcode,
2153 RegisterOperand cls, ImmOpWithPattern imm>
2154 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, cond4:$M3),
2155 mnemonic#"$M3\t$R1, $I2", []>;
2157 class AsmCmpBranchRIEa<string mnemonic, bits<16> opcode,
2158 RegisterOperand cls, ImmOpWithPattern imm>
2159 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, imm32zx4:$M3),
2160 mnemonic#"\t$R1, $I2, $M3", []>;
2162 class FixedCmpBranchRIEa<CondVariant V, string mnemonic, bits<16> opcode,
2163 RegisterOperand cls, ImmOpWithPattern imm>
2164 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2),
2165 mnemonic#V.suffix#"\t$R1, $I2", []> {
2166 let isAsmParserOnly = V.alternate;
2170 multiclass CmpBranchRIEaPair<string mnemonic, bits<16> opcode,
2171 RegisterOperand cls, ImmOpWithPattern imm> {
2172 let isCodeGenOnly = 1 in
2173 def "" : CmpBranchRIEa<mnemonic, opcode, cls, imm>;
2174 def Asm : AsmCmpBranchRIEa<mnemonic, opcode, cls, imm>;
2177 class CmpBranchRIEb<string mnemonic, bits<16> opcode,
2178 RegisterOperand cls>
2179 : InstRIEb<opcode, (outs),
2180 (ins cls:$R1, cls:$R2, cond4:$M3, brtarget16:$RI4),
2181 mnemonic#"$M3\t$R1, $R2, $RI4", []>;
2183 class AsmCmpBranchRIEb<string mnemonic, bits<16> opcode,
2184 RegisterOperand cls>
2185 : InstRIEb<opcode, (outs),
2186 (ins cls:$R1, cls:$R2, imm32zx4:$M3, brtarget16:$RI4),
2187 mnemonic#"\t$R1, $R2, $M3, $RI4", []>;
2189 class FixedCmpBranchRIEb<CondVariant V, string mnemonic, bits<16> opcode,
2190 RegisterOperand cls>
2191 : InstRIEb<opcode, (outs), (ins cls:$R1, cls:$R2, brtarget16:$RI4),
2192 mnemonic#V.suffix#"\t$R1, $R2, $RI4", []> {
2193 let isAsmParserOnly = V.alternate;
2197 multiclass CmpBranchRIEbPair<string mnemonic, bits<16> opcode,
2198 RegisterOperand cls> {
2199 let isCodeGenOnly = 1 in
2200 def "" : CmpBranchRIEb<mnemonic, opcode, cls>;
2201 def Asm : AsmCmpBranchRIEb<mnemonic, opcode, cls>;
2204 class CmpBranchRIEc<string mnemonic, bits<16> opcode,
2205 RegisterOperand cls, ImmOpWithPattern imm>
2206 : InstRIEc<opcode, (outs),
2207 (ins cls:$R1, imm:$I2, cond4:$M3, brtarget16:$RI4),
2208 mnemonic#"$M3\t$R1, $I2, $RI4", []>;
2210 class AsmCmpBranchRIEc<string mnemonic, bits<16> opcode,
2211 RegisterOperand cls, ImmOpWithPattern imm>
2212 : InstRIEc<opcode, (outs),
2213 (ins cls:$R1, imm:$I2, imm32zx4:$M3, brtarget16:$RI4),
2214 mnemonic#"\t$R1, $I2, $M3, $RI4", []>;
2216 class FixedCmpBranchRIEc<CondVariant V, string mnemonic, bits<16> opcode,
2217 RegisterOperand cls, ImmOpWithPattern imm>
2218 : InstRIEc<opcode, (outs), (ins cls:$R1, imm:$I2, brtarget16:$RI4),
2219 mnemonic#V.suffix#"\t$R1, $I2, $RI4", []> {
2220 let isAsmParserOnly = V.alternate;
2224 multiclass CmpBranchRIEcPair<string mnemonic, bits<16> opcode,
2225 RegisterOperand cls, ImmOpWithPattern imm> {
2226 let isCodeGenOnly = 1 in
2227 def "" : CmpBranchRIEc<mnemonic, opcode, cls, imm>;
2228 def Asm : AsmCmpBranchRIEc<mnemonic, opcode, cls, imm>;
2231 class CmpBranchRRFc<string mnemonic, bits<16> opcode,
2232 RegisterOperand cls>
2233 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, cond4:$M3),
2234 mnemonic#"$M3\t$R1, $R2", []>;
2236 class AsmCmpBranchRRFc<string mnemonic, bits<16> opcode,
2237 RegisterOperand cls>
2238 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, imm32zx4:$M3),
2239 mnemonic#"\t$R1, $R2, $M3", []>;
2241 multiclass CmpBranchRRFcPair<string mnemonic, bits<16> opcode,
2242 RegisterOperand cls> {
2243 let isCodeGenOnly = 1 in
2244 def "" : CmpBranchRRFc<mnemonic, opcode, cls>;
2245 def Asm : AsmCmpBranchRRFc<mnemonic, opcode, cls>;
2248 class FixedCmpBranchRRFc<CondVariant V, string mnemonic, bits<16> opcode,
2249 RegisterOperand cls>
2250 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2),
2251 mnemonic#V.suffix#"\t$R1, $R2", []> {
2252 let isAsmParserOnly = V.alternate;
2256 class CmpBranchRRS<string mnemonic, bits<16> opcode,
2257 RegisterOperand cls>
2258 : InstRRS<opcode, (outs),
2259 (ins cls:$R1, cls:$R2, cond4:$M3, bdaddr12only:$BD4),
2260 mnemonic#"$M3\t$R1, $R2, $BD4", []>;
2262 class AsmCmpBranchRRS<string mnemonic, bits<16> opcode,
2263 RegisterOperand cls>
2264 : InstRRS<opcode, (outs),
2265 (ins cls:$R1, cls:$R2, imm32zx4:$M3, bdaddr12only:$BD4),
2266 mnemonic#"\t$R1, $R2, $M3, $BD4", []>;
2268 class FixedCmpBranchRRS<CondVariant V, string mnemonic, bits<16> opcode,
2269 RegisterOperand cls>
2270 : InstRRS<opcode, (outs), (ins cls:$R1, cls:$R2, bdaddr12only:$BD4),
2271 mnemonic#V.suffix#"\t$R1, $R2, $BD4", []> {
2272 let isAsmParserOnly = V.alternate;
2276 multiclass CmpBranchRRSPair<string mnemonic, bits<16> opcode,
2277 RegisterOperand cls> {
2278 let isCodeGenOnly = 1 in
2279 def "" : CmpBranchRRS<mnemonic, opcode, cls>;
2280 def Asm : AsmCmpBranchRRS<mnemonic, opcode, cls>;
2283 class CmpBranchRIS<string mnemonic, bits<16> opcode,
2284 RegisterOperand cls, ImmOpWithPattern imm>
2285 : InstRIS<opcode, (outs),
2286 (ins cls:$R1, imm:$I2, cond4:$M3, bdaddr12only:$BD4),
2287 mnemonic#"$M3\t$R1, $I2, $BD4", []>;
2289 class AsmCmpBranchRIS<string mnemonic, bits<16> opcode,
2290 RegisterOperand cls, ImmOpWithPattern imm>
2291 : InstRIS<opcode, (outs),
2292 (ins cls:$R1, imm:$I2, imm32zx4:$M3, bdaddr12only:$BD4),
2293 mnemonic#"\t$R1, $I2, $M3, $BD4", []>;
2295 class FixedCmpBranchRIS<CondVariant V, string mnemonic, bits<16> opcode,
2296 RegisterOperand cls, ImmOpWithPattern imm>
2297 : InstRIS<opcode, (outs), (ins cls:$R1, imm:$I2, bdaddr12only:$BD4),
2298 mnemonic#V.suffix#"\t$R1, $I2, $BD4", []> {
2299 let isAsmParserOnly = V.alternate;
2303 multiclass CmpBranchRISPair<string mnemonic, bits<16> opcode,
2304 RegisterOperand cls, ImmOpWithPattern imm> {
2305 let isCodeGenOnly = 1 in
2306 def "" : CmpBranchRIS<mnemonic, opcode, cls, imm>;
2307 def Asm : AsmCmpBranchRIS<mnemonic, opcode, cls, imm>;
2310 class CmpBranchRSYb<string mnemonic, bits<16> opcode,
2311 RegisterOperand cls>
2312 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, cond4:$M3),
2313 mnemonic#"$M3\t$R1, $BD2", []>;
2315 class AsmCmpBranchRSYb<string mnemonic, bits<16> opcode,
2316 RegisterOperand cls>
2317 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, imm32zx4:$M3),
2318 mnemonic#"\t$R1, $M3, $BD2", []>;
2320 multiclass CmpBranchRSYbPair<string mnemonic, bits<16> opcode,
2321 RegisterOperand cls> {
2322 let isCodeGenOnly = 1 in
2323 def "" : CmpBranchRSYb<mnemonic, opcode, cls>;
2324 def Asm : AsmCmpBranchRSYb<mnemonic, opcode, cls>;
2327 class FixedCmpBranchRSYb<CondVariant V, string mnemonic, bits<16> opcode,
2328 RegisterOperand cls>
2329 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2),
2330 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2331 let isAsmParserOnly = V.alternate;
2335 class BranchUnaryRI<string mnemonic, bits<12> opcode, RegisterOperand cls>
2336 : InstRIb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget16:$RI2),
2337 mnemonic##"\t$R1, $RI2", []> {
2338 let Constraints = "$R1 = $R1src";
2339 let DisableEncoding = "$R1src";
2342 class BranchUnaryRIL<string mnemonic, bits<12> opcode, RegisterOperand cls>
2343 : InstRILb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget32:$RI2),
2344 mnemonic##"\t$R1, $RI2", []> {
2345 let Constraints = "$R1 = $R1src";
2346 let DisableEncoding = "$R1src";
2349 class BranchUnaryRR<string mnemonic, bits<8> opcode, RegisterOperand cls>
2350 : InstRR<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2351 mnemonic##"\t$R1, $R2", []> {
2352 let Constraints = "$R1 = $R1src";
2353 let DisableEncoding = "$R1src";
2356 class BranchUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2357 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2358 mnemonic##"\t$R1, $R2", []> {
2359 let Constraints = "$R1 = $R1src";
2360 let DisableEncoding = "$R1src";
2363 class BranchUnaryRX<string mnemonic, bits<8> opcode, RegisterOperand cls>
2364 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2),
2365 mnemonic##"\t$R1, $XBD2", []> {
2366 let Constraints = "$R1 = $R1src";
2367 let DisableEncoding = "$R1src";
2370 class BranchUnaryRXY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2371 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr20only:$XBD2),
2372 mnemonic##"\t$R1, $XBD2", []> {
2373 let Constraints = "$R1 = $R1src";
2374 let DisableEncoding = "$R1src";
2377 class BranchBinaryRSI<string mnemonic, bits<8> opcode, RegisterOperand cls>
2378 : InstRSI<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2379 mnemonic##"\t$R1, $R3, $RI2", []> {
2380 let Constraints = "$R1 = $R1src";
2381 let DisableEncoding = "$R1src";
2384 class BranchBinaryRIEe<string mnemonic, bits<16> opcode, RegisterOperand cls>
2385 : InstRIEe<opcode, (outs cls:$R1),
2386 (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2387 mnemonic##"\t$R1, $R3, $RI2", []> {
2388 let Constraints = "$R1 = $R1src";
2389 let DisableEncoding = "$R1src";
2392 class BranchBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls>
2393 : InstRSa<opcode, (outs cls:$R1),
2394 (ins cls:$R1src, cls:$R3, bdaddr12only:$BD2),
2395 mnemonic##"\t$R1, $R3, $BD2", []> {
2396 let Constraints = "$R1 = $R1src";
2397 let DisableEncoding = "$R1src";
2400 class BranchBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2402 (outs cls:$R1), (ins cls:$R1src, cls:$R3, bdaddr20only:$BD2),
2403 mnemonic##"\t$R1, $R3, $BD2", []> {
2404 let Constraints = "$R1 = $R1src";
2405 let DisableEncoding = "$R1src";
2408 class LoadMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2409 AddressingMode mode = bdaddr12only>
2410 : InstRSa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2),
2411 mnemonic#"\t$R1, $R3, $BD2", []> {
2415 class LoadMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2416 AddressingMode mode = bdaddr20only>
2417 : InstRSYa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2),
2418 mnemonic#"\t$R1, $R3, $BD2", []> {
2422 multiclass LoadMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2423 bits<16> rsyOpcode, RegisterOperand cls> {
2424 let DispKey = mnemonic ## #cls in {
2425 let DispSize = "12" in
2426 def "" : LoadMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2427 let DispSize = "20" in
2428 def Y : LoadMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2432 class LoadMultipleSSe<string mnemonic, bits<8> opcode, RegisterOperand cls>
2433 : InstSSe<opcode, (outs cls:$R1, cls:$R3),
2434 (ins bdaddr12only:$BD2, bdaddr12only:$BD4),
2435 mnemonic#"\t$R1, $R3, $BD2, $BD4", []> {
2439 multiclass LoadMultipleVRSaAlign<string mnemonic, bits<16> opcode> {
2440 let mayLoad = 1 in {
2441 def Align : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3),
2442 (ins bdaddr12only:$BD2, imm32zx4:$M4),
2443 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
2445 def "" : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3),
2446 (ins bdaddr12only:$BD2),
2447 mnemonic#"\t$V1, $V3, $BD2", []>;
2451 class StoreRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2452 RegisterOperand cls>
2453 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
2454 mnemonic#"\t$R1, $RI2",
2455 [(operator cls:$R1, pcrel32:$RI2)]> {
2457 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2458 // However, BDXs have two extra operands and are therefore 6 units more
2460 let AddedComplexity = 7;
2463 class StoreRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2464 RegisterOperand cls, bits<5> bytes,
2465 AddressingMode mode = bdxaddr12only>
2466 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
2467 mnemonic#"\t$R1, $XBD2",
2468 [(operator cls:$R1, mode:$XBD2)]> {
2469 let OpKey = mnemonic#"r"#cls;
2472 let AccessBytes = bytes;
2475 class StoreRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2476 RegisterOperand cls, bits<5> bytes,
2477 AddressingMode mode = bdxaddr20only>
2478 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
2479 mnemonic#"\t$R1, $XBD2",
2480 [(operator cls:$R1, mode:$XBD2)]> {
2481 let OpKey = mnemonic#"r"#cls;
2484 let AccessBytes = bytes;
2487 multiclass StoreRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
2488 SDPatternOperator operator, RegisterOperand cls,
2490 let DispKey = mnemonic ## #cls in {
2491 let DispSize = "12" in
2492 def "" : StoreRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
2493 let DispSize = "20" in
2494 def Y : StoreRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
2499 class StoreVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2500 TypedReg tr, bits<5> bytes, bits<4> type = 0>
2501 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2),
2502 mnemonic#"\t$V1, $XBD2",
2503 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2)]> {
2506 let AccessBytes = bytes;
2509 class StoreVRXGeneric<string mnemonic, bits<16> opcode>
2510 : InstVRX<opcode, (outs), (ins VR128:$V1, bdxaddr12only:$XBD2, imm32zx4:$M3),
2511 mnemonic#"\t$V1, $XBD2, $M3", []> {
2515 multiclass StoreVRXAlign<string mnemonic, bits<16> opcode> {
2516 let mayStore = 1, AccessBytes = 16 in {
2517 def Align : InstVRX<opcode, (outs),
2518 (ins VR128:$V1, bdxaddr12only:$XBD2, imm32zx4:$M3),
2519 mnemonic#"\t$V1, $XBD2, $M3", []>;
2521 def "" : InstVRX<opcode, (outs), (ins VR128:$V1, bdxaddr12only:$XBD2),
2522 mnemonic#"\t$V1, $XBD2", []>;
2526 class StoreLengthVRSb<string mnemonic, bits<16> opcode,
2527 SDPatternOperator operator, bits<5> bytes>
2528 : InstVRSb<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2),
2529 mnemonic#"\t$V1, $R3, $BD2",
2530 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2533 let AccessBytes = bytes;
2536 class StoreLengthVRSd<string mnemonic, bits<16> opcode,
2537 SDPatternOperator operator, bits<5> bytes>
2538 : InstVRSd<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2),
2539 mnemonic#"\t$V1, $R3, $BD2",
2540 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2542 let AccessBytes = bytes;
2545 class StoreLengthVSI<string mnemonic, bits<16> opcode,
2546 SDPatternOperator operator, bits<5> bytes>
2547 : InstVSI<opcode, (outs), (ins VR128:$V1, bdaddr12only:$BD2, imm32zx8:$I3),
2548 mnemonic#"\t$V1, $BD2, $I3",
2549 [(operator VR128:$V1, imm32zx8:$I3, bdaddr12only:$BD2)]> {
2551 let AccessBytes = bytes;
2554 class StoreMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2555 AddressingMode mode = bdaddr12only>
2556 : InstRSa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2),
2557 mnemonic#"\t$R1, $R3, $BD2", []> {
2561 class StoreMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2562 AddressingMode mode = bdaddr20only>
2563 : InstRSYa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2),
2564 mnemonic#"\t$R1, $R3, $BD2", []> {
2568 multiclass StoreMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2569 bits<16> rsyOpcode, RegisterOperand cls> {
2570 let DispKey = mnemonic ## #cls in {
2571 let DispSize = "12" in
2572 def "" : StoreMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2573 let DispSize = "20" in
2574 def Y : StoreMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2578 multiclass StoreMultipleVRSaAlign<string mnemonic, bits<16> opcode> {
2579 let mayStore = 1 in {
2580 def Align : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3,
2581 bdaddr12only:$BD2, imm32zx4:$M4),
2582 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
2584 def "" : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3,
2586 mnemonic#"\t$V1, $V3, $BD2", []>;
2590 // StoreSI* instructions are used to store an integer to memory, but the
2591 // addresses are more restricted than for normal stores. If we are in the
2592 // situation of having to force either the address into a register or the
2593 // constant into a register, it's usually better to do the latter.
2594 // We therefore match the address in the same way as a normal store and
2595 // only use the StoreSI* instruction if the matched address is suitable.
2596 class StoreSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2597 ImmOpWithPattern imm>
2598 : InstSI<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2),
2599 mnemonic#"\t$BD1, $I2",
2600 [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2604 class StoreSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2605 ImmOpWithPattern imm>
2606 : InstSIY<opcode, (outs), (ins mviaddr20pair:$BD1, imm:$I2),
2607 mnemonic#"\t$BD1, $I2",
2608 [(operator imm:$I2, mviaddr20pair:$BD1)]> {
2612 class StoreSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2613 ImmOpWithPattern imm>
2614 : InstSIL<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2),
2615 mnemonic#"\t$BD1, $I2",
2616 [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2620 multiclass StoreSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
2621 SDPatternOperator operator, ImmOpWithPattern imm> {
2622 let DispKey = mnemonic in {
2623 let DispSize = "12" in
2624 def "" : StoreSI<mnemonic, siOpcode, operator, imm>;
2625 let DispSize = "20" in
2626 def Y : StoreSIY<mnemonic#"y", siyOpcode, operator, imm>;
2630 class StoreSSE<string mnemonic, bits<16> opcode>
2631 : InstSSE<opcode, (outs), (ins bdaddr12only:$BD1, bdaddr12only:$BD2),
2632 mnemonic#"\t$BD1, $BD2", []> {
2636 class CondStoreRSY<string mnemonic, bits<16> opcode,
2637 RegisterOperand cls, bits<5> bytes,
2638 AddressingMode mode = bdaddr20only>
2639 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$M3),
2640 mnemonic#"$M3\t$R1, $BD2", []> {
2642 let AccessBytes = bytes;
2646 // Like CondStoreRSY, but used for the raw assembly form. The condition-code
2647 // mask is the third operand rather than being part of the mnemonic.
2648 class AsmCondStoreRSY<string mnemonic, bits<16> opcode,
2649 RegisterOperand cls, bits<5> bytes,
2650 AddressingMode mode = bdaddr20only>
2651 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, imm32zx4:$M3),
2652 mnemonic#"\t$R1, $BD2, $M3", []> {
2654 let AccessBytes = bytes;
2657 // Like CondStoreRSY, but with a fixed CC mask.
2658 class FixedCondStoreRSY<CondVariant V, string mnemonic, bits<16> opcode,
2659 RegisterOperand cls, bits<5> bytes,
2660 AddressingMode mode = bdaddr20only>
2661 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2),
2662 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2664 let AccessBytes = bytes;
2665 let isAsmParserOnly = V.alternate;
2669 multiclass CondStoreRSYPair<string mnemonic, bits<16> opcode,
2670 RegisterOperand cls, bits<5> bytes,
2671 AddressingMode mode = bdaddr20only> {
2672 let isCodeGenOnly = 1 in
2673 def "" : CondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
2674 def Asm : AsmCondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
2677 class SideEffectUnaryI<string mnemonic, bits<8> opcode, ImmOpWithPattern imm>
2678 : InstI<opcode, (outs), (ins imm:$I1),
2679 mnemonic#"\t$I1", []>;
2681 class SideEffectUnaryRR<string mnemonic, bits<8>opcode, RegisterOperand cls>
2682 : InstRR<opcode, (outs), (ins cls:$R1),
2683 mnemonic#"\t$R1", []> {
2687 class SideEffectUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
2688 SDPatternOperator operator>
2689 : InstRRE<opcode, (outs), (ins cls:$R1),
2690 mnemonic#"\t$R1", [(operator cls:$R1)]> {
2694 class SideEffectUnaryS<string mnemonic, bits<16> opcode,
2695 SDPatternOperator operator, bits<5> bytes,
2696 AddressingMode mode = bdaddr12only>
2697 : InstS<opcode, (outs), (ins mode:$BD2),
2698 mnemonic#"\t$BD2", [(operator mode:$BD2)]> {
2700 let AccessBytes = bytes;
2703 class SideEffectAddressS<string mnemonic, bits<16> opcode,
2704 SDPatternOperator operator,
2705 AddressingMode mode = bdaddr12only>
2706 : InstS<opcode, (outs), (ins mode:$BD2),
2707 mnemonic#"\t$BD2", [(operator mode:$BD2)]>;
2709 class LoadAddressRX<string mnemonic, bits<8> opcode,
2710 SDPatternOperator operator, AddressingMode mode>
2711 : InstRXa<opcode, (outs GR64:$R1), (ins mode:$XBD2),
2712 mnemonic#"\t$R1, $XBD2",
2713 [(set GR64:$R1, (operator mode:$XBD2))]>;
2715 class LoadAddressRXY<string mnemonic, bits<16> opcode,
2716 SDPatternOperator operator, AddressingMode mode>
2717 : InstRXYa<opcode, (outs GR64:$R1), (ins mode:$XBD2),
2718 mnemonic#"\t$R1, $XBD2",
2719 [(set GR64:$R1, (operator mode:$XBD2))]>;
2721 multiclass LoadAddressRXPair<string mnemonic, bits<8> rxOpcode,
2722 bits<16> rxyOpcode, SDPatternOperator operator> {
2723 let DispKey = mnemonic in {
2724 let DispSize = "12" in
2725 def "" : LoadAddressRX<mnemonic, rxOpcode, operator, laaddr12pair>;
2726 let DispSize = "20" in
2727 def Y : LoadAddressRXY<mnemonic#"y", rxyOpcode, operator, laaddr20pair>;
2731 class LoadAddressRIL<string mnemonic, bits<12> opcode,
2732 SDPatternOperator operator>
2733 : InstRILb<opcode, (outs GR64:$R1), (ins pcrel32:$RI2),
2734 mnemonic#"\t$R1, $RI2",
2735 [(set GR64:$R1, (operator pcrel32:$RI2))]>;
2737 class UnaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2738 RegisterOperand cls1, RegisterOperand cls2>
2739 : InstRR<opcode, (outs cls1:$R1), (ins cls2:$R2),
2740 mnemonic#"\t$R1, $R2",
2741 [(set cls1:$R1, (operator cls2:$R2))]> {
2742 let OpKey = mnemonic#cls1;
2746 class UnaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2747 RegisterOperand cls1, RegisterOperand cls2>
2748 : InstRRE<opcode, (outs cls1:$R1), (ins cls2:$R2),
2749 mnemonic#"\t$R1, $R2",
2750 [(set cls1:$R1, (operator cls2:$R2))]> {
2751 let OpKey = mnemonic#cls1;
2755 class UnaryTiedRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2756 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src),
2757 mnemonic#"\t$R1", []> {
2758 let Constraints = "$R1 = $R1src";
2759 let DisableEncoding = "$R1src";
2763 class UnaryMemRRFc<string mnemonic, bits<16> opcode,
2764 RegisterOperand cls1, RegisterOperand cls2>
2765 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src),
2766 mnemonic#"\t$R1, $R2", []> {
2767 let Constraints = "$R1 = $R1src";
2768 let DisableEncoding = "$R1src";
2772 class UnaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2773 RegisterOperand cls, ImmOpWithPattern imm>
2774 : InstRIa<opcode, (outs cls:$R1), (ins imm:$I2),
2775 mnemonic#"\t$R1, $I2",
2776 [(set cls:$R1, (operator imm:$I2))]>;
2778 class UnaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2779 RegisterOperand cls, ImmOpWithPattern imm>
2780 : InstRILa<opcode, (outs cls:$R1), (ins imm:$I2),
2781 mnemonic#"\t$R1, $I2",
2782 [(set cls:$R1, (operator imm:$I2))]>;
2784 class UnaryRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2785 RegisterOperand cls>
2786 : InstRILb<opcode, (outs cls:$R1), (ins pcrel32:$RI2),
2787 mnemonic#"\t$R1, $RI2",
2788 [(set cls:$R1, (operator pcrel32:$RI2))]> {
2790 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2791 // However, BDXs have two extra operands and are therefore 6 units more
2793 let AddedComplexity = 7;
2796 class CondUnaryRSY<string mnemonic, bits<16> opcode,
2797 SDPatternOperator operator, RegisterOperand cls,
2798 bits<5> bytes, AddressingMode mode = bdaddr20only>
2799 : InstRSYb<opcode, (outs cls:$R1),
2800 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$M3),
2801 mnemonic#"$M3\t$R1, $BD2",
2803 (z_select_ccmask (operator bdaddr20only:$BD2), cls:$R1src,
2804 cond4:$valid, cond4:$M3))]> {
2805 let Constraints = "$R1 = $R1src";
2806 let DisableEncoding = "$R1src";
2808 let AccessBytes = bytes;
2812 // Like CondUnaryRSY, but used for the raw assembly form. The condition-code
2813 // mask is the third operand rather than being part of the mnemonic.
2814 class AsmCondUnaryRSY<string mnemonic, bits<16> opcode,
2815 RegisterOperand cls, bits<5> bytes,
2816 AddressingMode mode = bdaddr20only>
2817 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2, imm32zx4:$M3),
2818 mnemonic#"\t$R1, $BD2, $M3", []> {
2820 let AccessBytes = bytes;
2821 let Constraints = "$R1 = $R1src";
2822 let DisableEncoding = "$R1src";
2825 // Like CondUnaryRSY, but with a fixed CC mask.
2826 class FixedCondUnaryRSY<CondVariant V, string mnemonic, bits<16> opcode,
2827 RegisterOperand cls, bits<5> bytes,
2828 AddressingMode mode = bdaddr20only>
2829 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2),
2830 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2831 let Constraints = "$R1 = $R1src";
2832 let DisableEncoding = "$R1src";
2834 let AccessBytes = bytes;
2835 let isAsmParserOnly = V.alternate;
2839 multiclass CondUnaryRSYPair<string mnemonic, bits<16> opcode,
2840 SDPatternOperator operator,
2841 RegisterOperand cls, bits<5> bytes,
2842 AddressingMode mode = bdaddr20only> {
2843 let isCodeGenOnly = 1 in
2844 def "" : CondUnaryRSY<mnemonic, opcode, operator, cls, bytes, mode>;
2845 def Asm : AsmCondUnaryRSY<mnemonic, opcode, cls, bytes, mode>;
2848 class UnaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2849 RegisterOperand cls, bits<5> bytes,
2850 AddressingMode mode = bdxaddr12only>
2851 : InstRXa<opcode, (outs cls:$R1), (ins mode:$XBD2),
2852 mnemonic#"\t$R1, $XBD2",
2853 [(set cls:$R1, (operator mode:$XBD2))]> {
2854 let OpKey = mnemonic#"r"#cls;
2857 let AccessBytes = bytes;
2860 class UnaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2861 RegisterOperand cls, bits<5> bytes>
2862 : InstRXE<opcode, (outs cls:$R1), (ins bdxaddr12only:$XBD2),
2863 mnemonic#"\t$R1, $XBD2",
2864 [(set cls:$R1, (operator bdxaddr12only:$XBD2))]> {
2865 let OpKey = mnemonic#"r"#cls;
2868 let AccessBytes = bytes;
2872 class UnaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2873 RegisterOperand cls, bits<5> bytes,
2874 AddressingMode mode = bdxaddr20only>
2875 : InstRXYa<opcode, (outs cls:$R1), (ins mode:$XBD2),
2876 mnemonic#"\t$R1, $XBD2",
2877 [(set cls:$R1, (operator mode:$XBD2))]> {
2878 let OpKey = mnemonic#"r"#cls;
2881 let AccessBytes = bytes;
2884 multiclass UnaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
2885 SDPatternOperator operator, RegisterOperand cls,
2887 let DispKey = mnemonic ## #cls in {
2888 let DispSize = "12" in
2889 def "" : UnaryRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
2890 let DispSize = "20" in
2891 def Y : UnaryRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
2896 class UnaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2897 TypedReg tr, ImmOpWithPattern imm, bits<4> type = 0>
2898 : InstVRIa<opcode, (outs tr.op:$V1), (ins imm:$I2),
2899 mnemonic#"\t$V1, $I2",
2900 [(set (tr.vt tr.op:$V1), (operator (i32 timm:$I2)))]> {
2904 class UnaryVRIaGeneric<string mnemonic, bits<16> opcode, ImmOpWithPattern imm>
2905 : InstVRIa<opcode, (outs VR128:$V1), (ins imm:$I2, imm32zx4:$M3),
2906 mnemonic#"\t$V1, $I2, $M3", []>;
2908 class UnaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2909 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0,
2911 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2),
2912 mnemonic#"\t$V1, $V2",
2913 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]> {
2919 class UnaryVRRaGeneric<string mnemonic, bits<16> opcode, bits<4> m4 = 0,
2921 : InstVRRa<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3),
2922 mnemonic#"\t$V1, $V2, $M3", []> {
2927 class UnaryVRRaFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0>
2928 : InstVRRa<opcode, (outs VR128:$V1),
2929 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4),
2930 mnemonic#"\t$V1, $V2, $M3, $M4", []> {
2934 // Declare a pair of instructions, one which sets CC and one which doesn't.
2935 // The CC-setting form ends with "S" and sets the low bit of M5.
2936 // The form that does not set CC has an extra operand to optionally allow
2937 // specifying arbitrary M5 values in assembler.
2938 multiclass UnaryExtraVRRaSPair<string mnemonic, bits<16> opcode,
2939 SDPatternOperator operator,
2940 SDPatternOperator operator_cc,
2941 TypedReg tr1, TypedReg tr2, bits<4> type> {
2942 let M3 = type, M4 = 0 in
2943 def "" : InstVRRa<opcode, (outs tr1.op:$V1),
2944 (ins tr2.op:$V2, imm32zx4:$M5),
2945 mnemonic#"\t$V1, $V2, $M5", []>;
2946 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2))),
2947 (!cast<Instruction>(NAME) tr2.op:$V2, 0)>;
2948 def : InstAlias<mnemonic#"\t$V1, $V2",
2949 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 0)>;
2951 def S : UnaryVRRa<mnemonic##"s", opcode, operator_cc, tr1, tr2,
2955 multiclass UnaryExtraVRRaSPairGeneric<string mnemonic, bits<16> opcode> {
2956 let M4 = 0, Defs = [CC] in
2957 def "" : InstVRRa<opcode, (outs VR128:$V1),
2958 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M5),
2959 mnemonic#"\t$V1, $V2, $M3, $M5", []>;
2960 def : InstAlias<mnemonic#"\t$V1, $V2, $M3",
2961 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2,
2965 class UnaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2966 TypedReg tr, bits<5> bytes, bits<4> type = 0>
2967 : InstVRX<opcode, (outs tr.op:$V1), (ins bdxaddr12only:$XBD2),
2968 mnemonic#"\t$V1, $XBD2",
2969 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2))]> {
2972 let AccessBytes = bytes;
2975 class UnaryVRXGeneric<string mnemonic, bits<16> opcode>
2976 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
2977 mnemonic#"\t$V1, $XBD2, $M3", []> {
2981 multiclass UnaryVRXAlign<string mnemonic, bits<16> opcode> {
2982 let mayLoad = 1, AccessBytes = 16 in {
2983 def Align : InstVRX<opcode, (outs VR128:$V1),
2984 (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
2985 mnemonic#"\t$V1, $XBD2, $M3", []>;
2987 def "" : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2),
2988 mnemonic#"\t$V1, $XBD2", []>;
2992 class SideEffectBinaryRX<string mnemonic, bits<8> opcode,
2993 RegisterOperand cls>
2994 : InstRXa<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
2995 mnemonic##"\t$R1, $XBD2", []>;
2997 class SideEffectBinaryRXY<string mnemonic, bits<16> opcode,
2998 RegisterOperand cls>
2999 : InstRXYa<opcode, (outs), (ins cls:$R1, bdxaddr20only:$XBD2),
3000 mnemonic##"\t$R1, $XBD2", []>;
3002 class SideEffectBinaryRILPC<string mnemonic, bits<12> opcode,
3003 RegisterOperand cls>
3004 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
3005 mnemonic##"\t$R1, $RI2", []> {
3006 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
3007 // However, BDXs have two extra operands and are therefore 6 units more
3009 let AddedComplexity = 7;
3012 class SideEffectBinaryRRE<string mnemonic, bits<16> opcode,
3013 RegisterOperand cls1, RegisterOperand cls2>
3014 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3015 mnemonic#"\t$R1, $R2", []>;
3017 class SideEffectBinaryRRFa<string mnemonic, bits<16> opcode,
3018 RegisterOperand cls1, RegisterOperand cls2>
3019 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3020 mnemonic#"\t$R1, $R2", []> {
3025 class SideEffectBinaryRRFc<string mnemonic, bits<16> opcode,
3026 RegisterOperand cls1, RegisterOperand cls2>
3027 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3028 mnemonic#"\t$R1, $R2", []> {
3032 class SideEffectBinaryIE<string mnemonic, bits<16> opcode,
3033 ImmOpWithPattern imm1, ImmOpWithPattern imm2>
3034 : InstIE<opcode, (outs), (ins imm1:$I1, imm2:$I2),
3035 mnemonic#"\t$I1, $I2", []>;
3037 class SideEffectBinarySI<string mnemonic, bits<8> opcode, Operand imm>
3038 : InstSI<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
3039 mnemonic#"\t$BD1, $I2", []>;
3041 class SideEffectBinarySIL<string mnemonic, bits<16> opcode,
3042 SDPatternOperator operator, ImmOpWithPattern imm>
3043 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
3044 mnemonic#"\t$BD1, $I2", [(operator bdaddr12only:$BD1, imm:$I2)]>;
3046 class SideEffectBinarySSa<string mnemonic, bits<8> opcode>
3047 : InstSSa<opcode, (outs), (ins bdladdr12onlylen8:$BDL1, bdaddr12only:$BD2),
3048 mnemonic##"\t$BDL1, $BD2", []>;
3050 class SideEffectBinarySSb<string mnemonic, bits<8> opcode>
3052 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2),
3053 mnemonic##"\t$BDL1, $BDL2", []>;
3055 class SideEffectBinarySSf<string mnemonic, bits<8> opcode>
3056 : InstSSf<opcode, (outs), (ins bdaddr12only:$BD1, bdladdr12onlylen8:$BDL2),
3057 mnemonic##"\t$BD1, $BDL2", []>;
3059 class SideEffectBinarySSE<string mnemonic, bits<16> opcode>
3060 : InstSSE<opcode, (outs), (ins bdaddr12only:$BD1, bdaddr12only:$BD2),
3061 mnemonic#"\t$BD1, $BD2", []>;
3063 class SideEffectBinaryMemMemRR<string mnemonic, bits<8> opcode,
3064 RegisterOperand cls1, RegisterOperand cls2>
3065 : InstRR<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3066 mnemonic#"\t$R1, $R2", []> {
3067 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3068 let DisableEncoding = "$R1src, $R2src";
3071 class SideEffectBinaryMemRRE<string mnemonic, bits<16> opcode,
3072 RegisterOperand cls1, RegisterOperand cls2>
3073 : InstRRE<opcode, (outs cls2:$R2), (ins cls1:$R1, cls2:$R2src),
3074 mnemonic#"\t$R1, $R2", []> {
3075 let Constraints = "$R2 = $R2src";
3076 let DisableEncoding = "$R2src";
3079 class SideEffectBinaryMemMemRRE<string mnemonic, bits<16> opcode,
3080 RegisterOperand cls1, RegisterOperand cls2>
3081 : InstRRE<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3082 mnemonic#"\t$R1, $R2", []> {
3083 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3084 let DisableEncoding = "$R1src, $R2src";
3087 class SideEffectBinaryMemMemRRFc<string mnemonic, bits<16> opcode,
3088 RegisterOperand cls1, RegisterOperand cls2>
3089 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3090 mnemonic#"\t$R1, $R2", []> {
3091 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3092 let DisableEncoding = "$R1src, $R2src";
3096 class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3097 RegisterOperand cls1, RegisterOperand cls2>
3098 : InstRR<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3099 mnemonic#"\t$R1, $R2",
3100 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
3101 let OpKey = mnemonic#cls1;
3103 let Constraints = "$R1 = $R1src";
3104 let DisableEncoding = "$R1src";
3107 class BinaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3108 RegisterOperand cls1, RegisterOperand cls2>
3109 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3110 mnemonic#"\t$R1, $R2",
3111 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
3112 let OpKey = mnemonic#cls1;
3114 let Constraints = "$R1 = $R1src";
3115 let DisableEncoding = "$R1src";
3118 class BinaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3119 RegisterOperand cls1, RegisterOperand cls2>
3120 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R3, cls2:$R2),
3121 mnemonic#"\t$R1, $R3, $R2",
3122 [(set cls1:$R1, (operator cls2:$R3, cls2:$R2))]> {
3123 let OpKey = mnemonic#cls;
3127 class BinaryRRFa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3128 RegisterOperand cls1, RegisterOperand cls2,
3129 RegisterOperand cls3>
3130 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
3131 mnemonic#"\t$R1, $R2, $R3",
3132 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
3134 let OpKey = mnemonic#cls1;
3138 multiclass BinaryRRAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
3139 SDPatternOperator operator, RegisterOperand cls1,
3140 RegisterOperand cls2> {
3141 let NumOpsKey = mnemonic in {
3142 let NumOpsValue = "3" in
3143 def K : BinaryRRFa<mnemonic#"k", opcode2, operator, cls1, cls1, cls2>,
3144 Requires<[FeatureDistinctOps]>;
3145 let NumOpsValue = "2" in
3146 def "" : BinaryRR<mnemonic, opcode1, operator, cls1, cls2>;
3150 multiclass BinaryRREAndK<string mnemonic, bits<16> opcode1, bits<16> opcode2,
3151 SDPatternOperator operator, RegisterOperand cls1,
3152 RegisterOperand cls2> {
3153 let NumOpsKey = mnemonic in {
3154 let NumOpsValue = "3" in
3155 def K : BinaryRRFa<mnemonic#"k", opcode2, operator, cls1, cls1, cls2>,
3156 Requires<[FeatureDistinctOps]>;
3157 let NumOpsValue = "2" in
3158 def "" : BinaryRRE<mnemonic, opcode1, operator, cls1, cls2>;
3162 class BinaryRRFb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3163 RegisterOperand cls1, RegisterOperand cls2,
3164 RegisterOperand cls3>
3165 : InstRRFb<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
3166 mnemonic#"\t$R1, $R3, $R2",
3167 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
3171 class BinaryRRFc<string mnemonic, bits<16> opcode,
3172 RegisterOperand cls1, RegisterOperand cls2>
3173 : InstRRFc<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M3),
3174 mnemonic#"\t$R1, $R2, $M3", []>;
3176 class BinaryMemRRFc<string mnemonic, bits<16> opcode,
3177 RegisterOperand cls1, RegisterOperand cls2, ImmOpWithPattern imm>
3178 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src, imm:$M3),
3179 mnemonic#"\t$R1, $R2, $M3", []> {
3180 let Constraints = "$R1 = $R1src";
3181 let DisableEncoding = "$R1src";
3184 multiclass BinaryMemRRFcOpt<string mnemonic, bits<16> opcode,
3185 RegisterOperand cls1, RegisterOperand cls2> {
3186 def "" : BinaryMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
3187 def Opt : UnaryMemRRFc<mnemonic, opcode, cls1, cls2>;
3190 class BinaryRRFd<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3191 RegisterOperand cls2>
3192 : InstRRFd<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M4),
3193 mnemonic#"\t$R1, $R2, $M4", []>;
3195 class BinaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3196 RegisterOperand cls2>
3197 : InstRRFe<opcode, (outs cls1:$R1), (ins imm32zx4:$M3, cls2:$R2),
3198 mnemonic#"\t$R1, $M3, $R2", []> {
3202 class CondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3203 RegisterOperand cls2>
3204 : InstRRFc<opcode, (outs cls1:$R1),
3205 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
3206 mnemonic#"$M3\t$R1, $R2",
3207 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src,
3208 cond4:$valid, cond4:$M3))]> {
3209 let Constraints = "$R1 = $R1src";
3210 let DisableEncoding = "$R1src";
3212 let NumOpsKey = !subst("loc", "sel", mnemonic);
3213 let NumOpsValue = "2";
3216 // Like CondBinaryRRF, but used for the raw assembly form. The condition-code
3217 // mask is the third operand rather than being part of the mnemonic.
3218 class AsmCondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3219 RegisterOperand cls2>
3220 : InstRRFc<opcode, (outs cls1:$R1),
3221 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M3),
3222 mnemonic#"\t$R1, $R2, $M3", []> {
3223 let Constraints = "$R1 = $R1src";
3224 let DisableEncoding = "$R1src";
3227 // Like CondBinaryRRF, but with a fixed CC mask.
3228 class FixedCondBinaryRRF<CondVariant V, string mnemonic, bits<16> opcode,
3229 RegisterOperand cls1, RegisterOperand cls2>
3230 : InstRRFc<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3231 mnemonic#V.suffix#"\t$R1, $R2", []> {
3232 let Constraints = "$R1 = $R1src";
3233 let DisableEncoding = "$R1src";
3234 let isAsmParserOnly = V.alternate;
3238 multiclass CondBinaryRRFPair<string mnemonic, bits<16> opcode,
3239 RegisterOperand cls1, RegisterOperand cls2> {
3240 let isCodeGenOnly = 1 in
3241 def "" : CondBinaryRRF<mnemonic, opcode, cls1, cls2>;
3242 def Asm : AsmCondBinaryRRF<mnemonic, opcode, cls1, cls2>;
3245 class CondBinaryRRFa<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3246 RegisterOperand cls2, RegisterOperand cls3>
3247 : InstRRFa<opcode, (outs cls1:$R1),
3248 (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4),
3249 mnemonic#"$M4\t$R1, $R2, $R3",
3250 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3,
3251 cond4:$valid, cond4:$M4))]> {
3253 let NumOpsKey = mnemonic;
3254 let NumOpsValue = "3";
3257 // Like CondBinaryRRFa, but used for the raw assembly form. The condition-code
3258 // mask is the third operand rather than being part of the mnemonic.
3259 class AsmCondBinaryRRFa<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3260 RegisterOperand cls2, RegisterOperand cls3>
3261 : InstRRFa<opcode, (outs cls1:$R1), (ins cls3:$R3, cls2:$R2, imm32zx4:$M4),
3262 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
3264 // Like CondBinaryRRFa, but with a fixed CC mask.
3265 class FixedCondBinaryRRFa<CondVariant V, string mnemonic, bits<16> opcode,
3266 RegisterOperand cls1, RegisterOperand cls2,
3267 RegisterOperand cls3>
3268 : InstRRFa<opcode, (outs cls1:$R1), (ins cls3:$R3, cls2:$R2),
3269 mnemonic#V.suffix#"\t$R1, $R2, $R3", []> {
3270 let isAsmParserOnly = V.alternate;
3274 multiclass CondBinaryRRFaPair<string mnemonic, bits<16> opcode,
3275 RegisterOperand cls1, RegisterOperand cls2,
3276 RegisterOperand cls3> {
3277 let isCodeGenOnly = 1 in
3278 def "" : CondBinaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
3279 def Asm : AsmCondBinaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
3282 class BinaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3283 RegisterOperand cls, ImmOpWithPattern imm>
3284 : InstRIa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3285 mnemonic#"\t$R1, $I2",
3286 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
3287 let Constraints = "$R1 = $R1src";
3288 let DisableEncoding = "$R1src";
3291 class BinaryRIE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3292 RegisterOperand cls, ImmOpWithPattern imm>
3293 : InstRIEd<opcode, (outs cls:$R1), (ins cls:$R3, imm:$I2),
3294 mnemonic#"\t$R1, $R3, $I2",
3295 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
3297 multiclass BinaryRIAndK<string mnemonic, bits<12> opcode1, bits<16> opcode2,
3298 SDPatternOperator operator, RegisterOperand cls,
3299 ImmOpWithPattern imm> {
3300 let NumOpsKey = mnemonic in {
3301 let NumOpsValue = "3" in
3302 def K : BinaryRIE<mnemonic##"k", opcode2, operator, cls, imm>,
3303 Requires<[FeatureDistinctOps]>;
3304 let NumOpsValue = "2" in
3305 def "" : BinaryRI<mnemonic, opcode1, operator, cls, imm>;
3309 class CondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3310 ImmOpWithPattern imm>
3311 : InstRIEg<opcode, (outs cls:$R1),
3312 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
3313 mnemonic#"$M3\t$R1, $I2",
3314 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
3315 cond4:$valid, cond4:$M3))]> {
3316 let Constraints = "$R1 = $R1src";
3317 let DisableEncoding = "$R1src";
3321 // Like CondBinaryRIE, but used for the raw assembly form. The condition-code
3322 // mask is the third operand rather than being part of the mnemonic.
3323 class AsmCondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3324 ImmOpWithPattern imm>
3325 : InstRIEg<opcode, (outs cls:$R1),
3326 (ins cls:$R1src, imm:$I2, imm32zx4:$M3),
3327 mnemonic#"\t$R1, $I2, $M3", []> {
3328 let Constraints = "$R1 = $R1src";
3329 let DisableEncoding = "$R1src";
3332 // Like CondBinaryRIE, but with a fixed CC mask.
3333 class FixedCondBinaryRIE<CondVariant V, string mnemonic, bits<16> opcode,
3334 RegisterOperand cls, ImmOpWithPattern imm>
3335 : InstRIEg<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3336 mnemonic#V.suffix#"\t$R1, $I2", []> {
3337 let Constraints = "$R1 = $R1src";
3338 let DisableEncoding = "$R1src";
3339 let isAsmParserOnly = V.alternate;
3343 multiclass CondBinaryRIEPair<string mnemonic, bits<16> opcode,
3344 RegisterOperand cls, ImmOpWithPattern imm> {
3345 let isCodeGenOnly = 1 in
3346 def "" : CondBinaryRIE<mnemonic, opcode, cls, imm>;
3347 def Asm : AsmCondBinaryRIE<mnemonic, opcode, cls, imm>;
3350 class BinaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3351 RegisterOperand cls, ImmOpWithPattern imm>
3352 : InstRILa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3353 mnemonic#"\t$R1, $I2",
3354 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
3355 let Constraints = "$R1 = $R1src";
3356 let DisableEncoding = "$R1src";
3359 class BinaryRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3360 RegisterOperand cls>
3361 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, shift12only:$BD2),
3362 mnemonic#"\t$R1, $BD2",
3363 [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> {
3365 let Constraints = "$R1 = $R1src";
3366 let DisableEncoding = "$R1src";
3369 class BinaryRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3370 RegisterOperand cls>
3371 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, shift20only:$BD2),
3372 mnemonic#"\t$R1, $R3, $BD2",
3373 [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>;
3375 multiclass BinaryRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
3376 SDPatternOperator operator, RegisterOperand cls> {
3377 let NumOpsKey = mnemonic in {
3378 let NumOpsValue = "3" in
3379 def K : BinaryRSY<mnemonic##"k", opcode2, operator, cls>,
3380 Requires<[FeatureDistinctOps]>;
3381 let NumOpsValue = "2" in
3382 def "" : BinaryRS<mnemonic, opcode1, operator, cls>;
3386 class BinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
3387 : InstRSLb<opcode, (outs cls:$R1),
3388 (ins bdladdr12onlylen8:$BDL2, imm32zx4:$M3),
3389 mnemonic#"\t$R1, $BDL2, $M3", []> {
3393 class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3394 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3395 AddressingMode mode = bdxaddr12only>
3396 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2),
3397 mnemonic#"\t$R1, $XBD2",
3398 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3399 let OpKey = mnemonic#"r"#cls;
3401 let Constraints = "$R1 = $R1src";
3402 let DisableEncoding = "$R1src";
3404 let AccessBytes = bytes;
3407 class BinaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3408 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
3409 : InstRXE<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2),
3410 mnemonic#"\t$R1, $XBD2",
3411 [(set cls:$R1, (operator cls:$R1src,
3412 (load bdxaddr12only:$XBD2)))]> {
3413 let OpKey = mnemonic#"r"#cls;
3415 let Constraints = "$R1 = $R1src";
3416 let DisableEncoding = "$R1src";
3418 let AccessBytes = bytes;
3422 class BinaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3423 RegisterOperand cls1, RegisterOperand cls2,
3424 SDPatternOperator load, bits<5> bytes>
3425 : InstRXF<opcode, (outs cls1:$R1), (ins cls2:$R3, bdxaddr12only:$XBD2),
3426 mnemonic#"\t$R1, $R3, $XBD2",
3427 [(set cls1:$R1, (operator cls2:$R3, (load bdxaddr12only:$XBD2)))]> {
3428 let OpKey = mnemonic#"r"#cls;
3431 let AccessBytes = bytes;
3434 class BinaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3435 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3436 AddressingMode mode = bdxaddr20only>
3437 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2),
3438 mnemonic#"\t$R1, $XBD2",
3439 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3440 let OpKey = mnemonic#"r"#cls;
3442 let Constraints = "$R1 = $R1src";
3443 let DisableEncoding = "$R1src";
3445 let AccessBytes = bytes;
3448 multiclass BinaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3449 SDPatternOperator operator, RegisterOperand cls,
3450 SDPatternOperator load, bits<5> bytes> {
3451 let DispKey = mnemonic ## #cls in {
3452 let DispSize = "12" in
3453 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes,
3455 let DispSize = "20" in
3456 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load, bytes,
3461 class BinarySI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3462 Operand imm, AddressingMode mode = bdaddr12only>
3463 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
3464 mnemonic#"\t$BD1, $I2",
3465 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
3470 class BinarySIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3471 Operand imm, AddressingMode mode = bdaddr20only>
3472 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
3473 mnemonic#"\t$BD1, $I2",
3474 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
3479 multiclass BinarySIPair<string mnemonic, bits<8> siOpcode,
3480 bits<16> siyOpcode, SDPatternOperator operator,
3482 let DispKey = mnemonic ## #cls in {
3483 let DispSize = "12" in
3484 def "" : BinarySI<mnemonic, siOpcode, operator, imm, bdaddr12pair>;
3485 let DispSize = "20" in
3486 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>;
3490 class BinarySSF<string mnemonic, bits<12> opcode, RegisterOperand cls>
3491 : InstSSF<opcode, (outs cls:$R3), (ins bdaddr12pair:$BD1, bdaddr12pair:$BD2),
3492 mnemonic#"\t$R3, $BD1, $BD2", []> {
3496 class BinaryVRIb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3497 TypedReg tr, bits<4> type>
3498 : InstVRIb<opcode, (outs tr.op:$V1), (ins imm32zx8:$I2, imm32zx8:$I3),
3499 mnemonic#"\t$V1, $I2, $I3",
3500 [(set (tr.vt tr.op:$V1), (operator imm32zx8_timm:$I2, imm32zx8_timm:$I3))]> {
3504 class BinaryVRIbGeneric<string mnemonic, bits<16> opcode>
3505 : InstVRIb<opcode, (outs VR128:$V1),
3506 (ins imm32zx8:$I2, imm32zx8:$I3, imm32zx4:$M4),
3507 mnemonic#"\t$V1, $I2, $I3, $M4", []>;
3509 class BinaryVRIc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3510 TypedReg tr1, TypedReg tr2, bits<4> type>
3511 : InstVRIc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, imm32zx16:$I2),
3512 mnemonic#"\t$V1, $V3, $I2",
3513 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3),
3514 imm32zx16_timm:$I2))]> {
3518 class BinaryVRIcGeneric<string mnemonic, bits<16> opcode>
3519 : InstVRIc<opcode, (outs VR128:$V1),
3520 (ins VR128:$V3, imm32zx16:$I2, imm32zx4:$M4),
3521 mnemonic#"\t$V1, $V3, $I2, $M4", []>;
3523 class BinaryVRIe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3524 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5>
3525 : InstVRIe<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx12:$I3),
3526 mnemonic#"\t$V1, $V2, $I3",
3527 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3528 imm32zx12_timm:$I3))]> {
3533 class BinaryVRIeFloatGeneric<string mnemonic, bits<16> opcode>
3534 : InstVRIe<opcode, (outs VR128:$V1),
3535 (ins VR128:$V2, imm32zx12:$I3, imm32zx4:$M4, imm32zx4:$M5),
3536 mnemonic#"\t$V1, $V2, $I3, $M4, $M5", []>;
3538 class BinaryVRIh<string mnemonic, bits<16> opcode>
3539 : InstVRIh<opcode, (outs VR128:$V1),
3540 (ins imm32zx16:$I2, imm32zx4:$I3),
3541 mnemonic#"\t$V1, $I2, $I3", []>;
3543 class BinaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3544 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0>
3545 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx4:$M5),
3546 mnemonic#"\t$V1, $V2, $M5",
3547 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3553 class BinaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
3554 : InstVRRa<opcode, (outs VR128:$V1),
3555 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
3556 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
3558 class BinaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3559 TypedReg tr1, TypedReg tr2, bits<4> type = 0,
3560 bits<4> modifier = 0>
3561 : InstVRRb<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3562 mnemonic#"\t$V1, $V2, $V3",
3563 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3564 (tr2.vt tr2.op:$V3)))]> {
3569 // Declare a pair of instructions, one which sets CC and one which doesn't.
3570 // The CC-setting form ends with "S" and sets the low bit of M5.
3571 multiclass BinaryVRRbSPair<string mnemonic, bits<16> opcode,
3572 SDPatternOperator operator,
3573 SDPatternOperator operator_cc, TypedReg tr1,
3574 TypedReg tr2, bits<4> type, bits<4> modifier = 0> {
3575 def "" : BinaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
3576 !and (modifier, 14)>;
3578 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
3579 !add (!and (modifier, 14), 1)>;
3582 class BinaryVRRbSPairGeneric<string mnemonic, bits<16> opcode>
3583 : InstVRRb<opcode, (outs VR128:$V1),
3584 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3585 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> {
3589 // Declare a pair of instructions, one which sets CC and one which doesn't.
3590 // The CC-setting form ends with "S" and sets the low bit of M5.
3591 // The form that does not set CC has an extra operand to optionally allow
3592 // specifying arbitrary M5 values in assembler.
3593 multiclass BinaryExtraVRRbSPair<string mnemonic, bits<16> opcode,
3594 SDPatternOperator operator,
3595 SDPatternOperator operator_cc,
3596 TypedReg tr1, TypedReg tr2, bits<4> type> {
3598 def "" : InstVRRb<opcode, (outs tr1.op:$V1),
3599 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M5),
3600 mnemonic#"\t$V1, $V2, $V3, $M5", []>;
3601 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3))),
3602 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, 0)>;
3603 def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
3604 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
3607 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 1>;
3610 multiclass BinaryExtraVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
3612 def "" : InstVRRb<opcode, (outs VR128:$V1),
3613 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3614 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
3615 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
3616 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
3620 class BinaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3621 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0,
3623 : InstVRRc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3624 mnemonic#"\t$V1, $V2, $V3",
3625 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3626 (tr2.vt tr2.op:$V3)))]> {
3632 class BinaryVRRcGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0,
3634 : InstVRRc<opcode, (outs VR128:$V1),
3635 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4),
3636 mnemonic#"\t$V1, $V2, $V3, $M4", []> {
3641 class BinaryVRRcFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m6 = 0>
3642 : InstVRRc<opcode, (outs VR128:$V1),
3643 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3644 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> {
3648 // Declare a pair of instructions, one which sets CC and one which doesn't.
3649 // The CC-setting form ends with "S" and sets the low bit of M5.
3650 multiclass BinaryVRRcSPair<string mnemonic, bits<16> opcode,
3651 SDPatternOperator operator,
3652 SDPatternOperator operator_cc, TypedReg tr1,
3653 TypedReg tr2, bits<4> type, bits<4> m5,
3654 bits<4> modifier = 0> {
3655 def "" : BinaryVRRc<mnemonic, opcode, operator, tr1, tr2, type,
3656 m5, !and (modifier, 14)>;
3658 def S : BinaryVRRc<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
3659 m5, !add (!and (modifier, 14), 1)>;
3662 class BinaryVRRcSPairFloatGeneric<string mnemonic, bits<16> opcode>
3663 : InstVRRc<opcode, (outs VR128:$V1),
3664 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
3666 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
3668 class BinaryVRRf<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3670 : InstVRRf<opcode, (outs tr.op:$V1), (ins GR64:$R2, GR64:$R3),
3671 mnemonic#"\t$V1, $R2, $R3",
3672 [(set (tr.vt tr.op:$V1), (operator GR64:$R2, GR64:$R3))]>;
3674 class BinaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls>
3675 : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2, imm32zx4:$M3),
3676 mnemonic#"\t$R1, $V2, $M3", []> {
3680 class BinaryVRSa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3681 TypedReg tr1, TypedReg tr2, bits<4> type>
3682 : InstVRSa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, shift12only:$BD2),
3683 mnemonic#"\t$V1, $V3, $BD2",
3684 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3),
3685 shift12only:$BD2))]> {
3689 class BinaryVRSaGeneric<string mnemonic, bits<16> opcode>
3690 : InstVRSa<opcode, (outs VR128:$V1),
3691 (ins VR128:$V3, shift12only:$BD2, imm32zx4:$M4),
3692 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
3694 class BinaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3696 : InstVRSb<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2),
3697 mnemonic#"\t$V1, $R3, $BD2",
3698 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
3701 let AccessBytes = bytes;
3704 class BinaryVRSc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3705 TypedReg tr, bits<4> type>
3706 : InstVRSc<opcode, (outs GR64:$R1), (ins tr.op:$V3, shift12only:$BD2),
3707 mnemonic#"\t$R1, $V3, $BD2",
3708 [(set GR64:$R1, (operator (tr.vt tr.op:$V3), shift12only:$BD2))]> {
3712 class BinaryVRScGeneric<string mnemonic, bits<16> opcode>
3713 : InstVRSc<opcode, (outs GR64:$R1),
3714 (ins VR128:$V3, shift12only:$BD2, imm32zx4: $M4),
3715 mnemonic#"\t$R1, $V3, $BD2, $M4", []>;
3717 class BinaryVRSd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3719 : InstVRSd<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2),
3720 mnemonic#"\t$V1, $R3, $BD2",
3721 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
3723 let AccessBytes = bytes;
3726 class BinaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3727 TypedReg tr, bits<5> bytes>
3728 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
3729 mnemonic#"\t$V1, $XBD2, $M3",
3730 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2,
3731 imm32zx4_timm:$M3))]> {
3733 let AccessBytes = bytes;
3736 class StoreBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
3737 bits<5> bytes, AddressingMode mode = bdaddr12only>
3738 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3739 mnemonic#"\t$R1, $M3, $BD2", []> {
3741 let AccessBytes = bytes;
3744 class StoreBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
3745 bits<5> bytes, AddressingMode mode = bdaddr20only>
3746 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3747 mnemonic#"\t$R1, $M3, $BD2", []> {
3749 let AccessBytes = bytes;
3752 multiclass StoreBinaryRSPair<string mnemonic, bits<8> rsOpcode,
3753 bits<16> rsyOpcode, RegisterOperand cls,
3755 let DispKey = mnemonic ## #cls in {
3756 let DispSize = "12" in
3757 def "" : StoreBinaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
3758 let DispSize = "20" in
3759 def Y : StoreBinaryRSY<mnemonic#"y", rsyOpcode, cls, bytes,
3764 class StoreBinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
3765 : InstRSLb<opcode, (outs),
3766 (ins cls:$R1, bdladdr12onlylen8:$BDL2, imm32zx4:$M3),
3767 mnemonic#"\t$R1, $BDL2, $M3", []> {
3771 class BinaryVSI<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3773 : InstVSI<opcode, (outs VR128:$V1), (ins bdaddr12only:$BD2, imm32zx8:$I3),
3774 mnemonic#"\t$V1, $BD2, $I3",
3775 [(set VR128:$V1, (operator imm32zx8:$I3, bdaddr12only:$BD2))]> {
3777 let AccessBytes = bytes;
3780 class StoreBinaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
3781 ImmOpWithPattern index>
3782 : InstVRV<opcode, (outs), (ins VR128:$V1, bdvaddr12only:$VBD2, index:$M3),
3783 mnemonic#"\t$V1, $VBD2, $M3", []> {
3785 let AccessBytes = bytes;
3788 class StoreBinaryVRX<string mnemonic, bits<16> opcode,
3789 SDPatternOperator operator, TypedReg tr, bits<5> bytes,
3790 ImmOpWithPattern index>
3791 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2, index:$M3),
3792 mnemonic#"\t$V1, $XBD2, $M3",
3793 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2, index:$M3)]> {
3795 let AccessBytes = bytes;
3798 class MemoryBinarySSd<string mnemonic, bits<8> opcode,
3799 RegisterOperand cls>
3800 : InstSSd<opcode, (outs),
3801 (ins bdraddr12only:$RBD1, bdaddr12only:$BD2, cls:$R3),
3802 mnemonic#"\t$RBD1, $BD2, $R3", []>;
3804 class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3805 RegisterOperand cls1, RegisterOperand cls2>
3806 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3807 mnemonic#"\t$R1, $R2",
3808 [(set CC, (operator cls1:$R1, cls2:$R2))]> {
3809 let OpKey = mnemonic#cls1;
3814 class CompareRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3815 RegisterOperand cls1, RegisterOperand cls2>
3816 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3817 mnemonic#"\t$R1, $R2",
3818 [(set CC, (operator cls1:$R1, cls2:$R2))]> {
3819 let OpKey = mnemonic#cls1;
3824 class CompareRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3825 RegisterOperand cls, ImmOpWithPattern imm>
3826 : InstRIa<opcode, (outs), (ins cls:$R1, imm:$I2),
3827 mnemonic#"\t$R1, $I2",
3828 [(set CC, (operator cls:$R1, imm:$I2))]> {
3832 class CompareRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3833 RegisterOperand cls, ImmOpWithPattern imm>
3834 : InstRILa<opcode, (outs), (ins cls:$R1, imm:$I2),
3835 mnemonic#"\t$R1, $I2",
3836 [(set CC, (operator cls:$R1, imm:$I2))]> {
3840 class CompareRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3841 RegisterOperand cls, SDPatternOperator load>
3842 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
3843 mnemonic#"\t$R1, $RI2",
3844 [(set CC, (operator cls:$R1, (load pcrel32:$RI2)))]> {
3847 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
3848 // However, BDXs have two extra operands and are therefore 6 units more
3850 let AddedComplexity = 7;
3853 class CompareRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3854 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3855 AddressingMode mode = bdxaddr12only>
3856 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
3857 mnemonic#"\t$R1, $XBD2",
3858 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
3859 let OpKey = mnemonic#"r"#cls;
3863 let AccessBytes = bytes;
3866 class CompareRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3867 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
3868 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
3869 mnemonic#"\t$R1, $XBD2",
3870 [(set CC, (operator cls:$R1, (load bdxaddr12only:$XBD2)))]> {
3871 let OpKey = mnemonic#"r"#cls;
3875 let AccessBytes = bytes;
3879 class CompareRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3880 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3881 AddressingMode mode = bdxaddr20only>
3882 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
3883 mnemonic#"\t$R1, $XBD2",
3884 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
3885 let OpKey = mnemonic#"r"#cls;
3889 let AccessBytes = bytes;
3892 multiclass CompareRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3893 SDPatternOperator operator, RegisterOperand cls,
3894 SDPatternOperator load, bits<5> bytes> {
3895 let DispKey = mnemonic ## #cls in {
3896 let DispSize = "12" in
3897 def "" : CompareRX<mnemonic, rxOpcode, operator, cls,
3898 load, bytes, bdxaddr12pair>;
3899 let DispSize = "20" in
3900 def Y : CompareRXY<mnemonic#"y", rxyOpcode, operator, cls,
3901 load, bytes, bdxaddr20pair>;
3905 class CompareRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
3906 bits<5> bytes, AddressingMode mode = bdaddr12only>
3907 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3908 mnemonic#"\t$R1, $M3, $BD2", []> {
3910 let AccessBytes = bytes;
3913 class CompareRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
3914 bits<5> bytes, AddressingMode mode = bdaddr20only>
3915 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3916 mnemonic#"\t$R1, $M3, $BD2", []> {
3918 let AccessBytes = bytes;
3921 multiclass CompareRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
3922 RegisterOperand cls, bits<5> bytes> {
3923 let DispKey = mnemonic ## #cls in {
3924 let DispSize = "12" in
3925 def "" : CompareRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
3926 let DispSize = "20" in
3927 def Y : CompareRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
3931 class CompareSSb<string mnemonic, bits<8> opcode>
3933 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2),
3934 mnemonic##"\t$BDL1, $BDL2", []> {
3939 class CompareSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3940 SDPatternOperator load, ImmOpWithPattern imm,
3941 AddressingMode mode = bdaddr12only>
3942 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
3943 mnemonic#"\t$BD1, $I2",
3944 [(set CC, (operator (load mode:$BD1), imm:$I2))]> {
3949 class CompareSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3950 SDPatternOperator load, ImmOpWithPattern imm>
3951 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
3952 mnemonic#"\t$BD1, $I2",
3953 [(set CC, (operator (load bdaddr12only:$BD1), imm:$I2))]> {
3958 class CompareSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3959 SDPatternOperator load, ImmOpWithPattern imm,
3960 AddressingMode mode = bdaddr20only>
3961 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
3962 mnemonic#"\t$BD1, $I2",
3963 [(set CC, (operator (load mode:$BD1), imm:$I2))]> {
3968 multiclass CompareSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
3969 SDPatternOperator operator, SDPatternOperator load,
3970 ImmOpWithPattern imm> {
3971 let DispKey = mnemonic in {
3972 let DispSize = "12" in
3973 def "" : CompareSI<mnemonic, siOpcode, operator, load, imm, bdaddr12pair>;
3974 let DispSize = "20" in
3975 def Y : CompareSIY<mnemonic#"y", siyOpcode, operator, load, imm,
3980 class CompareVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3981 TypedReg tr, bits<4> type>
3982 : InstVRRa<opcode, (outs), (ins tr.op:$V1, tr.op:$V2),
3983 mnemonic#"\t$V1, $V2",
3984 [(set CC, (operator (tr.vt tr.op:$V1), (tr.vt tr.op:$V2)))]> {
3991 class CompareVRRaGeneric<string mnemonic, bits<16> opcode>
3992 : InstVRRa<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
3993 mnemonic#"\t$V1, $V2, $M3", []> {
3999 class CompareVRRaFloatGeneric<string mnemonic, bits<16> opcode>
4000 : InstVRRa<opcode, (outs),
4001 (ins VR64:$V1, VR64:$V2, imm32zx4:$M3, imm32zx4:$M4),
4002 mnemonic#"\t$V1, $V2, $M3, $M4", []> {
4007 class CompareVRRh<string mnemonic, bits<16> opcode>
4008 : InstVRRh<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
4009 mnemonic#"\t$V1, $V2, $M3", []> {
4013 class TestInherentS<string mnemonic, bits<16> opcode,
4014 SDPatternOperator operator>
4015 : InstS<opcode, (outs), (ins), mnemonic, [(set CC, (operator))]> {
4019 class TestRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4020 RegisterOperand cls>
4021 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
4022 mnemonic#"\t$R1, $XBD2",
4023 [(set CC, (operator cls:$R1, bdxaddr12only:$XBD2))]> {
4027 class TestBinarySIL<string mnemonic, bits<16> opcode,
4028 SDPatternOperator operator, ImmOpWithPattern imm>
4029 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
4030 mnemonic#"\t$BD1, $I2",
4031 [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>;
4033 class TestRSL<string mnemonic, bits<16> opcode>
4034 : InstRSLa<opcode, (outs), (ins bdladdr12onlylen4:$BDL1),
4035 mnemonic#"\t$BDL1", []> {
4039 class TestVRRg<string mnemonic, bits<16> opcode>
4040 : InstVRRg<opcode, (outs), (ins VR128:$V1),
4041 mnemonic#"\t$V1", []>;
4043 class SideEffectTernarySSc<string mnemonic, bits<8> opcode>
4044 : InstSSc<opcode, (outs), (ins bdladdr12onlylen4:$BDL1,
4045 shift12only:$BD2, imm32zx4:$I3),
4046 mnemonic##"\t$BDL1, $BD2, $I3", []>;
4048 class SideEffectTernaryRRFa<string mnemonic, bits<16> opcode,
4049 RegisterOperand cls1, RegisterOperand cls2,
4050 RegisterOperand cls3>
4051 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3),
4052 mnemonic#"\t$R1, $R2, $R3", []> {
4056 class SideEffectTernaryMemMemRRFa<string mnemonic, bits<16> opcode,
4057 RegisterOperand cls1, RegisterOperand cls2,
4058 RegisterOperand cls3>
4059 : InstRRFa<opcode, (outs cls1:$R1, cls2:$R2),
4060 (ins cls1:$R1src, cls2:$R2src, cls3:$R3),
4061 mnemonic#"\t$R1, $R2, $R3", []> {
4062 let Constraints = "$R1 = $R1src, $R2 = $R2src";
4063 let DisableEncoding = "$R1src, $R2src";
4067 class SideEffectTernaryRRFb<string mnemonic, bits<16> opcode,
4068 RegisterOperand cls1, RegisterOperand cls2,
4069 RegisterOperand cls3>
4070 : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3),
4071 mnemonic#"\t$R1, $R3, $R2", []> {
4075 class SideEffectTernaryMemMemMemRRFb<string mnemonic, bits<16> opcode,
4076 RegisterOperand cls1,
4077 RegisterOperand cls2,
4078 RegisterOperand cls3>
4079 : InstRRFb<opcode, (outs cls1:$R1, cls2:$R2, cls3:$R3),
4080 (ins cls1:$R1src, cls2:$R2src, cls3:$R3src),
4081 mnemonic#"\t$R1, $R3, $R2", []> {
4082 let Constraints = "$R1 = $R1src, $R2 = $R2src, $R3 = $R3src";
4083 let DisableEncoding = "$R1src, $R2src, $R3src";
4087 class SideEffectTernaryRRFc<string mnemonic, bits<16> opcode,
4088 RegisterOperand cls1, RegisterOperand cls2,
4089 ImmOpWithPattern imm>
4090 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2, imm:$M3),
4091 mnemonic#"\t$R1, $R2, $M3", []>;
4093 multiclass SideEffectTernaryRRFcOpt<string mnemonic, bits<16> opcode,
4094 RegisterOperand cls1,
4095 RegisterOperand cls2> {
4096 def "" : SideEffectTernaryRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
4097 def Opt : SideEffectBinaryRRFc<mnemonic, opcode, cls1, cls2>;
4100 class SideEffectTernaryMemMemRRFc<string mnemonic, bits<16> opcode,
4101 RegisterOperand cls1, RegisterOperand cls2,
4102 ImmOpWithPattern imm>
4103 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2),
4104 (ins cls1:$R1src, cls2:$R2src, imm:$M3),
4105 mnemonic#"\t$R1, $R2, $M3", []> {
4106 let Constraints = "$R1 = $R1src, $R2 = $R2src";
4107 let DisableEncoding = "$R1src, $R2src";
4110 multiclass SideEffectTernaryMemMemRRFcOpt<string mnemonic, bits<16> opcode,
4111 RegisterOperand cls1,
4112 RegisterOperand cls2> {
4113 def "" : SideEffectTernaryMemMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
4114 def Opt : SideEffectBinaryMemMemRRFc<mnemonic, opcode, cls1, cls2>;
4117 class SideEffectTernarySSF<string mnemonic, bits<12> opcode,
4118 RegisterOperand cls>
4119 : InstSSF<opcode, (outs),
4120 (ins bdaddr12only:$BD1, bdaddr12only:$BD2, cls:$R3),
4121 mnemonic#"\t$BD1, $BD2, $R3", []>;
4123 class TernaryRRFa<string mnemonic, bits<16> opcode,
4124 RegisterOperand cls1, RegisterOperand cls2,
4125 RegisterOperand cls3>
4126 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3, imm32zx4:$M4),
4127 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
4129 class TernaryRRFb<string mnemonic, bits<16> opcode,
4130 RegisterOperand cls1, RegisterOperand cls2,
4131 RegisterOperand cls3>
4132 : InstRRFb<opcode, (outs cls1:$R1, cls3:$R3),
4133 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M4),
4134 mnemonic#"\t$R1, $R3, $R2, $M4", []> {
4135 let Constraints = "$R1 = $R1src";
4136 let DisableEncoding = "$R1src";
4139 class TernaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
4140 RegisterOperand cls2>
4141 : InstRRFe<opcode, (outs cls1:$R1),
4142 (ins imm32zx4:$M3, cls2:$R2, imm32zx4:$M4),
4143 mnemonic#"\t$R1, $M3, $R2, $M4", []>;
4145 class TernaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4146 RegisterOperand cls1, RegisterOperand cls2>
4147 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R1src, cls2:$R3, cls2:$R2),
4148 mnemonic#"\t$R1, $R3, $R2",
4149 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3, cls2:$R2))]> {
4150 let OpKey = mnemonic#cls;
4152 let Constraints = "$R1 = $R1src";
4153 let DisableEncoding = "$R1src";
4156 class TernaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
4157 bits<5> bytes, AddressingMode mode = bdaddr12only>
4158 : InstRSb<opcode, (outs cls:$R1),
4159 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2),
4160 mnemonic#"\t$R1, $M3, $BD2", []> {
4162 let Constraints = "$R1 = $R1src";
4163 let DisableEncoding = "$R1src";
4165 let AccessBytes = bytes;
4168 class TernaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
4169 bits<5> bytes, AddressingMode mode = bdaddr20only>
4170 : InstRSYb<opcode, (outs cls:$R1),
4171 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2),
4172 mnemonic#"\t$R1, $M3, $BD2", []> {
4174 let Constraints = "$R1 = $R1src";
4175 let DisableEncoding = "$R1src";
4177 let AccessBytes = bytes;
4180 multiclass TernaryRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4181 RegisterOperand cls, bits<5> bytes> {
4182 let DispKey = mnemonic ## #cls in {
4183 let DispSize = "12" in
4184 def "" : TernaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
4185 let DispSize = "20" in
4186 def Y : TernaryRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
4190 class SideEffectTernaryRS<string mnemonic, bits<8> opcode,
4191 RegisterOperand cls1, RegisterOperand cls2>
4192 : InstRSa<opcode, (outs),
4193 (ins cls1:$R1, cls2:$R3, bdaddr12only:$BD2),
4194 mnemonic#"\t$R1, $R3, $BD2", []>;
4196 class SideEffectTernaryRSY<string mnemonic, bits<16> opcode,
4197 RegisterOperand cls1, RegisterOperand cls2>
4198 : InstRSYa<opcode, (outs),
4199 (ins cls1:$R1, cls2:$R3, bdaddr20only:$BD2),
4200 mnemonic#"\t$R1, $R3, $BD2", []>;
4202 class SideEffectTernaryMemMemRS<string mnemonic, bits<8> opcode,
4203 RegisterOperand cls1, RegisterOperand cls2>
4204 : InstRSa<opcode, (outs cls1:$R1, cls2:$R3),
4205 (ins cls1:$R1src, cls2:$R3src, shift12only:$BD2),
4206 mnemonic#"\t$R1, $R3, $BD2", []> {
4207 let Constraints = "$R1 = $R1src, $R3 = $R3src";
4208 let DisableEncoding = "$R1src, $R3src";
4211 class SideEffectTernaryMemMemRSY<string mnemonic, bits<16> opcode,
4212 RegisterOperand cls1, RegisterOperand cls2>
4213 : InstRSYa<opcode, (outs cls1:$R1, cls2:$R3),
4214 (ins cls1:$R1src, cls2:$R3src, shift20only:$BD2),
4215 mnemonic#"\t$R1, $R3, $BD2", []> {
4216 let Constraints = "$R1 = $R1src, $R3 = $R3src";
4217 let DisableEncoding = "$R1src, $R3src";
4220 class TernaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4221 RegisterOperand cls1, RegisterOperand cls2,
4222 SDPatternOperator load, bits<5> bytes>
4223 : InstRXF<opcode, (outs cls1:$R1),
4224 (ins cls2:$R1src, cls2:$R3, bdxaddr12only:$XBD2),
4225 mnemonic#"\t$R1, $R3, $XBD2",
4226 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3,
4227 (load bdxaddr12only:$XBD2)))]> {
4228 let OpKey = mnemonic#"r"#cls;
4230 let Constraints = "$R1 = $R1src";
4231 let DisableEncoding = "$R1src";
4233 let AccessBytes = bytes;
4236 class TernaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4237 TypedReg tr1, TypedReg tr2, ImmOpWithPattern imm, ImmOpWithPattern index>
4238 : InstVRIa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V1src, imm:$I2, index:$M3),
4239 mnemonic#"\t$V1, $I2, $M3",
4240 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4241 imm:$I2, index:$M3))]> {
4242 let Constraints = "$V1 = $V1src";
4243 let DisableEncoding = "$V1src";
4246 class TernaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4247 TypedReg tr1, TypedReg tr2, bits<4> type>
4248 : InstVRId<opcode, (outs tr1.op:$V1),
4249 (ins tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
4250 mnemonic#"\t$V1, $V2, $V3, $I4",
4251 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4252 (tr2.vt tr2.op:$V3),
4253 imm32zx8_timm:$I4))]> {
4257 class TernaryVRIi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4258 : InstVRIi<opcode, (outs VR128:$V1),
4259 (ins cls:$R2, imm32zx8:$I3, imm32zx4:$M4),
4260 mnemonic#"\t$V1, $R2, $I3, $M4", []>;
4262 class TernaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4263 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m4or>
4264 : InstVRRa<opcode, (outs tr1.op:$V1),
4265 (ins tr2.op:$V2, imm32zx4:$M4, imm32zx4:$M5),
4266 mnemonic#"\t$V1, $V2, $M4, $M5",
4267 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4269 imm32zx4_timm:$M5))],
4274 class TernaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
4275 : InstVRRa<opcode, (outs VR128:$V1),
4276 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
4277 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
4279 class TernaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4280 TypedReg tr1, TypedReg tr2, bits<4> type,
4281 SDPatternOperator m5mask, bits<4> m5or>
4282 : InstVRRb<opcode, (outs tr1.op:$V1),
4283 (ins tr2.op:$V2, tr2.op:$V3, m5mask:$M5),
4284 mnemonic#"\t$V1, $V2, $V3, $M5",
4285 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4286 (tr2.vt tr2.op:$V3),
4292 // Declare a pair of instructions, one which sets CC and one which doesn't.
4293 // The CC-setting form ends with "S" and sets the low bit of M5.
4294 // Also create aliases to make use of M5 operand optional in assembler.
4295 multiclass TernaryOptVRRbSPair<string mnemonic, bits<16> opcode,
4296 SDPatternOperator operator,
4297 SDPatternOperator operator_cc,
4298 TypedReg tr1, TypedReg tr2, bits<4> type,
4299 bits<4> modifier = 0> {
4300 def "" : TernaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
4301 imm32zx4even_timm, !and (modifier, 14)>;
4302 def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
4303 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4306 def S : TernaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
4307 imm32zx4even_timm, !add(!and (modifier, 14), 1)>;
4308 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3",
4309 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
4313 multiclass TernaryOptVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
4315 def "" : InstVRRb<opcode, (outs VR128:$V1),
4316 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
4317 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
4318 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
4319 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4323 class TernaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4324 TypedReg tr1, TypedReg tr2>
4325 : InstVRRc<opcode, (outs tr1.op:$V1),
4326 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M4),
4327 mnemonic#"\t$V1, $V2, $V3, $M4",
4328 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4329 (tr2.vt tr2.op:$V3),
4330 imm32zx4_timm:$M4))]> {
4335 class TernaryVRRcFloat<string mnemonic, bits<16> opcode,
4336 SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
4337 bits<4> type = 0, bits<4> m5 = 0>
4338 : InstVRRc<opcode, (outs tr1.op:$V1),
4339 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M6),
4340 mnemonic#"\t$V1, $V2, $V3, $M6",
4341 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4342 (tr2.vt tr2.op:$V3),
4343 imm32zx4_timm:$M6))]> {
4348 class TernaryVRRcFloatGeneric<string mnemonic, bits<16> opcode>
4349 : InstVRRc<opcode, (outs VR128:$V1),
4350 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
4352 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
4354 class TernaryVRRd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4355 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m6 = 0>
4356 : InstVRRd<opcode, (outs tr1.op:$V1),
4357 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
4358 mnemonic#"\t$V1, $V2, $V3, $V4",
4359 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4360 (tr2.vt tr2.op:$V3),
4361 (tr1.vt tr1.op:$V4)))]> {
4366 class TernaryVRRdGeneric<string mnemonic, bits<16> opcode>
4367 : InstVRRd<opcode, (outs VR128:$V1),
4368 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5),
4369 mnemonic#"\t$V1, $V2, $V3, $V4, $M5", []> {
4373 // Ternary operation where the assembler mnemonic has an extra operand to
4374 // optionally allow specifiying arbitrary M6 values.
4375 multiclass TernaryExtraVRRd<string mnemonic, bits<16> opcode,
4376 SDPatternOperator operator,
4377 TypedReg tr1, TypedReg tr2, bits<4> type> {
4378 let M5 = type, Defs = [CC] in
4379 def "" : InstVRRd<opcode, (outs tr1.op:$V1),
4380 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, imm32zx4:$M6),
4381 mnemonic#"\t$V1, $V2, $V3, $V4, $M6", []>;
4382 def : Pat<(operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3),
4383 (tr1.vt tr1.op:$V4)),
4384 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, 0)>;
4385 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4",
4386 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4387 tr2.op:$V3, tr1.op:$V4, 0)>;
4390 multiclass TernaryExtraVRRdGeneric<string mnemonic, bits<16> opcode> {
4392 def "" : InstVRRd<opcode, (outs VR128:$V1),
4393 (ins VR128:$V2, VR128:$V3, VR128:$V4,
4394 imm32zx4:$M5, imm32zx4:$M6),
4395 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4396 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5",
4397 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4398 VR128:$V4, imm32zx4:$M5, 0)>;
4401 class TernaryVRRe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4402 TypedReg tr1, TypedReg tr2, bits<4> m5 = 0, bits<4> type = 0>
4403 : InstVRRe<opcode, (outs tr1.op:$V1),
4404 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
4405 mnemonic#"\t$V1, $V2, $V3, $V4",
4406 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4407 (tr2.vt tr2.op:$V3),
4408 (tr1.vt tr1.op:$V4)))]> {
4413 class TernaryVRReFloatGeneric<string mnemonic, bits<16> opcode>
4414 : InstVRRe<opcode, (outs VR128:$V1),
4415 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
4416 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4418 class TernaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4419 TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type>
4420 : InstVRSb<opcode, (outs tr1.op:$V1),
4421 (ins tr2.op:$V1src, cls:$R3, shift12only:$BD2),
4422 mnemonic#"\t$V1, $R3, $BD2",
4423 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4425 shift12only:$BD2))]> {
4426 let Constraints = "$V1 = $V1src";
4427 let DisableEncoding = "$V1src";
4431 class TernaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4432 : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2,
4433 imm32zx4:$M3, imm32zx4:$M4),
4434 mnemonic#"\t$R1, $V2, $M3, $M4", []>;
4436 class TernaryVRSbGeneric<string mnemonic, bits<16> opcode>
4437 : InstVRSb<opcode, (outs VR128:$V1),
4438 (ins VR128:$V1src, GR64:$R3, shift12only:$BD2, imm32zx4:$M4),
4439 mnemonic#"\t$V1, $R3, $BD2, $M4", []> {
4440 let Constraints = "$V1 = $V1src";
4441 let DisableEncoding = "$V1src";
4444 class TernaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
4445 ImmOpWithPattern index>
4446 : InstVRV<opcode, (outs VR128:$V1),
4447 (ins VR128:$V1src, bdvaddr12only:$VBD2, index:$M3),
4448 mnemonic#"\t$V1, $VBD2, $M3", []> {
4449 let Constraints = "$V1 = $V1src";
4450 let DisableEncoding = "$V1src";
4452 let AccessBytes = bytes;
4455 class TernaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4456 TypedReg tr1, TypedReg tr2, bits<5> bytes, ImmOpWithPattern index>
4457 : InstVRX<opcode, (outs tr1.op:$V1),
4458 (ins tr2.op:$V1src, bdxaddr12only:$XBD2, index:$M3),
4459 mnemonic#"\t$V1, $XBD2, $M3",
4460 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4461 bdxaddr12only:$XBD2,
4463 let Constraints = "$V1 = $V1src";
4464 let DisableEncoding = "$V1src";
4466 let AccessBytes = bytes;
4469 class QuaternaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4470 TypedReg tr1, TypedReg tr2, bits<4> type>
4471 : InstVRId<opcode, (outs tr1.op:$V1),
4472 (ins tr2.op:$V1src, tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
4473 mnemonic#"\t$V1, $V2, $V3, $I4",
4474 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4475 (tr2.vt tr2.op:$V2),
4476 (tr2.vt tr2.op:$V3),
4477 imm32zx8_timm:$I4))]> {
4478 let Constraints = "$V1 = $V1src";
4479 let DisableEncoding = "$V1src";
4483 class QuaternaryVRIdGeneric<string mnemonic, bits<16> opcode>
4484 : InstVRId<opcode, (outs VR128:$V1),
4485 (ins VR128:$V1src, VR128:$V2, VR128:$V3,
4486 imm32zx8:$I4, imm32zx4:$M5),
4487 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []> {
4488 let Constraints = "$V1 = $V1src";
4489 let DisableEncoding = "$V1src";
4492 class QuaternaryVRIf<string mnemonic, bits<16> opcode>
4493 : InstVRIf<opcode, (outs VR128:$V1),
4494 (ins VR128:$V2, VR128:$V3,
4495 imm32zx8:$I4, imm32zx4:$M5),
4496 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []>;
4498 class QuaternaryVRIg<string mnemonic, bits<16> opcode>
4499 : InstVRIg<opcode, (outs VR128:$V1),
4500 (ins VR128:$V2, imm32zx8:$I3,
4501 imm32zx8:$I4, imm32zx4:$M5),
4502 mnemonic#"\t$V1, $V2, $I3, $I4, $M5", []>;
4504 class QuaternaryVRRd<string mnemonic, bits<16> opcode,
4505 SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
4506 TypedReg tr3, TypedReg tr4, bits<4> type,
4507 SDPatternOperator m6mask = imm32zx4_timm, bits<4> m6or = 0>
4508 : InstVRRd<opcode, (outs tr1.op:$V1),
4509 (ins tr2.op:$V2, tr3.op:$V3, tr4.op:$V4, m6mask:$M6),
4510 mnemonic#"\t$V1, $V2, $V3, $V4, $M6",
4511 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4512 (tr3.vt tr3.op:$V3),
4513 (tr4.vt tr4.op:$V4),
4519 class QuaternaryVRRdGeneric<string mnemonic, bits<16> opcode>
4520 : InstVRRd<opcode, (outs VR128:$V1),
4521 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
4522 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4524 // Declare a pair of instructions, one which sets CC and one which doesn't.
4525 // The CC-setting form ends with "S" and sets the low bit of M6.
4526 // Also create aliases to make use of M6 operand optional in assembler.
4527 multiclass QuaternaryOptVRRdSPair<string mnemonic, bits<16> opcode,
4528 SDPatternOperator operator,
4529 SDPatternOperator operator_cc,
4530 TypedReg tr1, TypedReg tr2, bits<4> type,
4531 bits<4> modifier = 0> {
4532 def "" : QuaternaryVRRd<mnemonic, opcode, operator,
4533 tr1, tr2, tr2, tr2, type,
4534 imm32zx4even_timm, !and (modifier, 14)>;
4535 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4",
4536 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4537 tr2.op:$V3, tr2.op:$V4, 0)>;
4539 def S : QuaternaryVRRd<mnemonic##"s", opcode, operator_cc,
4540 tr1, tr2, tr2, tr2, type,
4541 imm32zx4even_timm, !add (!and (modifier, 14), 1)>;
4542 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3, $V4",
4543 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
4544 tr2.op:$V3, tr2.op:$V4, 0)>;
4547 multiclass QuaternaryOptVRRdSPairGeneric<string mnemonic, bits<16> opcode> {
4549 def "" : QuaternaryVRRdGeneric<mnemonic, opcode>;
4550 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5",
4551 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4552 VR128:$V4, imm32zx4_timm:$M5, 0)>;
4555 class SideEffectQuaternaryRRFa<string mnemonic, bits<16> opcode,
4556 RegisterOperand cls1, RegisterOperand cls2,
4557 RegisterOperand cls3>
4558 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4),
4559 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
4561 multiclass SideEffectQuaternaryRRFaOptOpt<string mnemonic, bits<16> opcode,
4562 RegisterOperand cls1,
4563 RegisterOperand cls2,
4564 RegisterOperand cls3> {
4565 def "" : SideEffectQuaternaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
4566 def Opt : SideEffectTernaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
4567 def OptOpt : SideEffectBinaryRRFa<mnemonic, opcode, cls1, cls2>;
4570 class SideEffectQuaternaryRRFb<string mnemonic, bits<16> opcode,
4571 RegisterOperand cls1, RegisterOperand cls2,
4572 RegisterOperand cls3>
4573 : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4),
4574 mnemonic#"\t$R1, $R3, $R2, $M4", []>;
4576 multiclass SideEffectQuaternaryRRFbOpt<string mnemonic, bits<16> opcode,
4577 RegisterOperand cls1,
4578 RegisterOperand cls2,
4579 RegisterOperand cls3> {
4580 def "" : SideEffectQuaternaryRRFb<mnemonic, opcode, cls1, cls2, cls3>;
4581 def Opt : SideEffectTernaryRRFb<mnemonic, opcode, cls1, cls2, cls3>;
4584 class SideEffectQuaternarySSe<string mnemonic, bits<8> opcode,
4585 RegisterOperand cls>
4586 : InstSSe<opcode, (outs),
4587 (ins cls:$R1, bdaddr12only:$BD2, cls:$R3, bdaddr12only:$BD4),
4588 mnemonic#"\t$R1, $BD2, $R3, $BD4", []>;
4590 class LoadAndOpRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4591 RegisterOperand cls, AddressingMode mode = bdaddr20only>
4592 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, mode:$BD2),
4593 mnemonic#"\t$R1, $R3, $BD2",
4594 [(set cls:$R1, (operator mode:$BD2, cls:$R3))]> {
4599 class CmpSwapRRE<string mnemonic, bits<16> opcode,
4600 RegisterOperand cls1, RegisterOperand cls2>
4601 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
4602 mnemonic#"\t$R1, $R2", []> {
4603 let Constraints = "$R1 = $R1src";
4604 let DisableEncoding = "$R1src";
4609 class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4610 RegisterOperand cls, AddressingMode mode = bdaddr12only>
4611 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
4612 mnemonic#"\t$R1, $R3, $BD2",
4613 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
4614 let Constraints = "$R1 = $R1src";
4615 let DisableEncoding = "$R1src";
4620 class CmpSwapRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4621 RegisterOperand cls, AddressingMode mode = bdaddr20only>
4622 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
4623 mnemonic#"\t$R1, $R3, $BD2",
4624 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
4625 let Constraints = "$R1 = $R1src";
4626 let DisableEncoding = "$R1src";
4631 multiclass CmpSwapRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4632 SDPatternOperator operator, RegisterOperand cls> {
4633 let DispKey = mnemonic ## #cls in {
4634 let DispSize = "12" in
4635 def "" : CmpSwapRS<mnemonic, rsOpcode, operator, cls, bdaddr12pair>;
4636 let DispSize = "20" in
4637 def Y : CmpSwapRSY<mnemonic#"y", rsyOpcode, operator, cls, bdaddr20pair>;
4641 class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1,
4642 RegisterOperand cls2>
4643 : InstRIEf<opcode, (outs cls1:$R1),
4644 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
4646 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> {
4647 let Constraints = "$R1 = $R1src";
4648 let DisableEncoding = "$R1src";
4651 class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator>
4652 : InstRXYb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr20only:$XBD2),
4653 mnemonic##"\t$M1, $XBD2",
4654 [(operator imm32zx4_timm:$M1, bdxaddr20only:$XBD2)]>;
4656 class PrefetchRILPC<string mnemonic, bits<12> opcode,
4657 SDPatternOperator operator>
4658 : InstRILc<opcode, (outs), (ins imm32zx4_timm:$M1, pcrel32:$RI2),
4659 mnemonic##"\t$M1, $RI2",
4660 [(operator imm32zx4_timm:$M1, pcrel32:$RI2)]> {
4661 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
4662 // However, BDXs have two extra operands and are therefore 6 units more
4664 let AddedComplexity = 7;
4667 class BranchPreloadSMI<string mnemonic, bits<8> opcode>
4668 : InstSMI<opcode, (outs),
4669 (ins imm32zx4:$M1, brtarget16bpp:$RI2, bdxaddr12only:$BD3),
4670 mnemonic#"\t$M1, $RI2, $BD3", []>;
4672 class BranchPreloadMII<string mnemonic, bits<8> opcode>
4673 : InstMII<opcode, (outs),
4674 (ins imm32zx4:$M1, brtarget12bpp:$RI2, brtarget24bpp:$RI3),
4675 mnemonic#"\t$M1, $RI2, $RI3", []>;
4677 // A floating-point load-and test operation. Create both a normal unary
4678 // operation and one that acts as a comparison against zero.
4679 // Note that the comparison against zero operation is not available if we
4680 // have vector support, since load-and-test instructions will partially
4681 // clobber the target (vector) register.
4682 multiclass LoadAndTestRRE<string mnemonic, bits<16> opcode,
4683 RegisterOperand cls> {
4684 def "" : UnaryRRE<mnemonic, opcode, null_frag, cls, cls>;
4685 let isCodeGenOnly = 1, Predicates = [FeatureNoVector] in
4686 def Compare : CompareRRE<mnemonic, opcode, null_frag, cls, cls>;
4689 //===----------------------------------------------------------------------===//
4690 // Pseudo instructions
4691 //===----------------------------------------------------------------------===//
4693 // Convenience instructions that get lowered to real instructions
4694 // by either SystemZTargetLowering::EmitInstrWithCustomInserter()
4695 // or SystemZInstrInfo::expandPostRAPseudo().
4697 //===----------------------------------------------------------------------===//
4699 class Pseudo<dag outs, dag ins, list<dag> pattern>
4700 : InstSystemZ<0, outs, ins, "", pattern> {
4702 let isCodeGenOnly = 1;
4705 // Like UnaryRI, but expanded after RA depending on the choice of register.
4706 class UnaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4707 ImmOpWithPattern imm>
4708 : Pseudo<(outs cls:$R1), (ins imm:$I2),
4709 [(set cls:$R1, (operator imm:$I2))]>;
4711 // Like UnaryRXY, but expanded after RA depending on the choice of register.
4712 class UnaryRXYPseudo<string key, SDPatternOperator operator,
4713 RegisterOperand cls, bits<5> bytes,
4714 AddressingMode mode = bdxaddr20only>
4715 : Pseudo<(outs cls:$R1), (ins mode:$XBD2),
4716 [(set cls:$R1, (operator mode:$XBD2))]> {
4717 let OpKey = key#"r"#cls;
4720 let Has20BitOffset = 1;
4722 let AccessBytes = bytes;
4725 // Like UnaryRR, but expanded after RA depending on the choice of registers.
4726 class UnaryRRPseudo<string key, SDPatternOperator operator,
4727 RegisterOperand cls1, RegisterOperand cls2>
4728 : Pseudo<(outs cls1:$R1), (ins cls2:$R2),
4729 [(set cls1:$R1, (operator cls2:$R2))]> {
4730 let OpKey = key#cls1;
4734 // Like BinaryRI, but expanded after RA depending on the choice of register.
4735 class BinaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4736 ImmOpWithPattern imm>
4737 : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2),
4738 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
4739 let Constraints = "$R1 = $R1src";
4742 // Like BinaryRIE, but expanded after RA depending on the choice of register.
4743 class BinaryRIEPseudo<SDPatternOperator operator, RegisterOperand cls,
4744 ImmOpWithPattern imm>
4745 : Pseudo<(outs cls:$R1), (ins cls:$R3, imm:$I2),
4746 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
4748 // Like BinaryRIAndK, but expanded after RA depending on the choice of register.
4749 multiclass BinaryRIAndKPseudo<string key, SDPatternOperator operator,
4750 RegisterOperand cls, ImmOpWithPattern imm> {
4751 let NumOpsKey = key in {
4752 let NumOpsValue = "3" in
4753 def K : BinaryRIEPseudo<operator, cls, imm>,
4754 Requires<[FeatureHighWord, FeatureDistinctOps]>;
4755 let NumOpsValue = "2" in
4756 def "" : BinaryRIPseudo<operator, cls, imm>,
4757 Requires<[FeatureHighWord]>;
4761 // A pseudo that is used during register allocation when folding a memory
4762 // operand. The 3-address register instruction with a spilled source cannot
4763 // be converted directly to a target 2-address reg/mem instruction.
4764 // Mapping: <INSN>R -> MemFoldPseudo -> <INSN>
4765 class MemFoldPseudo<string mnemonic, RegisterOperand cls, bits<5> bytes,
4766 AddressingMode mode>
4767 : Pseudo<(outs cls:$R1), (ins cls:$R2, mode:$XBD2), []> {
4768 let OpKey = mnemonic#"rk"#cls;
4770 let MemKey = mnemonic#cls;
4771 let MemType = "pseudo";
4773 let AccessBytes = bytes;
4775 let hasNoSchedulingInfo = 1;
4778 // Like CompareRI, but expanded after RA depending on the choice of register.
4779 class CompareRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4780 ImmOpWithPattern imm>
4781 : Pseudo<(outs), (ins cls:$R1, imm:$I2),
4782 [(set CC, (operator cls:$R1, imm:$I2))]> {
4786 // Like CompareRXY, but expanded after RA depending on the choice of register.
4787 class CompareRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
4788 SDPatternOperator load, bits<5> bytes,
4789 AddressingMode mode = bdxaddr20only>
4790 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2),
4791 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
4793 let Has20BitOffset = 1;
4795 let AccessBytes = bytes;
4798 // Like TestBinarySIL, but expanded later.
4799 class TestBinarySILPseudo<SDPatternOperator operator, ImmOpWithPattern imm>
4800 : Pseudo<(outs), (ins bdaddr12only:$BD1, imm:$I2),
4801 [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>;
4803 // Like CondBinaryRRF, but expanded after RA depending on the choice of
4805 class CondBinaryRRFPseudo<string mnemonic, RegisterOperand cls1,
4806 RegisterOperand cls2>
4807 : Pseudo<(outs cls1:$R1),
4808 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
4809 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src,
4810 cond4:$valid, cond4:$M3))]> {
4811 let Constraints = "$R1 = $R1src";
4812 let DisableEncoding = "$R1src";
4814 let NumOpsKey = !subst("loc", "sel", mnemonic);
4815 let NumOpsValue = "2";
4818 // Like CondBinaryRRFa, but expanded after RA depending on the choice of
4820 class CondBinaryRRFaPseudo<string mnemonic, RegisterOperand cls1,
4821 RegisterOperand cls2, RegisterOperand cls3>
4822 : Pseudo<(outs cls1:$R1),
4823 (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4),
4824 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3,
4825 cond4:$valid, cond4:$M4))]> {
4827 let NumOpsKey = mnemonic;
4828 let NumOpsValue = "3";
4831 // Like CondBinaryRIE, but expanded after RA depending on the choice of
4833 class CondBinaryRIEPseudo<RegisterOperand cls, ImmOpWithPattern imm>
4834 : Pseudo<(outs cls:$R1),
4835 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
4836 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
4837 cond4:$valid, cond4:$M3))]> {
4838 let Constraints = "$R1 = $R1src";
4839 let DisableEncoding = "$R1src";
4843 // Like CondUnaryRSY, but expanded after RA depending on the choice of
4845 class CondUnaryRSYPseudo<SDPatternOperator operator, RegisterOperand cls,
4846 bits<5> bytes, AddressingMode mode = bdaddr20only>
4847 : Pseudo<(outs cls:$R1),
4848 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$R3),
4850 (z_select_ccmask (operator mode:$BD2), cls:$R1src,
4851 cond4:$valid, cond4:$R3))]> {
4852 let Constraints = "$R1 = $R1src";
4853 let DisableEncoding = "$R1src";
4855 let AccessBytes = bytes;
4859 // Like CondStoreRSY, but expanded after RA depending on the choice of
4861 class CondStoreRSYPseudo<RegisterOperand cls, bits<5> bytes,
4862 AddressingMode mode = bdaddr20only>
4863 : Pseudo<(outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$R3), []> {
4865 let AccessBytes = bytes;
4869 // Like StoreRXY, but expanded after RA depending on the choice of register.
4870 class StoreRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
4871 bits<5> bytes, AddressingMode mode = bdxaddr20only>
4872 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2),
4873 [(operator cls:$R1, mode:$XBD2)]> {
4875 let Has20BitOffset = 1;
4877 let AccessBytes = bytes;
4880 // Like RotateSelectRIEf, but expanded after RA depending on the choice
4882 class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2>
4883 : Pseudo<(outs cls1:$R1),
4884 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
4887 let Constraints = "$R1 = $R1src";
4888 let DisableEncoding = "$R1src";
4891 // Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is
4892 // the value of the PSW's 2-bit condition code field.
4893 class SelectWrapper<ValueType vt, RegisterOperand cls>
4894 : Pseudo<(outs cls:$dst),
4895 (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc),
4896 [(set (vt cls:$dst), (z_select_ccmask cls:$src1, cls:$src2,
4897 imm32zx4_timm:$valid, imm32zx4_timm:$cc))]> {
4898 let usesCustomInserter = 1;
4899 let hasNoSchedulingInfo = 1;
4903 // Stores $new to $addr if $cc is true ("" case) or false (Inv case).
4904 multiclass CondStores<RegisterOperand cls, SDPatternOperator store,
4905 SDPatternOperator load, AddressingMode mode> {
4906 let Uses = [CC], usesCustomInserter = 1, hasNoSchedulingInfo = 1,
4907 mayLoad = 1, mayStore = 1 in {
4908 def "" : Pseudo<(outs),
4909 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
4910 [(store (z_select_ccmask cls:$new, (load mode:$addr),
4911 imm32zx4_timm:$valid, imm32zx4_timm:$cc),
4913 def Inv : Pseudo<(outs),
4914 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
4915 [(store (z_select_ccmask (load mode:$addr), cls:$new,
4916 imm32zx4_timm:$valid, imm32zx4_timm:$cc),
4921 // OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation. PAT and OPERAND
4922 // describe the second (non-memory) operand.
4923 class AtomicLoadBinary<SDPatternOperator operator, RegisterOperand cls,
4924 dag pat, DAGOperand operand>
4925 : Pseudo<(outs cls:$dst), (ins bdaddr20only:$ptr, operand:$src2),
4926 [(set cls:$dst, (operator bdaddr20only:$ptr, pat))]> {
4928 let Has20BitOffset = 1;
4931 let usesCustomInserter = 1;
4932 let hasNoSchedulingInfo = 1;
4935 // Specializations of AtomicLoadWBinary.
4936 class AtomicLoadBinaryReg32<SDPatternOperator operator>
4937 : AtomicLoadBinary<operator, GR32, (i32 GR32:$src2), GR32>;
4938 class AtomicLoadBinaryImm32<SDPatternOperator operator, ImmOpWithPattern imm>
4939 : AtomicLoadBinary<operator, GR32, (i32 imm:$src2), imm>;
4940 class AtomicLoadBinaryReg64<SDPatternOperator operator>
4941 : AtomicLoadBinary<operator, GR64, (i64 GR64:$src2), GR64>;
4942 class AtomicLoadBinaryImm64<SDPatternOperator operator, ImmOpWithPattern imm>
4943 : AtomicLoadBinary<operator, GR64, (i64 imm:$src2), imm>;
4945 // OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation. PAT and OPERAND
4946 // describe the second (non-memory) operand.
4947 class AtomicLoadWBinary<SDPatternOperator operator, dag pat,
4949 : Pseudo<(outs GR32:$dst),
4950 (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift,
4951 ADDR32:$negbitshift, uimm32:$bitsize),
4952 [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift,
4953 ADDR32:$negbitshift, uimm32:$bitsize))]> {
4955 let Has20BitOffset = 1;
4958 let usesCustomInserter = 1;
4959 let hasNoSchedulingInfo = 1;
4962 // Specializations of AtomicLoadWBinary.
4963 class AtomicLoadWBinaryReg<SDPatternOperator operator>
4964 : AtomicLoadWBinary<operator, (i32 GR32:$src2), GR32>;
4965 class AtomicLoadWBinaryImm<SDPatternOperator operator, ImmOpWithPattern imm>
4966 : AtomicLoadWBinary<operator, (i32 imm:$src2), imm>;
4968 // A pseudo instruction that is a direct alias of a real instruction.
4969 // These aliases are used in cases where a particular register operand is
4970 // fixed or where the same instruction is used with different register sizes.
4971 // The size parameter is the size in bytes of the associated real instruction.
4972 class Alias<int size, dag outs, dag ins, list<dag> pattern>
4973 : InstSystemZ<size, outs, ins, "", pattern> {
4975 let isCodeGenOnly = 1;
4978 class UnaryAliasVRS<RegisterOperand cls1, RegisterOperand cls2>
4979 : Alias<6, (outs cls1:$src1), (ins cls2:$src2), []>;
4981 // An alias of a UnaryVRR*, but with different register sizes.
4982 class UnaryAliasVRR<SDPatternOperator operator, TypedReg tr1, TypedReg tr2>
4983 : Alias<6, (outs tr1.op:$V1), (ins tr2.op:$V2),
4984 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]>;
4986 // An alias of a UnaryVRX, but with different register sizes.
4987 class UnaryAliasVRX<SDPatternOperator operator, TypedReg tr,
4988 AddressingMode mode = bdxaddr12only>
4989 : Alias<6, (outs tr.op:$V1), (ins mode:$XBD2),
4990 [(set (tr.vt tr.op:$V1), (operator mode:$XBD2))]>;
4992 // An alias of a StoreVRX, but with different register sizes.
4993 class StoreAliasVRX<SDPatternOperator operator, TypedReg tr,
4994 AddressingMode mode = bdxaddr12only>
4995 : Alias<6, (outs), (ins tr.op:$V1, mode:$XBD2),
4996 [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>;
4998 // An alias of a BinaryRI, but with different register sizes.
4999 class BinaryAliasRI<SDPatternOperator operator, RegisterOperand cls,
5000 ImmOpWithPattern imm>
5001 : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
5002 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
5003 let Constraints = "$R1 = $R1src";
5006 // An alias of a BinaryRIL, but with different register sizes.
5007 class BinaryAliasRIL<SDPatternOperator operator, RegisterOperand cls,
5008 ImmOpWithPattern imm>
5009 : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
5010 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
5011 let Constraints = "$R1 = $R1src";
5014 // An alias of a BinaryVRRf, but with different register sizes.
5015 class BinaryAliasVRRf<RegisterOperand cls>
5016 : Alias<6, (outs VR128:$V1), (ins cls:$R2, cls:$R3), []>;
5018 // An alias of a CompareRI, but with different register sizes.
5019 class CompareAliasRI<SDPatternOperator operator, RegisterOperand cls,
5020 ImmOpWithPattern imm>
5021 : Alias<4, (outs), (ins cls:$R1, imm:$I2),
5022 [(set CC, (operator cls:$R1, imm:$I2))]> {
5026 // An alias of a RotateSelectRIEf, but with different register sizes.
5027 class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2>
5028 : Alias<6, (outs cls1:$R1),
5029 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
5030 imm32zx6:$I5), []> {
5031 let Constraints = "$R1 = $R1src";
5034 //===----------------------------------------------------------------------===//
5035 // Multiclasses that emit both real and pseudo instructions
5036 //===----------------------------------------------------------------------===//
5038 multiclass BinaryRXYAndPseudo<string mnemonic, bits<16> opcode,
5039 SDPatternOperator operator, RegisterOperand cls,
5040 SDPatternOperator load, bits<5> bytes,
5041 AddressingMode mode = bdxaddr20only> {
5043 def "" : BinaryRXY<mnemonic, opcode, operator, cls, load, bytes, mode> {
5044 let MemKey = mnemonic#cls;
5045 let MemType = "target";
5047 let Has20BitOffset = 1 in
5048 def _MemFoldPseudo : MemFoldPseudo<mnemonic, cls, bytes, mode>;
5051 multiclass BinaryRXPairAndPseudo<string mnemonic, bits<8> rxOpcode,
5052 bits<16> rxyOpcode, SDPatternOperator operator,
5053 RegisterOperand cls,
5054 SDPatternOperator load, bits<5> bytes> {
5055 let DispKey = mnemonic ## #cls in {
5056 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes,
5058 let DispSize = "12";
5059 let MemKey = mnemonic#cls;
5060 let MemType = "target";
5062 let DispSize = "20" in
5063 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load,
5064 bytes, bdxaddr20pair>;
5066 def _MemFoldPseudo : MemFoldPseudo<mnemonic, cls, bytes, bdxaddr12pair>;
5069 // Define an instruction that operates on two fixed-length blocks of memory,
5070 // and associated pseudo instructions for operating on blocks of any size.
5071 // The Sequence form uses a straight-line sequence of instructions and
5072 // the Loop form uses a loop of length-256 instructions followed by
5073 // another instruction to handle the excess.
5074 multiclass MemorySS<string mnemonic, bits<8> opcode,
5075 SDPatternOperator sequence, SDPatternOperator loop> {
5076 def "" : SideEffectBinarySSa<mnemonic, opcode>;
5077 let usesCustomInserter = 1, hasNoSchedulingInfo = 1, Defs = [CC] in {
5078 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5080 [(sequence bdaddr12only:$dest, bdaddr12only:$src,
5082 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5083 imm64:$length, GR64:$count256),
5084 [(loop bdaddr12only:$dest, bdaddr12only:$src,
5085 imm64:$length, GR64:$count256)]>;
5089 // The same, but setting a CC result as comparion operator.
5090 multiclass CompareMemorySS<string mnemonic, bits<8> opcode,
5091 SDPatternOperator sequence, SDPatternOperator loop> {
5092 def "" : SideEffectBinarySSa<mnemonic, opcode>;
5093 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in {
5094 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5096 [(set CC, (sequence bdaddr12only:$dest, bdaddr12only:$src,
5098 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5099 imm64:$length, GR64:$count256),
5100 [(set CC, (loop bdaddr12only:$dest, bdaddr12only:$src,
5101 imm64:$length, GR64:$count256))]>;
5105 // Define an instruction that operates on two strings, both terminated
5106 // by the character in R0. The instruction processes a CPU-determinated
5107 // number of bytes at a time and sets CC to 3 if the instruction needs
5108 // to be repeated. Also define a pseudo instruction that represents
5109 // the full loop (the main instruction plus the branch on CC==3).
5110 multiclass StringRRE<string mnemonic, bits<16> opcode,
5111 SDPatternOperator operator> {
5113 def "" : SideEffectBinaryMemMemRRE<mnemonic, opcode, GR64, GR64>;
5114 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in
5115 def Loop : Pseudo<(outs GR64:$end),
5116 (ins GR64:$start1, GR64:$start2, GR32:$char),
5117 [(set GR64:$end, (operator GR64:$start1, GR64:$start2,