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
79 // a comparison of the first operand against zero.
80 bits<4> CompareZeroCCMask = 0;
82 // True if the instruction is conditional and if the CC mask operand
83 // comes first (as for BRC, etc.).
86 // Similar, but true if the CC mask operand comes last (as for LOC, etc.).
89 // True if the instruction is the "logical" rather than "arithmetic" form,
90 // in cases where a distinction exists.
93 let TSFlags{0} = SimpleBDXLoad;
94 let TSFlags{1} = SimpleBDXStore;
95 let TSFlags{2} = Has20BitOffset;
96 let TSFlags{3} = HasIndex;
97 let TSFlags{4} = Is128Bit;
98 let TSFlags{9-5} = AccessBytes;
99 let TSFlags{13-10} = CCValues;
100 let TSFlags{17-14} = CompareZeroCCMask;
101 let TSFlags{18} = CCMaskFirst;
102 let TSFlags{19} = CCMaskLast;
103 let TSFlags{20} = IsLogical;
106 //===----------------------------------------------------------------------===//
107 // Mappings between instructions
108 //===----------------------------------------------------------------------===//
110 // Return the version of an instruction that has an unsigned 12-bit
112 def getDisp12Opcode : InstrMapping {
113 let FilterClass = "InstSystemZ";
114 let RowFields = ["DispKey"];
115 let ColFields = ["DispSize"];
117 let ValueCols = [["12"]];
120 // Return the version of an instruction that has a signed 20-bit displacement.
121 def getDisp20Opcode : InstrMapping {
122 let FilterClass = "InstSystemZ";
123 let RowFields = ["DispKey"];
124 let ColFields = ["DispSize"];
126 let ValueCols = [["20"]];
129 // Return the memory form of a register instruction. Note that this may
130 // return a MemFoldPseudo instruction (see below).
131 def getMemOpcode : InstrMapping {
132 let FilterClass = "InstSystemZ";
133 let RowFields = ["OpKey"];
134 let ColFields = ["OpType"];
135 let KeyCol = ["reg"];
136 let ValueCols = [["mem"]];
139 // Return the target memory instruction for a MemFoldPseudo.
140 def getTargetMemOpcode : InstrMapping {
141 let FilterClass = "InstSystemZ";
142 let RowFields = ["MemKey"];
143 let ColFields = ["MemType"];
144 let KeyCol = ["pseudo"];
145 let ValueCols = [["target"]];
148 // Return the 2-operand form of a 3-operand instruction.
149 def getTwoOperandOpcode : InstrMapping {
150 let FilterClass = "InstSystemZ";
151 let RowFields = ["NumOpsKey"];
152 let ColFields = ["NumOpsValue"];
154 let ValueCols = [["2"]];
157 //===----------------------------------------------------------------------===//
158 // Instruction formats
159 //===----------------------------------------------------------------------===//
161 // Formats are specified using operand field declarations of the form:
163 // bits<4> Rn : register input or output for operand n
164 // bits<5> Vn : vector register input or output for operand n
165 // bits<m> In : immediate value of width m for operand n
166 // bits<4> BDn : address operand n, which has a base and a displacement
167 // bits<m> XBDn : address operand n, which has an index, a base and a
169 // bits<m> VBDn : address operand n, which has a vector index, a base and a
171 // bits<4> Xn : index register for address operand n
172 // bits<4> Mn : mode value for operand n
174 // The operand numbers ("n" in the list above) follow the architecture manual.
175 // Assembly operands sometimes have a different order; in particular, R3 often
176 // is often written between operands 1 and 2.
178 //===----------------------------------------------------------------------===//
180 class InstE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
181 : InstSystemZ<2, outs, ins, asmstr, pattern> {
183 field bits<16> SoftFail = 0;
188 class InstI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
189 : InstSystemZ<2, outs, ins, asmstr, pattern> {
191 field bits<16> SoftFail = 0;
199 class InstIE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
200 : InstSystemZ<4, outs, ins, asmstr, pattern> {
202 field bits<32> SoftFail = 0;
207 let Inst{31-16} = op;
213 class InstMII<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
214 : InstSystemZ<6, outs, ins, asmstr, pattern> {
216 field bits<48> SoftFail = 0;
222 let Inst{47-40} = op;
223 let Inst{39-36} = M1;
224 let Inst{35-24} = RI2;
225 let Inst{23-0} = RI3;
228 class InstRIa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
229 : InstSystemZ<4, outs, ins, asmstr, pattern> {
231 field bits<32> SoftFail = 0;
236 let Inst{31-24} = op{11-4};
237 let Inst{23-20} = R1;
238 let Inst{19-16} = op{3-0};
242 class InstRIb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
243 : InstSystemZ<4, outs, ins, asmstr, pattern> {
245 field bits<32> SoftFail = 0;
250 let Inst{31-24} = op{11-4};
251 let Inst{23-20} = R1;
252 let Inst{19-16} = op{3-0};
253 let Inst{15-0} = RI2;
256 class InstRIc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
257 : InstSystemZ<4, outs, ins, asmstr, pattern> {
259 field bits<32> SoftFail = 0;
264 let Inst{31-24} = op{11-4};
265 let Inst{23-20} = M1;
266 let Inst{19-16} = op{3-0};
267 let Inst{15-0} = RI2;
270 class InstRIEa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
271 : InstSystemZ<6, outs, ins, asmstr, pattern> {
273 field bits<48> SoftFail = 0;
279 let Inst{47-40} = op{15-8};
280 let Inst{39-36} = R1;
282 let Inst{31-16} = I2;
283 let Inst{15-12} = M3;
285 let Inst{7-0} = op{7-0};
288 class InstRIEb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
289 : InstSystemZ<6, outs, ins, asmstr, pattern> {
291 field bits<48> SoftFail = 0;
298 let Inst{47-40} = op{15-8};
299 let Inst{39-36} = R1;
300 let Inst{35-32} = R2;
301 let Inst{31-16} = RI4;
302 let Inst{15-12} = M3;
304 let Inst{7-0} = op{7-0};
307 class InstRIEc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
308 : InstSystemZ<6, outs, ins, asmstr, pattern> {
310 field bits<48> SoftFail = 0;
317 let Inst{47-40} = op{15-8};
318 let Inst{39-36} = R1;
319 let Inst{35-32} = M3;
320 let Inst{31-16} = RI4;
322 let Inst{7-0} = op{7-0};
325 class InstRIEd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
326 : InstSystemZ<6, outs, ins, asmstr, pattern> {
328 field bits<48> SoftFail = 0;
334 let Inst{47-40} = op{15-8};
335 let Inst{39-36} = R1;
336 let Inst{35-32} = R3;
337 let Inst{31-16} = I2;
339 let Inst{7-0} = op{7-0};
342 class InstRIEe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
343 : InstSystemZ<6, outs, ins, asmstr, pattern> {
345 field bits<48> SoftFail = 0;
351 let Inst{47-40} = op{15-8};
352 let Inst{39-36} = R1;
353 let Inst{35-32} = R3;
354 let Inst{31-16} = RI2;
356 let Inst{7-0} = op{7-0};
359 class InstRIEf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
360 : InstSystemZ<6, outs, ins, asmstr, pattern> {
362 field bits<48> SoftFail = 0;
370 let Inst{47-40} = op{15-8};
371 let Inst{39-36} = R1;
372 let Inst{35-32} = R2;
373 let Inst{31-24} = I3;
374 let Inst{23-16} = I4;
376 let Inst{7-0} = op{7-0};
379 class InstRIEg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
380 : InstSystemZ<6, outs, ins, asmstr, pattern> {
382 field bits<48> SoftFail = 0;
388 let Inst{47-40} = op{15-8};
389 let Inst{39-36} = R1;
390 let Inst{35-32} = M3;
391 let Inst{31-16} = I2;
393 let Inst{7-0} = op{7-0};
396 class InstRILa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
397 : InstSystemZ<6, outs, ins, asmstr, pattern> {
399 field bits<48> SoftFail = 0;
404 let Inst{47-40} = op{11-4};
405 let Inst{39-36} = R1;
406 let Inst{35-32} = op{3-0};
410 class InstRILb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
411 : InstSystemZ<6, outs, ins, asmstr, pattern> {
413 field bits<48> SoftFail = 0;
418 let Inst{47-40} = op{11-4};
419 let Inst{39-36} = R1;
420 let Inst{35-32} = op{3-0};
421 let Inst{31-0} = RI2;
424 class InstRILc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
425 : InstSystemZ<6, outs, ins, asmstr, pattern> {
427 field bits<48> SoftFail = 0;
432 let Inst{47-40} = op{11-4};
433 let Inst{39-36} = M1;
434 let Inst{35-32} = op{3-0};
435 let Inst{31-0} = RI2;
438 class InstRIS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
439 : InstSystemZ<6, outs, ins, asmstr, pattern> {
441 field bits<48> SoftFail = 0;
448 let Inst{47-40} = op{15-8};
449 let Inst{39-36} = R1;
450 let Inst{35-32} = M3;
451 let Inst{31-16} = BD4;
453 let Inst{7-0} = op{7-0};
456 class InstRR<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
457 : InstSystemZ<2, outs, ins, asmstr, pattern> {
459 field bits<16> SoftFail = 0;
469 class InstRRD<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
470 : InstSystemZ<4, outs, ins, asmstr, pattern> {
472 field bits<32> SoftFail = 0;
478 let Inst{31-16} = op;
479 let Inst{15-12} = R1;
485 class InstRRE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
486 : InstSystemZ<4, outs, ins, asmstr, pattern> {
488 field bits<32> SoftFail = 0;
493 let Inst{31-16} = op;
499 class InstRRFa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
500 : InstSystemZ<4, outs, ins, asmstr, pattern> {
502 field bits<32> SoftFail = 0;
509 let Inst{31-16} = op;
510 let Inst{15-12} = R3;
516 class InstRRFb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
517 : InstSystemZ<4, outs, ins, asmstr, pattern> {
519 field bits<32> SoftFail = 0;
526 let Inst{31-16} = op;
527 let Inst{15-12} = R3;
533 class InstRRFc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
534 : InstSystemZ<4, outs, ins, asmstr, pattern> {
536 field bits<32> SoftFail = 0;
542 let Inst{31-16} = op;
543 let Inst{15-12} = M3;
549 class InstRRFd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
550 : InstSystemZ<4, outs, ins, asmstr, pattern> {
552 field bits<32> SoftFail = 0;
558 let Inst{31-16} = op;
565 class InstRRFe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
566 : InstSystemZ<4, outs, ins, asmstr, pattern> {
568 field bits<32> SoftFail = 0;
575 let Inst{31-16} = op;
576 let Inst{15-12} = M3;
582 class InstRRS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
583 : InstSystemZ<6, outs, ins, asmstr, pattern> {
585 field bits<48> SoftFail = 0;
592 let Inst{47-40} = op{15-8};
593 let Inst{39-36} = R1;
594 let Inst{35-32} = R2;
595 let Inst{31-16} = BD4;
596 let Inst{15-12} = M3;
598 let Inst{7-0} = op{7-0};
601 class InstRXa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
602 : InstSystemZ<4, outs, ins, asmstr, pattern> {
604 field bits<32> SoftFail = 0;
609 let Inst{31-24} = op;
610 let Inst{23-20} = R1;
611 let Inst{19-0} = XBD2;
616 class InstRXb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
617 : InstSystemZ<4, outs, ins, asmstr, pattern> {
619 field bits<32> SoftFail = 0;
624 let Inst{31-24} = op;
625 let Inst{23-20} = M1;
626 let Inst{19-0} = XBD2;
631 class InstRXE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
632 : InstSystemZ<6, outs, ins, asmstr, pattern> {
634 field bits<48> SoftFail = 0;
640 let Inst{47-40} = op{15-8};
641 let Inst{39-36} = R1;
642 let Inst{35-16} = XBD2;
643 let Inst{15-12} = M3;
645 let Inst{7-0} = op{7-0};
650 class InstRXF<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
651 : InstSystemZ<6, outs, ins, asmstr, pattern> {
653 field bits<48> SoftFail = 0;
659 let Inst{47-40} = op{15-8};
660 let Inst{39-36} = R3;
661 let Inst{35-16} = XBD2;
662 let Inst{15-12} = R1;
664 let Inst{7-0} = op{7-0};
669 class InstRXYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
670 : InstSystemZ<6, outs, ins, asmstr, pattern> {
672 field bits<48> SoftFail = 0;
677 let Inst{47-40} = op{15-8};
678 let Inst{39-36} = R1;
679 let Inst{35-8} = XBD2;
680 let Inst{7-0} = op{7-0};
682 let Has20BitOffset = 1;
686 class InstRXYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
687 : InstSystemZ<6, outs, ins, asmstr, pattern> {
689 field bits<48> SoftFail = 0;
694 let Inst{47-40} = op{15-8};
695 let Inst{39-36} = M1;
696 let Inst{35-8} = XBD2;
697 let Inst{7-0} = op{7-0};
699 let Has20BitOffset = 1;
703 class InstRSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
704 : InstSystemZ<4, outs, ins, asmstr, pattern> {
706 field bits<32> SoftFail = 0;
712 let Inst{31-24} = op;
713 let Inst{23-20} = R1;
714 let Inst{19-16} = R3;
715 let Inst{15-0} = BD2;
718 class InstRSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
719 : InstSystemZ<4, outs, ins, asmstr, pattern> {
721 field bits<32> SoftFail = 0;
727 let Inst{31-24} = op;
728 let Inst{23-20} = R1;
729 let Inst{19-16} = M3;
730 let Inst{15-0} = BD2;
733 class InstRSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
734 : InstSystemZ<4, outs, ins, asmstr, pattern> {
736 field bits<32> SoftFail = 0;
742 let Inst{31-24} = op;
743 let Inst{23-20} = R1;
744 let Inst{19-16} = R3;
745 let Inst{15-0} = RI2;
748 class InstRSLa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
749 : InstSystemZ<6, outs, ins, asmstr, pattern> {
751 field bits<48> SoftFail = 0;
755 let Inst{47-40} = op{15-8};
756 let Inst{39-36} = BDL1{19-16};
758 let Inst{31-16} = BDL1{15-0};
760 let Inst{7-0} = op{7-0};
763 class InstRSLb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
764 : InstSystemZ<6, outs, ins, asmstr, pattern> {
766 field bits<48> SoftFail = 0;
772 let Inst{47-40} = op{15-8};
773 let Inst{39-16} = BDL2;
774 let Inst{15-12} = R1;
776 let Inst{7-0} = op{7-0};
779 class InstRSYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
780 : InstSystemZ<6, outs, ins, asmstr, pattern> {
782 field bits<48> SoftFail = 0;
788 let Inst{47-40} = op{15-8};
789 let Inst{39-36} = R1;
790 let Inst{35-32} = R3;
791 let Inst{31-8} = BD2;
792 let Inst{7-0} = op{7-0};
794 let Has20BitOffset = 1;
797 class InstRSYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
798 : InstSystemZ<6, outs, ins, asmstr, pattern> {
800 field bits<48> SoftFail = 0;
806 let Inst{47-40} = op{15-8};
807 let Inst{39-36} = R1;
808 let Inst{35-32} = M3;
809 let Inst{31-8} = BD2;
810 let Inst{7-0} = op{7-0};
812 let Has20BitOffset = 1;
815 class InstSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
816 : InstSystemZ<4, outs, ins, asmstr, pattern> {
818 field bits<32> SoftFail = 0;
823 let Inst{31-24} = op;
824 let Inst{23-16} = I2;
825 let Inst{15-0} = BD1;
828 class InstSIL<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
829 : InstSystemZ<6, outs, ins, asmstr, pattern> {
831 field bits<48> SoftFail = 0;
836 let Inst{47-32} = op;
837 let Inst{31-16} = BD1;
841 class InstSIY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
842 : InstSystemZ<6, outs, ins, asmstr, pattern> {
844 field bits<48> SoftFail = 0;
849 let Inst{47-40} = op{15-8};
850 let Inst{39-32} = I2;
851 let Inst{31-8} = BD1;
852 let Inst{7-0} = op{7-0};
854 let Has20BitOffset = 1;
857 class InstSMI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
858 : InstSystemZ<6, outs, ins, asmstr, pattern> {
860 field bits<48> SoftFail = 0;
866 let Inst{47-40} = op;
867 let Inst{39-36} = M1;
869 let Inst{31-16} = BD3;
870 let Inst{15-0} = RI2;
873 class InstSSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
874 : InstSystemZ<6, outs, ins, asmstr, pattern> {
876 field bits<48> SoftFail = 0;
881 let Inst{47-40} = op;
882 let Inst{39-16} = BDL1;
883 let Inst{15-0} = BD2;
886 class InstSSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
887 : InstSystemZ<6, outs, ins, asmstr, pattern> {
889 field bits<48> SoftFail = 0;
894 let Inst{47-40} = op;
895 let Inst{39-36} = BDL1{19-16};
896 let Inst{35-32} = BDL2{19-16};
897 let Inst{31-16} = BDL1{15-0};
898 let Inst{15-0} = BDL2{15-0};
901 class InstSSc<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
902 : InstSystemZ<6, outs, ins, asmstr, pattern> {
904 field bits<48> SoftFail = 0;
910 let Inst{47-40} = op;
911 let Inst{39-36} = BDL1{19-16};
912 let Inst{35-32} = I3;
913 let Inst{31-16} = BDL1{15-0};
914 let Inst{15-0} = BD2;
917 class InstSSd<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
918 : InstSystemZ<6, outs, ins, asmstr, pattern> {
920 field bits<48> SoftFail = 0;
926 let Inst{47-40} = op;
927 let Inst{39-36} = RBD1{19-16};
928 let Inst{35-32} = R3;
929 let Inst{31-16} = RBD1{15-0};
930 let Inst{15-0} = BD2;
933 class InstSSe<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
934 : InstSystemZ<6, outs, ins, asmstr, pattern> {
936 field bits<48> SoftFail = 0;
943 let Inst{47-40} = op;
944 let Inst{39-36} = R1;
945 let Inst{35-32} = R3;
946 let Inst{31-16} = BD2;
947 let Inst{15-0} = BD4;
950 class InstSSf<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
951 : InstSystemZ<6, outs, ins, asmstr, pattern> {
953 field bits<48> SoftFail = 0;
958 let Inst{47-40} = op;
959 let Inst{39-32} = BDL2{23-16};
960 let Inst{31-16} = BD1;
961 let Inst{15-0} = BDL2{15-0};
964 class InstSSE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
965 : InstSystemZ<6, outs, ins, asmstr, pattern> {
967 field bits<48> SoftFail = 0;
972 let Inst{47-32} = op;
973 let Inst{31-16} = BD1;
974 let Inst{15-0} = BD2;
977 class InstSSF<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
978 : InstSystemZ<6, outs, ins, asmstr, pattern> {
980 field bits<48> SoftFail = 0;
986 let Inst{47-40} = op{11-4};
987 let Inst{39-36} = R3;
988 let Inst{35-32} = op{3-0};
989 let Inst{31-16} = BD1;
990 let Inst{15-0} = BD2;
993 class InstS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
994 : InstSystemZ<4, outs, ins, asmstr, pattern> {
996 field bits<32> SoftFail = 0;
1000 let Inst{31-16} = op;
1001 let Inst{15-0} = BD2;
1004 class InstVRIa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1005 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1006 field bits<48> Inst;
1007 field bits<48> SoftFail = 0;
1013 let Inst{47-40} = op{15-8};
1014 let Inst{39-36} = V1{3-0};
1015 let Inst{35-32} = 0;
1016 let Inst{31-16} = I2;
1017 let Inst{15-12} = M3;
1018 let Inst{11} = V1{4};
1020 let Inst{7-0} = op{7-0};
1023 class InstVRIb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1024 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1025 field bits<48> Inst;
1026 field bits<48> SoftFail = 0;
1033 let Inst{47-40} = op{15-8};
1034 let Inst{39-36} = V1{3-0};
1035 let Inst{35-32} = 0;
1036 let Inst{31-24} = I2;
1037 let Inst{23-16} = I3;
1038 let Inst{15-12} = M4;
1039 let Inst{11} = V1{4};
1041 let Inst{7-0} = op{7-0};
1044 class InstVRIc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1045 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1046 field bits<48> Inst;
1047 field bits<48> SoftFail = 0;
1054 let Inst{47-40} = op{15-8};
1055 let Inst{39-36} = V1{3-0};
1056 let Inst{35-32} = V3{3-0};
1057 let Inst{31-16} = I2;
1058 let Inst{15-12} = M4;
1059 let Inst{11} = V1{4};
1060 let Inst{10} = V3{4};
1062 let Inst{7-0} = op{7-0};
1065 class InstVRId<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1066 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1067 field bits<48> Inst;
1068 field bits<48> SoftFail = 0;
1076 let Inst{47-40} = op{15-8};
1077 let Inst{39-36} = V1{3-0};
1078 let Inst{35-32} = V2{3-0};
1079 let Inst{31-28} = V3{3-0};
1080 let Inst{27-24} = 0;
1081 let Inst{23-16} = I4;
1082 let Inst{15-12} = M5;
1083 let Inst{11} = V1{4};
1084 let Inst{10} = V2{4};
1085 let Inst{9} = V3{4};
1087 let Inst{7-0} = op{7-0};
1090 class InstVRIe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1091 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1092 field bits<48> Inst;
1093 field bits<48> SoftFail = 0;
1101 let Inst{47-40} = op{15-8};
1102 let Inst{39-36} = V1{3-0};
1103 let Inst{35-32} = V2{3-0};
1104 let Inst{31-20} = I3;
1105 let Inst{19-16} = M5;
1106 let Inst{15-12} = M4;
1107 let Inst{11} = V1{4};
1108 let Inst{10} = V2{4};
1110 let Inst{7-0} = op{7-0};
1113 class InstVRIf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1114 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1115 field bits<48> Inst;
1116 field bits<48> SoftFail = 0;
1124 let Inst{47-40} = op{15-8};
1125 let Inst{39-36} = V1{3-0};
1126 let Inst{35-32} = V2{3-0};
1127 let Inst{31-28} = V3{3-0};
1128 let Inst{27-24} = 0;
1129 let Inst{23-20} = M5;
1130 let Inst{19-12} = I4;
1131 let Inst{11} = V1{4};
1132 let Inst{10} = V2{4};
1133 let Inst{9} = V3{4};
1135 let Inst{7-0} = op{7-0};
1138 class InstVRIg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1139 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1140 field bits<48> Inst;
1141 field bits<48> SoftFail = 0;
1149 let Inst{47-40} = op{15-8};
1150 let Inst{39-36} = V1{3-0};
1151 let Inst{35-32} = V2{3-0};
1152 let Inst{31-24} = I4;
1153 let Inst{23-20} = M5;
1154 let Inst{19-12} = I3;
1155 let Inst{11} = V1{4};
1156 let Inst{10} = V2{4};
1158 let Inst{7-0} = op{7-0};
1161 class InstVRIh<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1162 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1163 field bits<48> Inst;
1164 field bits<48> SoftFail = 0;
1170 let Inst{47-40} = op{15-8};
1171 let Inst{39-36} = V1{3-0};
1172 let Inst{35-32} = 0;
1173 let Inst{31-16} = I2;
1174 let Inst{15-12} = I3;
1175 let Inst{11} = V1{4};
1177 let Inst{7-0} = op{7-0};
1180 class InstVRIi<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1181 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1182 field bits<48> Inst;
1183 field bits<48> SoftFail = 0;
1190 let Inst{47-40} = op{15-8};
1191 let Inst{39-36} = V1{3-0};
1192 let Inst{35-32} = R2;
1193 let Inst{31-24} = 0;
1194 let Inst{23-20} = M4;
1195 let Inst{19-12} = I3;
1196 let Inst{11} = V1{4};
1198 let Inst{7-0} = op{7-0};
1201 // Depending on the instruction mnemonic, certain bits may be or-ed into
1202 // the M4 value provided as explicit operand. These are passed as m4or.
1203 class InstVRRa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1205 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1206 field bits<48> Inst;
1207 field bits<48> SoftFail = 0;
1215 let Inst{47-40} = op{15-8};
1216 let Inst{39-36} = V1{3-0};
1217 let Inst{35-32} = V2{3-0};
1218 let Inst{31-24} = 0;
1219 let Inst{23-20} = M5;
1220 let Inst{19} = !if (!eq (m4or{3}, 1), 1, M4{3});
1221 let Inst{18} = !if (!eq (m4or{2}, 1), 1, M4{2});
1222 let Inst{17} = !if (!eq (m4or{1}, 1), 1, M4{1});
1223 let Inst{16} = !if (!eq (m4or{0}, 1), 1, M4{0});
1224 let Inst{15-12} = M3;
1225 let Inst{11} = V1{4};
1226 let Inst{10} = V2{4};
1228 let Inst{7-0} = op{7-0};
1231 // Depending on the instruction mnemonic, certain bits may be or-ed into
1232 // the M5 value provided as explicit operand. These are passed as m5or.
1233 class InstVRRb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1235 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1236 field bits<48> Inst;
1237 field bits<48> SoftFail = 0;
1245 let Inst{47-40} = op{15-8};
1246 let Inst{39-36} = V1{3-0};
1247 let Inst{35-32} = V2{3-0};
1248 let Inst{31-28} = V3{3-0};
1249 let Inst{27-24} = 0;
1250 let Inst{23} = !if (!eq (m5or{3}, 1), 1, M5{3});
1251 let Inst{22} = !if (!eq (m5or{2}, 1), 1, M5{2});
1252 let Inst{21} = !if (!eq (m5or{1}, 1), 1, M5{1});
1253 let Inst{20} = !if (!eq (m5or{0}, 1), 1, M5{0});
1254 let Inst{19-16} = 0;
1255 let Inst{15-12} = M4;
1256 let Inst{11} = V1{4};
1257 let Inst{10} = V2{4};
1258 let Inst{9} = V3{4};
1260 let Inst{7-0} = op{7-0};
1263 class InstVRRc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1264 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1265 field bits<48> Inst;
1266 field bits<48> SoftFail = 0;
1275 let Inst{47-40} = op{15-8};
1276 let Inst{39-36} = V1{3-0};
1277 let Inst{35-32} = V2{3-0};
1278 let Inst{31-28} = V3{3-0};
1279 let Inst{27-24} = 0;
1280 let Inst{23-20} = M6;
1281 let Inst{19-16} = M5;
1282 let Inst{15-12} = M4;
1283 let Inst{11} = V1{4};
1284 let Inst{10} = V2{4};
1285 let Inst{9} = V3{4};
1287 let Inst{7-0} = op{7-0};
1290 // Depending on the instruction mnemonic, certain bits may be or-ed into
1291 // the M6 value provided as explicit operand. These are passed as m6or.
1292 class InstVRRd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1294 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1295 field bits<48> Inst;
1296 field bits<48> SoftFail = 0;
1305 let Inst{47-40} = op{15-8};
1306 let Inst{39-36} = V1{3-0};
1307 let Inst{35-32} = V2{3-0};
1308 let Inst{31-28} = V3{3-0};
1309 let Inst{27-24} = M5;
1310 let Inst{23} = !if (!eq (m6or{3}, 1), 1, M6{3});
1311 let Inst{22} = !if (!eq (m6or{2}, 1), 1, M6{2});
1312 let Inst{21} = !if (!eq (m6or{1}, 1), 1, M6{1});
1313 let Inst{20} = !if (!eq (m6or{0}, 1), 1, M6{0});
1314 let Inst{19-16} = 0;
1315 let Inst{15-12} = V4{3-0};
1316 let Inst{11} = V1{4};
1317 let Inst{10} = V2{4};
1318 let Inst{9} = V3{4};
1319 let Inst{8} = V4{4};
1320 let Inst{7-0} = op{7-0};
1323 class InstVRRe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1324 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1325 field bits<48> Inst;
1326 field bits<48> SoftFail = 0;
1335 let Inst{47-40} = op{15-8};
1336 let Inst{39-36} = V1{3-0};
1337 let Inst{35-32} = V2{3-0};
1338 let Inst{31-28} = V3{3-0};
1339 let Inst{27-24} = M6;
1340 let Inst{23-20} = 0;
1341 let Inst{19-16} = M5;
1342 let Inst{15-12} = V4{3-0};
1343 let Inst{11} = V1{4};
1344 let Inst{10} = V2{4};
1345 let Inst{9} = V3{4};
1346 let Inst{8} = V4{4};
1347 let Inst{7-0} = op{7-0};
1350 class InstVRRf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1351 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1352 field bits<48> Inst;
1353 field bits<48> SoftFail = 0;
1359 let Inst{47-40} = op{15-8};
1360 let Inst{39-36} = V1{3-0};
1361 let Inst{35-32} = R2;
1362 let Inst{31-28} = R3;
1363 let Inst{27-12} = 0;
1364 let Inst{11} = V1{4};
1366 let Inst{7-0} = op{7-0};
1369 class InstVRRg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1370 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1371 field bits<48> Inst;
1372 field bits<48> SoftFail = 0;
1376 let Inst{47-40} = op{15-8};
1377 let Inst{39-36} = 0;
1378 let Inst{35-32} = V1{3-0};
1379 let Inst{31-12} = 0;
1381 let Inst{10} = V1{4};
1383 let Inst{7-0} = op{7-0};
1386 class InstVRRh<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1387 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1388 field bits<48> Inst;
1389 field bits<48> SoftFail = 0;
1395 let Inst{47-40} = op{15-8};
1396 let Inst{39-36} = 0;
1397 let Inst{35-32} = V1{3-0};
1398 let Inst{31-28} = V2{3-0};
1399 let Inst{27-24} = 0;
1400 let Inst{23-20} = M3;
1401 let Inst{19-12} = 0;
1403 let Inst{10} = V1{4};
1404 let Inst{9} = V2{4};
1406 let Inst{7-0} = op{7-0};
1409 class InstVRRi<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1410 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1411 field bits<48> Inst;
1412 field bits<48> SoftFail = 0;
1419 let Inst{47-40} = op{15-8};
1420 let Inst{39-36} = R1;
1421 let Inst{35-32} = V2{3-0};
1422 let Inst{31-24} = 0;
1423 let Inst{23-20} = M3;
1424 let Inst{19-16} = M4;
1425 let Inst{15-12} = 0;
1427 let Inst{10} = V2{4};
1429 let Inst{7-0} = op{7-0};
1432 class InstVRSa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1433 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1434 field bits<48> Inst;
1435 field bits<48> SoftFail = 0;
1442 let Inst{47-40} = op{15-8};
1443 let Inst{39-36} = V1{3-0};
1444 let Inst{35-32} = V3{3-0};
1445 let Inst{31-16} = BD2;
1446 let Inst{15-12} = M4;
1447 let Inst{11} = V1{4};
1448 let Inst{10} = V3{4};
1450 let Inst{7-0} = op{7-0};
1453 class InstVRSb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1454 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1455 field bits<48> Inst;
1456 field bits<48> SoftFail = 0;
1463 let Inst{47-40} = op{15-8};
1464 let Inst{39-36} = V1{3-0};
1465 let Inst{35-32} = R3;
1466 let Inst{31-16} = BD2;
1467 let Inst{15-12} = M4;
1468 let Inst{11} = V1{4};
1470 let Inst{7-0} = op{7-0};
1473 class InstVRSc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1474 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1475 field bits<48> Inst;
1476 field bits<48> SoftFail = 0;
1483 let Inst{47-40} = op{15-8};
1484 let Inst{39-36} = R1;
1485 let Inst{35-32} = V3{3-0};
1486 let Inst{31-16} = BD2;
1487 let Inst{15-12} = M4;
1489 let Inst{10} = V3{4};
1491 let Inst{7-0} = op{7-0};
1494 class InstVRSd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1495 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1496 field bits<48> Inst;
1497 field bits<48> SoftFail = 0;
1503 let Inst{47-40} = op{15-8};
1504 let Inst{39-36} = 0;
1505 let Inst{35-32} = R3;
1506 let Inst{31-16} = BD2;
1507 let Inst{15-12} = V1{3-0};
1509 let Inst{8} = V1{4};
1510 let Inst{7-0} = op{7-0};
1513 class InstVRV<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1514 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1515 field bits<48> Inst;
1516 field bits<48> SoftFail = 0;
1522 let Inst{47-40} = op{15-8};
1523 let Inst{39-36} = V1{3-0};
1524 let Inst{35-16} = VBD2{19-0};
1525 let Inst{15-12} = M3;
1526 let Inst{11} = V1{4};
1527 let Inst{10} = VBD2{20};
1529 let Inst{7-0} = op{7-0};
1532 class InstVRX<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1533 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1534 field bits<48> Inst;
1535 field bits<48> SoftFail = 0;
1541 let Inst{47-40} = op{15-8};
1542 let Inst{39-36} = V1{3-0};
1543 let Inst{35-16} = XBD2;
1544 let Inst{15-12} = M3;
1545 let Inst{11} = V1{4};
1547 let Inst{7-0} = op{7-0};
1550 class InstVSI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1551 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1552 field bits<48> Inst;
1553 field bits<48> SoftFail = 0;
1559 let Inst{47-40} = op{15-8};
1560 let Inst{39-32} = I3;
1561 let Inst{31-16} = BD2;
1562 let Inst{15-12} = V1{3-0};
1564 let Inst{8} = V1{4};
1565 let Inst{7-0} = op{7-0};
1568 //===----------------------------------------------------------------------===//
1569 // Instruction classes for .insn directives
1570 //===----------------------------------------------------------------------===//
1572 class DirectiveInsnE<dag outs, dag ins, string asmstr, list<dag> pattern>
1573 : InstE<0, outs, ins, asmstr, pattern> {
1579 class DirectiveInsnRI<dag outs, dag ins, string asmstr, list<dag> pattern>
1580 : InstRIa<0, outs, ins, asmstr, pattern> {
1583 let Inst{31-24} = enc{31-24};
1584 let Inst{19-16} = enc{19-16};
1587 class DirectiveInsnRIE<dag outs, dag ins, string asmstr, list<dag> pattern>
1588 : InstRIEd<0, outs, ins, asmstr, pattern> {
1591 let Inst{47-40} = enc{47-40};
1592 let Inst{7-0} = enc{7-0};
1595 class DirectiveInsnRIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1596 : InstRILa<0, outs, ins, asmstr, pattern> {
1600 let Inst{47-40} = enc{47-40};
1601 let Inst{35-32} = enc{35-32};
1604 class DirectiveInsnRIS<dag outs, dag ins, string asmstr, list<dag> pattern>
1605 : InstRIS<0, outs, ins, asmstr, pattern> {
1608 let Inst{47-40} = enc{47-40};
1609 let Inst{7-0} = enc{7-0};
1612 class DirectiveInsnRR<dag outs, dag ins, string asmstr, list<dag> pattern>
1613 : InstRR<0, outs, ins, asmstr, pattern> {
1616 let Inst{15-8} = enc{15-8};
1619 class DirectiveInsnRRE<dag outs, dag ins, string asmstr, list<dag> pattern>
1620 : InstRRE<0, outs, ins, asmstr, pattern> {
1623 let Inst{31-16} = enc{31-16};
1626 class DirectiveInsnRRF<dag outs, dag ins, string asmstr, list<dag> pattern>
1627 : InstRRFa<0, outs, ins, asmstr, pattern> {
1630 let Inst{31-16} = enc{31-16};
1633 class DirectiveInsnRRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1634 : InstRRS<0, outs, ins, asmstr, pattern> {
1637 let Inst{47-40} = enc{47-40};
1638 let Inst{7-0} = enc{7-0};
1641 class DirectiveInsnRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1642 : InstRSa<0, outs, ins, asmstr, pattern> {
1645 let Inst{31-24} = enc{31-24};
1648 // RSE is like RSY except with a 12 bit displacement (instead of 20).
1649 class DirectiveInsnRSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1650 : InstRSYa<6, outs, ins, asmstr, pattern> {
1653 let Inst{47-40} = enc{47-40};
1654 let Inst{31-16} = BD2{15-0};
1656 let Inst{7-0} = enc{7-0};
1659 class DirectiveInsnRSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1660 : InstRSI<0, outs, ins, asmstr, pattern> {
1663 let Inst{31-24} = enc{31-24};
1666 class DirectiveInsnRSY<dag outs, dag ins, string asmstr, list<dag> pattern>
1667 : InstRSYa<0, outs, ins, asmstr, pattern> {
1670 let Inst{47-40} = enc{47-40};
1671 let Inst{7-0} = enc{7-0};
1674 class DirectiveInsnRX<dag outs, dag ins, string asmstr, list<dag> pattern>
1675 : InstRXa<0, outs, ins, asmstr, pattern> {
1678 let Inst{31-24} = enc{31-24};
1681 class DirectiveInsnRXE<dag outs, dag ins, string asmstr, list<dag> pattern>
1682 : InstRXE<0, outs, ins, asmstr, pattern> {
1687 let Inst{47-40} = enc{47-40};
1688 let Inst{7-0} = enc{7-0};
1691 class DirectiveInsnRXF<dag outs, dag ins, string asmstr, list<dag> pattern>
1692 : InstRXF<0, outs, ins, asmstr, pattern> {
1695 let Inst{47-40} = enc{47-40};
1696 let Inst{7-0} = enc{7-0};
1699 class DirectiveInsnRXY<dag outs, dag ins, string asmstr, list<dag> pattern>
1700 : InstRXYa<0, outs, ins, asmstr, pattern> {
1703 let Inst{47-40} = enc{47-40};
1704 let Inst{7-0} = enc{7-0};
1707 class DirectiveInsnS<dag outs, dag ins, string asmstr, list<dag> pattern>
1708 : InstS<0, outs, ins, asmstr, pattern> {
1711 let Inst{31-16} = enc{31-16};
1714 class DirectiveInsnSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1715 : InstSI<0, outs, ins, asmstr, pattern> {
1718 let Inst{31-24} = enc{31-24};
1721 class DirectiveInsnSIY<dag outs, dag ins, string asmstr, list<dag> pattern>
1722 : InstSIY<0, outs, ins, asmstr, pattern> {
1725 let Inst{47-40} = enc{47-40};
1726 let Inst{7-0} = enc{7-0};
1729 class DirectiveInsnSIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1730 : InstSIL<0, outs, ins, asmstr, pattern> {
1733 let Inst{47-32} = enc{47-32};
1736 class DirectiveInsnSS<dag outs, dag ins, string asmstr, list<dag> pattern>
1737 : InstSSd<0, outs, ins, asmstr, pattern> {
1740 let Inst{47-40} = enc{47-40};
1743 class DirectiveInsnSSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1744 : InstSSE<0, outs, ins, asmstr, pattern> {
1747 let Inst{47-32} = enc{47-32};
1750 class DirectiveInsnSSF<dag outs, dag ins, string asmstr, list<dag> pattern>
1751 : InstSSF<0, outs, ins, asmstr, pattern> {
1754 let Inst{47-40} = enc{47-40};
1755 let Inst{35-32} = enc{35-32};
1758 //===----------------------------------------------------------------------===//
1759 // Variants of instructions with condition mask
1760 //===----------------------------------------------------------------------===//
1762 // For instructions using a condition mask (e.g. conditional branches,
1763 // compare-and-branch instructions, or conditional move instructions),
1764 // we generally need to create multiple instruction patterns:
1766 // - One used for code generation, which encodes the condition mask as an
1767 // MI operand, but writes out an extended mnemonic for better readability.
1768 // - One pattern for the base form of the instruction with an explicit
1769 // condition mask (encoded as a plain integer MI operand).
1770 // - Specific patterns for each extended mnemonic, where the condition mask
1771 // is implied by the pattern name and not otherwise encoded at all.
1773 // We need the latter primarily for the assembler and disassembler, since the
1774 // assembler parser is not able to decode part of an instruction mnemonic
1775 // into an operand. Thus we provide separate patterns for each mnemonic.
1777 // Note that in some cases there are two different mnemonics for the same
1778 // condition mask. In this case we cannot have both instructions available
1779 // to the disassembler at the same time since the encodings are not distinct.
1780 // Therefore the alternate forms are marked isAsmParserOnly.
1782 // We don't make one of the two names an alias of the other because
1783 // we need the custom parsing routines to select the correct register class.
1785 // This section provides helpers for generating the specific forms.
1787 //===----------------------------------------------------------------------===//
1789 // A class to describe a variant of an instruction with condition mask.
1790 class CondVariant<bits<4> ccmaskin, string suffixin, bit alternatein> {
1791 // The fixed condition mask to use.
1792 bits<4> ccmask = ccmaskin;
1794 // The suffix to use for the extended assembler mnemonic.
1795 string suffix = suffixin;
1797 // Whether this is an alternate that needs to be marked isAsmParserOnly.
1798 bit alternate = alternatein;
1801 // Condition mask 15 means "always true", which is used to define
1802 // unconditional branches as a variant of conditional branches.
1803 def CondAlways : CondVariant<15, "", 0>;
1805 // Condition masks for general instructions that can set all 4 bits.
1806 def CondVariantO : CondVariant<1, "o", 0>;
1807 def CondVariantH : CondVariant<2, "h", 0>;
1808 def CondVariantP : CondVariant<2, "p", 1>;
1809 def CondVariantNLE : CondVariant<3, "nle", 0>;
1810 def CondVariantL : CondVariant<4, "l", 0>;
1811 def CondVariantM : CondVariant<4, "m", 1>;
1812 def CondVariantNHE : CondVariant<5, "nhe", 0>;
1813 def CondVariantLH : CondVariant<6, "lh", 0>;
1814 def CondVariantNE : CondVariant<7, "ne", 0>;
1815 def CondVariantNZ : CondVariant<7, "nz", 1>;
1816 def CondVariantE : CondVariant<8, "e", 0>;
1817 def CondVariantZ : CondVariant<8, "z", 1>;
1818 def CondVariantNLH : CondVariant<9, "nlh", 0>;
1819 def CondVariantHE : CondVariant<10, "he", 0>;
1820 def CondVariantNL : CondVariant<11, "nl", 0>;
1821 def CondVariantNM : CondVariant<11, "nm", 1>;
1822 def CondVariantLE : CondVariant<12, "le", 0>;
1823 def CondVariantNH : CondVariant<13, "nh", 0>;
1824 def CondVariantNP : CondVariant<13, "np", 1>;
1825 def CondVariantNO : CondVariant<14, "no", 0>;
1827 // A helper class to look up one of the above by name.
1828 class CV<string name>
1829 : CondVariant<!cast<CondVariant>("CondVariant"#name).ccmask,
1830 !cast<CondVariant>("CondVariant"#name).suffix,
1831 !cast<CondVariant>("CondVariant"#name).alternate>;
1833 // Condition masks for integer instructions (e.g. compare-and-branch).
1834 // This is like the list above, except that condition 3 is not possible
1835 // and that the low bit of the mask is therefore always 0. This means
1836 // that each condition has two names. Conditions "o" and "no" are not used.
1837 def IntCondVariantH : CondVariant<2, "h", 0>;
1838 def IntCondVariantNLE : CondVariant<2, "nle", 1>;
1839 def IntCondVariantL : CondVariant<4, "l", 0>;
1840 def IntCondVariantNHE : CondVariant<4, "nhe", 1>;
1841 def IntCondVariantLH : CondVariant<6, "lh", 0>;
1842 def IntCondVariantNE : CondVariant<6, "ne", 1>;
1843 def IntCondVariantE : CondVariant<8, "e", 0>;
1844 def IntCondVariantNLH : CondVariant<8, "nlh", 1>;
1845 def IntCondVariantHE : CondVariant<10, "he", 0>;
1846 def IntCondVariantNL : CondVariant<10, "nl", 1>;
1847 def IntCondVariantLE : CondVariant<12, "le", 0>;
1848 def IntCondVariantNH : CondVariant<12, "nh", 1>;
1850 // A helper class to look up one of the above by name.
1851 class ICV<string name>
1852 : CondVariant<!cast<CondVariant>("IntCondVariant"#name).ccmask,
1853 !cast<CondVariant>("IntCondVariant"#name).suffix,
1854 !cast<CondVariant>("IntCondVariant"#name).alternate>;
1856 //===----------------------------------------------------------------------===//
1857 // Instruction definitions with semantics
1858 //===----------------------------------------------------------------------===//
1860 // These classes have the form [Cond]<Category><Format>, where <Format> is one
1861 // of the formats defined above and where <Category> describes the inputs
1862 // and outputs. "Cond" is used if the instruction is conditional,
1863 // in which case the 4-bit condition-code mask is added as a final operand.
1864 // <Category> can be one of:
1867 // One register output operand and no input operands.
1870 // Two register output operands and no input operands.
1873 // One address operand. The instruction stores to the address.
1875 // SideEffectInherent:
1876 // No input or output operands, but causes some side effect.
1879 // One branch target. The instruction branches to the target.
1882 // One output operand and one branch target. The instruction stores
1883 // the return address to the output operand and branches to the target.
1886 // Two input operands and one optional branch target. The instruction
1887 // compares the two input operands and branches or traps on the result.
1890 // One register output operand, one register input operand and one branch
1891 // target. The instructions stores a modified form of the source register
1892 // in the destination register and branches on the result.
1895 // One register output operand, two register input operands and one branch
1896 // target. The instructions stores a modified form of one of the source
1897 // registers in the destination register and branches on the result.
1900 // One address input operand and two explicit output operands.
1901 // The instruction loads a range of registers from the address,
1902 // with the explicit operands giving the first and last register
1903 // to load. Other loaded registers are added as implicit definitions.
1906 // Two explicit input register operands and an address operand.
1907 // The instruction stores a range of registers to the address,
1908 // with the explicit operands giving the first and last register
1909 // to store. Other stored registers are added as implicit uses.
1912 // One value operand, one length operand and one address operand.
1913 // The instruction stores the value operand to the address but
1914 // doesn't write more than the number of bytes specified by the
1918 // One register output operand and one address operand.
1920 // SideEffectAddress:
1921 // One address operand. No output operands, but causes some side effect.
1924 // One register output operand and one input operand.
1927 // One address operand and one other input operand. The instruction
1928 // stores to the address.
1931 // One input operand. No output operands, but causes some side effect.
1934 // One register output operand and two input operands.
1937 // One address operand and two other input operands. The instruction
1938 // stores to the address.
1940 // SideEffectBinary:
1941 // Two input operands. No output operands, but causes some side effect.
1944 // Two input operands and an implicit CC output operand.
1947 // One or two input operands and an implicit CC output operand. If
1948 // present, the second input operand is an "address" operand used as
1949 // a test class mask.
1952 // One register output operand and three input operands.
1954 // SideEffectTernary:
1955 // Three input operands. No output operands, but causes some side effect.
1958 // One register output operand and four input operands.
1961 // One output operand and two input operands, one of which is an address.
1962 // The instruction both reads from and writes to the address.
1965 // One output operand and three input operands, one of which is an address.
1966 // The instruction both reads from and writes to the address.
1969 // One output operand and five input operands. The first two operands
1970 // are registers and the other three are immediates.
1973 // One 4-bit immediate operand and one address operand. The immediate
1974 // operand is 1 for a load prefetch and 2 for a store prefetch.
1977 // One 4-bit immediate operand and two address operands.
1979 // The format determines which input operands are tied to output operands,
1980 // and also determines the shape of any address operand.
1982 // Multiclasses of the form <Category><Format>Pair define two instructions,
1983 // one with <Category><Format> and one with <Category><Format>Y. The name
1984 // of the first instruction has no suffix, the name of the second has
1987 //===----------------------------------------------------------------------===//
1989 class InherentRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
1990 SDPatternOperator operator>
1991 : InstRRE<opcode, (outs cls:$R1), (ins),
1993 [(set cls:$R1, (operator))]> {
1997 class InherentDualRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
1998 : InstRRE<opcode, (outs cls:$R1, cls:$R2), (ins),
1999 mnemonic#"\t$R1, $R2", []>;
2001 class InherentVRIa<string mnemonic, bits<16> opcode, bits<16> value>
2002 : InstVRIa<opcode, (outs VR128:$V1), (ins), mnemonic#"\t$V1", []> {
2007 class StoreInherentS<string mnemonic, bits<16> opcode,
2008 SDPatternOperator operator, bits<5> bytes>
2009 : InstS<opcode, (outs), (ins bdaddr12only:$BD2),
2010 mnemonic#"\t$BD2", [(operator bdaddr12only:$BD2)]> {
2012 let AccessBytes = bytes;
2015 class SideEffectInherentE<string mnemonic, bits<16>opcode>
2016 : InstE<opcode, (outs), (ins), mnemonic, []>;
2018 class SideEffectInherentS<string mnemonic, bits<16> opcode,
2019 SDPatternOperator operator>
2020 : InstS<opcode, (outs), (ins), mnemonic, [(operator)]> {
2024 class SideEffectInherentRRE<string mnemonic, bits<16> opcode>
2025 : InstRRE<opcode, (outs), (ins), mnemonic, []> {
2030 // Allow an optional TLS marker symbol to generate TLS call relocations.
2031 class CallRI<string mnemonic, bits<12> opcode>
2032 : InstRIb<opcode, (outs), (ins GR64:$R1, brtarget16tls:$RI2),
2033 mnemonic#"\t$R1, $RI2", []>;
2035 // Allow an optional TLS marker symbol to generate TLS call relocations.
2036 class CallRIL<string mnemonic, bits<12> opcode>
2037 : InstRILb<opcode, (outs), (ins GR64:$R1, brtarget32tls:$RI2),
2038 mnemonic#"\t$R1, $RI2", []>;
2040 class CallRR<string mnemonic, bits<8> opcode>
2041 : InstRR<opcode, (outs), (ins GR64:$R1, ADDR64:$R2),
2042 mnemonic#"\t$R1, $R2", []>;
2044 class CallRX<string mnemonic, bits<8> opcode>
2045 : InstRXa<opcode, (outs), (ins GR64:$R1, bdxaddr12only:$XBD2),
2046 mnemonic#"\t$R1, $XBD2", []>;
2048 class CondBranchRI<string mnemonic, bits<12> opcode,
2049 SDPatternOperator operator = null_frag>
2050 : InstRIc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget16:$RI2),
2051 !subst("#", "${M1}", mnemonic)#"\t$RI2",
2052 [(operator cond4:$valid, cond4:$M1, bb:$RI2)]> {
2053 let CCMaskFirst = 1;
2056 class AsmCondBranchRI<string mnemonic, bits<12> opcode>
2057 : InstRIc<opcode, (outs), (ins imm32zx4:$M1, brtarget16:$RI2),
2058 mnemonic#"\t$M1, $RI2", []>;
2060 class FixedCondBranchRI<CondVariant V, string mnemonic, bits<12> opcode,
2061 SDPatternOperator operator = null_frag>
2062 : InstRIc<opcode, (outs), (ins brtarget16:$RI2),
2063 !subst("#", V.suffix, mnemonic)#"\t$RI2", [(operator bb:$RI2)]> {
2064 let isAsmParserOnly = V.alternate;
2068 class CondBranchRIL<string mnemonic, bits<12> opcode>
2069 : InstRILc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget32:$RI2),
2070 !subst("#", "${M1}", mnemonic)#"\t$RI2", []> {
2071 let CCMaskFirst = 1;
2074 class AsmCondBranchRIL<string mnemonic, bits<12> opcode>
2075 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, brtarget32:$RI2),
2076 mnemonic#"\t$M1, $RI2", []>;
2078 class FixedCondBranchRIL<CondVariant V, string mnemonic, bits<12> opcode>
2079 : InstRILc<opcode, (outs), (ins brtarget32:$RI2),
2080 !subst("#", V.suffix, mnemonic)#"\t$RI2", []> {
2081 let isAsmParserOnly = V.alternate;
2085 class CondBranchRR<string mnemonic, bits<8> opcode>
2086 : InstRR<opcode, (outs), (ins cond4:$valid, cond4:$R1, GR64:$R2),
2087 !subst("#", "${R1}", mnemonic)#"\t$R2", []> {
2088 let CCMaskFirst = 1;
2091 class AsmCondBranchRR<string mnemonic, bits<8> opcode>
2092 : InstRR<opcode, (outs), (ins imm32zx4:$R1, GR64:$R2),
2093 mnemonic#"\t$R1, $R2", []>;
2095 class FixedCondBranchRR<CondVariant V, string mnemonic, bits<8> opcode,
2096 SDPatternOperator operator = null_frag>
2097 : InstRR<opcode, (outs), (ins ADDR64:$R2),
2098 !subst("#", V.suffix, mnemonic)#"\t$R2", [(operator ADDR64:$R2)]> {
2099 let isAsmParserOnly = V.alternate;
2103 class CondBranchRX<string mnemonic, bits<8> opcode>
2104 : InstRXb<opcode, (outs), (ins cond4:$valid, cond4:$M1, bdxaddr12only:$XBD2),
2105 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
2106 let CCMaskFirst = 1;
2109 class AsmCondBranchRX<string mnemonic, bits<8> opcode>
2110 : InstRXb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr12only:$XBD2),
2111 mnemonic#"\t$M1, $XBD2", []>;
2113 class FixedCondBranchRX<CondVariant V, string mnemonic, bits<8> opcode>
2114 : InstRXb<opcode, (outs), (ins bdxaddr12only:$XBD2),
2115 !subst("#", V.suffix, mnemonic)#"\t$XBD2", []> {
2116 let isAsmParserOnly = V.alternate;
2120 class CondBranchRXY<string mnemonic, bits<16> opcode>
2121 : InstRXYb<opcode, (outs), (ins cond4:$valid, cond4:$M1, bdxaddr20only:$XBD2),
2122 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
2123 let CCMaskFirst = 1;
2127 class AsmCondBranchRXY<string mnemonic, bits<16> opcode>
2128 : InstRXYb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr20only:$XBD2),
2129 mnemonic#"\t$M1, $XBD2", []> {
2133 class FixedCondBranchRXY<CondVariant V, string mnemonic, bits<16> opcode,
2134 SDPatternOperator operator = null_frag>
2135 : InstRXYb<opcode, (outs), (ins bdxaddr20only:$XBD2),
2136 !subst("#", V.suffix, mnemonic)#"\t$XBD2",
2137 [(operator (load bdxaddr20only:$XBD2))]> {
2138 let isAsmParserOnly = V.alternate;
2143 class CmpBranchRIEa<string mnemonic, bits<16> opcode,
2144 RegisterOperand cls, Immediate imm>
2145 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, cond4:$M3),
2146 mnemonic#"$M3\t$R1, $I2", []>;
2148 class AsmCmpBranchRIEa<string mnemonic, bits<16> opcode,
2149 RegisterOperand cls, Immediate imm>
2150 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, imm32zx4:$M3),
2151 mnemonic#"\t$R1, $I2, $M3", []>;
2153 class FixedCmpBranchRIEa<CondVariant V, string mnemonic, bits<16> opcode,
2154 RegisterOperand cls, Immediate imm>
2155 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2),
2156 mnemonic#V.suffix#"\t$R1, $I2", []> {
2157 let isAsmParserOnly = V.alternate;
2161 multiclass CmpBranchRIEaPair<string mnemonic, bits<16> opcode,
2162 RegisterOperand cls, Immediate imm> {
2163 let isCodeGenOnly = 1 in
2164 def "" : CmpBranchRIEa<mnemonic, opcode, cls, imm>;
2165 def Asm : AsmCmpBranchRIEa<mnemonic, opcode, cls, imm>;
2168 class CmpBranchRIEb<string mnemonic, bits<16> opcode,
2169 RegisterOperand cls>
2170 : InstRIEb<opcode, (outs),
2171 (ins cls:$R1, cls:$R2, cond4:$M3, brtarget16:$RI4),
2172 mnemonic#"$M3\t$R1, $R2, $RI4", []>;
2174 class AsmCmpBranchRIEb<string mnemonic, bits<16> opcode,
2175 RegisterOperand cls>
2176 : InstRIEb<opcode, (outs),
2177 (ins cls:$R1, cls:$R2, imm32zx4:$M3, brtarget16:$RI4),
2178 mnemonic#"\t$R1, $R2, $M3, $RI4", []>;
2180 class FixedCmpBranchRIEb<CondVariant V, string mnemonic, bits<16> opcode,
2181 RegisterOperand cls>
2182 : InstRIEb<opcode, (outs), (ins cls:$R1, cls:$R2, brtarget16:$RI4),
2183 mnemonic#V.suffix#"\t$R1, $R2, $RI4", []> {
2184 let isAsmParserOnly = V.alternate;
2188 multiclass CmpBranchRIEbPair<string mnemonic, bits<16> opcode,
2189 RegisterOperand cls> {
2190 let isCodeGenOnly = 1 in
2191 def "" : CmpBranchRIEb<mnemonic, opcode, cls>;
2192 def Asm : AsmCmpBranchRIEb<mnemonic, opcode, cls>;
2195 class CmpBranchRIEc<string mnemonic, bits<16> opcode,
2196 RegisterOperand cls, Immediate imm>
2197 : InstRIEc<opcode, (outs),
2198 (ins cls:$R1, imm:$I2, cond4:$M3, brtarget16:$RI4),
2199 mnemonic#"$M3\t$R1, $I2, $RI4", []>;
2201 class AsmCmpBranchRIEc<string mnemonic, bits<16> opcode,
2202 RegisterOperand cls, Immediate imm>
2203 : InstRIEc<opcode, (outs),
2204 (ins cls:$R1, imm:$I2, imm32zx4:$M3, brtarget16:$RI4),
2205 mnemonic#"\t$R1, $I2, $M3, $RI4", []>;
2207 class FixedCmpBranchRIEc<CondVariant V, string mnemonic, bits<16> opcode,
2208 RegisterOperand cls, Immediate imm>
2209 : InstRIEc<opcode, (outs), (ins cls:$R1, imm:$I2, brtarget16:$RI4),
2210 mnemonic#V.suffix#"\t$R1, $I2, $RI4", []> {
2211 let isAsmParserOnly = V.alternate;
2215 multiclass CmpBranchRIEcPair<string mnemonic, bits<16> opcode,
2216 RegisterOperand cls, Immediate imm> {
2217 let isCodeGenOnly = 1 in
2218 def "" : CmpBranchRIEc<mnemonic, opcode, cls, imm>;
2219 def Asm : AsmCmpBranchRIEc<mnemonic, opcode, cls, imm>;
2222 class CmpBranchRRFc<string mnemonic, bits<16> opcode,
2223 RegisterOperand cls>
2224 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, cond4:$M3),
2225 mnemonic#"$M3\t$R1, $R2", []>;
2227 class AsmCmpBranchRRFc<string mnemonic, bits<16> opcode,
2228 RegisterOperand cls>
2229 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, imm32zx4:$M3),
2230 mnemonic#"\t$R1, $R2, $M3", []>;
2232 multiclass CmpBranchRRFcPair<string mnemonic, bits<16> opcode,
2233 RegisterOperand cls> {
2234 let isCodeGenOnly = 1 in
2235 def "" : CmpBranchRRFc<mnemonic, opcode, cls>;
2236 def Asm : AsmCmpBranchRRFc<mnemonic, opcode, cls>;
2239 class FixedCmpBranchRRFc<CondVariant V, string mnemonic, bits<16> opcode,
2240 RegisterOperand cls>
2241 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2),
2242 mnemonic#V.suffix#"\t$R1, $R2", []> {
2243 let isAsmParserOnly = V.alternate;
2247 class CmpBranchRRS<string mnemonic, bits<16> opcode,
2248 RegisterOperand cls>
2249 : InstRRS<opcode, (outs),
2250 (ins cls:$R1, cls:$R2, cond4:$M3, bdaddr12only:$BD4),
2251 mnemonic#"$M3\t$R1, $R2, $BD4", []>;
2253 class AsmCmpBranchRRS<string mnemonic, bits<16> opcode,
2254 RegisterOperand cls>
2255 : InstRRS<opcode, (outs),
2256 (ins cls:$R1, cls:$R2, imm32zx4:$M3, bdaddr12only:$BD4),
2257 mnemonic#"\t$R1, $R2, $M3, $BD4", []>;
2259 class FixedCmpBranchRRS<CondVariant V, string mnemonic, bits<16> opcode,
2260 RegisterOperand cls>
2261 : InstRRS<opcode, (outs), (ins cls:$R1, cls:$R2, bdaddr12only:$BD4),
2262 mnemonic#V.suffix#"\t$R1, $R2, $BD4", []> {
2263 let isAsmParserOnly = V.alternate;
2267 multiclass CmpBranchRRSPair<string mnemonic, bits<16> opcode,
2268 RegisterOperand cls> {
2269 let isCodeGenOnly = 1 in
2270 def "" : CmpBranchRRS<mnemonic, opcode, cls>;
2271 def Asm : AsmCmpBranchRRS<mnemonic, opcode, cls>;
2274 class CmpBranchRIS<string mnemonic, bits<16> opcode,
2275 RegisterOperand cls, Immediate imm>
2276 : InstRIS<opcode, (outs),
2277 (ins cls:$R1, imm:$I2, cond4:$M3, bdaddr12only:$BD4),
2278 mnemonic#"$M3\t$R1, $I2, $BD4", []>;
2280 class AsmCmpBranchRIS<string mnemonic, bits<16> opcode,
2281 RegisterOperand cls, Immediate imm>
2282 : InstRIS<opcode, (outs),
2283 (ins cls:$R1, imm:$I2, imm32zx4:$M3, bdaddr12only:$BD4),
2284 mnemonic#"\t$R1, $I2, $M3, $BD4", []>;
2286 class FixedCmpBranchRIS<CondVariant V, string mnemonic, bits<16> opcode,
2287 RegisterOperand cls, Immediate imm>
2288 : InstRIS<opcode, (outs), (ins cls:$R1, imm:$I2, bdaddr12only:$BD4),
2289 mnemonic#V.suffix#"\t$R1, $I2, $BD4", []> {
2290 let isAsmParserOnly = V.alternate;
2294 multiclass CmpBranchRISPair<string mnemonic, bits<16> opcode,
2295 RegisterOperand cls, Immediate imm> {
2296 let isCodeGenOnly = 1 in
2297 def "" : CmpBranchRIS<mnemonic, opcode, cls, imm>;
2298 def Asm : AsmCmpBranchRIS<mnemonic, opcode, cls, imm>;
2301 class CmpBranchRSYb<string mnemonic, bits<16> opcode,
2302 RegisterOperand cls>
2303 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, cond4:$M3),
2304 mnemonic#"$M3\t$R1, $BD2", []>;
2306 class AsmCmpBranchRSYb<string mnemonic, bits<16> opcode,
2307 RegisterOperand cls>
2308 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, imm32zx4:$M3),
2309 mnemonic#"\t$R1, $M3, $BD2", []>;
2311 multiclass CmpBranchRSYbPair<string mnemonic, bits<16> opcode,
2312 RegisterOperand cls> {
2313 let isCodeGenOnly = 1 in
2314 def "" : CmpBranchRSYb<mnemonic, opcode, cls>;
2315 def Asm : AsmCmpBranchRSYb<mnemonic, opcode, cls>;
2318 class FixedCmpBranchRSYb<CondVariant V, string mnemonic, bits<16> opcode,
2319 RegisterOperand cls>
2320 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2),
2321 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2322 let isAsmParserOnly = V.alternate;
2326 class BranchUnaryRI<string mnemonic, bits<12> opcode, RegisterOperand cls>
2327 : InstRIb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget16:$RI2),
2328 mnemonic##"\t$R1, $RI2", []> {
2329 let Constraints = "$R1 = $R1src";
2330 let DisableEncoding = "$R1src";
2333 class BranchUnaryRIL<string mnemonic, bits<12> opcode, RegisterOperand cls>
2334 : InstRILb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget32:$RI2),
2335 mnemonic##"\t$R1, $RI2", []> {
2336 let Constraints = "$R1 = $R1src";
2337 let DisableEncoding = "$R1src";
2340 class BranchUnaryRR<string mnemonic, bits<8> opcode, RegisterOperand cls>
2341 : InstRR<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2342 mnemonic##"\t$R1, $R2", []> {
2343 let Constraints = "$R1 = $R1src";
2344 let DisableEncoding = "$R1src";
2347 class BranchUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2348 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2349 mnemonic##"\t$R1, $R2", []> {
2350 let Constraints = "$R1 = $R1src";
2351 let DisableEncoding = "$R1src";
2354 class BranchUnaryRX<string mnemonic, bits<8> opcode, RegisterOperand cls>
2355 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2),
2356 mnemonic##"\t$R1, $XBD2", []> {
2357 let Constraints = "$R1 = $R1src";
2358 let DisableEncoding = "$R1src";
2361 class BranchUnaryRXY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2362 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr20only:$XBD2),
2363 mnemonic##"\t$R1, $XBD2", []> {
2364 let Constraints = "$R1 = $R1src";
2365 let DisableEncoding = "$R1src";
2368 class BranchBinaryRSI<string mnemonic, bits<8> opcode, RegisterOperand cls>
2369 : InstRSI<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2370 mnemonic##"\t$R1, $R3, $RI2", []> {
2371 let Constraints = "$R1 = $R1src";
2372 let DisableEncoding = "$R1src";
2375 class BranchBinaryRIEe<string mnemonic, bits<16> opcode, RegisterOperand cls>
2376 : InstRIEe<opcode, (outs cls:$R1),
2377 (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2378 mnemonic##"\t$R1, $R3, $RI2", []> {
2379 let Constraints = "$R1 = $R1src";
2380 let DisableEncoding = "$R1src";
2383 class BranchBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls>
2384 : InstRSa<opcode, (outs cls:$R1),
2385 (ins cls:$R1src, cls:$R3, bdaddr12only:$BD2),
2386 mnemonic##"\t$R1, $R3, $BD2", []> {
2387 let Constraints = "$R1 = $R1src";
2388 let DisableEncoding = "$R1src";
2391 class BranchBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2393 (outs cls:$R1), (ins cls:$R1src, cls:$R3, bdaddr20only:$BD2),
2394 mnemonic##"\t$R1, $R3, $BD2", []> {
2395 let Constraints = "$R1 = $R1src";
2396 let DisableEncoding = "$R1src";
2399 class LoadMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2400 AddressingMode mode = bdaddr12only>
2401 : InstRSa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2),
2402 mnemonic#"\t$R1, $R3, $BD2", []> {
2406 class LoadMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2407 AddressingMode mode = bdaddr20only>
2408 : InstRSYa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2),
2409 mnemonic#"\t$R1, $R3, $BD2", []> {
2413 multiclass LoadMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2414 bits<16> rsyOpcode, RegisterOperand cls> {
2415 let DispKey = mnemonic ## #cls in {
2416 let DispSize = "12" in
2417 def "" : LoadMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2418 let DispSize = "20" in
2419 def Y : LoadMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2423 class LoadMultipleSSe<string mnemonic, bits<8> opcode, RegisterOperand cls>
2424 : InstSSe<opcode, (outs cls:$R1, cls:$R3),
2425 (ins bdaddr12only:$BD2, bdaddr12only:$BD4),
2426 mnemonic#"\t$R1, $R3, $BD2, $BD4", []> {
2430 multiclass LoadMultipleVRSaAlign<string mnemonic, bits<16> opcode> {
2431 let mayLoad = 1 in {
2432 def Align : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3),
2433 (ins bdaddr12only:$BD2, imm32zx4:$M4),
2434 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
2436 def "" : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3),
2437 (ins bdaddr12only:$BD2),
2438 mnemonic#"\t$V1, $V3, $BD2", []>;
2442 class StoreRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2443 RegisterOperand cls>
2444 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
2445 mnemonic#"\t$R1, $RI2",
2446 [(operator cls:$R1, pcrel32:$RI2)]> {
2448 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2449 // However, BDXs have two extra operands and are therefore 6 units more
2451 let AddedComplexity = 7;
2454 class StoreRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2455 RegisterOperand cls, bits<5> bytes,
2456 AddressingMode mode = bdxaddr12only>
2457 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
2458 mnemonic#"\t$R1, $XBD2",
2459 [(operator cls:$R1, mode:$XBD2)]> {
2460 let OpKey = mnemonic#"r"#cls;
2463 let AccessBytes = bytes;
2466 class StoreRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2467 RegisterOperand cls, bits<5> bytes,
2468 AddressingMode mode = bdxaddr20only>
2469 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
2470 mnemonic#"\t$R1, $XBD2",
2471 [(operator cls:$R1, mode:$XBD2)]> {
2472 let OpKey = mnemonic#"r"#cls;
2475 let AccessBytes = bytes;
2478 multiclass StoreRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
2479 SDPatternOperator operator, RegisterOperand cls,
2481 let DispKey = mnemonic ## #cls in {
2482 let DispSize = "12" in
2483 def "" : StoreRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
2484 let DispSize = "20" in
2485 def Y : StoreRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
2490 class StoreVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2491 TypedReg tr, bits<5> bytes, bits<4> type = 0>
2492 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2),
2493 mnemonic#"\t$V1, $XBD2",
2494 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2)]> {
2497 let AccessBytes = bytes;
2500 class StoreVRXGeneric<string mnemonic, bits<16> opcode>
2501 : InstVRX<opcode, (outs), (ins VR128:$V1, bdxaddr12only:$XBD2, imm32zx4:$M3),
2502 mnemonic#"\t$V1, $XBD2, $M3", []> {
2506 multiclass StoreVRXAlign<string mnemonic, bits<16> opcode> {
2507 let mayStore = 1, AccessBytes = 16 in {
2508 def Align : InstVRX<opcode, (outs),
2509 (ins VR128:$V1, bdxaddr12only:$XBD2, imm32zx4:$M3),
2510 mnemonic#"\t$V1, $XBD2, $M3", []>;
2512 def "" : InstVRX<opcode, (outs), (ins VR128:$V1, bdxaddr12only:$XBD2),
2513 mnemonic#"\t$V1, $XBD2", []>;
2517 class StoreLengthVRSb<string mnemonic, bits<16> opcode,
2518 SDPatternOperator operator, bits<5> bytes>
2519 : InstVRSb<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2),
2520 mnemonic#"\t$V1, $R3, $BD2",
2521 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2524 let AccessBytes = bytes;
2527 class StoreLengthVRSd<string mnemonic, bits<16> opcode,
2528 SDPatternOperator operator, bits<5> bytes>
2529 : InstVRSd<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2),
2530 mnemonic#"\t$V1, $R3, $BD2",
2531 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2533 let AccessBytes = bytes;
2536 class StoreLengthVSI<string mnemonic, bits<16> opcode,
2537 SDPatternOperator operator, bits<5> bytes>
2538 : InstVSI<opcode, (outs), (ins VR128:$V1, bdaddr12only:$BD2, imm32zx8:$I3),
2539 mnemonic#"\t$V1, $BD2, $I3",
2540 [(operator VR128:$V1, imm32zx8:$I3, bdaddr12only:$BD2)]> {
2542 let AccessBytes = bytes;
2545 class StoreMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2546 AddressingMode mode = bdaddr12only>
2547 : InstRSa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2),
2548 mnemonic#"\t$R1, $R3, $BD2", []> {
2552 class StoreMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2553 AddressingMode mode = bdaddr20only>
2554 : InstRSYa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2),
2555 mnemonic#"\t$R1, $R3, $BD2", []> {
2559 multiclass StoreMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2560 bits<16> rsyOpcode, RegisterOperand cls> {
2561 let DispKey = mnemonic ## #cls in {
2562 let DispSize = "12" in
2563 def "" : StoreMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2564 let DispSize = "20" in
2565 def Y : StoreMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2569 multiclass StoreMultipleVRSaAlign<string mnemonic, bits<16> opcode> {
2570 let mayStore = 1 in {
2571 def Align : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3,
2572 bdaddr12only:$BD2, imm32zx4:$M4),
2573 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
2575 def "" : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3,
2577 mnemonic#"\t$V1, $V3, $BD2", []>;
2581 // StoreSI* instructions are used to store an integer to memory, but the
2582 // addresses are more restricted than for normal stores. If we are in the
2583 // situation of having to force either the address into a register or the
2584 // constant into a register, it's usually better to do the latter.
2585 // We therefore match the address in the same way as a normal store and
2586 // only use the StoreSI* instruction if the matched address is suitable.
2587 class StoreSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2589 : InstSI<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2),
2590 mnemonic#"\t$BD1, $I2",
2591 [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2595 class StoreSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2597 : InstSIY<opcode, (outs), (ins mviaddr20pair:$BD1, imm:$I2),
2598 mnemonic#"\t$BD1, $I2",
2599 [(operator imm:$I2, mviaddr20pair:$BD1)]> {
2603 class StoreSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2605 : InstSIL<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2),
2606 mnemonic#"\t$BD1, $I2",
2607 [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2611 multiclass StoreSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
2612 SDPatternOperator operator, Immediate imm> {
2613 let DispKey = mnemonic in {
2614 let DispSize = "12" in
2615 def "" : StoreSI<mnemonic, siOpcode, operator, imm>;
2616 let DispSize = "20" in
2617 def Y : StoreSIY<mnemonic#"y", siyOpcode, operator, imm>;
2621 class StoreSSE<string mnemonic, bits<16> opcode>
2622 : InstSSE<opcode, (outs), (ins bdaddr12only:$BD1, bdaddr12only:$BD2),
2623 mnemonic#"\t$BD1, $BD2", []> {
2627 class CondStoreRSY<string mnemonic, bits<16> opcode,
2628 RegisterOperand cls, bits<5> bytes,
2629 AddressingMode mode = bdaddr20only>
2630 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$M3),
2631 mnemonic#"$M3\t$R1, $BD2", []> {
2633 let AccessBytes = bytes;
2637 // Like CondStoreRSY, but used for the raw assembly form. The condition-code
2638 // mask is the third operand rather than being part of the mnemonic.
2639 class AsmCondStoreRSY<string mnemonic, bits<16> opcode,
2640 RegisterOperand cls, bits<5> bytes,
2641 AddressingMode mode = bdaddr20only>
2642 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, imm32zx4:$M3),
2643 mnemonic#"\t$R1, $BD2, $M3", []> {
2645 let AccessBytes = bytes;
2648 // Like CondStoreRSY, but with a fixed CC mask.
2649 class FixedCondStoreRSY<CondVariant V, string mnemonic, bits<16> opcode,
2650 RegisterOperand cls, bits<5> bytes,
2651 AddressingMode mode = bdaddr20only>
2652 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2),
2653 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2655 let AccessBytes = bytes;
2656 let isAsmParserOnly = V.alternate;
2660 multiclass CondStoreRSYPair<string mnemonic, bits<16> opcode,
2661 RegisterOperand cls, bits<5> bytes,
2662 AddressingMode mode = bdaddr20only> {
2663 let isCodeGenOnly = 1 in
2664 def "" : CondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
2665 def Asm : AsmCondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
2668 class SideEffectUnaryI<string mnemonic, bits<8> opcode, Immediate imm>
2669 : InstI<opcode, (outs), (ins imm:$I1),
2670 mnemonic#"\t$I1", []>;
2672 class SideEffectUnaryRR<string mnemonic, bits<8>opcode, RegisterOperand cls>
2673 : InstRR<opcode, (outs), (ins cls:$R1),
2674 mnemonic#"\t$R1", []> {
2678 class SideEffectUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
2679 SDPatternOperator operator>
2680 : InstRRE<opcode, (outs), (ins cls:$R1),
2681 mnemonic#"\t$R1", [(operator cls:$R1)]> {
2685 class SideEffectUnaryS<string mnemonic, bits<16> opcode,
2686 SDPatternOperator operator, bits<5> bytes,
2687 AddressingMode mode = bdaddr12only>
2688 : InstS<opcode, (outs), (ins mode:$BD2),
2689 mnemonic#"\t$BD2", [(operator mode:$BD2)]> {
2691 let AccessBytes = bytes;
2694 class SideEffectAddressS<string mnemonic, bits<16> opcode,
2695 SDPatternOperator operator,
2696 AddressingMode mode = bdaddr12only>
2697 : InstS<opcode, (outs), (ins mode:$BD2),
2698 mnemonic#"\t$BD2", [(operator mode:$BD2)]>;
2700 class LoadAddressRX<string mnemonic, bits<8> opcode,
2701 SDPatternOperator operator, AddressingMode mode>
2702 : InstRXa<opcode, (outs GR64:$R1), (ins mode:$XBD2),
2703 mnemonic#"\t$R1, $XBD2",
2704 [(set GR64:$R1, (operator mode:$XBD2))]>;
2706 class LoadAddressRXY<string mnemonic, bits<16> opcode,
2707 SDPatternOperator operator, AddressingMode mode>
2708 : InstRXYa<opcode, (outs GR64:$R1), (ins mode:$XBD2),
2709 mnemonic#"\t$R1, $XBD2",
2710 [(set GR64:$R1, (operator mode:$XBD2))]>;
2712 multiclass LoadAddressRXPair<string mnemonic, bits<8> rxOpcode,
2713 bits<16> rxyOpcode, SDPatternOperator operator> {
2714 let DispKey = mnemonic in {
2715 let DispSize = "12" in
2716 def "" : LoadAddressRX<mnemonic, rxOpcode, operator, laaddr12pair>;
2717 let DispSize = "20" in
2718 def Y : LoadAddressRXY<mnemonic#"y", rxyOpcode, operator, laaddr20pair>;
2722 class LoadAddressRIL<string mnemonic, bits<12> opcode,
2723 SDPatternOperator operator>
2724 : InstRILb<opcode, (outs GR64:$R1), (ins pcrel32:$RI2),
2725 mnemonic#"\t$R1, $RI2",
2726 [(set GR64:$R1, (operator pcrel32:$RI2))]>;
2728 class UnaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2729 RegisterOperand cls1, RegisterOperand cls2>
2730 : InstRR<opcode, (outs cls1:$R1), (ins cls2:$R2),
2731 mnemonic#"\t$R1, $R2",
2732 [(set cls1:$R1, (operator cls2:$R2))]> {
2733 let OpKey = mnemonic#cls1;
2737 class UnaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2738 RegisterOperand cls1, RegisterOperand cls2>
2739 : InstRRE<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 UnaryTiedRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2747 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src),
2748 mnemonic#"\t$R1", []> {
2749 let Constraints = "$R1 = $R1src";
2750 let DisableEncoding = "$R1src";
2754 class UnaryMemRRFc<string mnemonic, bits<16> opcode,
2755 RegisterOperand cls1, RegisterOperand cls2>
2756 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src),
2757 mnemonic#"\t$R1, $R2", []> {
2758 let Constraints = "$R1 = $R1src";
2759 let DisableEncoding = "$R1src";
2763 class UnaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2764 RegisterOperand cls, Immediate imm>
2765 : InstRIa<opcode, (outs cls:$R1), (ins imm:$I2),
2766 mnemonic#"\t$R1, $I2",
2767 [(set cls:$R1, (operator imm:$I2))]>;
2769 class UnaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2770 RegisterOperand cls, Immediate imm>
2771 : InstRILa<opcode, (outs cls:$R1), (ins imm:$I2),
2772 mnemonic#"\t$R1, $I2",
2773 [(set cls:$R1, (operator imm:$I2))]>;
2775 class UnaryRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2776 RegisterOperand cls>
2777 : InstRILb<opcode, (outs cls:$R1), (ins pcrel32:$RI2),
2778 mnemonic#"\t$R1, $RI2",
2779 [(set cls:$R1, (operator pcrel32:$RI2))]> {
2781 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2782 // However, BDXs have two extra operands and are therefore 6 units more
2784 let AddedComplexity = 7;
2787 class CondUnaryRSY<string mnemonic, bits<16> opcode,
2788 SDPatternOperator operator, RegisterOperand cls,
2789 bits<5> bytes, AddressingMode mode = bdaddr20only>
2790 : InstRSYb<opcode, (outs cls:$R1),
2791 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$M3),
2792 mnemonic#"$M3\t$R1, $BD2",
2794 (z_select_ccmask (operator bdaddr20only:$BD2), cls:$R1src,
2795 cond4:$valid, cond4:$M3))]> {
2796 let Constraints = "$R1 = $R1src";
2797 let DisableEncoding = "$R1src";
2799 let AccessBytes = bytes;
2803 // Like CondUnaryRSY, but used for the raw assembly form. The condition-code
2804 // mask is the third operand rather than being part of the mnemonic.
2805 class AsmCondUnaryRSY<string mnemonic, bits<16> opcode,
2806 RegisterOperand cls, bits<5> bytes,
2807 AddressingMode mode = bdaddr20only>
2808 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2, imm32zx4:$M3),
2809 mnemonic#"\t$R1, $BD2, $M3", []> {
2811 let AccessBytes = bytes;
2812 let Constraints = "$R1 = $R1src";
2813 let DisableEncoding = "$R1src";
2816 // Like CondUnaryRSY, but with a fixed CC mask.
2817 class FixedCondUnaryRSY<CondVariant V, string mnemonic, bits<16> opcode,
2818 RegisterOperand cls, bits<5> bytes,
2819 AddressingMode mode = bdaddr20only>
2820 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2),
2821 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2822 let Constraints = "$R1 = $R1src";
2823 let DisableEncoding = "$R1src";
2825 let AccessBytes = bytes;
2826 let isAsmParserOnly = V.alternate;
2830 multiclass CondUnaryRSYPair<string mnemonic, bits<16> opcode,
2831 SDPatternOperator operator,
2832 RegisterOperand cls, bits<5> bytes,
2833 AddressingMode mode = bdaddr20only> {
2834 let isCodeGenOnly = 1 in
2835 def "" : CondUnaryRSY<mnemonic, opcode, operator, cls, bytes, mode>;
2836 def Asm : AsmCondUnaryRSY<mnemonic, opcode, cls, bytes, mode>;
2839 class UnaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2840 RegisterOperand cls, bits<5> bytes,
2841 AddressingMode mode = bdxaddr12only>
2842 : InstRXa<opcode, (outs cls:$R1), (ins mode:$XBD2),
2843 mnemonic#"\t$R1, $XBD2",
2844 [(set cls:$R1, (operator mode:$XBD2))]> {
2845 let OpKey = mnemonic#"r"#cls;
2848 let AccessBytes = bytes;
2851 class UnaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2852 RegisterOperand cls, bits<5> bytes>
2853 : InstRXE<opcode, (outs cls:$R1), (ins bdxaddr12only:$XBD2),
2854 mnemonic#"\t$R1, $XBD2",
2855 [(set cls:$R1, (operator bdxaddr12only:$XBD2))]> {
2856 let OpKey = mnemonic#"r"#cls;
2859 let AccessBytes = bytes;
2863 class UnaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2864 RegisterOperand cls, bits<5> bytes,
2865 AddressingMode mode = bdxaddr20only>
2866 : InstRXYa<opcode, (outs cls:$R1), (ins mode:$XBD2),
2867 mnemonic#"\t$R1, $XBD2",
2868 [(set cls:$R1, (operator mode:$XBD2))]> {
2869 let OpKey = mnemonic#"r"#cls;
2872 let AccessBytes = bytes;
2875 multiclass UnaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
2876 SDPatternOperator operator, RegisterOperand cls,
2878 let DispKey = mnemonic ## #cls in {
2879 let DispSize = "12" in
2880 def "" : UnaryRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
2881 let DispSize = "20" in
2882 def Y : UnaryRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
2887 class UnaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2888 TypedReg tr, Immediate imm, bits<4> type = 0>
2889 : InstVRIa<opcode, (outs tr.op:$V1), (ins imm:$I2),
2890 mnemonic#"\t$V1, $I2",
2891 [(set (tr.vt tr.op:$V1), (operator imm:$I2))]> {
2895 class UnaryVRIaGeneric<string mnemonic, bits<16> opcode, Immediate imm>
2896 : InstVRIa<opcode, (outs VR128:$V1), (ins imm:$I2, imm32zx4:$M3),
2897 mnemonic#"\t$V1, $I2, $M3", []>;
2899 class UnaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2900 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0,
2902 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2),
2903 mnemonic#"\t$V1, $V2",
2904 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]> {
2910 class UnaryVRRaGeneric<string mnemonic, bits<16> opcode, bits<4> m4 = 0,
2912 : InstVRRa<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3),
2913 mnemonic#"\t$V1, $V2, $M3", []> {
2918 class UnaryVRRaFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0>
2919 : InstVRRa<opcode, (outs VR128:$V1),
2920 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4),
2921 mnemonic#"\t$V1, $V2, $M3, $M4", []> {
2925 // Declare a pair of instructions, one which sets CC and one which doesn't.
2926 // The CC-setting form ends with "S" and sets the low bit of M5.
2927 // The form that does not set CC has an extra operand to optionally allow
2928 // specifying arbitrary M5 values in assembler.
2929 multiclass UnaryExtraVRRaSPair<string mnemonic, bits<16> opcode,
2930 SDPatternOperator operator,
2931 SDPatternOperator operator_cc,
2932 TypedReg tr1, TypedReg tr2, bits<4> type> {
2933 let M3 = type, M4 = 0 in
2934 def "" : InstVRRa<opcode, (outs tr1.op:$V1),
2935 (ins tr2.op:$V2, imm32zx4:$M5),
2936 mnemonic#"\t$V1, $V2, $M5", []>;
2937 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2))),
2938 (!cast<Instruction>(NAME) tr2.op:$V2, 0)>;
2939 def : InstAlias<mnemonic#"\t$V1, $V2",
2940 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 0)>;
2942 def S : UnaryVRRa<mnemonic##"s", opcode, operator_cc, tr1, tr2,
2946 multiclass UnaryExtraVRRaSPairGeneric<string mnemonic, bits<16> opcode> {
2947 let M4 = 0, Defs = [CC] in
2948 def "" : InstVRRa<opcode, (outs VR128:$V1),
2949 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M5),
2950 mnemonic#"\t$V1, $V2, $M3, $M5", []>;
2951 def : InstAlias<mnemonic#"\t$V1, $V2, $M3",
2952 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2,
2956 class UnaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2957 TypedReg tr, bits<5> bytes, bits<4> type = 0>
2958 : InstVRX<opcode, (outs tr.op:$V1), (ins bdxaddr12only:$XBD2),
2959 mnemonic#"\t$V1, $XBD2",
2960 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2))]> {
2963 let AccessBytes = bytes;
2966 class UnaryVRXGeneric<string mnemonic, bits<16> opcode>
2967 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
2968 mnemonic#"\t$V1, $XBD2, $M3", []> {
2972 multiclass UnaryVRXAlign<string mnemonic, bits<16> opcode> {
2973 let mayLoad = 1, AccessBytes = 16 in {
2974 def Align : InstVRX<opcode, (outs VR128:$V1),
2975 (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
2976 mnemonic#"\t$V1, $XBD2, $M3", []>;
2978 def "" : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2),
2979 mnemonic#"\t$V1, $XBD2", []>;
2983 class SideEffectBinaryRX<string mnemonic, bits<8> opcode,
2984 RegisterOperand cls>
2985 : InstRXa<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
2986 mnemonic##"\t$R1, $XBD2", []>;
2988 class SideEffectBinaryRXY<string mnemonic, bits<16> opcode,
2989 RegisterOperand cls>
2990 : InstRXYa<opcode, (outs), (ins cls:$R1, bdxaddr20only:$XBD2),
2991 mnemonic##"\t$R1, $XBD2", []>;
2993 class SideEffectBinaryRILPC<string mnemonic, bits<12> opcode,
2994 RegisterOperand cls>
2995 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
2996 mnemonic##"\t$R1, $RI2", []> {
2997 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2998 // However, BDXs have two extra operands and are therefore 6 units more
3000 let AddedComplexity = 7;
3003 class SideEffectBinaryRRE<string mnemonic, bits<16> opcode,
3004 RegisterOperand cls1, RegisterOperand cls2>
3005 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3006 mnemonic#"\t$R1, $R2", []>;
3008 class SideEffectBinaryRRFa<string mnemonic, bits<16> opcode,
3009 RegisterOperand cls1, RegisterOperand cls2>
3010 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3011 mnemonic#"\t$R1, $R2", []> {
3016 class SideEffectBinaryRRFc<string mnemonic, bits<16> opcode,
3017 RegisterOperand cls1, RegisterOperand cls2>
3018 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3019 mnemonic#"\t$R1, $R2", []> {
3023 class SideEffectBinaryIE<string mnemonic, bits<16> opcode,
3024 Immediate imm1, Immediate imm2>
3025 : InstIE<opcode, (outs), (ins imm1:$I1, imm2:$I2),
3026 mnemonic#"\t$I1, $I2", []>;
3028 class SideEffectBinarySI<string mnemonic, bits<8> opcode, Operand imm>
3029 : InstSI<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
3030 mnemonic#"\t$BD1, $I2", []>;
3032 class SideEffectBinarySIL<string mnemonic, bits<16> opcode,
3033 SDPatternOperator operator, Immediate imm>
3034 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
3035 mnemonic#"\t$BD1, $I2", [(operator bdaddr12only:$BD1, imm:$I2)]>;
3037 class SideEffectBinarySSa<string mnemonic, bits<8> opcode>
3038 : InstSSa<opcode, (outs), (ins bdladdr12onlylen8:$BDL1, bdaddr12only:$BD2),
3039 mnemonic##"\t$BDL1, $BD2", []>;
3041 class SideEffectBinarySSb<string mnemonic, bits<8> opcode>
3043 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2),
3044 mnemonic##"\t$BDL1, $BDL2", []>;
3046 class SideEffectBinarySSf<string mnemonic, bits<8> opcode>
3047 : InstSSf<opcode, (outs), (ins bdaddr12only:$BD1, bdladdr12onlylen8:$BDL2),
3048 mnemonic##"\t$BD1, $BDL2", []>;
3050 class SideEffectBinarySSE<string mnemonic, bits<16> opcode>
3051 : InstSSE<opcode, (outs), (ins bdaddr12only:$BD1, bdaddr12only:$BD2),
3052 mnemonic#"\t$BD1, $BD2", []>;
3054 class SideEffectBinaryMemMemRR<string mnemonic, bits<8> opcode,
3055 RegisterOperand cls1, RegisterOperand cls2>
3056 : InstRR<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3057 mnemonic#"\t$R1, $R2", []> {
3058 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3059 let DisableEncoding = "$R1src, $R2src";
3062 class SideEffectBinaryMemRRE<string mnemonic, bits<16> opcode,
3063 RegisterOperand cls1, RegisterOperand cls2>
3064 : InstRRE<opcode, (outs cls2:$R2), (ins cls1:$R1, cls2:$R2src),
3065 mnemonic#"\t$R1, $R2", []> {
3066 let Constraints = "$R2 = $R2src";
3067 let DisableEncoding = "$R2src";
3070 class SideEffectBinaryMemMemRRE<string mnemonic, bits<16> opcode,
3071 RegisterOperand cls1, RegisterOperand cls2>
3072 : InstRRE<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3073 mnemonic#"\t$R1, $R2", []> {
3074 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3075 let DisableEncoding = "$R1src, $R2src";
3078 class SideEffectBinaryMemMemRRFc<string mnemonic, bits<16> opcode,
3079 RegisterOperand cls1, RegisterOperand cls2>
3080 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3081 mnemonic#"\t$R1, $R2", []> {
3082 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3083 let DisableEncoding = "$R1src, $R2src";
3087 class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3088 RegisterOperand cls1, RegisterOperand cls2>
3089 : InstRR<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3090 mnemonic#"\t$R1, $R2",
3091 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
3092 let OpKey = mnemonic#cls1;
3094 let Constraints = "$R1 = $R1src";
3095 let DisableEncoding = "$R1src";
3098 class BinaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3099 RegisterOperand cls1, RegisterOperand cls2>
3100 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3101 mnemonic#"\t$R1, $R2",
3102 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
3103 let OpKey = mnemonic#cls1;
3105 let Constraints = "$R1 = $R1src";
3106 let DisableEncoding = "$R1src";
3109 class BinaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3110 RegisterOperand cls1, RegisterOperand cls2>
3111 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R3, cls2:$R2),
3112 mnemonic#"\t$R1, $R3, $R2",
3113 [(set cls1:$R1, (operator cls2:$R3, cls2:$R2))]> {
3114 let OpKey = mnemonic#cls;
3118 class BinaryRRFa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3119 RegisterOperand cls1, RegisterOperand cls2,
3120 RegisterOperand cls3>
3121 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
3122 mnemonic#"\t$R1, $R2, $R3",
3123 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
3125 let OpKey = mnemonic#cls1;
3129 multiclass BinaryRRAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
3130 SDPatternOperator operator, RegisterOperand cls1,
3131 RegisterOperand cls2> {
3132 let NumOpsKey = mnemonic in {
3133 let NumOpsValue = "3" in
3134 def K : BinaryRRFa<mnemonic#"k", opcode2, operator, cls1, cls1, cls2>,
3135 Requires<[FeatureDistinctOps]>;
3136 let NumOpsValue = "2" in
3137 def "" : BinaryRR<mnemonic, opcode1, operator, cls1, cls2>;
3141 multiclass BinaryRREAndK<string mnemonic, bits<16> opcode1, bits<16> opcode2,
3142 SDPatternOperator operator, RegisterOperand cls1,
3143 RegisterOperand cls2> {
3144 let NumOpsKey = mnemonic in {
3145 let NumOpsValue = "3" in
3146 def K : BinaryRRFa<mnemonic#"k", opcode2, operator, cls1, cls1, cls2>,
3147 Requires<[FeatureDistinctOps]>;
3148 let NumOpsValue = "2" in
3149 def "" : BinaryRRE<mnemonic, opcode1, operator, cls1, cls2>;
3153 class BinaryRRFb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3154 RegisterOperand cls1, RegisterOperand cls2,
3155 RegisterOperand cls3>
3156 : InstRRFb<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
3157 mnemonic#"\t$R1, $R3, $R2",
3158 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
3162 class BinaryRRFc<string mnemonic, bits<16> opcode,
3163 RegisterOperand cls1, RegisterOperand cls2>
3164 : InstRRFc<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M3),
3165 mnemonic#"\t$R1, $R2, $M3", []>;
3167 class BinaryMemRRFc<string mnemonic, bits<16> opcode,
3168 RegisterOperand cls1, RegisterOperand cls2, Immediate imm>
3169 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src, imm:$M3),
3170 mnemonic#"\t$R1, $R2, $M3", []> {
3171 let Constraints = "$R1 = $R1src";
3172 let DisableEncoding = "$R1src";
3175 multiclass BinaryMemRRFcOpt<string mnemonic, bits<16> opcode,
3176 RegisterOperand cls1, RegisterOperand cls2> {
3177 def "" : BinaryMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
3178 def Opt : UnaryMemRRFc<mnemonic, opcode, cls1, cls2>;
3181 class BinaryRRFd<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3182 RegisterOperand cls2>
3183 : InstRRFd<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M4),
3184 mnemonic#"\t$R1, $R2, $M4", []>;
3186 class BinaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3187 RegisterOperand cls2>
3188 : InstRRFe<opcode, (outs cls1:$R1), (ins imm32zx4:$M3, cls2:$R2),
3189 mnemonic#"\t$R1, $M3, $R2", []> {
3193 class CondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3194 RegisterOperand cls2>
3195 : InstRRFc<opcode, (outs cls1:$R1),
3196 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
3197 mnemonic#"$M3\t$R1, $R2",
3198 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src,
3199 cond4:$valid, cond4:$M3))]> {
3200 let Constraints = "$R1 = $R1src";
3201 let DisableEncoding = "$R1src";
3205 // Like CondBinaryRRF, but used for the raw assembly form. The condition-code
3206 // mask is the third operand rather than being part of the mnemonic.
3207 class AsmCondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3208 RegisterOperand cls2>
3209 : InstRRFc<opcode, (outs cls1:$R1),
3210 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M3),
3211 mnemonic#"\t$R1, $R2, $M3", []> {
3212 let Constraints = "$R1 = $R1src";
3213 let DisableEncoding = "$R1src";
3216 // Like CondBinaryRRF, but with a fixed CC mask.
3217 class FixedCondBinaryRRF<CondVariant V, string mnemonic, bits<16> opcode,
3218 RegisterOperand cls1, RegisterOperand cls2>
3219 : InstRRFc<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3220 mnemonic#V.suffix#"\t$R1, $R2", []> {
3221 let Constraints = "$R1 = $R1src";
3222 let DisableEncoding = "$R1src";
3223 let isAsmParserOnly = V.alternate;
3227 multiclass CondBinaryRRFPair<string mnemonic, bits<16> opcode,
3228 RegisterOperand cls1, RegisterOperand cls2> {
3229 let isCodeGenOnly = 1 in
3230 def "" : CondBinaryRRF<mnemonic, opcode, cls1, cls2>;
3231 def Asm : AsmCondBinaryRRF<mnemonic, opcode, cls1, cls2>;
3234 class CondBinaryRRFa<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3235 RegisterOperand cls2, RegisterOperand cls3>
3236 : InstRRFa<opcode, (outs cls1:$R1),
3237 (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4),
3238 mnemonic#"$M4\t$R1, $R2, $R3",
3239 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3,
3240 cond4:$valid, cond4:$M4))]> {
3244 // Like CondBinaryRRFa, but used for the raw assembly form. The condition-code
3245 // mask is the third operand rather than being part of the mnemonic.
3246 class AsmCondBinaryRRFa<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3247 RegisterOperand cls2, RegisterOperand cls3>
3248 : InstRRFa<opcode, (outs cls1:$R1), (ins cls3:$R3, cls2:$R2, imm32zx4:$M4),
3249 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
3251 // Like CondBinaryRRFa, but with a fixed CC mask.
3252 class FixedCondBinaryRRFa<CondVariant V, string mnemonic, bits<16> opcode,
3253 RegisterOperand cls1, RegisterOperand cls2,
3254 RegisterOperand cls3>
3255 : InstRRFa<opcode, (outs cls1:$R1), (ins cls3:$R3, cls2:$R2),
3256 mnemonic#V.suffix#"\t$R1, $R2, $R3", []> {
3257 let isAsmParserOnly = V.alternate;
3261 multiclass CondBinaryRRFaPair<string mnemonic, bits<16> opcode,
3262 RegisterOperand cls1, RegisterOperand cls2,
3263 RegisterOperand cls3> {
3264 let isCodeGenOnly = 1 in
3265 def "" : CondBinaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
3266 def Asm : AsmCondBinaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
3269 class BinaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3270 RegisterOperand cls, Immediate imm>
3271 : InstRIa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3272 mnemonic#"\t$R1, $I2",
3273 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
3274 let Constraints = "$R1 = $R1src";
3275 let DisableEncoding = "$R1src";
3278 class BinaryRIE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3279 RegisterOperand cls, Immediate imm>
3280 : InstRIEd<opcode, (outs cls:$R1), (ins cls:$R3, imm:$I2),
3281 mnemonic#"\t$R1, $R3, $I2",
3282 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
3284 multiclass BinaryRIAndK<string mnemonic, bits<12> opcode1, bits<16> opcode2,
3285 SDPatternOperator operator, RegisterOperand cls,
3287 let NumOpsKey = mnemonic in {
3288 let NumOpsValue = "3" in
3289 def K : BinaryRIE<mnemonic##"k", opcode2, operator, cls, imm>,
3290 Requires<[FeatureDistinctOps]>;
3291 let NumOpsValue = "2" in
3292 def "" : BinaryRI<mnemonic, opcode1, operator, cls, imm>;
3296 class CondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3298 : InstRIEg<opcode, (outs cls:$R1),
3299 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
3300 mnemonic#"$M3\t$R1, $I2",
3301 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
3302 cond4:$valid, cond4:$M3))]> {
3303 let Constraints = "$R1 = $R1src";
3304 let DisableEncoding = "$R1src";
3308 // Like CondBinaryRIE, but used for the raw assembly form. The condition-code
3309 // mask is the third operand rather than being part of the mnemonic.
3310 class AsmCondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3312 : InstRIEg<opcode, (outs cls:$R1),
3313 (ins cls:$R1src, imm:$I2, imm32zx4:$M3),
3314 mnemonic#"\t$R1, $I2, $M3", []> {
3315 let Constraints = "$R1 = $R1src";
3316 let DisableEncoding = "$R1src";
3319 // Like CondBinaryRIE, but with a fixed CC mask.
3320 class FixedCondBinaryRIE<CondVariant V, string mnemonic, bits<16> opcode,
3321 RegisterOperand cls, Immediate imm>
3322 : InstRIEg<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3323 mnemonic#V.suffix#"\t$R1, $I2", []> {
3324 let Constraints = "$R1 = $R1src";
3325 let DisableEncoding = "$R1src";
3326 let isAsmParserOnly = V.alternate;
3330 multiclass CondBinaryRIEPair<string mnemonic, bits<16> opcode,
3331 RegisterOperand cls, Immediate imm> {
3332 let isCodeGenOnly = 1 in
3333 def "" : CondBinaryRIE<mnemonic, opcode, cls, imm>;
3334 def Asm : AsmCondBinaryRIE<mnemonic, opcode, cls, imm>;
3337 class BinaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3338 RegisterOperand cls, Immediate imm>
3339 : InstRILa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3340 mnemonic#"\t$R1, $I2",
3341 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
3342 let Constraints = "$R1 = $R1src";
3343 let DisableEncoding = "$R1src";
3346 class BinaryRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3347 RegisterOperand cls>
3348 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, shift12only:$BD2),
3349 mnemonic#"\t$R1, $BD2",
3350 [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> {
3352 let Constraints = "$R1 = $R1src";
3353 let DisableEncoding = "$R1src";
3356 class BinaryRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3357 RegisterOperand cls>
3358 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, shift20only:$BD2),
3359 mnemonic#"\t$R1, $R3, $BD2",
3360 [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>;
3362 multiclass BinaryRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
3363 SDPatternOperator operator, RegisterOperand cls> {
3364 let NumOpsKey = mnemonic in {
3365 let NumOpsValue = "3" in
3366 def K : BinaryRSY<mnemonic##"k", opcode2, operator, cls>,
3367 Requires<[FeatureDistinctOps]>;
3368 let NumOpsValue = "2" in
3369 def "" : BinaryRS<mnemonic, opcode1, operator, cls>;
3373 class BinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
3374 : InstRSLb<opcode, (outs cls:$R1),
3375 (ins bdladdr12onlylen8:$BDL2, imm32zx4:$M3),
3376 mnemonic#"\t$R1, $BDL2, $M3", []> {
3380 class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3381 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3382 AddressingMode mode = bdxaddr12only>
3383 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2),
3384 mnemonic#"\t$R1, $XBD2",
3385 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3386 let OpKey = mnemonic#"r"#cls;
3388 let Constraints = "$R1 = $R1src";
3389 let DisableEncoding = "$R1src";
3391 let AccessBytes = bytes;
3394 class BinaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3395 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
3396 : InstRXE<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2),
3397 mnemonic#"\t$R1, $XBD2",
3398 [(set cls:$R1, (operator cls:$R1src,
3399 (load bdxaddr12only:$XBD2)))]> {
3400 let OpKey = mnemonic#"r"#cls;
3402 let Constraints = "$R1 = $R1src";
3403 let DisableEncoding = "$R1src";
3405 let AccessBytes = bytes;
3409 class BinaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3410 RegisterOperand cls1, RegisterOperand cls2,
3411 SDPatternOperator load, bits<5> bytes>
3412 : InstRXF<opcode, (outs cls1:$R1), (ins cls2:$R3, bdxaddr12only:$XBD2),
3413 mnemonic#"\t$R1, $R3, $XBD2",
3414 [(set cls1:$R1, (operator cls2:$R3, (load bdxaddr12only:$XBD2)))]> {
3415 let OpKey = mnemonic#"r"#cls;
3418 let AccessBytes = bytes;
3421 class BinaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3422 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3423 AddressingMode mode = bdxaddr20only>
3424 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2),
3425 mnemonic#"\t$R1, $XBD2",
3426 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3427 let OpKey = mnemonic#"r"#cls;
3429 let Constraints = "$R1 = $R1src";
3430 let DisableEncoding = "$R1src";
3432 let AccessBytes = bytes;
3435 multiclass BinaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3436 SDPatternOperator operator, RegisterOperand cls,
3437 SDPatternOperator load, bits<5> bytes> {
3438 let DispKey = mnemonic ## #cls in {
3439 let DispSize = "12" in
3440 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes,
3442 let DispSize = "20" in
3443 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load, bytes,
3448 class BinarySI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3449 Operand imm, AddressingMode mode = bdaddr12only>
3450 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
3451 mnemonic#"\t$BD1, $I2",
3452 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
3457 class BinarySIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3458 Operand imm, AddressingMode mode = bdaddr20only>
3459 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
3460 mnemonic#"\t$BD1, $I2",
3461 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
3466 multiclass BinarySIPair<string mnemonic, bits<8> siOpcode,
3467 bits<16> siyOpcode, SDPatternOperator operator,
3469 let DispKey = mnemonic ## #cls in {
3470 let DispSize = "12" in
3471 def "" : BinarySI<mnemonic, siOpcode, operator, imm, bdaddr12pair>;
3472 let DispSize = "20" in
3473 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>;
3477 class BinarySSF<string mnemonic, bits<12> opcode, RegisterOperand cls>
3478 : InstSSF<opcode, (outs cls:$R3), (ins bdaddr12pair:$BD1, bdaddr12pair:$BD2),
3479 mnemonic#"\t$R3, $BD1, $BD2", []> {
3483 class BinaryVRIb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3484 TypedReg tr, bits<4> type>
3485 : InstVRIb<opcode, (outs tr.op:$V1), (ins imm32zx8:$I2, imm32zx8:$I3),
3486 mnemonic#"\t$V1, $I2, $I3",
3487 [(set (tr.vt tr.op:$V1), (operator imm32zx8:$I2, imm32zx8:$I3))]> {
3491 class BinaryVRIbGeneric<string mnemonic, bits<16> opcode>
3492 : InstVRIb<opcode, (outs VR128:$V1),
3493 (ins imm32zx8:$I2, imm32zx8:$I3, imm32zx4:$M4),
3494 mnemonic#"\t$V1, $I2, $I3, $M4", []>;
3496 class BinaryVRIc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3497 TypedReg tr1, TypedReg tr2, bits<4> type>
3498 : InstVRIc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, imm32zx16:$I2),
3499 mnemonic#"\t$V1, $V3, $I2",
3500 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3),
3505 class BinaryVRIcGeneric<string mnemonic, bits<16> opcode>
3506 : InstVRIc<opcode, (outs VR128:$V1),
3507 (ins VR128:$V3, imm32zx16:$I2, imm32zx4:$M4),
3508 mnemonic#"\t$V1, $V3, $I2, $M4", []>;
3510 class BinaryVRIe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3511 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5>
3512 : InstVRIe<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx12:$I3),
3513 mnemonic#"\t$V1, $V2, $I3",
3514 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3520 class BinaryVRIeFloatGeneric<string mnemonic, bits<16> opcode>
3521 : InstVRIe<opcode, (outs VR128:$V1),
3522 (ins VR128:$V2, imm32zx12:$I3, imm32zx4:$M4, imm32zx4:$M5),
3523 mnemonic#"\t$V1, $V2, $I3, $M4, $M5", []>;
3525 class BinaryVRIh<string mnemonic, bits<16> opcode>
3526 : InstVRIh<opcode, (outs VR128:$V1),
3527 (ins imm32zx16:$I2, imm32zx4:$I3),
3528 mnemonic#"\t$V1, $I2, $I3", []>;
3530 class BinaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3531 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0>
3532 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx4:$M5),
3533 mnemonic#"\t$V1, $V2, $M5",
3534 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3540 class BinaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
3541 : InstVRRa<opcode, (outs VR128:$V1),
3542 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
3543 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
3545 class BinaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3546 TypedReg tr1, TypedReg tr2, bits<4> type = 0,
3547 bits<4> modifier = 0>
3548 : InstVRRb<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3549 mnemonic#"\t$V1, $V2, $V3",
3550 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3551 (tr2.vt tr2.op:$V3)))]> {
3556 // Declare a pair of instructions, one which sets CC and one which doesn't.
3557 // The CC-setting form ends with "S" and sets the low bit of M5.
3558 multiclass BinaryVRRbSPair<string mnemonic, bits<16> opcode,
3559 SDPatternOperator operator,
3560 SDPatternOperator operator_cc, TypedReg tr1,
3561 TypedReg tr2, bits<4> type, bits<4> modifier = 0> {
3562 def "" : BinaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
3563 !and (modifier, 14)>;
3565 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
3566 !add (!and (modifier, 14), 1)>;
3569 class BinaryVRRbSPairGeneric<string mnemonic, bits<16> opcode>
3570 : InstVRRb<opcode, (outs VR128:$V1),
3571 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3572 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> {
3576 // Declare a pair of instructions, one which sets CC and one which doesn't.
3577 // The CC-setting form ends with "S" and sets the low bit of M5.
3578 // The form that does not set CC has an extra operand to optionally allow
3579 // specifying arbitrary M5 values in assembler.
3580 multiclass BinaryExtraVRRbSPair<string mnemonic, bits<16> opcode,
3581 SDPatternOperator operator,
3582 SDPatternOperator operator_cc,
3583 TypedReg tr1, TypedReg tr2, bits<4> type> {
3585 def "" : InstVRRb<opcode, (outs tr1.op:$V1),
3586 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M5),
3587 mnemonic#"\t$V1, $V2, $V3, $M5", []>;
3588 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3))),
3589 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, 0)>;
3590 def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
3591 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
3594 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 1>;
3597 multiclass BinaryExtraVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
3599 def "" : InstVRRb<opcode, (outs VR128:$V1),
3600 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3601 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
3602 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
3603 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
3607 class BinaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3608 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0,
3610 : InstVRRc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3611 mnemonic#"\t$V1, $V2, $V3",
3612 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3613 (tr2.vt tr2.op:$V3)))]> {
3619 class BinaryVRRcGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0,
3621 : InstVRRc<opcode, (outs VR128:$V1),
3622 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4),
3623 mnemonic#"\t$V1, $V2, $V3, $M4", []> {
3628 class BinaryVRRcFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m6 = 0>
3629 : InstVRRc<opcode, (outs VR128:$V1),
3630 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3631 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> {
3635 // Declare a pair of instructions, one which sets CC and one which doesn't.
3636 // The CC-setting form ends with "S" and sets the low bit of M5.
3637 multiclass BinaryVRRcSPair<string mnemonic, bits<16> opcode,
3638 SDPatternOperator operator,
3639 SDPatternOperator operator_cc, TypedReg tr1,
3640 TypedReg tr2, bits<4> type, bits<4> m5,
3641 bits<4> modifier = 0> {
3642 def "" : BinaryVRRc<mnemonic, opcode, operator, tr1, tr2, type,
3643 m5, !and (modifier, 14)>;
3645 def S : BinaryVRRc<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
3646 m5, !add (!and (modifier, 14), 1)>;
3649 class BinaryVRRcSPairFloatGeneric<string mnemonic, bits<16> opcode>
3650 : InstVRRc<opcode, (outs VR128:$V1),
3651 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
3653 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
3655 class BinaryVRRf<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3657 : InstVRRf<opcode, (outs tr.op:$V1), (ins GR64:$R2, GR64:$R3),
3658 mnemonic#"\t$V1, $R2, $R3",
3659 [(set (tr.vt tr.op:$V1), (operator GR64:$R2, GR64:$R3))]>;
3661 class BinaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls>
3662 : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2, imm32zx4:$M3),
3663 mnemonic#"\t$R1, $V2, $M3", []> {
3667 class BinaryVRSa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3668 TypedReg tr1, TypedReg tr2, bits<4> type>
3669 : InstVRSa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, shift12only:$BD2),
3670 mnemonic#"\t$V1, $V3, $BD2",
3671 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3),
3672 shift12only:$BD2))]> {
3676 class BinaryVRSaGeneric<string mnemonic, bits<16> opcode>
3677 : InstVRSa<opcode, (outs VR128:$V1),
3678 (ins VR128:$V3, shift12only:$BD2, imm32zx4:$M4),
3679 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
3681 class BinaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3683 : InstVRSb<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2),
3684 mnemonic#"\t$V1, $R3, $BD2",
3685 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
3688 let AccessBytes = bytes;
3691 class BinaryVRSc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3692 TypedReg tr, bits<4> type>
3693 : InstVRSc<opcode, (outs GR64:$R1), (ins tr.op:$V3, shift12only:$BD2),
3694 mnemonic#"\t$R1, $V3, $BD2",
3695 [(set GR64:$R1, (operator (tr.vt tr.op:$V3), shift12only:$BD2))]> {
3699 class BinaryVRScGeneric<string mnemonic, bits<16> opcode>
3700 : InstVRSc<opcode, (outs GR64:$R1),
3701 (ins VR128:$V3, shift12only:$BD2, imm32zx4: $M4),
3702 mnemonic#"\t$R1, $V3, $BD2, $M4", []>;
3704 class BinaryVRSd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3706 : InstVRSd<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2),
3707 mnemonic#"\t$V1, $R3, $BD2",
3708 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
3710 let AccessBytes = bytes;
3713 class BinaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3714 TypedReg tr, bits<5> bytes>
3715 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
3716 mnemonic#"\t$V1, $XBD2, $M3",
3717 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2,
3720 let AccessBytes = bytes;
3723 class StoreBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
3724 bits<5> bytes, AddressingMode mode = bdaddr12only>
3725 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3726 mnemonic#"\t$R1, $M3, $BD2", []> {
3728 let AccessBytes = bytes;
3731 class StoreBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
3732 bits<5> bytes, AddressingMode mode = bdaddr20only>
3733 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3734 mnemonic#"\t$R1, $M3, $BD2", []> {
3736 let AccessBytes = bytes;
3739 multiclass StoreBinaryRSPair<string mnemonic, bits<8> rsOpcode,
3740 bits<16> rsyOpcode, RegisterOperand cls,
3742 let DispKey = mnemonic ## #cls in {
3743 let DispSize = "12" in
3744 def "" : StoreBinaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
3745 let DispSize = "20" in
3746 def Y : StoreBinaryRSY<mnemonic#"y", rsyOpcode, cls, bytes,
3751 class StoreBinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
3752 : InstRSLb<opcode, (outs),
3753 (ins cls:$R1, bdladdr12onlylen8:$BDL2, imm32zx4:$M3),
3754 mnemonic#"\t$R1, $BDL2, $M3", []> {
3758 class BinaryVSI<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3760 : InstVSI<opcode, (outs VR128:$V1), (ins bdaddr12only:$BD2, imm32zx8:$I3),
3761 mnemonic#"\t$V1, $BD2, $I3",
3762 [(set VR128:$V1, (operator imm32zx8:$I3, bdaddr12only:$BD2))]> {
3764 let AccessBytes = bytes;
3767 class StoreBinaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
3769 : InstVRV<opcode, (outs), (ins VR128:$V1, bdvaddr12only:$VBD2, index:$M3),
3770 mnemonic#"\t$V1, $VBD2, $M3", []> {
3772 let AccessBytes = bytes;
3775 class StoreBinaryVRX<string mnemonic, bits<16> opcode,
3776 SDPatternOperator operator, TypedReg tr, bits<5> bytes,
3778 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2, index:$M3),
3779 mnemonic#"\t$V1, $XBD2, $M3",
3780 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2, index:$M3)]> {
3782 let AccessBytes = bytes;
3785 class MemoryBinarySSd<string mnemonic, bits<8> opcode,
3786 RegisterOperand cls>
3787 : InstSSd<opcode, (outs),
3788 (ins bdraddr12only:$RBD1, bdaddr12only:$BD2, cls:$R3),
3789 mnemonic#"\t$RBD1, $BD2, $R3", []>;
3791 class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3792 RegisterOperand cls1, RegisterOperand cls2>
3793 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3794 mnemonic#"\t$R1, $R2",
3795 [(set CC, (operator cls1:$R1, cls2:$R2))]> {
3796 let OpKey = mnemonic#cls1;
3801 class CompareRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3802 RegisterOperand cls1, RegisterOperand cls2>
3803 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3804 mnemonic#"\t$R1, $R2",
3805 [(set CC, (operator cls1:$R1, cls2:$R2))]> {
3806 let OpKey = mnemonic#cls1;
3811 class CompareRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3812 RegisterOperand cls, Immediate imm>
3813 : InstRIa<opcode, (outs), (ins cls:$R1, imm:$I2),
3814 mnemonic#"\t$R1, $I2",
3815 [(set CC, (operator cls:$R1, imm:$I2))]> {
3819 class CompareRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3820 RegisterOperand cls, Immediate imm>
3821 : InstRILa<opcode, (outs), (ins cls:$R1, imm:$I2),
3822 mnemonic#"\t$R1, $I2",
3823 [(set CC, (operator cls:$R1, imm:$I2))]> {
3827 class CompareRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3828 RegisterOperand cls, SDPatternOperator load>
3829 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
3830 mnemonic#"\t$R1, $RI2",
3831 [(set CC, (operator cls:$R1, (load pcrel32:$RI2)))]> {
3834 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
3835 // However, BDXs have two extra operands and are therefore 6 units more
3837 let AddedComplexity = 7;
3840 class CompareRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3841 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3842 AddressingMode mode = bdxaddr12only>
3843 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
3844 mnemonic#"\t$R1, $XBD2",
3845 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
3846 let OpKey = mnemonic#"r"#cls;
3850 let AccessBytes = bytes;
3853 class CompareRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3854 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
3855 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
3856 mnemonic#"\t$R1, $XBD2",
3857 [(set CC, (operator cls:$R1, (load bdxaddr12only:$XBD2)))]> {
3858 let OpKey = mnemonic#"r"#cls;
3862 let AccessBytes = bytes;
3866 class CompareRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3867 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3868 AddressingMode mode = bdxaddr20only>
3869 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
3870 mnemonic#"\t$R1, $XBD2",
3871 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
3872 let OpKey = mnemonic#"r"#cls;
3876 let AccessBytes = bytes;
3879 multiclass CompareRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3880 SDPatternOperator operator, RegisterOperand cls,
3881 SDPatternOperator load, bits<5> bytes> {
3882 let DispKey = mnemonic ## #cls in {
3883 let DispSize = "12" in
3884 def "" : CompareRX<mnemonic, rxOpcode, operator, cls,
3885 load, bytes, bdxaddr12pair>;
3886 let DispSize = "20" in
3887 def Y : CompareRXY<mnemonic#"y", rxyOpcode, operator, cls,
3888 load, bytes, bdxaddr20pair>;
3892 class CompareRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
3893 bits<5> bytes, AddressingMode mode = bdaddr12only>
3894 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3895 mnemonic#"\t$R1, $M3, $BD2", []> {
3897 let AccessBytes = bytes;
3900 class CompareRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
3901 bits<5> bytes, AddressingMode mode = bdaddr20only>
3902 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3903 mnemonic#"\t$R1, $M3, $BD2", []> {
3905 let AccessBytes = bytes;
3908 multiclass CompareRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
3909 RegisterOperand cls, bits<5> bytes> {
3910 let DispKey = mnemonic ## #cls in {
3911 let DispSize = "12" in
3912 def "" : CompareRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
3913 let DispSize = "20" in
3914 def Y : CompareRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
3918 class CompareSSb<string mnemonic, bits<8> opcode>
3920 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2),
3921 mnemonic##"\t$BDL1, $BDL2", []> {
3926 class CompareSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3927 SDPatternOperator load, Immediate imm,
3928 AddressingMode mode = bdaddr12only>
3929 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
3930 mnemonic#"\t$BD1, $I2",
3931 [(set CC, (operator (load mode:$BD1), imm:$I2))]> {
3936 class CompareSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3937 SDPatternOperator load, Immediate imm>
3938 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
3939 mnemonic#"\t$BD1, $I2",
3940 [(set CC, (operator (load bdaddr12only:$BD1), imm:$I2))]> {
3945 class CompareSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3946 SDPatternOperator load, Immediate imm,
3947 AddressingMode mode = bdaddr20only>
3948 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
3949 mnemonic#"\t$BD1, $I2",
3950 [(set CC, (operator (load mode:$BD1), imm:$I2))]> {
3955 multiclass CompareSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
3956 SDPatternOperator operator, SDPatternOperator load,
3958 let DispKey = mnemonic in {
3959 let DispSize = "12" in
3960 def "" : CompareSI<mnemonic, siOpcode, operator, load, imm, bdaddr12pair>;
3961 let DispSize = "20" in
3962 def Y : CompareSIY<mnemonic#"y", siyOpcode, operator, load, imm,
3967 class CompareVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3968 TypedReg tr, bits<4> type>
3969 : InstVRRa<opcode, (outs), (ins tr.op:$V1, tr.op:$V2),
3970 mnemonic#"\t$V1, $V2",
3971 [(set CC, (operator (tr.vt tr.op:$V1), (tr.vt tr.op:$V2)))]> {
3978 class CompareVRRaGeneric<string mnemonic, bits<16> opcode>
3979 : InstVRRa<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
3980 mnemonic#"\t$V1, $V2, $M3", []> {
3986 class CompareVRRaFloatGeneric<string mnemonic, bits<16> opcode>
3987 : InstVRRa<opcode, (outs),
3988 (ins VR64:$V1, VR64:$V2, imm32zx4:$M3, imm32zx4:$M4),
3989 mnemonic#"\t$V1, $V2, $M3, $M4", []> {
3994 class CompareVRRh<string mnemonic, bits<16> opcode>
3995 : InstVRRh<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
3996 mnemonic#"\t$V1, $V2, $M3", []> {
4000 class TestInherentS<string mnemonic, bits<16> opcode,
4001 SDPatternOperator operator>
4002 : InstS<opcode, (outs), (ins), mnemonic, [(set CC, (operator))]> {
4006 class TestRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4007 RegisterOperand cls>
4008 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
4009 mnemonic#"\t$R1, $XBD2",
4010 [(set CC, (operator cls:$R1, bdxaddr12only:$XBD2))]> {
4014 class TestBinarySIL<string mnemonic, bits<16> opcode,
4015 SDPatternOperator operator, Immediate imm>
4016 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
4017 mnemonic#"\t$BD1, $I2",
4018 [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>;
4020 class TestRSL<string mnemonic, bits<16> opcode>
4021 : InstRSLa<opcode, (outs), (ins bdladdr12onlylen4:$BDL1),
4022 mnemonic#"\t$BDL1", []> {
4026 class TestVRRg<string mnemonic, bits<16> opcode>
4027 : InstVRRg<opcode, (outs), (ins VR128:$V1),
4028 mnemonic#"\t$V1", []>;
4030 class SideEffectTernarySSc<string mnemonic, bits<8> opcode>
4031 : InstSSc<opcode, (outs), (ins bdladdr12onlylen4:$BDL1,
4032 shift12only:$BD2, imm32zx4:$I3),
4033 mnemonic##"\t$BDL1, $BD2, $I3", []>;
4035 class SideEffectTernaryRRFa<string mnemonic, bits<16> opcode,
4036 RegisterOperand cls1, RegisterOperand cls2,
4037 RegisterOperand cls3>
4038 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3),
4039 mnemonic#"\t$R1, $R2, $R3", []> {
4043 class SideEffectTernaryMemMemRRFa<string mnemonic, bits<16> opcode,
4044 RegisterOperand cls1, RegisterOperand cls2,
4045 RegisterOperand cls3>
4046 : InstRRFa<opcode, (outs cls1:$R1, cls2:$R2),
4047 (ins cls1:$R1src, cls2:$R2src, cls3:$R3),
4048 mnemonic#"\t$R1, $R2, $R3", []> {
4049 let Constraints = "$R1 = $R1src, $R2 = $R2src";
4050 let DisableEncoding = "$R1src, $R2src";
4054 class SideEffectTernaryRRFb<string mnemonic, bits<16> opcode,
4055 RegisterOperand cls1, RegisterOperand cls2,
4056 RegisterOperand cls3>
4057 : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3),
4058 mnemonic#"\t$R1, $R3, $R2", []> {
4062 class SideEffectTernaryMemMemMemRRFb<string mnemonic, bits<16> opcode,
4063 RegisterOperand cls1,
4064 RegisterOperand cls2,
4065 RegisterOperand cls3>
4066 : InstRRFb<opcode, (outs cls1:$R1, cls2:$R2, cls3:$R3),
4067 (ins cls1:$R1src, cls2:$R2src, cls3:$R3src),
4068 mnemonic#"\t$R1, $R3, $R2", []> {
4069 let Constraints = "$R1 = $R1src, $R2 = $R2src, $R3 = $R3src";
4070 let DisableEncoding = "$R1src, $R2src, $R3src";
4074 class SideEffectTernaryRRFc<string mnemonic, bits<16> opcode,
4075 RegisterOperand cls1, RegisterOperand cls2,
4077 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2, imm:$M3),
4078 mnemonic#"\t$R1, $R2, $M3", []>;
4080 multiclass SideEffectTernaryRRFcOpt<string mnemonic, bits<16> opcode,
4081 RegisterOperand cls1,
4082 RegisterOperand cls2> {
4083 def "" : SideEffectTernaryRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
4084 def Opt : SideEffectBinaryRRFc<mnemonic, opcode, cls1, cls2>;
4087 class SideEffectTernaryMemMemRRFc<string mnemonic, bits<16> opcode,
4088 RegisterOperand cls1, RegisterOperand cls2,
4090 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2),
4091 (ins cls1:$R1src, cls2:$R2src, imm:$M3),
4092 mnemonic#"\t$R1, $R2, $M3", []> {
4093 let Constraints = "$R1 = $R1src, $R2 = $R2src";
4094 let DisableEncoding = "$R1src, $R2src";
4097 multiclass SideEffectTernaryMemMemRRFcOpt<string mnemonic, bits<16> opcode,
4098 RegisterOperand cls1,
4099 RegisterOperand cls2> {
4100 def "" : SideEffectTernaryMemMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
4101 def Opt : SideEffectBinaryMemMemRRFc<mnemonic, opcode, cls1, cls2>;
4104 class SideEffectTernarySSF<string mnemonic, bits<12> opcode,
4105 RegisterOperand cls>
4106 : InstSSF<opcode, (outs),
4107 (ins bdaddr12only:$BD1, bdaddr12only:$BD2, cls:$R3),
4108 mnemonic#"\t$BD1, $BD2, $R3", []>;
4110 class TernaryRRFa<string mnemonic, bits<16> opcode,
4111 RegisterOperand cls1, RegisterOperand cls2,
4112 RegisterOperand cls3>
4113 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3, imm32zx4:$M4),
4114 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
4116 class TernaryRRFb<string mnemonic, bits<16> opcode,
4117 RegisterOperand cls1, RegisterOperand cls2,
4118 RegisterOperand cls3>
4119 : InstRRFb<opcode, (outs cls1:$R1, cls3:$R3),
4120 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M4),
4121 mnemonic#"\t$R1, $R3, $R2, $M4", []> {
4122 let Constraints = "$R1 = $R1src";
4123 let DisableEncoding = "$R1src";
4126 class TernaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
4127 RegisterOperand cls2>
4128 : InstRRFe<opcode, (outs cls1:$R1),
4129 (ins imm32zx4:$M3, cls2:$R2, imm32zx4:$M4),
4130 mnemonic#"\t$R1, $M3, $R2, $M4", []>;
4132 class TernaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4133 RegisterOperand cls1, RegisterOperand cls2>
4134 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R1src, cls2:$R3, cls2:$R2),
4135 mnemonic#"\t$R1, $R3, $R2",
4136 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3, cls2:$R2))]> {
4137 let OpKey = mnemonic#cls;
4139 let Constraints = "$R1 = $R1src";
4140 let DisableEncoding = "$R1src";
4143 class TernaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
4144 bits<5> bytes, AddressingMode mode = bdaddr12only>
4145 : InstRSb<opcode, (outs cls:$R1),
4146 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2),
4147 mnemonic#"\t$R1, $M3, $BD2", []> {
4149 let Constraints = "$R1 = $R1src";
4150 let DisableEncoding = "$R1src";
4152 let AccessBytes = bytes;
4155 class TernaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
4156 bits<5> bytes, AddressingMode mode = bdaddr20only>
4157 : InstRSYb<opcode, (outs cls:$R1),
4158 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2),
4159 mnemonic#"\t$R1, $M3, $BD2", []> {
4161 let Constraints = "$R1 = $R1src";
4162 let DisableEncoding = "$R1src";
4164 let AccessBytes = bytes;
4167 multiclass TernaryRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4168 RegisterOperand cls, bits<5> bytes> {
4169 let DispKey = mnemonic ## #cls in {
4170 let DispSize = "12" in
4171 def "" : TernaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
4172 let DispSize = "20" in
4173 def Y : TernaryRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
4177 class SideEffectTernaryRS<string mnemonic, bits<8> opcode,
4178 RegisterOperand cls1, RegisterOperand cls2>
4179 : InstRSa<opcode, (outs),
4180 (ins cls1:$R1, cls2:$R3, bdaddr12only:$BD2),
4181 mnemonic#"\t$R1, $R3, $BD2", []>;
4183 class SideEffectTernaryRSY<string mnemonic, bits<16> opcode,
4184 RegisterOperand cls1, RegisterOperand cls2>
4185 : InstRSYa<opcode, (outs),
4186 (ins cls1:$R1, cls2:$R3, bdaddr20only:$BD2),
4187 mnemonic#"\t$R1, $R3, $BD2", []>;
4189 class SideEffectTernaryMemMemRS<string mnemonic, bits<8> opcode,
4190 RegisterOperand cls1, RegisterOperand cls2>
4191 : InstRSa<opcode, (outs cls1:$R1, cls2:$R3),
4192 (ins cls1:$R1src, cls2:$R3src, shift12only:$BD2),
4193 mnemonic#"\t$R1, $R3, $BD2", []> {
4194 let Constraints = "$R1 = $R1src, $R3 = $R3src";
4195 let DisableEncoding = "$R1src, $R3src";
4198 class SideEffectTernaryMemMemRSY<string mnemonic, bits<16> opcode,
4199 RegisterOperand cls1, RegisterOperand cls2>
4200 : InstRSYa<opcode, (outs cls1:$R1, cls2:$R3),
4201 (ins cls1:$R1src, cls2:$R3src, shift20only:$BD2),
4202 mnemonic#"\t$R1, $R3, $BD2", []> {
4203 let Constraints = "$R1 = $R1src, $R3 = $R3src";
4204 let DisableEncoding = "$R1src, $R3src";
4207 class TernaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4208 RegisterOperand cls1, RegisterOperand cls2,
4209 SDPatternOperator load, bits<5> bytes>
4210 : InstRXF<opcode, (outs cls1:$R1),
4211 (ins cls2:$R1src, cls2:$R3, bdxaddr12only:$XBD2),
4212 mnemonic#"\t$R1, $R3, $XBD2",
4213 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3,
4214 (load bdxaddr12only:$XBD2)))]> {
4215 let OpKey = mnemonic#"r"#cls;
4217 let Constraints = "$R1 = $R1src";
4218 let DisableEncoding = "$R1src";
4220 let AccessBytes = bytes;
4223 class TernaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4224 TypedReg tr1, TypedReg tr2, Immediate imm, Immediate index>
4225 : InstVRIa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V1src, imm:$I2, index:$M3),
4226 mnemonic#"\t$V1, $I2, $M3",
4227 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4228 imm:$I2, index:$M3))]> {
4229 let Constraints = "$V1 = $V1src";
4230 let DisableEncoding = "$V1src";
4233 class TernaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4234 TypedReg tr1, TypedReg tr2, bits<4> type>
4235 : InstVRId<opcode, (outs tr1.op:$V1),
4236 (ins tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
4237 mnemonic#"\t$V1, $V2, $V3, $I4",
4238 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4239 (tr2.vt tr2.op:$V3),
4244 class TernaryVRIi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4245 : InstVRIi<opcode, (outs VR128:$V1),
4246 (ins cls:$R2, imm32zx8:$I3, imm32zx4:$M4),
4247 mnemonic#"\t$V1, $R2, $I3, $M4", []>;
4249 class TernaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4250 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m4or>
4251 : InstVRRa<opcode, (outs tr1.op:$V1),
4252 (ins tr2.op:$V2, imm32zx4:$M4, imm32zx4:$M5),
4253 mnemonic#"\t$V1, $V2, $M4, $M5",
4254 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4261 class TernaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
4262 : InstVRRa<opcode, (outs VR128:$V1),
4263 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
4264 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
4266 class TernaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4267 TypedReg tr1, TypedReg tr2, bits<4> type,
4268 SDPatternOperator m5mask, bits<4> m5or>
4269 : InstVRRb<opcode, (outs tr1.op:$V1),
4270 (ins tr2.op:$V2, tr2.op:$V3, m5mask:$M5),
4271 mnemonic#"\t$V1, $V2, $V3, $M5",
4272 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4273 (tr2.vt tr2.op:$V3),
4279 // Declare a pair of instructions, one which sets CC and one which doesn't.
4280 // The CC-setting form ends with "S" and sets the low bit of M5.
4281 // Also create aliases to make use of M5 operand optional in assembler.
4282 multiclass TernaryOptVRRbSPair<string mnemonic, bits<16> opcode,
4283 SDPatternOperator operator,
4284 SDPatternOperator operator_cc,
4285 TypedReg tr1, TypedReg tr2, bits<4> type,
4286 bits<4> modifier = 0> {
4287 def "" : TernaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
4288 imm32zx4even, !and (modifier, 14)>;
4289 def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
4290 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4293 def S : TernaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
4294 imm32zx4even, !add(!and (modifier, 14), 1)>;
4295 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3",
4296 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
4300 multiclass TernaryOptVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
4302 def "" : InstVRRb<opcode, (outs VR128:$V1),
4303 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
4304 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
4305 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
4306 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4310 class TernaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4311 TypedReg tr1, TypedReg tr2>
4312 : InstVRRc<opcode, (outs tr1.op:$V1),
4313 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M4),
4314 mnemonic#"\t$V1, $V2, $V3, $M4",
4315 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4316 (tr2.vt tr2.op:$V3),
4322 class TernaryVRRcFloat<string mnemonic, bits<16> opcode,
4323 SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
4324 bits<4> type = 0, bits<4> m5 = 0>
4325 : InstVRRc<opcode, (outs tr1.op:$V1),
4326 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M6),
4327 mnemonic#"\t$V1, $V2, $V3, $M6",
4328 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4329 (tr2.vt tr2.op:$V3),
4335 class TernaryVRRcFloatGeneric<string mnemonic, bits<16> opcode>
4336 : InstVRRc<opcode, (outs VR128:$V1),
4337 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
4339 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
4341 class TernaryVRRd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4342 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m6 = 0>
4343 : InstVRRd<opcode, (outs tr1.op:$V1),
4344 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
4345 mnemonic#"\t$V1, $V2, $V3, $V4",
4346 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4347 (tr2.vt tr2.op:$V3),
4348 (tr1.vt tr1.op:$V4)))]> {
4353 class TernaryVRRdGeneric<string mnemonic, bits<16> opcode>
4354 : InstVRRd<opcode, (outs VR128:$V1),
4355 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5),
4356 mnemonic#"\t$V1, $V2, $V3, $V4, $M5", []> {
4360 // Ternary operation where the assembler mnemonic has an extra operand to
4361 // optionally allow specifiying arbitrary M6 values.
4362 multiclass TernaryExtraVRRd<string mnemonic, bits<16> opcode,
4363 SDPatternOperator operator,
4364 TypedReg tr1, TypedReg tr2, bits<4> type> {
4365 let M5 = type, Defs = [CC] in
4366 def "" : InstVRRd<opcode, (outs tr1.op:$V1),
4367 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, imm32zx4:$M6),
4368 mnemonic#"\t$V1, $V2, $V3, $V4, $M6", []>;
4369 def : Pat<(operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3),
4370 (tr1.vt tr1.op:$V4)),
4371 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, 0)>;
4372 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4",
4373 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4374 tr2.op:$V3, tr1.op:$V4, 0)>;
4377 multiclass TernaryExtraVRRdGeneric<string mnemonic, bits<16> opcode> {
4379 def "" : InstVRRd<opcode, (outs VR128:$V1),
4380 (ins VR128:$V2, VR128:$V3, VR128:$V4,
4381 imm32zx4:$M5, imm32zx4:$M6),
4382 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4383 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5",
4384 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4385 VR128:$V4, imm32zx4:$M5, 0)>;
4388 class TernaryVRRe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4389 TypedReg tr1, TypedReg tr2, bits<4> m5 = 0, bits<4> type = 0>
4390 : InstVRRe<opcode, (outs tr1.op:$V1),
4391 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
4392 mnemonic#"\t$V1, $V2, $V3, $V4",
4393 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4394 (tr2.vt tr2.op:$V3),
4395 (tr1.vt tr1.op:$V4)))]> {
4400 class TernaryVRReFloatGeneric<string mnemonic, bits<16> opcode>
4401 : InstVRRe<opcode, (outs VR128:$V1),
4402 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
4403 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4405 class TernaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4406 TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type>
4407 : InstVRSb<opcode, (outs tr1.op:$V1),
4408 (ins tr2.op:$V1src, cls:$R3, shift12only:$BD2),
4409 mnemonic#"\t$V1, $R3, $BD2",
4410 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4412 shift12only:$BD2))]> {
4413 let Constraints = "$V1 = $V1src";
4414 let DisableEncoding = "$V1src";
4418 class TernaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4419 : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2,
4420 imm32zx4:$M3, imm32zx4:$M4),
4421 mnemonic#"\t$R1, $V2, $M3, $M4", []>;
4423 class TernaryVRSbGeneric<string mnemonic, bits<16> opcode>
4424 : InstVRSb<opcode, (outs VR128:$V1),
4425 (ins VR128:$V1src, GR64:$R3, shift12only:$BD2, imm32zx4:$M4),
4426 mnemonic#"\t$V1, $R3, $BD2, $M4", []> {
4427 let Constraints = "$V1 = $V1src";
4428 let DisableEncoding = "$V1src";
4431 class TernaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
4433 : InstVRV<opcode, (outs VR128:$V1),
4434 (ins VR128:$V1src, bdvaddr12only:$VBD2, index:$M3),
4435 mnemonic#"\t$V1, $VBD2, $M3", []> {
4436 let Constraints = "$V1 = $V1src";
4437 let DisableEncoding = "$V1src";
4439 let AccessBytes = bytes;
4442 class TernaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4443 TypedReg tr1, TypedReg tr2, bits<5> bytes, Immediate index>
4444 : InstVRX<opcode, (outs tr1.op:$V1),
4445 (ins tr2.op:$V1src, bdxaddr12only:$XBD2, index:$M3),
4446 mnemonic#"\t$V1, $XBD2, $M3",
4447 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4448 bdxaddr12only:$XBD2,
4450 let Constraints = "$V1 = $V1src";
4451 let DisableEncoding = "$V1src";
4453 let AccessBytes = bytes;
4456 class QuaternaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4457 TypedReg tr1, TypedReg tr2, bits<4> type>
4458 : InstVRId<opcode, (outs tr1.op:$V1),
4459 (ins tr2.op:$V1src, tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
4460 mnemonic#"\t$V1, $V2, $V3, $I4",
4461 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4462 (tr2.vt tr2.op:$V2),
4463 (tr2.vt tr2.op:$V3),
4465 let Constraints = "$V1 = $V1src";
4466 let DisableEncoding = "$V1src";
4470 class QuaternaryVRIdGeneric<string mnemonic, bits<16> opcode>
4471 : InstVRId<opcode, (outs VR128:$V1),
4472 (ins VR128:$V1src, VR128:$V2, VR128:$V3,
4473 imm32zx8:$I4, imm32zx4:$M5),
4474 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []> {
4475 let Constraints = "$V1 = $V1src";
4476 let DisableEncoding = "$V1src";
4479 class QuaternaryVRIf<string mnemonic, bits<16> opcode>
4480 : InstVRIf<opcode, (outs VR128:$V1),
4481 (ins VR128:$V2, VR128:$V3,
4482 imm32zx8:$I4, imm32zx4:$M5),
4483 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []>;
4485 class QuaternaryVRIg<string mnemonic, bits<16> opcode>
4486 : InstVRIg<opcode, (outs VR128:$V1),
4487 (ins VR128:$V2, imm32zx8:$I3,
4488 imm32zx8:$I4, imm32zx4:$M5),
4489 mnemonic#"\t$V1, $V2, $I3, $I4, $M5", []>;
4491 class QuaternaryVRRd<string mnemonic, bits<16> opcode,
4492 SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
4493 TypedReg tr3, TypedReg tr4, bits<4> type,
4494 SDPatternOperator m6mask = imm32zx4, bits<4> m6or = 0>
4495 : InstVRRd<opcode, (outs tr1.op:$V1),
4496 (ins tr2.op:$V2, tr3.op:$V3, tr4.op:$V4, m6mask:$M6),
4497 mnemonic#"\t$V1, $V2, $V3, $V4, $M6",
4498 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4499 (tr3.vt tr3.op:$V3),
4500 (tr4.vt tr4.op:$V4),
4506 class QuaternaryVRRdGeneric<string mnemonic, bits<16> opcode>
4507 : InstVRRd<opcode, (outs VR128:$V1),
4508 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
4509 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4511 // Declare a pair of instructions, one which sets CC and one which doesn't.
4512 // The CC-setting form ends with "S" and sets the low bit of M6.
4513 // Also create aliases to make use of M6 operand optional in assembler.
4514 multiclass QuaternaryOptVRRdSPair<string mnemonic, bits<16> opcode,
4515 SDPatternOperator operator,
4516 SDPatternOperator operator_cc,
4517 TypedReg tr1, TypedReg tr2, bits<4> type,
4518 bits<4> modifier = 0> {
4519 def "" : QuaternaryVRRd<mnemonic, opcode, operator,
4520 tr1, tr2, tr2, tr2, type,
4521 imm32zx4even, !and (modifier, 14)>;
4522 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4",
4523 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4524 tr2.op:$V3, tr2.op:$V4, 0)>;
4526 def S : QuaternaryVRRd<mnemonic##"s", opcode, operator_cc,
4527 tr1, tr2, tr2, tr2, type,
4528 imm32zx4even, !add (!and (modifier, 14), 1)>;
4529 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3, $V4",
4530 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
4531 tr2.op:$V3, tr2.op:$V4, 0)>;
4534 multiclass QuaternaryOptVRRdSPairGeneric<string mnemonic, bits<16> opcode> {
4536 def "" : QuaternaryVRRdGeneric<mnemonic, opcode>;
4537 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5",
4538 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4539 VR128:$V4, imm32zx4:$M5, 0)>;
4542 class SideEffectQuaternaryRRFa<string mnemonic, bits<16> opcode,
4543 RegisterOperand cls1, RegisterOperand cls2,
4544 RegisterOperand cls3>
4545 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4),
4546 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
4548 multiclass SideEffectQuaternaryRRFaOptOpt<string mnemonic, bits<16> opcode,
4549 RegisterOperand cls1,
4550 RegisterOperand cls2,
4551 RegisterOperand cls3> {
4552 def "" : SideEffectQuaternaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
4553 def Opt : SideEffectTernaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
4554 def OptOpt : SideEffectBinaryRRFa<mnemonic, opcode, cls1, cls2>;
4557 class SideEffectQuaternaryRRFb<string mnemonic, bits<16> opcode,
4558 RegisterOperand cls1, RegisterOperand cls2,
4559 RegisterOperand cls3>
4560 : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4),
4561 mnemonic#"\t$R1, $R3, $R2, $M4", []>;
4563 multiclass SideEffectQuaternaryRRFbOpt<string mnemonic, bits<16> opcode,
4564 RegisterOperand cls1,
4565 RegisterOperand cls2,
4566 RegisterOperand cls3> {
4567 def "" : SideEffectQuaternaryRRFb<mnemonic, opcode, cls1, cls2, cls3>;
4568 def Opt : SideEffectTernaryRRFb<mnemonic, opcode, cls1, cls2, cls3>;
4571 class SideEffectQuaternarySSe<string mnemonic, bits<8> opcode,
4572 RegisterOperand cls>
4573 : InstSSe<opcode, (outs),
4574 (ins cls:$R1, bdaddr12only:$BD2, cls:$R3, bdaddr12only:$BD4),
4575 mnemonic#"\t$R1, $BD2, $R3, $BD4", []>;
4577 class LoadAndOpRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4578 RegisterOperand cls, AddressingMode mode = bdaddr20only>
4579 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, mode:$BD2),
4580 mnemonic#"\t$R1, $R3, $BD2",
4581 [(set cls:$R1, (operator mode:$BD2, cls:$R3))]> {
4586 class CmpSwapRRE<string mnemonic, bits<16> opcode,
4587 RegisterOperand cls1, RegisterOperand cls2>
4588 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
4589 mnemonic#"\t$R1, $R2", []> {
4590 let Constraints = "$R1 = $R1src";
4591 let DisableEncoding = "$R1src";
4596 class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4597 RegisterOperand cls, AddressingMode mode = bdaddr12only>
4598 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
4599 mnemonic#"\t$R1, $R3, $BD2",
4600 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
4601 let Constraints = "$R1 = $R1src";
4602 let DisableEncoding = "$R1src";
4607 class CmpSwapRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4608 RegisterOperand cls, AddressingMode mode = bdaddr20only>
4609 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
4610 mnemonic#"\t$R1, $R3, $BD2",
4611 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
4612 let Constraints = "$R1 = $R1src";
4613 let DisableEncoding = "$R1src";
4618 multiclass CmpSwapRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4619 SDPatternOperator operator, RegisterOperand cls> {
4620 let DispKey = mnemonic ## #cls in {
4621 let DispSize = "12" in
4622 def "" : CmpSwapRS<mnemonic, rsOpcode, operator, cls, bdaddr12pair>;
4623 let DispSize = "20" in
4624 def Y : CmpSwapRSY<mnemonic#"y", rsyOpcode, operator, cls, bdaddr20pair>;
4628 class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1,
4629 RegisterOperand cls2>
4630 : InstRIEf<opcode, (outs cls1:$R1),
4631 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
4633 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> {
4634 let Constraints = "$R1 = $R1src";
4635 let DisableEncoding = "$R1src";
4638 class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator>
4639 : InstRXYb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr20only:$XBD2),
4640 mnemonic##"\t$M1, $XBD2",
4641 [(operator imm32zx4:$M1, bdxaddr20only:$XBD2)]>;
4643 class PrefetchRILPC<string mnemonic, bits<12> opcode,
4644 SDPatternOperator operator>
4645 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, pcrel32:$RI2),
4646 mnemonic##"\t$M1, $RI2",
4647 [(operator imm32zx4:$M1, pcrel32:$RI2)]> {
4648 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
4649 // However, BDXs have two extra operands and are therefore 6 units more
4651 let AddedComplexity = 7;
4654 class BranchPreloadSMI<string mnemonic, bits<8> opcode>
4655 : InstSMI<opcode, (outs),
4656 (ins imm32zx4:$M1, brtarget16bpp:$RI2, bdxaddr12only:$BD3),
4657 mnemonic#"\t$M1, $RI2, $BD3", []>;
4659 class BranchPreloadMII<string mnemonic, bits<8> opcode>
4660 : InstMII<opcode, (outs),
4661 (ins imm32zx4:$M1, brtarget12bpp:$RI2, brtarget24bpp:$RI3),
4662 mnemonic#"\t$M1, $RI2, $RI3", []>;
4664 // A floating-point load-and test operation. Create both a normal unary
4665 // operation and one that acts as a comparison against zero.
4666 // Note that the comparison against zero operation is not available if we
4667 // have vector support, since load-and-test instructions will partially
4668 // clobber the target (vector) register.
4669 multiclass LoadAndTestRRE<string mnemonic, bits<16> opcode,
4670 RegisterOperand cls> {
4671 def "" : UnaryRRE<mnemonic, opcode, null_frag, cls, cls>;
4672 let isCodeGenOnly = 1, Predicates = [FeatureNoVector] in
4673 def Compare : CompareRRE<mnemonic, opcode, null_frag, cls, cls>;
4676 //===----------------------------------------------------------------------===//
4677 // Pseudo instructions
4678 //===----------------------------------------------------------------------===//
4680 // Convenience instructions that get lowered to real instructions
4681 // by either SystemZTargetLowering::EmitInstrWithCustomInserter()
4682 // or SystemZInstrInfo::expandPostRAPseudo().
4684 //===----------------------------------------------------------------------===//
4686 class Pseudo<dag outs, dag ins, list<dag> pattern>
4687 : InstSystemZ<0, outs, ins, "", pattern> {
4689 let isCodeGenOnly = 1;
4692 // Like UnaryRI, but expanded after RA depending on the choice of register.
4693 class UnaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4695 : Pseudo<(outs cls:$R1), (ins imm:$I2),
4696 [(set cls:$R1, (operator imm:$I2))]>;
4698 // Like UnaryRXY, but expanded after RA depending on the choice of register.
4699 class UnaryRXYPseudo<string key, SDPatternOperator operator,
4700 RegisterOperand cls, bits<5> bytes,
4701 AddressingMode mode = bdxaddr20only>
4702 : Pseudo<(outs cls:$R1), (ins mode:$XBD2),
4703 [(set cls:$R1, (operator mode:$XBD2))]> {
4704 let OpKey = key#"r"#cls;
4707 let Has20BitOffset = 1;
4709 let AccessBytes = bytes;
4712 // Like UnaryRR, but expanded after RA depending on the choice of registers.
4713 class UnaryRRPseudo<string key, SDPatternOperator operator,
4714 RegisterOperand cls1, RegisterOperand cls2>
4715 : Pseudo<(outs cls1:$R1), (ins cls2:$R2),
4716 [(set cls1:$R1, (operator cls2:$R2))]> {
4717 let OpKey = key#cls1;
4721 // Like BinaryRI, but expanded after RA depending on the choice of register.
4722 class BinaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4724 : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2),
4725 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
4726 let Constraints = "$R1 = $R1src";
4729 // Like BinaryRIE, but expanded after RA depending on the choice of register.
4730 class BinaryRIEPseudo<SDPatternOperator operator, RegisterOperand cls,
4732 : Pseudo<(outs cls:$R1), (ins cls:$R3, imm:$I2),
4733 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
4735 // Like BinaryRIAndK, but expanded after RA depending on the choice of register.
4736 multiclass BinaryRIAndKPseudo<string key, SDPatternOperator operator,
4737 RegisterOperand cls, Immediate imm> {
4738 let NumOpsKey = key in {
4739 let NumOpsValue = "3" in
4740 def K : BinaryRIEPseudo<operator, cls, imm>,
4741 Requires<[FeatureHighWord, FeatureDistinctOps]>;
4742 let NumOpsValue = "2" in
4743 def "" : BinaryRIPseudo<operator, cls, imm>,
4744 Requires<[FeatureHighWord]>;
4748 // A pseudo that is used during register allocation when folding a memory
4749 // operand. The 3-address register instruction with a spilled source cannot
4750 // be converted directly to a target 2-address reg/mem instruction.
4751 // Mapping: <INSN>R -> MemFoldPseudo -> <INSN>
4752 class MemFoldPseudo<string mnemonic, RegisterOperand cls, bits<5> bytes,
4753 AddressingMode mode>
4754 : Pseudo<(outs cls:$R1), (ins cls:$R2, mode:$XBD2), []> {
4755 let OpKey = mnemonic#"rk"#cls;
4757 let MemKey = mnemonic#cls;
4758 let MemType = "pseudo";
4760 let AccessBytes = bytes;
4762 let hasNoSchedulingInfo = 1;
4765 // Like CompareRI, but expanded after RA depending on the choice of register.
4766 class CompareRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4768 : Pseudo<(outs), (ins cls:$R1, imm:$I2),
4769 [(set CC, (operator cls:$R1, imm:$I2))]> {
4773 // Like CompareRXY, but expanded after RA depending on the choice of register.
4774 class CompareRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
4775 SDPatternOperator load, bits<5> bytes,
4776 AddressingMode mode = bdxaddr20only>
4777 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2),
4778 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
4780 let Has20BitOffset = 1;
4782 let AccessBytes = bytes;
4785 // Like TestBinarySIL, but expanded later.
4786 class TestBinarySILPseudo<SDPatternOperator operator, Immediate imm>
4787 : Pseudo<(outs), (ins bdaddr12only:$BD1, imm:$I2),
4788 [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>;
4790 // Like CondBinaryRRF, but expanded after RA depending on the choice of
4792 class CondBinaryRRFPseudo<RegisterOperand cls1, RegisterOperand cls2>
4793 : Pseudo<(outs cls1:$R1),
4794 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
4795 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src,
4796 cond4:$valid, cond4:$M3))]> {
4797 let Constraints = "$R1 = $R1src";
4798 let DisableEncoding = "$R1src";
4802 // Like CondBinaryRRFa, but expanded after RA depending on the choice of
4804 class CondBinaryRRFaPseudo<RegisterOperand cls1, RegisterOperand cls2,
4805 RegisterOperand cls3>
4806 : Pseudo<(outs cls1:$R1),
4807 (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4),
4808 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3,
4809 cond4:$valid, cond4:$M4))]> {
4813 // Like CondBinaryRIE, but expanded after RA depending on the choice of
4815 class CondBinaryRIEPseudo<RegisterOperand cls, Immediate imm>
4816 : Pseudo<(outs cls:$R1),
4817 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
4818 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
4819 cond4:$valid, cond4:$M3))]> {
4820 let Constraints = "$R1 = $R1src";
4821 let DisableEncoding = "$R1src";
4825 // Like CondUnaryRSY, but expanded after RA depending on the choice of
4827 class CondUnaryRSYPseudo<SDPatternOperator operator, RegisterOperand cls,
4828 bits<5> bytes, AddressingMode mode = bdaddr20only>
4829 : Pseudo<(outs cls:$R1),
4830 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$R3),
4832 (z_select_ccmask (operator mode:$BD2), cls:$R1src,
4833 cond4:$valid, cond4:$R3))]> {
4834 let Constraints = "$R1 = $R1src";
4835 let DisableEncoding = "$R1src";
4837 let AccessBytes = bytes;
4841 // Like CondStoreRSY, but expanded after RA depending on the choice of
4843 class CondStoreRSYPseudo<RegisterOperand cls, bits<5> bytes,
4844 AddressingMode mode = bdaddr20only>
4845 : Pseudo<(outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$R3), []> {
4847 let AccessBytes = bytes;
4851 // Like StoreRXY, but expanded after RA depending on the choice of register.
4852 class StoreRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
4853 bits<5> bytes, AddressingMode mode = bdxaddr20only>
4854 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2),
4855 [(operator cls:$R1, mode:$XBD2)]> {
4857 let Has20BitOffset = 1;
4859 let AccessBytes = bytes;
4862 // Like RotateSelectRIEf, but expanded after RA depending on the choice
4864 class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2>
4865 : Pseudo<(outs cls1:$R1),
4866 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
4869 let Constraints = "$R1 = $R1src";
4870 let DisableEncoding = "$R1src";
4873 // Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is
4874 // the value of the PSW's 2-bit condition code field.
4875 class SelectWrapper<ValueType vt, RegisterOperand cls>
4876 : Pseudo<(outs cls:$dst),
4877 (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc),
4878 [(set (vt cls:$dst), (z_select_ccmask cls:$src1, cls:$src2,
4879 imm32zx4:$valid, imm32zx4:$cc))]> {
4880 let usesCustomInserter = 1;
4881 let hasNoSchedulingInfo = 1;
4885 // Stores $new to $addr if $cc is true ("" case) or false (Inv case).
4886 multiclass CondStores<RegisterOperand cls, SDPatternOperator store,
4887 SDPatternOperator load, AddressingMode mode> {
4888 let Uses = [CC], usesCustomInserter = 1, hasNoSchedulingInfo = 1,
4889 mayLoad = 1, mayStore = 1 in {
4890 def "" : Pseudo<(outs),
4891 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
4892 [(store (z_select_ccmask cls:$new, (load mode:$addr),
4893 imm32zx4:$valid, imm32zx4:$cc),
4895 def Inv : Pseudo<(outs),
4896 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
4897 [(store (z_select_ccmask (load mode:$addr), cls:$new,
4898 imm32zx4:$valid, imm32zx4:$cc),
4903 // OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation. PAT and OPERAND
4904 // describe the second (non-memory) operand.
4905 class AtomicLoadBinary<SDPatternOperator operator, RegisterOperand cls,
4906 dag pat, DAGOperand operand>
4907 : Pseudo<(outs cls:$dst), (ins bdaddr20only:$ptr, operand:$src2),
4908 [(set cls:$dst, (operator bdaddr20only:$ptr, pat))]> {
4910 let Has20BitOffset = 1;
4913 let usesCustomInserter = 1;
4914 let hasNoSchedulingInfo = 1;
4917 // Specializations of AtomicLoadWBinary.
4918 class AtomicLoadBinaryReg32<SDPatternOperator operator>
4919 : AtomicLoadBinary<operator, GR32, (i32 GR32:$src2), GR32>;
4920 class AtomicLoadBinaryImm32<SDPatternOperator operator, Immediate imm>
4921 : AtomicLoadBinary<operator, GR32, (i32 imm:$src2), imm>;
4922 class AtomicLoadBinaryReg64<SDPatternOperator operator>
4923 : AtomicLoadBinary<operator, GR64, (i64 GR64:$src2), GR64>;
4924 class AtomicLoadBinaryImm64<SDPatternOperator operator, Immediate imm>
4925 : AtomicLoadBinary<operator, GR64, (i64 imm:$src2), imm>;
4927 // OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation. PAT and OPERAND
4928 // describe the second (non-memory) operand.
4929 class AtomicLoadWBinary<SDPatternOperator operator, dag pat,
4931 : Pseudo<(outs GR32:$dst),
4932 (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift,
4933 ADDR32:$negbitshift, uimm32:$bitsize),
4934 [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift,
4935 ADDR32:$negbitshift, uimm32:$bitsize))]> {
4937 let Has20BitOffset = 1;
4940 let usesCustomInserter = 1;
4941 let hasNoSchedulingInfo = 1;
4944 // Specializations of AtomicLoadWBinary.
4945 class AtomicLoadWBinaryReg<SDPatternOperator operator>
4946 : AtomicLoadWBinary<operator, (i32 GR32:$src2), GR32>;
4947 class AtomicLoadWBinaryImm<SDPatternOperator operator, Immediate imm>
4948 : AtomicLoadWBinary<operator, (i32 imm:$src2), imm>;
4950 // A pseudo instruction that is a direct alias of a real instruction.
4951 // These aliases are used in cases where a particular register operand is
4952 // fixed or where the same instruction is used with different register sizes.
4953 // The size parameter is the size in bytes of the associated real instruction.
4954 class Alias<int size, dag outs, dag ins, list<dag> pattern>
4955 : InstSystemZ<size, outs, ins, "", pattern> {
4957 let isCodeGenOnly = 1;
4960 class UnaryAliasVRS<RegisterOperand cls1, RegisterOperand cls2>
4961 : Alias<6, (outs cls1:$src1), (ins cls2:$src2), []>;
4963 // An alias of a UnaryVRR*, but with different register sizes.
4964 class UnaryAliasVRR<SDPatternOperator operator, TypedReg tr1, TypedReg tr2>
4965 : Alias<6, (outs tr1.op:$V1), (ins tr2.op:$V2),
4966 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]>;
4968 // An alias of a UnaryVRX, but with different register sizes.
4969 class UnaryAliasVRX<SDPatternOperator operator, TypedReg tr,
4970 AddressingMode mode = bdxaddr12only>
4971 : Alias<6, (outs tr.op:$V1), (ins mode:$XBD2),
4972 [(set (tr.vt tr.op:$V1), (operator mode:$XBD2))]>;
4974 // An alias of a StoreVRX, but with different register sizes.
4975 class StoreAliasVRX<SDPatternOperator operator, TypedReg tr,
4976 AddressingMode mode = bdxaddr12only>
4977 : Alias<6, (outs), (ins tr.op:$V1, mode:$XBD2),
4978 [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>;
4980 // An alias of a BinaryRI, but with different register sizes.
4981 class BinaryAliasRI<SDPatternOperator operator, RegisterOperand cls,
4983 : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
4984 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
4985 let Constraints = "$R1 = $R1src";
4988 // An alias of a BinaryRIL, but with different register sizes.
4989 class BinaryAliasRIL<SDPatternOperator operator, RegisterOperand cls,
4991 : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
4992 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
4993 let Constraints = "$R1 = $R1src";
4996 // An alias of a BinaryVRRf, but with different register sizes.
4997 class BinaryAliasVRRf<RegisterOperand cls>
4998 : Alias<6, (outs VR128:$V1), (ins cls:$R2, cls:$R3), []>;
5000 // An alias of a CompareRI, but with different register sizes.
5001 class CompareAliasRI<SDPatternOperator operator, RegisterOperand cls,
5003 : Alias<4, (outs), (ins cls:$R1, imm:$I2),
5004 [(set CC, (operator cls:$R1, imm:$I2))]> {
5008 // An alias of a RotateSelectRIEf, but with different register sizes.
5009 class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2>
5010 : Alias<6, (outs cls1:$R1),
5011 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
5012 imm32zx6:$I5), []> {
5013 let Constraints = "$R1 = $R1src";
5016 //===----------------------------------------------------------------------===//
5017 // Multiclasses that emit both real and pseudo instructions
5018 //===----------------------------------------------------------------------===//
5020 multiclass BinaryRXYAndPseudo<string mnemonic, bits<16> opcode,
5021 SDPatternOperator operator, RegisterOperand cls,
5022 SDPatternOperator load, bits<5> bytes,
5023 AddressingMode mode = bdxaddr20only> {
5025 def "" : BinaryRXY<mnemonic, opcode, operator, cls, load, bytes, mode> {
5026 let MemKey = mnemonic#cls;
5027 let MemType = "target";
5029 let Has20BitOffset = 1 in
5030 def _MemFoldPseudo : MemFoldPseudo<mnemonic, cls, bytes, mode>;
5033 multiclass BinaryRXPairAndPseudo<string mnemonic, bits<8> rxOpcode,
5034 bits<16> rxyOpcode, SDPatternOperator operator,
5035 RegisterOperand cls,
5036 SDPatternOperator load, bits<5> bytes> {
5037 let DispKey = mnemonic ## #cls in {
5038 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes,
5040 let DispSize = "12";
5041 let MemKey = mnemonic#cls;
5042 let MemType = "target";
5044 let DispSize = "20" in
5045 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load,
5046 bytes, bdxaddr20pair>;
5048 def _MemFoldPseudo : MemFoldPseudo<mnemonic, cls, bytes, bdxaddr12pair>;
5051 // Define an instruction that operates on two fixed-length blocks of memory,
5052 // and associated pseudo instructions for operating on blocks of any size.
5053 // The Sequence form uses a straight-line sequence of instructions and
5054 // the Loop form uses a loop of length-256 instructions followed by
5055 // another instruction to handle the excess.
5056 multiclass MemorySS<string mnemonic, bits<8> opcode,
5057 SDPatternOperator sequence, SDPatternOperator loop> {
5058 def "" : SideEffectBinarySSa<mnemonic, opcode>;
5059 let usesCustomInserter = 1, hasNoSchedulingInfo = 1, Defs = [CC] in {
5060 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5062 [(sequence bdaddr12only:$dest, bdaddr12only:$src,
5064 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5065 imm64:$length, GR64:$count256),
5066 [(loop bdaddr12only:$dest, bdaddr12only:$src,
5067 imm64:$length, GR64:$count256)]>;
5071 // The same, but setting a CC result as comparion operator.
5072 multiclass CompareMemorySS<string mnemonic, bits<8> opcode,
5073 SDPatternOperator sequence, SDPatternOperator loop> {
5074 def "" : SideEffectBinarySSa<mnemonic, opcode>;
5075 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in {
5076 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5078 [(set CC, (sequence bdaddr12only:$dest, bdaddr12only:$src,
5080 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5081 imm64:$length, GR64:$count256),
5082 [(set CC, (loop bdaddr12only:$dest, bdaddr12only:$src,
5083 imm64:$length, GR64:$count256))]>;
5087 // Define an instruction that operates on two strings, both terminated
5088 // by the character in R0. The instruction processes a CPU-determinated
5089 // number of bytes at a time and sets CC to 3 if the instruction needs
5090 // to be repeated. Also define a pseudo instruction that represents
5091 // the full loop (the main instruction plus the branch on CC==3).
5092 multiclass StringRRE<string mnemonic, bits<16> opcode,
5093 SDPatternOperator operator> {
5095 def "" : SideEffectBinaryMemMemRRE<mnemonic, opcode, GR64, GR64>;
5096 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in
5097 def Loop : Pseudo<(outs GR64:$end),
5098 (ins GR64:$start1, GR64:$start2, GR32:$char),
5099 [(set GR64:$end, (operator GR64:$start1, GR64:$start2,