1 //==- SystemZInstrFormats.td - SystemZ Instruction Formats --*- tablegen -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
11 // Basic SystemZ instruction definition
12 //===----------------------------------------------------------------------===//
14 class InstSystemZ<int size, dag outs, dag ins, string asmstr,
15 list<dag> pattern> : Instruction {
16 let Namespace = "SystemZ";
18 dag OutOperandList = outs;
19 dag InOperandList = ins;
21 let Pattern = pattern;
22 let AsmString = asmstr;
24 // Some instructions come in pairs, one having a 12-bit displacement
25 // and the other having a 20-bit displacement. Both instructions in
26 // the pair have the same DispKey and their DispSizes are "12" and "20"
29 string DispSize = "none";
31 // Many register-based <INSN>R instructions have a memory-based <INSN>
32 // counterpart. OpKey uniquely identifies <INSN>R, while OpType is
33 // "reg" for <INSN>R and "mem" for <INSN>.
35 string OpType = "none";
37 // Many distinct-operands instructions have older 2-operand equivalents.
38 // NumOpsKey uniquely identifies one of these 2-operand and 3-operand pairs,
39 // with NumOpsValue being "2" or "3" as appropriate.
40 string NumOpsKey = "";
41 string NumOpsValue = "none";
43 // True if this instruction is a simple D(X,B) load of a register
44 // (with no sign or zero extension).
45 bit SimpleBDXLoad = 0;
47 // True if this instruction is a simple D(X,B) store of a register
48 // (with no truncation).
49 bit SimpleBDXStore = 0;
51 // True if this instruction has a 20-bit displacement field.
52 bit Has20BitOffset = 0;
54 // True if addresses in this instruction have an index register.
57 // True if this is a 128-bit pseudo instruction that combines two 64-bit
61 // The access size of all memory operands in bytes, or 0 if not known.
62 bits<5> AccessBytes = 0;
64 // If the instruction sets CC to a useful value, this gives the mask
65 // of all possible CC results. The mask has the same form as
69 // The subset of CCValues that have the same meaning as they would after
70 // a comparison of the first operand against zero.
71 bits<4> CompareZeroCCMask = 0;
73 // True if the instruction is conditional and if the CC mask operand
74 // comes first (as for BRC, etc.).
77 // Similar, but true if the CC mask operand comes last (as for LOC, etc.).
80 // True if the instruction is the "logical" rather than "arithmetic" form,
81 // in cases where a distinction exists.
84 let TSFlags{0} = SimpleBDXLoad;
85 let TSFlags{1} = SimpleBDXStore;
86 let TSFlags{2} = Has20BitOffset;
87 let TSFlags{3} = HasIndex;
88 let TSFlags{4} = Is128Bit;
89 let TSFlags{9-5} = AccessBytes;
90 let TSFlags{13-10} = CCValues;
91 let TSFlags{17-14} = CompareZeroCCMask;
92 let TSFlags{18} = CCMaskFirst;
93 let TSFlags{19} = CCMaskLast;
94 let TSFlags{20} = IsLogical;
97 //===----------------------------------------------------------------------===//
98 // Mappings between instructions
99 //===----------------------------------------------------------------------===//
101 // Return the version of an instruction that has an unsigned 12-bit
103 def getDisp12Opcode : InstrMapping {
104 let FilterClass = "InstSystemZ";
105 let RowFields = ["DispKey"];
106 let ColFields = ["DispSize"];
108 let ValueCols = [["12"]];
111 // Return the version of an instruction that has a signed 20-bit displacement.
112 def getDisp20Opcode : InstrMapping {
113 let FilterClass = "InstSystemZ";
114 let RowFields = ["DispKey"];
115 let ColFields = ["DispSize"];
117 let ValueCols = [["20"]];
120 // Return the memory form of a register instruction.
121 def getMemOpcode : InstrMapping {
122 let FilterClass = "InstSystemZ";
123 let RowFields = ["OpKey"];
124 let ColFields = ["OpType"];
125 let KeyCol = ["reg"];
126 let ValueCols = [["mem"]];
129 // Return the 3-operand form of a 2-operand instruction.
130 def getThreeOperandOpcode : InstrMapping {
131 let FilterClass = "InstSystemZ";
132 let RowFields = ["NumOpsKey"];
133 let ColFields = ["NumOpsValue"];
135 let ValueCols = [["3"]];
138 //===----------------------------------------------------------------------===//
139 // Instruction formats
140 //===----------------------------------------------------------------------===//
142 // Formats are specified using operand field declarations of the form:
144 // bits<4> Rn : register input or output for operand n
145 // bits<5> Vn : vector register input or output for operand n
146 // bits<m> In : immediate value of width m for operand n
147 // bits<4> BDn : address operand n, which has a base and a displacement
148 // bits<m> XBDn : address operand n, which has an index, a base and a
150 // bits<m> VBDn : address operand n, which has a vector index, a base and a
152 // bits<4> Xn : index register for address operand n
153 // bits<4> Mn : mode value for operand n
155 // The operand numbers ("n" in the list above) follow the architecture manual.
156 // Assembly operands sometimes have a different order; in particular, R3 often
157 // is often written between operands 1 and 2.
159 //===----------------------------------------------------------------------===//
161 class InstE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
162 : InstSystemZ<2, outs, ins, asmstr, pattern> {
164 field bits<16> SoftFail = 0;
169 class InstI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
170 : InstSystemZ<2, outs, ins, asmstr, pattern> {
172 field bits<16> SoftFail = 0;
180 class InstIE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
181 : InstSystemZ<4, outs, ins, asmstr, pattern> {
183 field bits<32> SoftFail = 0;
188 let Inst{31-16} = op;
194 class InstMII<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
195 : InstSystemZ<6, outs, ins, asmstr, pattern> {
197 field bits<48> SoftFail = 0;
203 let Inst{47-40} = op;
204 let Inst{39-36} = M1;
205 let Inst{35-24} = RI2;
206 let Inst{23-0} = RI3;
209 class InstRIa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
210 : InstSystemZ<4, outs, ins, asmstr, pattern> {
212 field bits<32> SoftFail = 0;
217 let Inst{31-24} = op{11-4};
218 let Inst{23-20} = R1;
219 let Inst{19-16} = op{3-0};
223 class InstRIb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
224 : InstSystemZ<4, outs, ins, asmstr, pattern> {
226 field bits<32> SoftFail = 0;
231 let Inst{31-24} = op{11-4};
232 let Inst{23-20} = R1;
233 let Inst{19-16} = op{3-0};
234 let Inst{15-0} = RI2;
237 class InstRIc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
238 : InstSystemZ<4, outs, ins, asmstr, pattern> {
240 field bits<32> SoftFail = 0;
245 let Inst{31-24} = op{11-4};
246 let Inst{23-20} = M1;
247 let Inst{19-16} = op{3-0};
248 let Inst{15-0} = RI2;
251 class InstRIEa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
252 : InstSystemZ<6, outs, ins, asmstr, pattern> {
254 field bits<48> SoftFail = 0;
260 let Inst{47-40} = op{15-8};
261 let Inst{39-36} = R1;
263 let Inst{31-16} = I2;
264 let Inst{15-12} = M3;
266 let Inst{7-0} = op{7-0};
269 class InstRIEb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
270 : InstSystemZ<6, outs, ins, asmstr, pattern> {
272 field bits<48> SoftFail = 0;
279 let Inst{47-40} = op{15-8};
280 let Inst{39-36} = R1;
281 let Inst{35-32} = R2;
282 let Inst{31-16} = RI4;
283 let Inst{15-12} = M3;
285 let Inst{7-0} = op{7-0};
288 class InstRIEc<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} = M3;
301 let Inst{31-16} = RI4;
303 let Inst{7-0} = op{7-0};
306 class InstRIEd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
307 : InstSystemZ<6, outs, ins, asmstr, pattern> {
309 field bits<48> SoftFail = 0;
315 let Inst{47-40} = op{15-8};
316 let Inst{39-36} = R1;
317 let Inst{35-32} = R3;
318 let Inst{31-16} = I2;
320 let Inst{7-0} = op{7-0};
323 class InstRIEe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
324 : InstSystemZ<6, outs, ins, asmstr, pattern> {
326 field bits<48> SoftFail = 0;
332 let Inst{47-40} = op{15-8};
333 let Inst{39-36} = R1;
334 let Inst{35-32} = R3;
335 let Inst{31-16} = RI2;
337 let Inst{7-0} = op{7-0};
340 class InstRIEf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
341 : InstSystemZ<6, outs, ins, asmstr, pattern> {
343 field bits<48> SoftFail = 0;
351 let Inst{47-40} = op{15-8};
352 let Inst{39-36} = R1;
353 let Inst{35-32} = R2;
354 let Inst{31-24} = I3;
355 let Inst{23-16} = I4;
357 let Inst{7-0} = op{7-0};
360 class InstRIEg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
361 : InstSystemZ<6, outs, ins, asmstr, pattern> {
363 field bits<48> SoftFail = 0;
369 let Inst{47-40} = op{15-8};
370 let Inst{39-36} = R1;
371 let Inst{35-32} = M3;
372 let Inst{31-16} = I2;
374 let Inst{7-0} = op{7-0};
377 class InstRILa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
378 : InstSystemZ<6, outs, ins, asmstr, pattern> {
380 field bits<48> SoftFail = 0;
385 let Inst{47-40} = op{11-4};
386 let Inst{39-36} = R1;
387 let Inst{35-32} = op{3-0};
391 class InstRILb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
392 : InstSystemZ<6, outs, ins, asmstr, pattern> {
394 field bits<48> SoftFail = 0;
399 let Inst{47-40} = op{11-4};
400 let Inst{39-36} = R1;
401 let Inst{35-32} = op{3-0};
402 let Inst{31-0} = RI2;
405 class InstRILc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
406 : InstSystemZ<6, outs, ins, asmstr, pattern> {
408 field bits<48> SoftFail = 0;
413 let Inst{47-40} = op{11-4};
414 let Inst{39-36} = M1;
415 let Inst{35-32} = op{3-0};
416 let Inst{31-0} = RI2;
419 class InstRIS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
420 : InstSystemZ<6, outs, ins, asmstr, pattern> {
422 field bits<48> SoftFail = 0;
429 let Inst{47-40} = op{15-8};
430 let Inst{39-36} = R1;
431 let Inst{35-32} = M3;
432 let Inst{31-16} = BD4;
434 let Inst{7-0} = op{7-0};
437 class InstRR<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
438 : InstSystemZ<2, outs, ins, asmstr, pattern> {
440 field bits<16> SoftFail = 0;
450 class InstRRD<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
451 : InstSystemZ<4, outs, ins, asmstr, pattern> {
453 field bits<32> SoftFail = 0;
459 let Inst{31-16} = op;
460 let Inst{15-12} = R1;
466 class InstRRE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
467 : InstSystemZ<4, outs, ins, asmstr, pattern> {
469 field bits<32> SoftFail = 0;
474 let Inst{31-16} = op;
480 class InstRRFa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
481 : InstSystemZ<4, outs, ins, asmstr, pattern> {
483 field bits<32> SoftFail = 0;
490 let Inst{31-16} = op;
491 let Inst{15-12} = R3;
497 class InstRRFb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
498 : InstSystemZ<4, outs, ins, asmstr, pattern> {
500 field bits<32> SoftFail = 0;
507 let Inst{31-16} = op;
508 let Inst{15-12} = R3;
514 class InstRRFc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
515 : InstSystemZ<4, outs, ins, asmstr, pattern> {
517 field bits<32> SoftFail = 0;
523 let Inst{31-16} = op;
524 let Inst{15-12} = M3;
530 class InstRRFd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
531 : InstSystemZ<4, outs, ins, asmstr, pattern> {
533 field bits<32> SoftFail = 0;
539 let Inst{31-16} = op;
546 class InstRRFe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
547 : InstSystemZ<4, outs, ins, asmstr, pattern> {
549 field bits<32> SoftFail = 0;
556 let Inst{31-16} = op;
557 let Inst{15-12} = M3;
563 class InstRRS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
564 : InstSystemZ<6, outs, ins, asmstr, pattern> {
566 field bits<48> SoftFail = 0;
573 let Inst{47-40} = op{15-8};
574 let Inst{39-36} = R1;
575 let Inst{35-32} = R2;
576 let Inst{31-16} = BD4;
577 let Inst{15-12} = M3;
579 let Inst{7-0} = op{7-0};
582 class InstRXa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
583 : InstSystemZ<4, outs, ins, asmstr, pattern> {
585 field bits<32> SoftFail = 0;
590 let Inst{31-24} = op;
591 let Inst{23-20} = R1;
592 let Inst{19-0} = XBD2;
597 class InstRXb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
598 : InstSystemZ<4, outs, ins, asmstr, pattern> {
600 field bits<32> SoftFail = 0;
605 let Inst{31-24} = op;
606 let Inst{23-20} = M1;
607 let Inst{19-0} = XBD2;
612 class InstRXE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
613 : InstSystemZ<6, outs, ins, asmstr, pattern> {
615 field bits<48> SoftFail = 0;
621 let Inst{47-40} = op{15-8};
622 let Inst{39-36} = R1;
623 let Inst{35-16} = XBD2;
624 let Inst{15-12} = M3;
626 let Inst{7-0} = op{7-0};
631 class InstRXF<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} = R3;
642 let Inst{35-16} = XBD2;
643 let Inst{15-12} = R1;
645 let Inst{7-0} = op{7-0};
650 class InstRXYa<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;
658 let Inst{47-40} = op{15-8};
659 let Inst{39-36} = R1;
660 let Inst{35-8} = XBD2;
661 let Inst{7-0} = op{7-0};
663 let Has20BitOffset = 1;
667 class InstRXYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
668 : InstSystemZ<6, outs, ins, asmstr, pattern> {
670 field bits<48> SoftFail = 0;
675 let Inst{47-40} = op{15-8};
676 let Inst{39-36} = M1;
677 let Inst{35-8} = XBD2;
678 let Inst{7-0} = op{7-0};
680 let Has20BitOffset = 1;
684 class InstRSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
685 : InstSystemZ<4, outs, ins, asmstr, pattern> {
687 field bits<32> SoftFail = 0;
693 let Inst{31-24} = op;
694 let Inst{23-20} = R1;
695 let Inst{19-16} = R3;
696 let Inst{15-0} = BD2;
699 class InstRSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
700 : InstSystemZ<4, outs, ins, asmstr, pattern> {
702 field bits<32> SoftFail = 0;
708 let Inst{31-24} = op;
709 let Inst{23-20} = R1;
710 let Inst{19-16} = M3;
711 let Inst{15-0} = BD2;
714 class InstRSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
715 : InstSystemZ<4, outs, ins, asmstr, pattern> {
717 field bits<32> SoftFail = 0;
723 let Inst{31-24} = op;
724 let Inst{23-20} = R1;
725 let Inst{19-16} = R3;
726 let Inst{15-0} = RI2;
729 class InstRSLa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
730 : InstSystemZ<6, outs, ins, asmstr, pattern> {
732 field bits<48> SoftFail = 0;
736 let Inst{47-40} = op{15-8};
737 let Inst{39-36} = BDL1{19-16};
739 let Inst{31-16} = BDL1{15-0};
741 let Inst{7-0} = op{7-0};
744 class InstRSLb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
745 : InstSystemZ<6, outs, ins, asmstr, pattern> {
747 field bits<48> SoftFail = 0;
753 let Inst{47-40} = op{15-8};
754 let Inst{39-16} = BDL2;
755 let Inst{15-12} = R1;
757 let Inst{7-0} = op{7-0};
760 class InstRSYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
761 : InstSystemZ<6, outs, ins, asmstr, pattern> {
763 field bits<48> SoftFail = 0;
769 let Inst{47-40} = op{15-8};
770 let Inst{39-36} = R1;
771 let Inst{35-32} = R3;
772 let Inst{31-8} = BD2;
773 let Inst{7-0} = op{7-0};
775 let Has20BitOffset = 1;
778 class InstRSYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
779 : InstSystemZ<6, outs, ins, asmstr, pattern> {
781 field bits<48> SoftFail = 0;
787 let Inst{47-40} = op{15-8};
788 let Inst{39-36} = R1;
789 let Inst{35-32} = M3;
790 let Inst{31-8} = BD2;
791 let Inst{7-0} = op{7-0};
793 let Has20BitOffset = 1;
796 class InstSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
797 : InstSystemZ<4, outs, ins, asmstr, pattern> {
799 field bits<32> SoftFail = 0;
804 let Inst{31-24} = op;
805 let Inst{23-16} = I2;
806 let Inst{15-0} = BD1;
809 class InstSIL<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
810 : InstSystemZ<6, outs, ins, asmstr, pattern> {
812 field bits<48> SoftFail = 0;
817 let Inst{47-32} = op;
818 let Inst{31-16} = BD1;
822 class InstSIY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
823 : InstSystemZ<6, outs, ins, asmstr, pattern> {
825 field bits<48> SoftFail = 0;
830 let Inst{47-40} = op{15-8};
831 let Inst{39-32} = I2;
832 let Inst{31-8} = BD1;
833 let Inst{7-0} = op{7-0};
835 let Has20BitOffset = 1;
838 class InstSMI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
839 : InstSystemZ<6, outs, ins, asmstr, pattern> {
841 field bits<48> SoftFail = 0;
847 let Inst{47-40} = op;
848 let Inst{39-36} = M1;
850 let Inst{31-16} = BD3;
851 let Inst{15-0} = RI2;
854 class InstSSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
855 : InstSystemZ<6, outs, ins, asmstr, pattern> {
857 field bits<48> SoftFail = 0;
862 let Inst{47-40} = op;
863 let Inst{39-16} = BDL1;
864 let Inst{15-0} = BD2;
867 class InstSSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
868 : InstSystemZ<6, outs, ins, asmstr, pattern> {
870 field bits<48> SoftFail = 0;
875 let Inst{47-40} = op;
876 let Inst{39-36} = BDL1{19-16};
877 let Inst{35-32} = BDL2{19-16};
878 let Inst{31-16} = BDL1{15-0};
879 let Inst{15-0} = BDL2{15-0};
882 class InstSSc<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
883 : InstSystemZ<6, outs, ins, asmstr, pattern> {
885 field bits<48> SoftFail = 0;
891 let Inst{47-40} = op;
892 let Inst{39-36} = BDL1{19-16};
893 let Inst{35-32} = I3;
894 let Inst{31-16} = BDL1{15-0};
895 let Inst{15-0} = BD2;
898 class InstSSd<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
899 : InstSystemZ<6, outs, ins, asmstr, pattern> {
901 field bits<48> SoftFail = 0;
907 let Inst{47-40} = op;
908 let Inst{39-36} = RBD1{19-16};
909 let Inst{35-32} = R3;
910 let Inst{31-16} = RBD1{15-0};
911 let Inst{15-0} = BD2;
914 class InstSSe<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
915 : InstSystemZ<6, outs, ins, asmstr, pattern> {
917 field bits<48> SoftFail = 0;
924 let Inst{47-40} = op;
925 let Inst{39-36} = R1;
926 let Inst{35-32} = R3;
927 let Inst{31-16} = BD2;
928 let Inst{15-0} = BD4;
931 class InstSSf<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
932 : InstSystemZ<6, outs, ins, asmstr, pattern> {
934 field bits<48> SoftFail = 0;
939 let Inst{47-40} = op;
940 let Inst{39-32} = BDL2{23-16};
941 let Inst{31-16} = BD1;
942 let Inst{15-0} = BDL2{15-0};
945 class InstSSE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
946 : InstSystemZ<6, outs, ins, asmstr, pattern> {
948 field bits<48> SoftFail = 0;
953 let Inst{47-32} = op;
954 let Inst{31-16} = BD1;
955 let Inst{15-0} = BD2;
958 class InstSSF<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
959 : InstSystemZ<6, outs, ins, asmstr, pattern> {
961 field bits<48> SoftFail = 0;
967 let Inst{47-40} = op{11-4};
968 let Inst{39-36} = R3;
969 let Inst{35-32} = op{3-0};
970 let Inst{31-16} = BD1;
971 let Inst{15-0} = BD2;
974 class InstS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
975 : InstSystemZ<4, outs, ins, asmstr, pattern> {
977 field bits<32> SoftFail = 0;
981 let Inst{31-16} = op;
982 let Inst{15-0} = BD2;
985 class InstVRIa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
986 : InstSystemZ<6, outs, ins, asmstr, pattern> {
988 field bits<48> SoftFail = 0;
994 let Inst{47-40} = op{15-8};
995 let Inst{39-36} = V1{3-0};
997 let Inst{31-16} = I2;
998 let Inst{15-12} = M3;
999 let Inst{11} = V1{4};
1001 let Inst{7-0} = op{7-0};
1004 class InstVRIb<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;
1014 let Inst{47-40} = op{15-8};
1015 let Inst{39-36} = V1{3-0};
1016 let Inst{35-32} = 0;
1017 let Inst{31-24} = I2;
1018 let Inst{23-16} = I3;
1019 let Inst{15-12} = M4;
1020 let Inst{11} = V1{4};
1022 let Inst{7-0} = op{7-0};
1025 class InstVRIc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1026 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1027 field bits<48> Inst;
1028 field bits<48> SoftFail = 0;
1035 let Inst{47-40} = op{15-8};
1036 let Inst{39-36} = V1{3-0};
1037 let Inst{35-32} = V3{3-0};
1038 let Inst{31-16} = I2;
1039 let Inst{15-12} = M4;
1040 let Inst{11} = V1{4};
1041 let Inst{10} = V3{4};
1043 let Inst{7-0} = op{7-0};
1046 class InstVRId<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1047 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1048 field bits<48> Inst;
1049 field bits<48> SoftFail = 0;
1057 let Inst{47-40} = op{15-8};
1058 let Inst{39-36} = V1{3-0};
1059 let Inst{35-32} = V2{3-0};
1060 let Inst{31-28} = V3{3-0};
1061 let Inst{27-24} = 0;
1062 let Inst{23-16} = I4;
1063 let Inst{15-12} = M5;
1064 let Inst{11} = V1{4};
1065 let Inst{10} = V2{4};
1066 let Inst{9} = V3{4};
1068 let Inst{7-0} = op{7-0};
1071 class InstVRIe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1072 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1073 field bits<48> Inst;
1074 field bits<48> SoftFail = 0;
1082 let Inst{47-40} = op{15-8};
1083 let Inst{39-36} = V1{3-0};
1084 let Inst{35-32} = V2{3-0};
1085 let Inst{31-20} = I3;
1086 let Inst{19-16} = M5;
1087 let Inst{15-12} = M4;
1088 let Inst{11} = V1{4};
1089 let Inst{10} = V2{4};
1091 let Inst{7-0} = op{7-0};
1094 // Depending on the instruction mnemonic, certain bits may be or-ed into
1095 // the M4 value provided as explicit operand. These are passed as m4or.
1096 class InstVRRa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1098 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1099 field bits<48> Inst;
1100 field bits<48> SoftFail = 0;
1108 let Inst{47-40} = op{15-8};
1109 let Inst{39-36} = V1{3-0};
1110 let Inst{35-32} = V2{3-0};
1111 let Inst{31-24} = 0;
1112 let Inst{23-20} = M5;
1113 let Inst{19} = !if (!eq (m4or{3}, 1), 1, M4{3});
1114 let Inst{18} = !if (!eq (m4or{2}, 1), 1, M4{2});
1115 let Inst{17} = !if (!eq (m4or{1}, 1), 1, M4{1});
1116 let Inst{16} = !if (!eq (m4or{0}, 1), 1, M4{0});
1117 let Inst{15-12} = M3;
1118 let Inst{11} = V1{4};
1119 let Inst{10} = V2{4};
1121 let Inst{7-0} = op{7-0};
1124 // Depending on the instruction mnemonic, certain bits may be or-ed into
1125 // the M5 value provided as explicit operand. These are passed as m5or.
1126 class InstVRRb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1128 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1129 field bits<48> Inst;
1130 field bits<48> SoftFail = 0;
1138 let Inst{47-40} = op{15-8};
1139 let Inst{39-36} = V1{3-0};
1140 let Inst{35-32} = V2{3-0};
1141 let Inst{31-28} = V3{3-0};
1142 let Inst{27-24} = 0;
1143 let Inst{23} = !if (!eq (m5or{3}, 1), 1, M5{3});
1144 let Inst{22} = !if (!eq (m5or{2}, 1), 1, M5{2});
1145 let Inst{21} = !if (!eq (m5or{1}, 1), 1, M5{1});
1146 let Inst{20} = !if (!eq (m5or{0}, 1), 1, M5{0});
1147 let Inst{19-16} = 0;
1148 let Inst{15-12} = M4;
1149 let Inst{11} = V1{4};
1150 let Inst{10} = V2{4};
1151 let Inst{9} = V3{4};
1153 let Inst{7-0} = op{7-0};
1156 class InstVRRc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1157 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1158 field bits<48> Inst;
1159 field bits<48> SoftFail = 0;
1168 let Inst{47-40} = op{15-8};
1169 let Inst{39-36} = V1{3-0};
1170 let Inst{35-32} = V2{3-0};
1171 let Inst{31-28} = V3{3-0};
1172 let Inst{27-24} = 0;
1173 let Inst{23-20} = M6;
1174 let Inst{19-16} = M5;
1175 let Inst{15-12} = M4;
1176 let Inst{11} = V1{4};
1177 let Inst{10} = V2{4};
1178 let Inst{9} = V3{4};
1180 let Inst{7-0} = op{7-0};
1183 // Depending on the instruction mnemonic, certain bits may be or-ed into
1184 // the M6 value provided as explicit operand. These are passed as m6or.
1185 class InstVRRd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1187 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1188 field bits<48> Inst;
1189 field bits<48> SoftFail = 0;
1198 let Inst{47-40} = op{15-8};
1199 let Inst{39-36} = V1{3-0};
1200 let Inst{35-32} = V2{3-0};
1201 let Inst{31-28} = V3{3-0};
1202 let Inst{27-24} = M5;
1203 let Inst{23} = !if (!eq (m6or{3}, 1), 1, M6{3});
1204 let Inst{22} = !if (!eq (m6or{2}, 1), 1, M6{2});
1205 let Inst{21} = !if (!eq (m6or{1}, 1), 1, M6{1});
1206 let Inst{20} = !if (!eq (m6or{0}, 1), 1, M6{0});
1207 let Inst{19-16} = 0;
1208 let Inst{15-12} = V4{3-0};
1209 let Inst{11} = V1{4};
1210 let Inst{10} = V2{4};
1211 let Inst{9} = V3{4};
1212 let Inst{8} = V4{4};
1213 let Inst{7-0} = op{7-0};
1216 class InstVRRe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1217 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1218 field bits<48> Inst;
1219 field bits<48> SoftFail = 0;
1228 let Inst{47-40} = op{15-8};
1229 let Inst{39-36} = V1{3-0};
1230 let Inst{35-32} = V2{3-0};
1231 let Inst{31-28} = V3{3-0};
1232 let Inst{27-24} = M6;
1233 let Inst{23-20} = 0;
1234 let Inst{19-16} = M5;
1235 let Inst{15-12} = V4{3-0};
1236 let Inst{11} = V1{4};
1237 let Inst{10} = V2{4};
1238 let Inst{9} = V3{4};
1239 let Inst{8} = V4{4};
1240 let Inst{7-0} = op{7-0};
1243 class InstVRRf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1244 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1245 field bits<48> Inst;
1246 field bits<48> SoftFail = 0;
1252 let Inst{47-40} = op{15-8};
1253 let Inst{39-36} = V1{3-0};
1254 let Inst{35-32} = R2;
1255 let Inst{31-28} = R3;
1256 let Inst{27-12} = 0;
1257 let Inst{11} = V1{4};
1259 let Inst{7-0} = op{7-0};
1262 class InstVRSa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1263 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1264 field bits<48> Inst;
1265 field bits<48> SoftFail = 0;
1272 let Inst{47-40} = op{15-8};
1273 let Inst{39-36} = V1{3-0};
1274 let Inst{35-32} = V3{3-0};
1275 let Inst{31-16} = BD2;
1276 let Inst{15-12} = M4;
1277 let Inst{11} = V1{4};
1278 let Inst{10} = V3{4};
1280 let Inst{7-0} = op{7-0};
1283 class InstVRSb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1284 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1285 field bits<48> Inst;
1286 field bits<48> SoftFail = 0;
1293 let Inst{47-40} = op{15-8};
1294 let Inst{39-36} = V1{3-0};
1295 let Inst{35-32} = R3;
1296 let Inst{31-16} = BD2;
1297 let Inst{15-12} = M4;
1298 let Inst{11} = V1{4};
1300 let Inst{7-0} = op{7-0};
1303 class InstVRSc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1304 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1305 field bits<48> Inst;
1306 field bits<48> SoftFail = 0;
1313 let Inst{47-40} = op{15-8};
1314 let Inst{39-36} = R1;
1315 let Inst{35-32} = V3{3-0};
1316 let Inst{31-16} = BD2;
1317 let Inst{15-12} = M4;
1319 let Inst{10} = V3{4};
1321 let Inst{7-0} = op{7-0};
1324 class InstVRV<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1325 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1326 field bits<48> Inst;
1327 field bits<48> SoftFail = 0;
1333 let Inst{47-40} = op{15-8};
1334 let Inst{39-36} = V1{3-0};
1335 let Inst{35-16} = VBD2{19-0};
1336 let Inst{15-12} = M3;
1337 let Inst{11} = V1{4};
1338 let Inst{10} = VBD2{20};
1340 let Inst{7-0} = op{7-0};
1343 class InstVRX<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1344 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1345 field bits<48> Inst;
1346 field bits<48> SoftFail = 0;
1352 let Inst{47-40} = op{15-8};
1353 let Inst{39-36} = V1{3-0};
1354 let Inst{35-16} = XBD2;
1355 let Inst{15-12} = M3;
1356 let Inst{11} = V1{4};
1358 let Inst{7-0} = op{7-0};
1361 //===----------------------------------------------------------------------===//
1362 // Instruction classes for .insn directives
1363 //===----------------------------------------------------------------------===//
1365 class DirectiveInsnE<dag outs, dag ins, string asmstr, list<dag> pattern>
1366 : InstE<0, outs, ins, asmstr, pattern> {
1372 class DirectiveInsnRI<dag outs, dag ins, string asmstr, list<dag> pattern>
1373 : InstRIa<0, outs, ins, asmstr, pattern> {
1376 let Inst{31-24} = enc{31-24};
1377 let Inst{19-16} = enc{19-16};
1380 class DirectiveInsnRIE<dag outs, dag ins, string asmstr, list<dag> pattern>
1381 : InstRIEd<0, outs, ins, asmstr, pattern> {
1384 let Inst{47-40} = enc{47-40};
1385 let Inst{7-0} = enc{7-0};
1388 class DirectiveInsnRIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1389 : InstRILa<0, outs, ins, asmstr, pattern> {
1393 let Inst{47-40} = enc{47-40};
1394 let Inst{35-32} = enc{35-32};
1397 class DirectiveInsnRIS<dag outs, dag ins, string asmstr, list<dag> pattern>
1398 : InstRIS<0, outs, ins, asmstr, pattern> {
1401 let Inst{47-40} = enc{47-40};
1402 let Inst{7-0} = enc{7-0};
1405 class DirectiveInsnRR<dag outs, dag ins, string asmstr, list<dag> pattern>
1406 : InstRR<0, outs, ins, asmstr, pattern> {
1409 let Inst{15-8} = enc{15-8};
1412 class DirectiveInsnRRE<dag outs, dag ins, string asmstr, list<dag> pattern>
1413 : InstRRE<0, outs, ins, asmstr, pattern> {
1416 let Inst{31-16} = enc{31-16};
1419 class DirectiveInsnRRF<dag outs, dag ins, string asmstr, list<dag> pattern>
1420 : InstRRFa<0, outs, ins, asmstr, pattern> {
1423 let Inst{31-16} = enc{31-16};
1426 class DirectiveInsnRRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1427 : InstRRS<0, outs, ins, asmstr, pattern> {
1430 let Inst{47-40} = enc{47-40};
1431 let Inst{7-0} = enc{7-0};
1434 class DirectiveInsnRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1435 : InstRSa<0, outs, ins, asmstr, pattern> {
1438 let Inst{31-24} = enc{31-24};
1441 // RSE is like RSY except with a 12 bit displacement (instead of 20).
1442 class DirectiveInsnRSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1443 : InstRSYa<6, outs, ins, asmstr, pattern> {
1446 let Inst{47-40} = enc{47-40};
1447 let Inst{31-16} = BD2{15-0};
1449 let Inst{7-0} = enc{7-0};
1452 class DirectiveInsnRSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1453 : InstRSI<0, outs, ins, asmstr, pattern> {
1456 let Inst{31-24} = enc{31-24};
1459 class DirectiveInsnRSY<dag outs, dag ins, string asmstr, list<dag> pattern>
1460 : InstRSYa<0, outs, ins, asmstr, pattern> {
1463 let Inst{47-40} = enc{47-40};
1464 let Inst{7-0} = enc{7-0};
1467 class DirectiveInsnRX<dag outs, dag ins, string asmstr, list<dag> pattern>
1468 : InstRXa<0, outs, ins, asmstr, pattern> {
1471 let Inst{31-24} = enc{31-24};
1474 class DirectiveInsnRXE<dag outs, dag ins, string asmstr, list<dag> pattern>
1475 : InstRXE<0, outs, ins, asmstr, pattern> {
1480 let Inst{47-40} = enc{47-40};
1481 let Inst{7-0} = enc{7-0};
1484 class DirectiveInsnRXF<dag outs, dag ins, string asmstr, list<dag> pattern>
1485 : InstRXF<0, outs, ins, asmstr, pattern> {
1488 let Inst{47-40} = enc{47-40};
1489 let Inst{7-0} = enc{7-0};
1492 class DirectiveInsnRXY<dag outs, dag ins, string asmstr, list<dag> pattern>
1493 : InstRXYa<0, outs, ins, asmstr, pattern> {
1496 let Inst{47-40} = enc{47-40};
1497 let Inst{7-0} = enc{7-0};
1500 class DirectiveInsnS<dag outs, dag ins, string asmstr, list<dag> pattern>
1501 : InstS<0, outs, ins, asmstr, pattern> {
1504 let Inst{31-16} = enc{31-16};
1507 class DirectiveInsnSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1508 : InstSI<0, outs, ins, asmstr, pattern> {
1511 let Inst{31-24} = enc{31-24};
1514 class DirectiveInsnSIY<dag outs, dag ins, string asmstr, list<dag> pattern>
1515 : InstSIY<0, outs, ins, asmstr, pattern> {
1518 let Inst{47-40} = enc{47-40};
1519 let Inst{7-0} = enc{7-0};
1522 class DirectiveInsnSIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1523 : InstSIL<0, outs, ins, asmstr, pattern> {
1526 let Inst{47-32} = enc{47-32};
1529 class DirectiveInsnSS<dag outs, dag ins, string asmstr, list<dag> pattern>
1530 : InstSSd<0, outs, ins, asmstr, pattern> {
1533 let Inst{47-40} = enc{47-40};
1536 class DirectiveInsnSSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1537 : InstSSE<0, outs, ins, asmstr, pattern> {
1540 let Inst{47-32} = enc{47-32};
1543 class DirectiveInsnSSF<dag outs, dag ins, string asmstr, list<dag> pattern>
1544 : InstSSF<0, outs, ins, asmstr, pattern> {
1547 let Inst{47-40} = enc{47-40};
1548 let Inst{35-32} = enc{35-32};
1551 //===----------------------------------------------------------------------===//
1552 // Variants of instructions with condition mask
1553 //===----------------------------------------------------------------------===//
1555 // For instructions using a condition mask (e.g. conditional branches,
1556 // compare-and-branch instructions, or conditional move instructions),
1557 // we generally need to create multiple instruction patterns:
1559 // - One used for code generation, which encodes the condition mask as an
1560 // MI operand, but writes out an extended mnemonic for better readability.
1561 // - One pattern for the base form of the instruction with an explicit
1562 // condition mask (encoded as a plain integer MI operand).
1563 // - Specific patterns for each extended mnemonic, where the condition mask
1564 // is implied by the pattern name and not otherwise encoded at all.
1566 // We need the latter primarily for the assembler and disassembler, since the
1567 // assembler parser is not able to decode part of an instruction mnemonic
1568 // into an operand. Thus we provide separate patterns for each mnemonic.
1570 // Note that in some cases there are two different mnemonics for the same
1571 // condition mask. In this case we cannot have both instructions available
1572 // to the disassembler at the same time since the encodings are not distinct.
1573 // Therefore the alternate forms are marked isAsmParserOnly.
1575 // We don't make one of the two names an alias of the other because
1576 // we need the custom parsing routines to select the correct register class.
1578 // This section provides helpers for generating the specific forms.
1580 //===----------------------------------------------------------------------===//
1582 // A class to describe a variant of an instruction with condition mask.
1583 class CondVariant<bits<4> ccmaskin, string suffixin, bit alternatein> {
1584 // The fixed condition mask to use.
1585 bits<4> ccmask = ccmaskin;
1587 // The suffix to use for the extended assembler mnemonic.
1588 string suffix = suffixin;
1590 // Whether this is an alternate that needs to be marked isAsmParserOnly.
1591 bit alternate = alternatein;
1594 // Condition mask 15 means "always true", which is used to define
1595 // unconditional branches as a variant of conditional branches.
1596 def CondAlways : CondVariant<15, "", 0>;
1598 // Condition masks for general instructions that can set all 4 bits.
1599 def CondVariantO : CondVariant<1, "o", 0>;
1600 def CondVariantH : CondVariant<2, "h", 0>;
1601 def CondVariantP : CondVariant<2, "p", 1>;
1602 def CondVariantNLE : CondVariant<3, "nle", 0>;
1603 def CondVariantL : CondVariant<4, "l", 0>;
1604 def CondVariantM : CondVariant<4, "m", 1>;
1605 def CondVariantNHE : CondVariant<5, "nhe", 0>;
1606 def CondVariantLH : CondVariant<6, "lh", 0>;
1607 def CondVariantNE : CondVariant<7, "ne", 0>;
1608 def CondVariantNZ : CondVariant<7, "nz", 1>;
1609 def CondVariantE : CondVariant<8, "e", 0>;
1610 def CondVariantZ : CondVariant<8, "z", 1>;
1611 def CondVariantNLH : CondVariant<9, "nlh", 0>;
1612 def CondVariantHE : CondVariant<10, "he", 0>;
1613 def CondVariantNL : CondVariant<11, "nl", 0>;
1614 def CondVariantNM : CondVariant<11, "nm", 1>;
1615 def CondVariantLE : CondVariant<12, "le", 0>;
1616 def CondVariantNH : CondVariant<13, "nh", 0>;
1617 def CondVariantNP : CondVariant<13, "np", 1>;
1618 def CondVariantNO : CondVariant<14, "no", 0>;
1620 // A helper class to look up one of the above by name.
1621 class CV<string name>
1622 : CondVariant<!cast<CondVariant>("CondVariant"#name).ccmask,
1623 !cast<CondVariant>("CondVariant"#name).suffix,
1624 !cast<CondVariant>("CondVariant"#name).alternate>;
1626 // Condition masks for integer instructions (e.g. compare-and-branch).
1627 // This is like the list above, except that condition 3 is not possible
1628 // and that the low bit of the mask is therefore always 0. This means
1629 // that each condition has two names. Conditions "o" and "no" are not used.
1630 def IntCondVariantH : CondVariant<2, "h", 0>;
1631 def IntCondVariantNLE : CondVariant<2, "nle", 1>;
1632 def IntCondVariantL : CondVariant<4, "l", 0>;
1633 def IntCondVariantNHE : CondVariant<4, "nhe", 1>;
1634 def IntCondVariantLH : CondVariant<6, "lh", 0>;
1635 def IntCondVariantNE : CondVariant<6, "ne", 1>;
1636 def IntCondVariantE : CondVariant<8, "e", 0>;
1637 def IntCondVariantNLH : CondVariant<8, "nlh", 1>;
1638 def IntCondVariantHE : CondVariant<10, "he", 0>;
1639 def IntCondVariantNL : CondVariant<10, "nl", 1>;
1640 def IntCondVariantLE : CondVariant<12, "le", 0>;
1641 def IntCondVariantNH : CondVariant<12, "nh", 1>;
1643 // A helper class to look up one of the above by name.
1644 class ICV<string name>
1645 : CondVariant<!cast<CondVariant>("IntCondVariant"#name).ccmask,
1646 !cast<CondVariant>("IntCondVariant"#name).suffix,
1647 !cast<CondVariant>("IntCondVariant"#name).alternate>;
1649 //===----------------------------------------------------------------------===//
1650 // Instruction definitions with semantics
1651 //===----------------------------------------------------------------------===//
1653 // These classes have the form [Cond]<Category><Format>, where <Format> is one
1654 // of the formats defined above and where <Category> describes the inputs
1655 // and outputs. "Cond" is used if the instruction is conditional,
1656 // in which case the 4-bit condition-code mask is added as a final operand.
1657 // <Category> can be one of:
1660 // One register output operand and no input operands.
1663 // Two register output operands and no input operands.
1666 // One address operand. The instruction stores to the address.
1668 // SideEffectInherent:
1669 // No input or output operands, but causes some side effect.
1672 // One branch target. The instruction branches to the target.
1675 // One output operand and one branch target. The instruction stores
1676 // the return address to the output operand and branches to the target.
1679 // Two input operands and one optional branch target. The instruction
1680 // compares the two input operands and branches or traps on the result.
1683 // One register output operand, one register input operand and one branch
1684 // target. The instructions stores a modified form of the source register
1685 // in the destination register and branches on the result.
1688 // One register output operand, two register input operands and one branch
1689 // target. The instructions stores a modified form of one of the source
1690 // registers in the destination register and branches on the result.
1693 // One address input operand and two explicit output operands.
1694 // The instruction loads a range of registers from the address,
1695 // with the explicit operands giving the first and last register
1696 // to load. Other loaded registers are added as implicit definitions.
1699 // Two explicit input register operands and an address operand.
1700 // The instruction stores a range of registers to the address,
1701 // with the explicit operands giving the first and last register
1702 // to store. Other stored registers are added as implicit uses.
1705 // One value operand, one length operand and one address operand.
1706 // The instruction stores the value operand to the address but
1707 // doesn't write more than the number of bytes specified by the
1711 // One register output operand and one address operand.
1713 // SideEffectAddress:
1714 // One address operand. No output operands, but causes some side effect.
1717 // One register output operand and one input operand.
1720 // One address operand and one other input operand. The instruction
1721 // stores to the address.
1724 // One input operand. No output operands, but causes some side effect.
1727 // One register output operand and two input operands.
1730 // One address operand and two other input operands. The instruction
1731 // stores to the address.
1733 // SideEffectBinary:
1734 // Two input operands. No output operands, but causes some side effect.
1737 // Two input operands and an implicit CC output operand.
1740 // One or two input operands and an implicit CC output operand. If
1741 // present, the second input operand is an "address" operand used as
1742 // a test class mask.
1745 // One register output operand and three input operands.
1747 // SideEffectTernary:
1748 // Three input operands. No output operands, but causes some side effect.
1751 // One register output operand and four input operands.
1754 // One output operand and two input operands, one of which is an address.
1755 // The instruction both reads from and writes to the address.
1758 // One output operand and three input operands, one of which is an address.
1759 // The instruction both reads from and writes to the address.
1762 // One output operand and five input operands. The first two operands
1763 // are registers and the other three are immediates.
1766 // One 4-bit immediate operand and one address operand. The immediate
1767 // operand is 1 for a load prefetch and 2 for a store prefetch.
1770 // One 4-bit immediate operand and two address operands.
1772 // The format determines which input operands are tied to output operands,
1773 // and also determines the shape of any address operand.
1775 // Multiclasses of the form <Category><Format>Pair define two instructions,
1776 // one with <Category><Format> and one with <Category><Format>Y. The name
1777 // of the first instruction has no suffix, the name of the second has
1780 //===----------------------------------------------------------------------===//
1782 class InherentRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
1783 SDPatternOperator operator>
1784 : InstRRE<opcode, (outs cls:$R1), (ins),
1786 [(set cls:$R1, (operator))]> {
1790 class InherentDualRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
1791 : InstRRE<opcode, (outs cls:$R1, cls:$R2), (ins),
1792 mnemonic#"\t$R1, $R2", []>;
1794 class InherentVRIa<string mnemonic, bits<16> opcode, bits<16> value>
1795 : InstVRIa<opcode, (outs VR128:$V1), (ins), mnemonic#"\t$V1", []> {
1800 class StoreInherentS<string mnemonic, bits<16> opcode,
1801 SDPatternOperator operator, bits<5> bytes>
1802 : InstS<opcode, (outs), (ins bdaddr12only:$BD2),
1803 mnemonic#"\t$BD2", [(operator bdaddr12only:$BD2)]> {
1805 let AccessBytes = bytes;
1808 class SideEffectInherentE<string mnemonic, bits<16>opcode>
1809 : InstE<opcode, (outs), (ins), mnemonic, []>;
1811 class SideEffectInherentS<string mnemonic, bits<16> opcode,
1812 SDPatternOperator operator>
1813 : InstS<opcode, (outs), (ins), mnemonic, [(operator)]> {
1817 class SideEffectInherentRRE<string mnemonic, bits<16> opcode>
1818 : InstRRE<opcode, (outs), (ins), mnemonic, []> {
1823 // Allow an optional TLS marker symbol to generate TLS call relocations.
1824 class CallRI<string mnemonic, bits<12> opcode>
1825 : InstRIb<opcode, (outs), (ins GR64:$R1, brtarget16tls:$RI2),
1826 mnemonic#"\t$R1, $RI2", []>;
1828 // Allow an optional TLS marker symbol to generate TLS call relocations.
1829 class CallRIL<string mnemonic, bits<12> opcode>
1830 : InstRILb<opcode, (outs), (ins GR64:$R1, brtarget32tls:$RI2),
1831 mnemonic#"\t$R1, $RI2", []>;
1833 class CallRR<string mnemonic, bits<8> opcode>
1834 : InstRR<opcode, (outs), (ins GR64:$R1, ADDR64:$R2),
1835 mnemonic#"\t$R1, $R2", []>;
1837 class CallRX<string mnemonic, bits<8> opcode>
1838 : InstRXa<opcode, (outs), (ins GR64:$R1, bdxaddr12only:$XBD2),
1839 mnemonic#"\t$R1, $XBD2", []>;
1841 class CondBranchRI<string mnemonic, bits<12> opcode,
1842 SDPatternOperator operator = null_frag>
1843 : InstRIc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget16:$RI2),
1844 !subst("#", "${M1}", mnemonic)#"\t$RI2",
1845 [(operator cond4:$valid, cond4:$M1, bb:$RI2)]> {
1846 let CCMaskFirst = 1;
1849 class AsmCondBranchRI<string mnemonic, bits<12> opcode>
1850 : InstRIc<opcode, (outs), (ins imm32zx4:$M1, brtarget16:$RI2),
1851 mnemonic#"\t$M1, $RI2", []>;
1853 class FixedCondBranchRI<CondVariant V, string mnemonic, bits<12> opcode,
1854 SDPatternOperator operator = null_frag>
1855 : InstRIc<opcode, (outs), (ins brtarget16:$RI2),
1856 !subst("#", V.suffix, mnemonic)#"\t$RI2", [(operator bb:$RI2)]> {
1857 let isAsmParserOnly = V.alternate;
1861 class CondBranchRIL<string mnemonic, bits<12> opcode>
1862 : InstRILc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget32:$RI2),
1863 !subst("#", "${M1}", mnemonic)#"\t$RI2", []> {
1864 let CCMaskFirst = 1;
1867 class AsmCondBranchRIL<string mnemonic, bits<12> opcode>
1868 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, brtarget32:$RI2),
1869 mnemonic#"\t$M1, $RI2", []>;
1871 class FixedCondBranchRIL<CondVariant V, string mnemonic, bits<12> opcode>
1872 : InstRILc<opcode, (outs), (ins brtarget32:$RI2),
1873 !subst("#", V.suffix, mnemonic)#"\t$RI2", []> {
1874 let isAsmParserOnly = V.alternate;
1878 class CondBranchRR<string mnemonic, bits<8> opcode>
1879 : InstRR<opcode, (outs), (ins cond4:$valid, cond4:$R1, GR64:$R2),
1880 !subst("#", "${R1}", mnemonic)#"\t$R2", []> {
1881 let CCMaskFirst = 1;
1884 class AsmCondBranchRR<string mnemonic, bits<8> opcode>
1885 : InstRR<opcode, (outs), (ins imm32zx4:$R1, GR64:$R2),
1886 mnemonic#"\t$R1, $R2", []>;
1888 class FixedCondBranchRR<CondVariant V, string mnemonic, bits<8> opcode,
1889 SDPatternOperator operator = null_frag>
1890 : InstRR<opcode, (outs), (ins ADDR64:$R2),
1891 !subst("#", V.suffix, mnemonic)#"\t$R2", [(operator ADDR64:$R2)]> {
1892 let isAsmParserOnly = V.alternate;
1896 class CondBranchRX<string mnemonic, bits<8> opcode>
1897 : InstRXb<opcode, (outs), (ins cond4:$valid, cond4:$M1, bdxaddr12only:$XBD2),
1898 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
1899 let CCMaskFirst = 1;
1902 class AsmCondBranchRX<string mnemonic, bits<8> opcode>
1903 : InstRXb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr12only:$XBD2),
1904 mnemonic#"\t$M1, $XBD2", []>;
1906 class FixedCondBranchRX<CondVariant V, string mnemonic, bits<8> opcode>
1907 : InstRXb<opcode, (outs), (ins bdxaddr12only:$XBD2),
1908 !subst("#", V.suffix, mnemonic)#"\t$XBD2", []> {
1909 let isAsmParserOnly = V.alternate;
1913 class CmpBranchRIEa<string mnemonic, bits<16> opcode,
1914 RegisterOperand cls, Immediate imm>
1915 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, cond4:$M3),
1916 mnemonic#"$M3\t$R1, $I2", []>;
1918 class AsmCmpBranchRIEa<string mnemonic, bits<16> opcode,
1919 RegisterOperand cls, Immediate imm>
1920 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, imm32zx4:$M3),
1921 mnemonic#"\t$R1, $I2, $M3", []>;
1923 class FixedCmpBranchRIEa<CondVariant V, string mnemonic, bits<16> opcode,
1924 RegisterOperand cls, Immediate imm>
1925 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2),
1926 mnemonic#V.suffix#"\t$R1, $I2", []> {
1927 let isAsmParserOnly = V.alternate;
1931 multiclass CmpBranchRIEaPair<string mnemonic, bits<16> opcode,
1932 RegisterOperand cls, Immediate imm> {
1933 let isCodeGenOnly = 1 in
1934 def "" : CmpBranchRIEa<mnemonic, opcode, cls, imm>;
1935 def Asm : AsmCmpBranchRIEa<mnemonic, opcode, cls, imm>;
1938 class CmpBranchRIEb<string mnemonic, bits<16> opcode,
1939 RegisterOperand cls>
1940 : InstRIEb<opcode, (outs),
1941 (ins cls:$R1, cls:$R2, cond4:$M3, brtarget16:$RI4),
1942 mnemonic#"$M3\t$R1, $R2, $RI4", []>;
1944 class AsmCmpBranchRIEb<string mnemonic, bits<16> opcode,
1945 RegisterOperand cls>
1946 : InstRIEb<opcode, (outs),
1947 (ins cls:$R1, cls:$R2, imm32zx4:$M3, brtarget16:$RI4),
1948 mnemonic#"\t$R1, $R2, $M3, $RI4", []>;
1950 class FixedCmpBranchRIEb<CondVariant V, string mnemonic, bits<16> opcode,
1951 RegisterOperand cls>
1952 : InstRIEb<opcode, (outs), (ins cls:$R1, cls:$R2, brtarget16:$RI4),
1953 mnemonic#V.suffix#"\t$R1, $R2, $RI4", []> {
1954 let isAsmParserOnly = V.alternate;
1958 multiclass CmpBranchRIEbPair<string mnemonic, bits<16> opcode,
1959 RegisterOperand cls> {
1960 let isCodeGenOnly = 1 in
1961 def "" : CmpBranchRIEb<mnemonic, opcode, cls>;
1962 def Asm : AsmCmpBranchRIEb<mnemonic, opcode, cls>;
1965 class CmpBranchRIEc<string mnemonic, bits<16> opcode,
1966 RegisterOperand cls, Immediate imm>
1967 : InstRIEc<opcode, (outs),
1968 (ins cls:$R1, imm:$I2, cond4:$M3, brtarget16:$RI4),
1969 mnemonic#"$M3\t$R1, $I2, $RI4", []>;
1971 class AsmCmpBranchRIEc<string mnemonic, bits<16> opcode,
1972 RegisterOperand cls, Immediate imm>
1973 : InstRIEc<opcode, (outs),
1974 (ins cls:$R1, imm:$I2, imm32zx4:$M3, brtarget16:$RI4),
1975 mnemonic#"\t$R1, $I2, $M3, $RI4", []>;
1977 class FixedCmpBranchRIEc<CondVariant V, string mnemonic, bits<16> opcode,
1978 RegisterOperand cls, Immediate imm>
1979 : InstRIEc<opcode, (outs), (ins cls:$R1, imm:$I2, brtarget16:$RI4),
1980 mnemonic#V.suffix#"\t$R1, $I2, $RI4", []> {
1981 let isAsmParserOnly = V.alternate;
1985 multiclass CmpBranchRIEcPair<string mnemonic, bits<16> opcode,
1986 RegisterOperand cls, Immediate imm> {
1987 let isCodeGenOnly = 1 in
1988 def "" : CmpBranchRIEc<mnemonic, opcode, cls, imm>;
1989 def Asm : AsmCmpBranchRIEc<mnemonic, opcode, cls, imm>;
1992 class CmpBranchRRFc<string mnemonic, bits<16> opcode,
1993 RegisterOperand cls>
1994 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, cond4:$M3),
1995 mnemonic#"$M3\t$R1, $R2", []>;
1997 class AsmCmpBranchRRFc<string mnemonic, bits<16> opcode,
1998 RegisterOperand cls>
1999 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, imm32zx4:$M3),
2000 mnemonic#"\t$R1, $R2, $M3", []>;
2002 multiclass CmpBranchRRFcPair<string mnemonic, bits<16> opcode,
2003 RegisterOperand cls> {
2004 let isCodeGenOnly = 1 in
2005 def "" : CmpBranchRRFc<mnemonic, opcode, cls>;
2006 def Asm : AsmCmpBranchRRFc<mnemonic, opcode, cls>;
2009 class FixedCmpBranchRRFc<CondVariant V, string mnemonic, bits<16> opcode,
2010 RegisterOperand cls>
2011 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2),
2012 mnemonic#V.suffix#"\t$R1, $R2", []> {
2013 let isAsmParserOnly = V.alternate;
2017 class CmpBranchRRS<string mnemonic, bits<16> opcode,
2018 RegisterOperand cls>
2019 : InstRRS<opcode, (outs),
2020 (ins cls:$R1, cls:$R2, cond4:$M3, bdaddr12only:$BD4),
2021 mnemonic#"$M3\t$R1, $R2, $BD4", []>;
2023 class AsmCmpBranchRRS<string mnemonic, bits<16> opcode,
2024 RegisterOperand cls>
2025 : InstRRS<opcode, (outs),
2026 (ins cls:$R1, cls:$R2, imm32zx4:$M3, bdaddr12only:$BD4),
2027 mnemonic#"\t$R1, $R2, $M3, $BD4", []>;
2029 class FixedCmpBranchRRS<CondVariant V, string mnemonic, bits<16> opcode,
2030 RegisterOperand cls>
2031 : InstRRS<opcode, (outs), (ins cls:$R1, cls:$R2, bdaddr12only:$BD4),
2032 mnemonic#V.suffix#"\t$R1, $R2, $BD4", []> {
2033 let isAsmParserOnly = V.alternate;
2037 multiclass CmpBranchRRSPair<string mnemonic, bits<16> opcode,
2038 RegisterOperand cls> {
2039 let isCodeGenOnly = 1 in
2040 def "" : CmpBranchRRS<mnemonic, opcode, cls>;
2041 def Asm : AsmCmpBranchRRS<mnemonic, opcode, cls>;
2044 class CmpBranchRIS<string mnemonic, bits<16> opcode,
2045 RegisterOperand cls, Immediate imm>
2046 : InstRIS<opcode, (outs),
2047 (ins cls:$R1, imm:$I2, cond4:$M3, bdaddr12only:$BD4),
2048 mnemonic#"$M3\t$R1, $I2, $BD4", []>;
2050 class AsmCmpBranchRIS<string mnemonic, bits<16> opcode,
2051 RegisterOperand cls, Immediate imm>
2052 : InstRIS<opcode, (outs),
2053 (ins cls:$R1, imm:$I2, imm32zx4:$M3, bdaddr12only:$BD4),
2054 mnemonic#"\t$R1, $I2, $M3, $BD4", []>;
2056 class FixedCmpBranchRIS<CondVariant V, string mnemonic, bits<16> opcode,
2057 RegisterOperand cls, Immediate imm>
2058 : InstRIS<opcode, (outs), (ins cls:$R1, imm:$I2, bdaddr12only:$BD4),
2059 mnemonic#V.suffix#"\t$R1, $I2, $BD4", []> {
2060 let isAsmParserOnly = V.alternate;
2064 multiclass CmpBranchRISPair<string mnemonic, bits<16> opcode,
2065 RegisterOperand cls, Immediate imm> {
2066 let isCodeGenOnly = 1 in
2067 def "" : CmpBranchRIS<mnemonic, opcode, cls, imm>;
2068 def Asm : AsmCmpBranchRIS<mnemonic, opcode, cls, imm>;
2071 class CmpBranchRSYb<string mnemonic, bits<16> opcode,
2072 RegisterOperand cls>
2073 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, cond4:$M3),
2074 mnemonic#"$M3\t$R1, $BD2", []>;
2076 class AsmCmpBranchRSYb<string mnemonic, bits<16> opcode,
2077 RegisterOperand cls>
2078 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, imm32zx4:$M3),
2079 mnemonic#"\t$R1, $M3, $BD2", []>;
2081 multiclass CmpBranchRSYbPair<string mnemonic, bits<16> opcode,
2082 RegisterOperand cls> {
2083 let isCodeGenOnly = 1 in
2084 def "" : CmpBranchRSYb<mnemonic, opcode, cls>;
2085 def Asm : AsmCmpBranchRSYb<mnemonic, opcode, cls>;
2088 class FixedCmpBranchRSYb<CondVariant V, string mnemonic, bits<16> opcode,
2089 RegisterOperand cls>
2090 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2),
2091 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2092 let isAsmParserOnly = V.alternate;
2096 class BranchUnaryRI<string mnemonic, bits<12> opcode, RegisterOperand cls>
2097 : InstRIb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget16:$RI2),
2098 mnemonic##"\t$R1, $RI2", []> {
2099 let Constraints = "$R1 = $R1src";
2100 let DisableEncoding = "$R1src";
2103 class BranchUnaryRIL<string mnemonic, bits<12> opcode, RegisterOperand cls>
2104 : InstRILb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget32:$RI2),
2105 mnemonic##"\t$R1, $RI2", []> {
2106 let Constraints = "$R1 = $R1src";
2107 let DisableEncoding = "$R1src";
2110 class BranchUnaryRR<string mnemonic, bits<8> opcode, RegisterOperand cls>
2111 : InstRR<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2112 mnemonic##"\t$R1, $R2", []> {
2113 let Constraints = "$R1 = $R1src";
2114 let DisableEncoding = "$R1src";
2117 class BranchUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2118 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2119 mnemonic##"\t$R1, $R2", []> {
2120 let Constraints = "$R1 = $R1src";
2121 let DisableEncoding = "$R1src";
2124 class BranchUnaryRX<string mnemonic, bits<8> opcode, RegisterOperand cls>
2125 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2),
2126 mnemonic##"\t$R1, $XBD2", []> {
2127 let Constraints = "$R1 = $R1src";
2128 let DisableEncoding = "$R1src";
2131 class BranchUnaryRXY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2132 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr20only:$XBD2),
2133 mnemonic##"\t$R1, $XBD2", []> {
2134 let Constraints = "$R1 = $R1src";
2135 let DisableEncoding = "$R1src";
2138 class BranchBinaryRSI<string mnemonic, bits<8> opcode, RegisterOperand cls>
2139 : InstRSI<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2140 mnemonic##"\t$R1, $R3, $RI2", []> {
2141 let Constraints = "$R1 = $R1src";
2142 let DisableEncoding = "$R1src";
2145 class BranchBinaryRIEe<string mnemonic, bits<16> opcode, RegisterOperand cls>
2146 : InstRIEe<opcode, (outs cls:$R1),
2147 (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2148 mnemonic##"\t$R1, $R3, $RI2", []> {
2149 let Constraints = "$R1 = $R1src";
2150 let DisableEncoding = "$R1src";
2153 class BranchBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls>
2154 : InstRSa<opcode, (outs cls:$R1),
2155 (ins cls:$R1src, cls:$R3, bdaddr12only:$BD2),
2156 mnemonic##"\t$R1, $R3, $BD2", []> {
2157 let Constraints = "$R1 = $R1src";
2158 let DisableEncoding = "$R1src";
2161 class BranchBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2163 (outs cls:$R1), (ins cls:$R1src, cls:$R3, bdaddr20only:$BD2),
2164 mnemonic##"\t$R1, $R3, $BD2", []> {
2165 let Constraints = "$R1 = $R1src";
2166 let DisableEncoding = "$R1src";
2169 class LoadMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2170 AddressingMode mode = bdaddr12only>
2171 : InstRSa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2),
2172 mnemonic#"\t$R1, $R3, $BD2", []> {
2176 class LoadMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2177 AddressingMode mode = bdaddr20only>
2178 : InstRSYa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2),
2179 mnemonic#"\t$R1, $R3, $BD2", []> {
2183 multiclass LoadMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2184 bits<16> rsyOpcode, RegisterOperand cls> {
2185 let DispKey = mnemonic ## #cls in {
2186 let DispSize = "12" in
2187 def "" : LoadMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2188 let DispSize = "20" in
2189 def Y : LoadMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2193 class LoadMultipleSSe<string mnemonic, bits<8> opcode, RegisterOperand cls>
2194 : InstSSe<opcode, (outs cls:$R1, cls:$R3),
2195 (ins bdaddr12only:$BD2, bdaddr12only:$BD4),
2196 mnemonic#"\t$R1, $R3, $BD2, $BD4", []> {
2200 class LoadMultipleVRSa<string mnemonic, bits<16> opcode>
2201 : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3), (ins bdaddr12only:$BD2),
2202 mnemonic#"\t$V1, $V3, $BD2", []> {
2207 class StoreRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2208 RegisterOperand cls>
2209 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
2210 mnemonic#"\t$R1, $RI2",
2211 [(operator cls:$R1, pcrel32:$RI2)]> {
2213 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2214 // However, BDXs have two extra operands and are therefore 6 units more
2216 let AddedComplexity = 7;
2219 class StoreRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2220 RegisterOperand cls, bits<5> bytes,
2221 AddressingMode mode = bdxaddr12only>
2222 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
2223 mnemonic#"\t$R1, $XBD2",
2224 [(operator cls:$R1, mode:$XBD2)]> {
2225 let OpKey = mnemonic#"r"#cls;
2228 let AccessBytes = bytes;
2231 class StoreRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2232 RegisterOperand cls, bits<5> bytes,
2233 AddressingMode mode = bdxaddr20only>
2234 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
2235 mnemonic#"\t$R1, $XBD2",
2236 [(operator cls:$R1, mode:$XBD2)]> {
2237 let OpKey = mnemonic#"r"#cls;
2240 let AccessBytes = bytes;
2243 multiclass StoreRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
2244 SDPatternOperator operator, RegisterOperand cls,
2246 let DispKey = mnemonic ## #cls in {
2247 let DispSize = "12" in
2248 def "" : StoreRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
2249 let DispSize = "20" in
2250 def Y : StoreRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
2255 class StoreVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2256 TypedReg tr, bits<5> bytes, bits<4> type = 0>
2257 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2),
2258 mnemonic#"\t$V1, $XBD2",
2259 [(set tr.op:$V1, (tr.vt (operator bdxaddr12only:$XBD2)))]> {
2262 let AccessBytes = bytes;
2265 class StoreLengthVRSb<string mnemonic, bits<16> opcode,
2266 SDPatternOperator operator, bits<5> bytes>
2267 : InstVRSb<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2),
2268 mnemonic#"\t$V1, $R3, $BD2",
2269 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2272 let AccessBytes = bytes;
2275 class StoreMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2276 AddressingMode mode = bdaddr12only>
2277 : InstRSa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2),
2278 mnemonic#"\t$R1, $R3, $BD2", []> {
2282 class StoreMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2283 AddressingMode mode = bdaddr20only>
2284 : InstRSYa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2),
2285 mnemonic#"\t$R1, $R3, $BD2", []> {
2289 multiclass StoreMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2290 bits<16> rsyOpcode, RegisterOperand cls> {
2291 let DispKey = mnemonic ## #cls in {
2292 let DispSize = "12" in
2293 def "" : StoreMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2294 let DispSize = "20" in
2295 def Y : StoreMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2299 class StoreMultipleVRSa<string mnemonic, bits<16> opcode>
2300 : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3, bdaddr12only:$BD2),
2301 mnemonic#"\t$V1, $V3, $BD2", []> {
2306 // StoreSI* instructions are used to store an integer to memory, but the
2307 // addresses are more restricted than for normal stores. If we are in the
2308 // situation of having to force either the address into a register or the
2309 // constant into a register, it's usually better to do the latter.
2310 // We therefore match the address in the same way as a normal store and
2311 // only use the StoreSI* instruction if the matched address is suitable.
2312 class StoreSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2314 : InstSI<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2),
2315 mnemonic#"\t$BD1, $I2",
2316 [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2320 class StoreSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2322 : InstSIY<opcode, (outs), (ins mviaddr20pair:$BD1, imm:$I2),
2323 mnemonic#"\t$BD1, $I2",
2324 [(operator imm:$I2, mviaddr20pair:$BD1)]> {
2328 class StoreSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2330 : InstSIL<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2),
2331 mnemonic#"\t$BD1, $I2",
2332 [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2336 multiclass StoreSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
2337 SDPatternOperator operator, Immediate imm> {
2338 let DispKey = mnemonic in {
2339 let DispSize = "12" in
2340 def "" : StoreSI<mnemonic, siOpcode, operator, imm>;
2341 let DispSize = "20" in
2342 def Y : StoreSIY<mnemonic#"y", siyOpcode, operator, imm>;
2346 class StoreSSE<string mnemonic, bits<16> opcode>
2347 : InstSSE<opcode, (outs), (ins bdaddr12only:$BD1, bdaddr12only:$BD2),
2348 mnemonic#"\t$BD1, $BD2", []> {
2352 class CondStoreRSY<string mnemonic, bits<16> opcode,
2353 RegisterOperand cls, bits<5> bytes,
2354 AddressingMode mode = bdaddr20only>
2355 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$M3),
2356 mnemonic#"$M3\t$R1, $BD2", []> {
2358 let AccessBytes = bytes;
2362 // Like CondStoreRSY, but used for the raw assembly form. The condition-code
2363 // mask is the third operand rather than being part of the mnemonic.
2364 class AsmCondStoreRSY<string mnemonic, bits<16> opcode,
2365 RegisterOperand cls, bits<5> bytes,
2366 AddressingMode mode = bdaddr20only>
2367 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, imm32zx4:$M3),
2368 mnemonic#"\t$R1, $BD2, $M3", []> {
2370 let AccessBytes = bytes;
2373 // Like CondStoreRSY, but with a fixed CC mask.
2374 class FixedCondStoreRSY<CondVariant V, string mnemonic, bits<16> opcode,
2375 RegisterOperand cls, bits<5> bytes,
2376 AddressingMode mode = bdaddr20only>
2377 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2),
2378 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2380 let AccessBytes = bytes;
2381 let isAsmParserOnly = V.alternate;
2385 multiclass CondStoreRSYPair<string mnemonic, bits<16> opcode,
2386 RegisterOperand cls, bits<5> bytes,
2387 AddressingMode mode = bdaddr20only> {
2388 let isCodeGenOnly = 1 in
2389 def "" : CondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
2390 def Asm : AsmCondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
2393 class SideEffectUnaryI<string mnemonic, bits<8> opcode, Immediate imm>
2394 : InstI<opcode, (outs), (ins imm:$I1),
2395 mnemonic#"\t$I1", []>;
2397 class SideEffectUnaryRR<string mnemonic, bits<8>opcode, RegisterOperand cls>
2398 : InstRR<opcode, (outs), (ins cls:$R1),
2399 mnemonic#"\t$R1", []> {
2403 class SideEffectUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
2404 SDPatternOperator operator>
2405 : InstRRE<opcode, (outs), (ins cls:$R1),
2406 mnemonic#"\t$R1", [(operator cls:$R1)]> {
2410 class SideEffectUnaryS<string mnemonic, bits<16> opcode,
2411 SDPatternOperator operator, bits<5> bytes,
2412 AddressingMode mode = bdaddr12only>
2413 : InstS<opcode, (outs), (ins mode:$BD2),
2414 mnemonic#"\t$BD2", [(operator mode:$BD2)]> {
2416 let AccessBytes = bytes;
2419 class SideEffectAddressS<string mnemonic, bits<16> opcode,
2420 SDPatternOperator operator,
2421 AddressingMode mode = bdaddr12only>
2422 : InstS<opcode, (outs), (ins mode:$BD2),
2423 mnemonic#"\t$BD2", [(operator mode:$BD2)]>;
2425 class LoadAddressRX<string mnemonic, bits<8> opcode,
2426 SDPatternOperator operator, AddressingMode mode>
2427 : InstRXa<opcode, (outs GR64:$R1), (ins mode:$XBD2),
2428 mnemonic#"\t$R1, $XBD2",
2429 [(set GR64:$R1, (operator mode:$XBD2))]>;
2431 class LoadAddressRXY<string mnemonic, bits<16> opcode,
2432 SDPatternOperator operator, AddressingMode mode>
2433 : InstRXYa<opcode, (outs GR64:$R1), (ins mode:$XBD2),
2434 mnemonic#"\t$R1, $XBD2",
2435 [(set GR64:$R1, (operator mode:$XBD2))]>;
2437 multiclass LoadAddressRXPair<string mnemonic, bits<8> rxOpcode,
2438 bits<16> rxyOpcode, SDPatternOperator operator> {
2439 let DispKey = mnemonic in {
2440 let DispSize = "12" in
2441 def "" : LoadAddressRX<mnemonic, rxOpcode, operator, laaddr12pair>;
2442 let DispSize = "20" in
2443 def Y : LoadAddressRXY<mnemonic#"y", rxyOpcode, operator, laaddr20pair>;
2447 class LoadAddressRIL<string mnemonic, bits<12> opcode,
2448 SDPatternOperator operator>
2449 : InstRILb<opcode, (outs GR64:$R1), (ins pcrel32:$RI2),
2450 mnemonic#"\t$R1, $RI2",
2451 [(set GR64:$R1, (operator pcrel32:$RI2))]>;
2453 class UnaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2454 RegisterOperand cls1, RegisterOperand cls2>
2455 : InstRR<opcode, (outs cls1:$R1), (ins cls2:$R2),
2456 mnemonic#"\t$R1, $R2",
2457 [(set cls1:$R1, (operator cls2:$R2))]> {
2458 let OpKey = mnemonic#cls1;
2462 class UnaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2463 RegisterOperand cls1, RegisterOperand cls2>
2464 : InstRRE<opcode, (outs cls1:$R1), (ins cls2:$R2),
2465 mnemonic#"\t$R1, $R2",
2466 [(set cls1:$R1, (operator cls2:$R2))]> {
2467 let OpKey = mnemonic#cls1;
2471 class UnaryMemRRFc<string mnemonic, bits<16> opcode,
2472 RegisterOperand cls1, RegisterOperand cls2>
2473 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src),
2474 mnemonic#"\t$R1, $R2", []> {
2475 let Constraints = "$R1 = $R1src";
2476 let DisableEncoding = "$R1src";
2480 class UnaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2481 RegisterOperand cls, Immediate imm>
2482 : InstRIa<opcode, (outs cls:$R1), (ins imm:$I2),
2483 mnemonic#"\t$R1, $I2",
2484 [(set cls:$R1, (operator imm:$I2))]>;
2486 class UnaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2487 RegisterOperand cls, Immediate imm>
2488 : InstRILa<opcode, (outs cls:$R1), (ins imm:$I2),
2489 mnemonic#"\t$R1, $I2",
2490 [(set cls:$R1, (operator imm:$I2))]>;
2492 class UnaryRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2493 RegisterOperand cls>
2494 : InstRILb<opcode, (outs cls:$R1), (ins pcrel32:$RI2),
2495 mnemonic#"\t$R1, $RI2",
2496 [(set cls:$R1, (operator pcrel32:$RI2))]> {
2498 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2499 // However, BDXs have two extra operands and are therefore 6 units more
2501 let AddedComplexity = 7;
2504 class CondUnaryRSY<string mnemonic, bits<16> opcode,
2505 SDPatternOperator operator, RegisterOperand cls,
2506 bits<5> bytes, AddressingMode mode = bdaddr20only>
2507 : InstRSYb<opcode, (outs cls:$R1),
2508 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$M3),
2509 mnemonic#"$M3\t$R1, $BD2",
2511 (z_select_ccmask (operator bdaddr20only:$BD2), cls:$R1src,
2512 cond4:$valid, cond4:$M3))]> {
2513 let Constraints = "$R1 = $R1src";
2514 let DisableEncoding = "$R1src";
2516 let AccessBytes = bytes;
2520 // Like CondUnaryRSY, but used for the raw assembly form. The condition-code
2521 // mask is the third operand rather than being part of the mnemonic.
2522 class AsmCondUnaryRSY<string mnemonic, bits<16> opcode,
2523 RegisterOperand cls, bits<5> bytes,
2524 AddressingMode mode = bdaddr20only>
2525 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2, imm32zx4:$M3),
2526 mnemonic#"\t$R1, $BD2, $M3", []> {
2528 let AccessBytes = bytes;
2529 let Constraints = "$R1 = $R1src";
2530 let DisableEncoding = "$R1src";
2533 // Like CondUnaryRSY, but with a fixed CC mask.
2534 class FixedCondUnaryRSY<CondVariant V, string mnemonic, bits<16> opcode,
2535 RegisterOperand cls, bits<5> bytes,
2536 AddressingMode mode = bdaddr20only>
2537 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2),
2538 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2539 let Constraints = "$R1 = $R1src";
2540 let DisableEncoding = "$R1src";
2542 let AccessBytes = bytes;
2543 let isAsmParserOnly = V.alternate;
2547 multiclass CondUnaryRSYPair<string mnemonic, bits<16> opcode,
2548 SDPatternOperator operator,
2549 RegisterOperand cls, bits<5> bytes,
2550 AddressingMode mode = bdaddr20only> {
2551 let isCodeGenOnly = 1 in
2552 def "" : CondUnaryRSY<mnemonic, opcode, operator, cls, bytes, mode>;
2553 def Asm : AsmCondUnaryRSY<mnemonic, opcode, cls, bytes, mode>;
2557 class UnaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2558 RegisterOperand cls, bits<5> bytes,
2559 AddressingMode mode = bdxaddr12only>
2560 : InstRXa<opcode, (outs cls:$R1), (ins mode:$XBD2),
2561 mnemonic#"\t$R1, $XBD2",
2562 [(set cls:$R1, (operator mode:$XBD2))]> {
2563 let OpKey = mnemonic#"r"#cls;
2566 let AccessBytes = bytes;
2569 class UnaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2570 RegisterOperand cls, bits<5> bytes>
2571 : InstRXE<opcode, (outs cls:$R1), (ins bdxaddr12only:$XBD2),
2572 mnemonic#"\t$R1, $XBD2",
2573 [(set cls:$R1, (operator bdxaddr12only:$XBD2))]> {
2574 let OpKey = mnemonic#"r"#cls;
2577 let AccessBytes = bytes;
2581 class UnaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2582 RegisterOperand cls, bits<5> bytes,
2583 AddressingMode mode = bdxaddr20only>
2584 : InstRXYa<opcode, (outs cls:$R1), (ins mode:$XBD2),
2585 mnemonic#"\t$R1, $XBD2",
2586 [(set cls:$R1, (operator mode:$XBD2))]> {
2587 let OpKey = mnemonic#"r"#cls;
2590 let AccessBytes = bytes;
2593 multiclass UnaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
2594 SDPatternOperator operator, RegisterOperand cls,
2596 let DispKey = mnemonic ## #cls in {
2597 let DispSize = "12" in
2598 def "" : UnaryRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
2599 let DispSize = "20" in
2600 def Y : UnaryRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
2605 class UnaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2606 TypedReg tr, Immediate imm, bits<4> type = 0>
2607 : InstVRIa<opcode, (outs tr.op:$V1), (ins imm:$I2),
2608 mnemonic#"\t$V1, $I2",
2609 [(set tr.op:$V1, (tr.vt (operator imm:$I2)))]> {
2613 class UnaryVRIaGeneric<string mnemonic, bits<16> opcode, Immediate imm>
2614 : InstVRIa<opcode, (outs VR128:$V1), (ins imm:$I2, imm32zx4:$M3),
2615 mnemonic#"\t$V1, $I2, $M3", []>;
2617 class UnaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2618 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0,
2620 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2),
2621 mnemonic#"\t$V1, $V2",
2622 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2))))]> {
2628 class UnaryVRRaGeneric<string mnemonic, bits<16> opcode, bits<4> m4 = 0,
2630 : InstVRRa<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3),
2631 mnemonic#"\t$V1, $V2, $M3", []> {
2636 class UnaryVRRaFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0>
2637 : InstVRRa<opcode, (outs VR128:$V1),
2638 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4),
2639 mnemonic#"\t$V1, $V2, $M3, $M4", []> {
2643 // Declare a pair of instructions, one which sets CC and one which doesn't.
2644 // The CC-setting form ends with "S" and sets the low bit of M5.
2645 // The form that does not set CC has an extra operand to optionally allow
2646 // specifying arbitrary M5 values in assembler.
2647 multiclass UnaryExtraVRRaSPair<string mnemonic, bits<16> opcode,
2648 SDPatternOperator operator,
2649 SDPatternOperator operator_cc,
2650 TypedReg tr1, TypedReg tr2, bits<4> type> {
2651 let M3 = type, M4 = 0 in
2652 def "" : InstVRRa<opcode, (outs tr1.op:$V1),
2653 (ins tr2.op:$V2, imm32zx4:$M5),
2654 mnemonic#"\t$V1, $V2, $M5", []>;
2655 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2))),
2656 (!cast<Instruction>(NAME) tr2.op:$V2, 0)>;
2657 def : InstAlias<mnemonic#"\t$V1, $V2",
2658 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 0)>;
2660 def S : UnaryVRRa<mnemonic##"s", opcode, operator_cc, tr1, tr2,
2664 multiclass UnaryExtraVRRaSPairGeneric<string mnemonic, bits<16> opcode> {
2666 def "" : InstVRRa<opcode, (outs VR128:$V1),
2667 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M5),
2668 mnemonic#"\t$V1, $V2, $M3, $M5", []>;
2669 def : InstAlias<mnemonic#"\t$V1, $V2, $M3",
2670 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2,
2674 class UnaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2675 TypedReg tr, bits<5> bytes, bits<4> type = 0>
2676 : InstVRX<opcode, (outs tr.op:$V1), (ins bdxaddr12only:$XBD2),
2677 mnemonic#"\t$V1, $XBD2",
2678 [(set tr.op:$V1, (tr.vt (operator bdxaddr12only:$XBD2)))]> {
2681 let AccessBytes = bytes;
2684 class UnaryVRXGeneric<string mnemonic, bits<16> opcode>
2685 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
2686 mnemonic#"\t$V1, $XBD2, $M3", []> {
2690 class SideEffectBinaryRX<string mnemonic, bits<8> opcode,
2691 RegisterOperand cls>
2692 : InstRXa<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
2693 mnemonic##"\t$R1, $XBD2", []>;
2695 class SideEffectBinaryRILPC<string mnemonic, bits<12> opcode,
2696 RegisterOperand cls>
2697 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
2698 mnemonic##"\t$R1, $RI2", []> {
2699 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2700 // However, BDXs have two extra operands and are therefore 6 units more
2702 let AddedComplexity = 7;
2705 class SideEffectBinaryIE<string mnemonic, bits<16> opcode,
2706 Immediate imm1, Immediate imm2>
2707 : InstIE<opcode, (outs), (ins imm1:$I1, imm2:$I2),
2708 mnemonic#"\t$I1, $I2", []>;
2710 class SideEffectBinarySI<string mnemonic, bits<8> opcode, Operand imm>
2711 : InstSI<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
2712 mnemonic#"\t$BD1, $I2", []>;
2714 class SideEffectBinarySIL<string mnemonic, bits<16> opcode,
2715 SDPatternOperator operator, Immediate imm>
2716 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
2717 mnemonic#"\t$BD1, $I2", [(operator bdaddr12only:$BD1, imm:$I2)]>;
2719 class SideEffectBinarySSa<string mnemonic, bits<8> opcode>
2720 : InstSSa<opcode, (outs), (ins bdladdr12onlylen8:$BDL1, bdaddr12only:$BD2),
2721 mnemonic##"\t$BDL1, $BD2", []>;
2723 class SideEffectBinarySSb<string mnemonic, bits<8> opcode>
2725 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2),
2726 mnemonic##"\t$BDL1, $BDL2", []>;
2728 class SideEffectBinarySSf<string mnemonic, bits<8> opcode>
2729 : InstSSf<opcode, (outs), (ins bdaddr12only:$BD1, bdladdr12onlylen8:$BDL2),
2730 mnemonic##"\t$BD1, $BDL2", []>;
2732 class SideEffectBinaryMemMemRR<string mnemonic, bits<8> opcode,
2733 RegisterOperand cls1, RegisterOperand cls2>
2734 : InstRR<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
2735 mnemonic#"\t$R1, $R2", []> {
2736 let Constraints = "$R1 = $R1src, $R2 = $R2src";
2737 let DisableEncoding = "$R1src, $R2src";
2740 class SideEffectBinaryMemRRE<string mnemonic, bits<16> opcode,
2741 RegisterOperand cls1, RegisterOperand cls2>
2742 : InstRRE<opcode, (outs cls2:$R2), (ins cls1:$R1, cls2:$R2src),
2743 mnemonic#"\t$R1, $R2", []> {
2744 let Constraints = "$R2 = $R2src";
2745 let DisableEncoding = "$R2src";
2748 class SideEffectBinaryMemMemRRE<string mnemonic, bits<16> opcode,
2749 RegisterOperand cls1, RegisterOperand cls2>
2750 : InstRRE<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
2751 mnemonic#"\t$R1, $R2", []> {
2752 let Constraints = "$R1 = $R1src, $R2 = $R2src";
2753 let DisableEncoding = "$R1src, $R2src";
2756 class SideEffectBinaryMemMemRRFc<string mnemonic, bits<16> opcode,
2757 RegisterOperand cls1, RegisterOperand cls2>
2758 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
2759 mnemonic#"\t$R1, $R2", []> {
2760 let Constraints = "$R1 = $R1src, $R2 = $R2src";
2761 let DisableEncoding = "$R1src, $R2src";
2765 class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2766 RegisterOperand cls1, RegisterOperand cls2>
2767 : InstRR<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
2768 mnemonic#"\t$R1, $R2",
2769 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
2770 let OpKey = mnemonic#cls1;
2772 let Constraints = "$R1 = $R1src";
2773 let DisableEncoding = "$R1src";
2776 class BinaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2777 RegisterOperand cls1, RegisterOperand cls2>
2778 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
2779 mnemonic#"\t$R1, $R2",
2780 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
2781 let OpKey = mnemonic#cls1;
2783 let Constraints = "$R1 = $R1src";
2784 let DisableEncoding = "$R1src";
2787 class BinaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2788 RegisterOperand cls1, RegisterOperand cls2>
2789 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R3, cls2:$R2),
2790 mnemonic#"\t$R1, $R3, $R2",
2791 [(set cls1:$R1, (operator cls2:$R3, cls2:$R2))]> {
2792 let OpKey = mnemonic#cls;
2796 class BinaryRRFa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2797 RegisterOperand cls1, RegisterOperand cls2,
2798 RegisterOperand cls3>
2799 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
2800 mnemonic#"\t$R1, $R2, $R3",
2801 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
2805 multiclass BinaryRRAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
2806 SDPatternOperator operator, RegisterOperand cls1,
2807 RegisterOperand cls2> {
2808 let NumOpsKey = mnemonic in {
2809 let NumOpsValue = "3" in
2810 def K : BinaryRRFa<mnemonic#"k", opcode2, null_frag, cls1, cls1, cls2>,
2811 Requires<[FeatureDistinctOps]>;
2812 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
2813 def "" : BinaryRR<mnemonic, opcode1, operator, cls1, cls2>;
2817 multiclass BinaryRREAndK<string mnemonic, bits<16> opcode1, bits<16> opcode2,
2818 SDPatternOperator operator, RegisterOperand cls1,
2819 RegisterOperand cls2> {
2820 let NumOpsKey = mnemonic in {
2821 let NumOpsValue = "3" in
2822 def K : BinaryRRFa<mnemonic#"k", opcode2, null_frag, cls1, cls1, cls2>,
2823 Requires<[FeatureDistinctOps]>;
2824 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
2825 def "" : BinaryRRE<mnemonic, opcode1, operator, cls1, cls2>;
2829 class BinaryRRFb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2830 RegisterOperand cls1, RegisterOperand cls2,
2831 RegisterOperand cls3>
2832 : InstRRFb<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
2833 mnemonic#"\t$R1, $R3, $R2",
2834 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
2838 class BinaryMemRRFc<string mnemonic, bits<16> opcode,
2839 RegisterOperand cls1, RegisterOperand cls2, Immediate imm>
2840 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src, imm:$M3),
2841 mnemonic#"\t$R1, $R2, $M3", []> {
2842 let Constraints = "$R1 = $R1src";
2843 let DisableEncoding = "$R1src";
2846 multiclass BinaryMemRRFcOpt<string mnemonic, bits<16> opcode,
2847 RegisterOperand cls1, RegisterOperand cls2> {
2848 def "" : BinaryMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
2849 def Opt : UnaryMemRRFc<mnemonic, opcode, cls1, cls2>;
2852 class BinaryRRFd<string mnemonic, bits<16> opcode, RegisterOperand cls1,
2853 RegisterOperand cls2>
2854 : InstRRFd<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M4),
2855 mnemonic#"\t$R1, $R2, $M4", []>;
2857 class BinaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
2858 RegisterOperand cls2>
2859 : InstRRFe<opcode, (outs cls1:$R1), (ins imm32zx4:$M3, cls2:$R2),
2860 mnemonic#"\t$R1, $M3, $R2", []> {
2864 class CondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
2865 RegisterOperand cls2>
2866 : InstRRFc<opcode, (outs cls1:$R1),
2867 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
2868 mnemonic#"$M3\t$R1, $R2", []> {
2869 let Constraints = "$R1 = $R1src";
2870 let DisableEncoding = "$R1src";
2874 // Like CondBinaryRRF, but used for the raw assembly form. The condition-code
2875 // mask is the third operand rather than being part of the mnemonic.
2876 class AsmCondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
2877 RegisterOperand cls2>
2878 : InstRRFc<opcode, (outs cls1:$R1),
2879 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M3),
2880 mnemonic#"\t$R1, $R2, $M3", []> {
2881 let Constraints = "$R1 = $R1src";
2882 let DisableEncoding = "$R1src";
2885 // Like CondBinaryRRF, but with a fixed CC mask.
2886 class FixedCondBinaryRRF<CondVariant V, string mnemonic, bits<16> opcode,
2887 RegisterOperand cls1, RegisterOperand cls2>
2888 : InstRRFc<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
2889 mnemonic#V.suffix#"\t$R1, $R2", []> {
2890 let Constraints = "$R1 = $R1src";
2891 let DisableEncoding = "$R1src";
2892 let isAsmParserOnly = V.alternate;
2896 multiclass CondBinaryRRFPair<string mnemonic, bits<16> opcode,
2897 RegisterOperand cls1, RegisterOperand cls2> {
2898 let isCodeGenOnly = 1 in
2899 def "" : CondBinaryRRF<mnemonic, opcode, cls1, cls2>;
2900 def Asm : AsmCondBinaryRRF<mnemonic, opcode, cls1, cls2>;
2903 class BinaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2904 RegisterOperand cls, Immediate imm>
2905 : InstRIa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
2906 mnemonic#"\t$R1, $I2",
2907 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
2908 let Constraints = "$R1 = $R1src";
2909 let DisableEncoding = "$R1src";
2912 class BinaryRIE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2913 RegisterOperand cls, Immediate imm>
2914 : InstRIEd<opcode, (outs cls:$R1), (ins cls:$R3, imm:$I2),
2915 mnemonic#"\t$R1, $R3, $I2",
2916 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
2918 multiclass BinaryRIAndK<string mnemonic, bits<12> opcode1, bits<16> opcode2,
2919 SDPatternOperator operator, RegisterOperand cls,
2921 let NumOpsKey = mnemonic in {
2922 let NumOpsValue = "3" in
2923 def K : BinaryRIE<mnemonic##"k", opcode2, null_frag, cls, imm>,
2924 Requires<[FeatureDistinctOps]>;
2925 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
2926 def "" : BinaryRI<mnemonic, opcode1, operator, cls, imm>;
2930 class CondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
2932 : InstRIEg<opcode, (outs cls:$R1),
2933 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
2934 mnemonic#"$M3\t$R1, $I2",
2935 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
2936 cond4:$valid, cond4:$M3))]> {
2937 let Constraints = "$R1 = $R1src";
2938 let DisableEncoding = "$R1src";
2942 // Like CondBinaryRIE, but used for the raw assembly form. The condition-code
2943 // mask is the third operand rather than being part of the mnemonic.
2944 class AsmCondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
2946 : InstRIEg<opcode, (outs cls:$R1),
2947 (ins cls:$R1src, imm:$I2, imm32zx4:$M3),
2948 mnemonic#"\t$R1, $I2, $M3", []> {
2949 let Constraints = "$R1 = $R1src";
2950 let DisableEncoding = "$R1src";
2953 // Like CondBinaryRIE, but with a fixed CC mask.
2954 class FixedCondBinaryRIE<CondVariant V, string mnemonic, bits<16> opcode,
2955 RegisterOperand cls, Immediate imm>
2956 : InstRIEg<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
2957 mnemonic#V.suffix#"\t$R1, $I2", []> {
2958 let Constraints = "$R1 = $R1src";
2959 let DisableEncoding = "$R1src";
2960 let isAsmParserOnly = V.alternate;
2964 multiclass CondBinaryRIEPair<string mnemonic, bits<16> opcode,
2965 RegisterOperand cls, Immediate imm> {
2966 let isCodeGenOnly = 1 in
2967 def "" : CondBinaryRIE<mnemonic, opcode, cls, imm>;
2968 def Asm : AsmCondBinaryRIE<mnemonic, opcode, cls, imm>;
2971 class BinaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2972 RegisterOperand cls, Immediate imm>
2973 : InstRILa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
2974 mnemonic#"\t$R1, $I2",
2975 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
2976 let Constraints = "$R1 = $R1src";
2977 let DisableEncoding = "$R1src";
2980 class BinaryRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2981 RegisterOperand cls>
2982 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, shift12only:$BD2),
2983 mnemonic#"\t$R1, $BD2",
2984 [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> {
2986 let Constraints = "$R1 = $R1src";
2987 let DisableEncoding = "$R1src";
2990 class BinaryRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2991 RegisterOperand cls>
2992 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, shift20only:$BD2),
2993 mnemonic#"\t$R1, $R3, $BD2",
2994 [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>;
2996 multiclass BinaryRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
2997 SDPatternOperator operator, RegisterOperand cls> {
2998 let NumOpsKey = mnemonic in {
2999 let NumOpsValue = "3" in
3000 def K : BinaryRSY<mnemonic##"k", opcode2, null_frag, cls>,
3001 Requires<[FeatureDistinctOps]>;
3002 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
3003 def "" : BinaryRS<mnemonic, opcode1, operator, cls>;
3007 class BinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
3008 : InstRSLb<opcode, (outs cls:$R1),
3009 (ins bdladdr12onlylen8:$BDL2, imm32zx4:$M3),
3010 mnemonic#"\t$R1, $BDL2, $M3", []> {
3014 class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3015 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3016 AddressingMode mode = bdxaddr12only>
3017 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2),
3018 mnemonic#"\t$R1, $XBD2",
3019 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3020 let OpKey = mnemonic#"r"#cls;
3022 let Constraints = "$R1 = $R1src";
3023 let DisableEncoding = "$R1src";
3025 let AccessBytes = bytes;
3028 class BinaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3029 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
3030 : InstRXE<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2),
3031 mnemonic#"\t$R1, $XBD2",
3032 [(set cls:$R1, (operator cls:$R1src,
3033 (load bdxaddr12only:$XBD2)))]> {
3034 let OpKey = mnemonic#"r"#cls;
3036 let Constraints = "$R1 = $R1src";
3037 let DisableEncoding = "$R1src";
3039 let AccessBytes = bytes;
3043 class BinaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3044 RegisterOperand cls1, RegisterOperand cls2,
3045 SDPatternOperator load, bits<5> bytes>
3046 : InstRXF<opcode, (outs cls1:$R1), (ins cls2:$R3, bdxaddr12only:$XBD2),
3047 mnemonic#"\t$R1, $R3, $XBD2",
3048 [(set cls1:$R1, (operator cls2:$R3, (load bdxaddr12only:$XBD2)))]> {
3049 let OpKey = mnemonic#"r"#cls;
3052 let AccessBytes = bytes;
3055 class BinaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3056 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3057 AddressingMode mode = bdxaddr20only>
3058 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2),
3059 mnemonic#"\t$R1, $XBD2",
3060 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3061 let OpKey = mnemonic#"r"#cls;
3063 let Constraints = "$R1 = $R1src";
3064 let DisableEncoding = "$R1src";
3066 let AccessBytes = bytes;
3069 multiclass BinaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3070 SDPatternOperator operator, RegisterOperand cls,
3071 SDPatternOperator load, bits<5> bytes> {
3072 let DispKey = mnemonic ## #cls in {
3073 let DispSize = "12" in
3074 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes,
3076 let DispSize = "20" in
3077 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load, bytes,
3082 class BinarySI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3083 Operand imm, AddressingMode mode = bdaddr12only>
3084 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
3085 mnemonic#"\t$BD1, $I2",
3086 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
3091 class BinarySIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3092 Operand imm, AddressingMode mode = bdaddr20only>
3093 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
3094 mnemonic#"\t$BD1, $I2",
3095 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
3100 multiclass BinarySIPair<string mnemonic, bits<8> siOpcode,
3101 bits<16> siyOpcode, SDPatternOperator operator,
3103 let DispKey = mnemonic ## #cls in {
3104 let DispSize = "12" in
3105 def "" : BinarySI<mnemonic, siOpcode, operator, imm, bdaddr12pair>;
3106 let DispSize = "20" in
3107 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>;
3111 class BinarySSF<string mnemonic, bits<12> opcode, RegisterOperand cls>
3112 : InstSSF<opcode, (outs cls:$R3), (ins bdaddr12pair:$BD1, bdaddr12pair:$BD2),
3113 mnemonic#"\t$R3, $BD1, $BD2", []> {
3117 class BinaryVRIb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3118 TypedReg tr, bits<4> type>
3119 : InstVRIb<opcode, (outs tr.op:$V1), (ins imm32zx8:$I2, imm32zx8:$I3),
3120 mnemonic#"\t$V1, $I2, $I3",
3121 [(set tr.op:$V1, (tr.vt (operator imm32zx8:$I2, imm32zx8:$I3)))]> {
3125 class BinaryVRIbGeneric<string mnemonic, bits<16> opcode>
3126 : InstVRIb<opcode, (outs VR128:$V1),
3127 (ins imm32zx8:$I2, imm32zx8:$I3, imm32zx4:$M4),
3128 mnemonic#"\t$V1, $I2, $I3, $M4", []>;
3130 class BinaryVRIc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3131 TypedReg tr1, TypedReg tr2, bits<4> type>
3132 : InstVRIc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, imm32zx16:$I2),
3133 mnemonic#"\t$V1, $V3, $I2",
3134 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V3),
3135 imm32zx16:$I2)))]> {
3139 class BinaryVRIcGeneric<string mnemonic, bits<16> opcode>
3140 : InstVRIc<opcode, (outs VR128:$V1),
3141 (ins VR128:$V3, imm32zx16:$I2, imm32zx4:$M4),
3142 mnemonic#"\t$V1, $V3, $I2, $M4", []>;
3144 class BinaryVRIe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3145 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5>
3146 : InstVRIe<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx12:$I3),
3147 mnemonic#"\t$V1, $V2, $I3",
3148 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3149 imm32zx12:$I3)))]> {
3154 class BinaryVRIeFloatGeneric<string mnemonic, bits<16> opcode>
3155 : InstVRIe<opcode, (outs VR128:$V1),
3156 (ins VR128:$V2, imm32zx12:$I3, imm32zx4:$M4, imm32zx4:$M5),
3157 mnemonic#"\t$V1, $V2, $I3, $M4, $M5", []>;
3159 class BinaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3160 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0>
3161 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx4:$M5),
3162 mnemonic#"\t$V1, $V2, $M5",
3163 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3164 imm32zx12:$M5)))]> {
3169 class BinaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
3170 : InstVRRa<opcode, (outs VR128:$V1),
3171 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
3172 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
3174 class BinaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3175 TypedReg tr1, TypedReg tr2, bits<4> type = 0,
3176 bits<4> modifier = 0>
3177 : InstVRRb<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3178 mnemonic#"\t$V1, $V2, $V3",
3179 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3180 (tr2.vt tr2.op:$V3))))]> {
3185 // Declare a pair of instructions, one which sets CC and one which doesn't.
3186 // The CC-setting form ends with "S" and sets the low bit of M5.
3187 multiclass BinaryVRRbSPair<string mnemonic, bits<16> opcode,
3188 SDPatternOperator operator,
3189 SDPatternOperator operator_cc, TypedReg tr1,
3190 TypedReg tr2, bits<4> type, bits<4> modifier = 0> {
3191 def "" : BinaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
3192 !and (modifier, 14)>;
3194 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
3195 !add (!and (modifier, 14), 1)>;
3198 class BinaryVRRbSPairGeneric<string mnemonic, bits<16> opcode>
3199 : InstVRRb<opcode, (outs VR128:$V1),
3200 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3201 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
3203 // Declare a pair of instructions, one which sets CC and one which doesn't.
3204 // The CC-setting form ends with "S" and sets the low bit of M5.
3205 // The form that does not set CC has an extra operand to optionally allow
3206 // specifying arbitrary M5 values in assembler.
3207 multiclass BinaryExtraVRRbSPair<string mnemonic, bits<16> opcode,
3208 SDPatternOperator operator,
3209 SDPatternOperator operator_cc,
3210 TypedReg tr1, TypedReg tr2, bits<4> type> {
3212 def "" : InstVRRb<opcode, (outs tr1.op:$V1),
3213 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M5),
3214 mnemonic#"\t$V1, $V2, $V3, $M5", []>;
3215 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3))),
3216 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, 0)>;
3217 def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
3218 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
3221 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 1>;
3224 multiclass BinaryExtraVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
3225 def "" : InstVRRb<opcode, (outs VR128:$V1),
3226 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3227 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
3228 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
3229 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
3233 class BinaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3234 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0,
3236 : InstVRRc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3237 mnemonic#"\t$V1, $V2, $V3",
3238 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3239 (tr2.vt tr2.op:$V3))))]> {
3245 class BinaryVRRcGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0,
3247 : InstVRRc<opcode, (outs VR128:$V1),
3248 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4),
3249 mnemonic#"\t$V1, $V2, $V3, $M4", []> {
3254 class BinaryVRRcFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m6 = 0>
3255 : InstVRRc<opcode, (outs VR128:$V1),
3256 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3257 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> {
3261 // Declare a pair of instructions, one which sets CC and one which doesn't.
3262 // The CC-setting form ends with "S" and sets the low bit of M5.
3263 multiclass BinaryVRRcSPair<string mnemonic, bits<16> opcode,
3264 SDPatternOperator operator,
3265 SDPatternOperator operator_cc, TypedReg tr1,
3266 TypedReg tr2, bits<4> type, bits<4> m5,
3267 bits<4> modifier = 0> {
3268 def "" : BinaryVRRc<mnemonic, opcode, operator, tr1, tr2, type,
3269 m5, !and (modifier, 14)>;
3271 def S : BinaryVRRc<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
3272 m5, !add (!and (modifier, 14), 1)>;
3275 class BinaryVRRcSPairFloatGeneric<string mnemonic, bits<16> opcode>
3276 : InstVRRc<opcode, (outs VR128:$V1),
3277 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
3279 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
3281 class BinaryVRRf<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3283 : InstVRRf<opcode, (outs tr.op:$V1), (ins GR64:$R2, GR64:$R3),
3284 mnemonic#"\t$V1, $R2, $R3",
3285 [(set tr.op:$V1, (tr.vt (operator GR64:$R2, GR64:$R3)))]>;
3287 class BinaryVRSa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3288 TypedReg tr1, TypedReg tr2, bits<4> type>
3289 : InstVRSa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, shift12only:$BD2),
3290 mnemonic#"\t$V1, $V3, $BD2",
3291 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V3),
3292 shift12only:$BD2)))]> {
3296 class BinaryVRSaGeneric<string mnemonic, bits<16> opcode>
3297 : InstVRSa<opcode, (outs VR128:$V1),
3298 (ins VR128:$V3, shift12only:$BD2, imm32zx4:$M4),
3299 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
3301 class BinaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3303 : InstVRSb<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2),
3304 mnemonic#"\t$V1, $R3, $BD2",
3305 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
3308 let AccessBytes = bytes;
3311 class BinaryVRSc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3312 TypedReg tr, bits<4> type>
3313 : InstVRSc<opcode, (outs GR64:$R1), (ins tr.op:$V3, shift12only:$BD2),
3314 mnemonic#"\t$R1, $V3, $BD2",
3315 [(set GR64:$R1, (operator (tr.vt tr.op:$V3), shift12only:$BD2))]> {
3319 class BinaryVRScGeneric<string mnemonic, bits<16> opcode>
3320 : InstVRSc<opcode, (outs GR64:$R1),
3321 (ins VR128:$V3, shift12only:$BD2, imm32zx4: $M4),
3322 mnemonic#"\t$R1, $V3, $BD2, $M4", []>;
3324 class BinaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3325 TypedReg tr, bits<5> bytes>
3326 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
3327 mnemonic#"\t$V1, $XBD2, $M3",
3328 [(set tr.op:$V1, (tr.vt (operator bdxaddr12only:$XBD2,
3331 let AccessBytes = bytes;
3334 class StoreBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
3335 bits<5> bytes, AddressingMode mode = bdaddr12only>
3336 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3337 mnemonic#"\t$R1, $M3, $BD2", []> {
3339 let AccessBytes = bytes;
3342 class StoreBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
3343 bits<5> bytes, AddressingMode mode = bdaddr20only>
3344 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3345 mnemonic#"\t$R1, $M3, $BD2", []> {
3347 let AccessBytes = bytes;
3350 multiclass StoreBinaryRSPair<string mnemonic, bits<8> rsOpcode,
3351 bits<16> rsyOpcode, RegisterOperand cls,
3353 let DispKey = mnemonic ## #cls in {
3354 let DispSize = "12" in
3355 def "" : StoreBinaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
3356 let DispSize = "20" in
3357 def Y : StoreBinaryRSY<mnemonic#"y", rsyOpcode, cls, bytes,
3362 class StoreBinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
3363 : InstRSLb<opcode, (outs),
3364 (ins cls:$R1, bdladdr12onlylen8:$BDL2, imm32zx4:$M3),
3365 mnemonic#"\t$R1, $BDL2, $M3", []> {
3369 class StoreBinaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
3371 : InstVRV<opcode, (outs), (ins VR128:$V1, bdvaddr12only:$VBD2, index:$M3),
3372 mnemonic#"\t$V1, $VBD2, $M3", []> {
3374 let AccessBytes = bytes;
3377 class StoreBinaryVRX<string mnemonic, bits<16> opcode,
3378 SDPatternOperator operator, TypedReg tr, bits<5> bytes,
3380 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2, index:$M3),
3381 mnemonic#"\t$V1, $XBD2, $M3",
3382 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2, index:$M3)]> {
3384 let AccessBytes = bytes;
3387 class MemoryBinarySSd<string mnemonic, bits<8> opcode,
3388 RegisterOperand cls>
3389 : InstSSd<opcode, (outs),
3390 (ins bdraddr12only:$RBD1, bdaddr12only:$BD2, cls:$R3),
3391 mnemonic#"\t$RBD1, $BD2, $R3", []>;
3393 class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3394 RegisterOperand cls1, RegisterOperand cls2>
3395 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3396 mnemonic#"\t$R1, $R2",
3397 [(operator cls1:$R1, cls2:$R2)]> {
3398 let OpKey = mnemonic#cls1;
3403 class CompareRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3404 RegisterOperand cls1, RegisterOperand cls2>
3405 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3406 mnemonic#"\t$R1, $R2",
3407 [(operator cls1:$R1, cls2:$R2)]> {
3408 let OpKey = mnemonic#cls1;
3413 class CompareRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3414 RegisterOperand cls, Immediate imm>
3415 : InstRIa<opcode, (outs), (ins cls:$R1, imm:$I2),
3416 mnemonic#"\t$R1, $I2",
3417 [(operator cls:$R1, imm:$I2)]> {
3421 class CompareRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3422 RegisterOperand cls, Immediate imm>
3423 : InstRILa<opcode, (outs), (ins cls:$R1, imm:$I2),
3424 mnemonic#"\t$R1, $I2",
3425 [(operator cls:$R1, imm:$I2)]> {
3429 class CompareRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3430 RegisterOperand cls, SDPatternOperator load>
3431 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
3432 mnemonic#"\t$R1, $RI2",
3433 [(operator cls:$R1, (load pcrel32:$RI2))]> {
3436 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
3437 // However, BDXs have two extra operands and are therefore 6 units more
3439 let AddedComplexity = 7;
3442 class CompareRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3443 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3444 AddressingMode mode = bdxaddr12only>
3445 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
3446 mnemonic#"\t$R1, $XBD2",
3447 [(operator cls:$R1, (load mode:$XBD2))]> {
3448 let OpKey = mnemonic#"r"#cls;
3452 let AccessBytes = bytes;
3455 class CompareRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3456 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
3457 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
3458 mnemonic#"\t$R1, $XBD2",
3459 [(operator cls:$R1, (load bdxaddr12only:$XBD2))]> {
3460 let OpKey = mnemonic#"r"#cls;
3464 let AccessBytes = bytes;
3468 class CompareRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3469 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3470 AddressingMode mode = bdxaddr20only>
3471 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
3472 mnemonic#"\t$R1, $XBD2",
3473 [(operator cls:$R1, (load mode:$XBD2))]> {
3474 let OpKey = mnemonic#"r"#cls;
3478 let AccessBytes = bytes;
3481 multiclass CompareRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3482 SDPatternOperator operator, RegisterOperand cls,
3483 SDPatternOperator load, bits<5> bytes> {
3484 let DispKey = mnemonic ## #cls in {
3485 let DispSize = "12" in
3486 def "" : CompareRX<mnemonic, rxOpcode, operator, cls,
3487 load, bytes, bdxaddr12pair>;
3488 let DispSize = "20" in
3489 def Y : CompareRXY<mnemonic#"y", rxyOpcode, operator, cls,
3490 load, bytes, bdxaddr20pair>;
3494 class CompareRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
3495 bits<5> bytes, AddressingMode mode = bdaddr12only>
3496 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3497 mnemonic#"\t$R1, $M3, $BD2", []> {
3499 let AccessBytes = bytes;
3502 class CompareRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
3503 bits<5> bytes, AddressingMode mode = bdaddr20only>
3504 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3505 mnemonic#"\t$R1, $M3, $BD2", []> {
3507 let AccessBytes = bytes;
3510 multiclass CompareRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
3511 RegisterOperand cls, bits<5> bytes> {
3512 let DispKey = mnemonic ## #cls in {
3513 let DispSize = "12" in
3514 def "" : CompareRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
3515 let DispSize = "20" in
3516 def Y : CompareRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
3520 class CompareSSb<string mnemonic, bits<8> opcode>
3522 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2),
3523 mnemonic##"\t$BDL1, $BDL2", []> {
3528 class CompareSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3529 SDPatternOperator load, Immediate imm,
3530 AddressingMode mode = bdaddr12only>
3531 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
3532 mnemonic#"\t$BD1, $I2",
3533 [(operator (load mode:$BD1), imm:$I2)]> {
3538 class CompareSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3539 SDPatternOperator load, Immediate imm>
3540 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
3541 mnemonic#"\t$BD1, $I2",
3542 [(operator (load bdaddr12only:$BD1), imm:$I2)]> {
3547 class CompareSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3548 SDPatternOperator load, Immediate imm,
3549 AddressingMode mode = bdaddr20only>
3550 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
3551 mnemonic#"\t$BD1, $I2",
3552 [(operator (load mode:$BD1), imm:$I2)]> {
3557 multiclass CompareSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
3558 SDPatternOperator operator, SDPatternOperator load,
3560 let DispKey = mnemonic in {
3561 let DispSize = "12" in
3562 def "" : CompareSI<mnemonic, siOpcode, operator, load, imm, bdaddr12pair>;
3563 let DispSize = "20" in
3564 def Y : CompareSIY<mnemonic#"y", siyOpcode, operator, load, imm,
3569 class CompareVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3570 TypedReg tr, bits<4> type>
3571 : InstVRRa<opcode, (outs), (ins tr.op:$V1, tr.op:$V2),
3572 mnemonic#"\t$V1, $V2",
3573 [(operator (tr.vt tr.op:$V1), (tr.vt tr.op:$V2))]> {
3580 class CompareVRRaGeneric<string mnemonic, bits<16> opcode>
3581 : InstVRRa<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
3582 mnemonic#"\t$V1, $V2, $M3", []> {
3588 class CompareVRRaFloatGeneric<string mnemonic, bits<16> opcode>
3589 : InstVRRa<opcode, (outs),
3590 (ins VR64:$V1, VR64:$V2, imm32zx4:$M3, imm32zx4:$M4),
3591 mnemonic#"\t$V1, $V2, $M3, $M4", []> {
3596 class TestRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3597 RegisterOperand cls>
3598 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
3599 mnemonic#"\t$R1, $XBD2",
3600 [(operator cls:$R1, bdxaddr12only:$XBD2)]> {
3604 class TestRSL<string mnemonic, bits<16> opcode>
3605 : InstRSLa<opcode, (outs), (ins bdladdr12onlylen4:$BDL1),
3606 mnemonic#"\t$BDL1", []> {
3610 class SideEffectTernarySSc<string mnemonic, bits<8> opcode>
3611 : InstSSc<opcode, (outs), (ins bdladdr12onlylen4:$BDL1,
3612 shift12only:$BD2, imm32zx4:$I3),
3613 mnemonic##"\t$BDL1, $BD2, $I3", []>;
3615 class SideEffectTernaryMemMemMemRRFb<string mnemonic, bits<16> opcode,
3616 RegisterOperand cls1,
3617 RegisterOperand cls2,
3618 RegisterOperand cls3>
3619 : InstRRFb<opcode, (outs cls1:$R1, cls2:$R2, cls3:$R3),
3620 (ins cls1:$R1src, cls2:$R2src, cls3:$R3src),
3621 mnemonic#"\t$R1, $R3, $R2", []> {
3622 let Constraints = "$R1 = $R1src, $R2 = $R2src, $R3 = $R3src";
3623 let DisableEncoding = "$R1src, $R2src, $R3src";
3627 class SideEffectTernaryRRFc<string mnemonic, bits<16> opcode,
3628 RegisterOperand cls1, RegisterOperand cls2,
3630 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2, imm:$M3),
3631 mnemonic#"\t$R1, $R2, $M3", []>;
3633 class SideEffectTernaryMemMemRRFc<string mnemonic, bits<16> opcode,
3634 RegisterOperand cls1, RegisterOperand cls2,
3636 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2),
3637 (ins cls1:$R1src, cls2:$R2src, imm:$M3),
3638 mnemonic#"\t$R1, $R2, $M3", []> {
3639 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3640 let DisableEncoding = "$R1src, $R2src";
3643 multiclass SideEffectTernaryMemMemRRFcOpt<string mnemonic, bits<16> opcode,
3644 RegisterOperand cls1,
3645 RegisterOperand cls2> {
3646 def "" : SideEffectTernaryMemMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
3647 def Opt : SideEffectBinaryMemMemRRFc<mnemonic, opcode, cls1, cls2>;
3650 class SideEffectTernarySSF<string mnemonic, bits<12> opcode,
3651 RegisterOperand cls>
3652 : InstSSF<opcode, (outs),
3653 (ins bdaddr12only:$BD1, bdaddr12only:$BD2, cls:$R3),
3654 mnemonic#"\t$BD1, $BD2, $R3", []>;
3656 class TernaryRRFa<string mnemonic, bits<16> opcode,
3657 RegisterOperand cls1, RegisterOperand cls2,
3658 RegisterOperand cls3>
3659 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3, imm32zx4:$M4),
3660 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
3662 class TernaryRRFb<string mnemonic, bits<16> opcode,
3663 RegisterOperand cls1, RegisterOperand cls2,
3664 RegisterOperand cls3>
3665 : InstRRFb<opcode, (outs cls1:$R1, cls3:$R3),
3666 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M4),
3667 mnemonic#"\t$R1, $R3, $R2, $M4", []> {
3668 let Constraints = "$R1 = $R1src";
3669 let DisableEncoding = "$R1src";
3672 class TernaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3673 RegisterOperand cls2>
3674 : InstRRFe<opcode, (outs cls1:$R1),
3675 (ins imm32zx4:$M3, cls2:$R2, imm32zx4:$M4),
3676 mnemonic#"\t$R1, $M3, $R2, $M4", []>;
3678 class TernaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3679 RegisterOperand cls1, RegisterOperand cls2>
3680 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R1src, cls2:$R3, cls2:$R2),
3681 mnemonic#"\t$R1, $R3, $R2",
3682 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3, cls2:$R2))]> {
3683 let OpKey = mnemonic#cls;
3685 let Constraints = "$R1 = $R1src";
3686 let DisableEncoding = "$R1src";
3689 class TernaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
3690 bits<5> bytes, AddressingMode mode = bdaddr12only>
3691 : InstRSb<opcode, (outs cls:$R1),
3692 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2),
3693 mnemonic#"\t$R1, $M3, $BD2", []> {
3695 let Constraints = "$R1 = $R1src";
3696 let DisableEncoding = "$R1src";
3698 let AccessBytes = bytes;
3701 class TernaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
3702 bits<5> bytes, AddressingMode mode = bdaddr20only>
3703 : InstRSYb<opcode, (outs cls:$R1),
3704 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2),
3705 mnemonic#"\t$R1, $M3, $BD2", []> {
3707 let Constraints = "$R1 = $R1src";
3708 let DisableEncoding = "$R1src";
3710 let AccessBytes = bytes;
3713 multiclass TernaryRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
3714 RegisterOperand cls, bits<5> bytes> {
3715 let DispKey = mnemonic ## #cls in {
3716 let DispSize = "12" in
3717 def "" : TernaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
3718 let DispSize = "20" in
3719 def Y : TernaryRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
3723 class SideEffectTernaryMemMemRS<string mnemonic, bits<8> opcode,
3724 RegisterOperand cls1, RegisterOperand cls2>
3725 : InstRSa<opcode, (outs cls1:$R1, cls2:$R3),
3726 (ins cls1:$R1src, cls2:$R3src, shift12only:$BD2),
3727 mnemonic#"\t$R1, $R3, $BD2", []> {
3728 let Constraints = "$R1 = $R1src, $R3 = $R3src";
3729 let DisableEncoding = "$R1src, $R3src";
3732 class SideEffectTernaryMemMemRSY<string mnemonic, bits<16> opcode,
3733 RegisterOperand cls1, RegisterOperand cls2>
3734 : InstRSYa<opcode, (outs cls1:$R1, cls2:$R3),
3735 (ins cls1:$R1src, cls2:$R3src, shift20only:$BD2),
3736 mnemonic#"\t$R1, $R3, $BD2", []> {
3737 let Constraints = "$R1 = $R1src, $R3 = $R3src";
3738 let DisableEncoding = "$R1src, $R3src";
3741 class TernaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3742 RegisterOperand cls1, RegisterOperand cls2,
3743 SDPatternOperator load, bits<5> bytes>
3744 : InstRXF<opcode, (outs cls1:$R1),
3745 (ins cls2:$R1src, cls2:$R3, bdxaddr12only:$XBD2),
3746 mnemonic#"\t$R1, $R3, $XBD2",
3747 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3,
3748 (load bdxaddr12only:$XBD2)))]> {
3749 let OpKey = mnemonic#"r"#cls;
3751 let Constraints = "$R1 = $R1src";
3752 let DisableEncoding = "$R1src";
3754 let AccessBytes = bytes;
3757 class TernaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3758 TypedReg tr1, TypedReg tr2, Immediate imm, Immediate index>
3759 : InstVRIa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V1src, imm:$I2, index:$M3),
3760 mnemonic#"\t$V1, $I2, $M3",
3761 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src),
3762 imm:$I2, index:$M3)))]> {
3763 let Constraints = "$V1 = $V1src";
3764 let DisableEncoding = "$V1src";
3767 class TernaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3768 TypedReg tr1, TypedReg tr2, bits<4> type>
3769 : InstVRId<opcode, (outs tr1.op:$V1),
3770 (ins tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
3771 mnemonic#"\t$V1, $V2, $V3, $I4",
3772 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3773 (tr2.vt tr2.op:$V3),
3778 class TernaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3779 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m4or>
3780 : InstVRRa<opcode, (outs tr1.op:$V1),
3781 (ins tr2.op:$V2, imm32zx4:$M4, imm32zx4:$M5),
3782 mnemonic#"\t$V1, $V2, $M4, $M5",
3783 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3790 class TernaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
3791 : InstVRRa<opcode, (outs VR128:$V1),
3792 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
3793 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
3795 class TernaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3796 TypedReg tr1, TypedReg tr2, bits<4> type,
3797 SDPatternOperator m5mask, bits<4> m5or>
3798 : InstVRRb<opcode, (outs tr1.op:$V1),
3799 (ins tr2.op:$V2, tr2.op:$V3, m5mask:$M5),
3800 mnemonic#"\t$V1, $V2, $V3, $M5",
3801 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3802 (tr2.vt tr2.op:$V3),
3808 // Declare a pair of instructions, one which sets CC and one which doesn't.
3809 // The CC-setting form ends with "S" and sets the low bit of M5.
3810 // Also create aliases to make use of M5 operand optional in assembler.
3811 multiclass TernaryOptVRRbSPair<string mnemonic, bits<16> opcode,
3812 SDPatternOperator operator,
3813 SDPatternOperator operator_cc,
3814 TypedReg tr1, TypedReg tr2, bits<4> type,
3815 bits<4> modifier = 0> {
3816 def "" : TernaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
3817 imm32zx4even, !and (modifier, 14)>;
3818 def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
3819 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
3822 def S : TernaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
3823 imm32zx4even, !add(!and (modifier, 14), 1)>;
3824 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3",
3825 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
3829 multiclass TernaryOptVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
3830 def "" : InstVRRb<opcode, (outs VR128:$V1),
3831 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3832 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
3833 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
3834 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
3838 class TernaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3839 TypedReg tr1, TypedReg tr2>
3840 : InstVRRc<opcode, (outs tr1.op:$V1),
3841 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M4),
3842 mnemonic#"\t$V1, $V2, $V3, $M4",
3843 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3844 (tr2.vt tr2.op:$V3),
3850 class TernaryVRRd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3851 TypedReg tr1, TypedReg tr2, bits<4> type = 0>
3852 : InstVRRd<opcode, (outs tr1.op:$V1),
3853 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
3854 mnemonic#"\t$V1, $V2, $V3, $V4",
3855 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3856 (tr2.vt tr2.op:$V3),
3857 (tr1.vt tr1.op:$V4))))]> {
3862 class TernaryVRRdGeneric<string mnemonic, bits<16> opcode>
3863 : InstVRRd<opcode, (outs VR128:$V1),
3864 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5),
3865 mnemonic#"\t$V1, $V2, $V3, $V4, $M5", []> {
3869 class TernaryVRRe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3870 TypedReg tr1, TypedReg tr2, bits<4> m5 = 0, bits<4> type = 0>
3871 : InstVRRe<opcode, (outs tr1.op:$V1),
3872 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
3873 mnemonic#"\t$V1, $V2, $V3, $V4",
3874 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3875 (tr2.vt tr2.op:$V3),
3876 (tr1.vt tr1.op:$V4))))]> {
3881 class TernaryVRReFloatGeneric<string mnemonic, bits<16> opcode>
3882 : InstVRRe<opcode, (outs VR128:$V1),
3883 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
3884 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
3886 class TernaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3887 TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type>
3888 : InstVRSb<opcode, (outs tr1.op:$V1),
3889 (ins tr2.op:$V1src, cls:$R3, shift12only:$BD2),
3890 mnemonic#"\t$V1, $R3, $BD2",
3891 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src),
3893 shift12only:$BD2)))]> {
3894 let Constraints = "$V1 = $V1src";
3895 let DisableEncoding = "$V1src";
3899 class TernaryVRSbGeneric<string mnemonic, bits<16> opcode>
3900 : InstVRSb<opcode, (outs VR128:$V1),
3901 (ins VR128:$V1src, GR64:$R3, shift12only:$BD2, imm32zx4:$M4),
3902 mnemonic#"\t$V1, $R3, $BD2, $M4", []> {
3903 let Constraints = "$V1 = $V1src";
3904 let DisableEncoding = "$V1src";
3907 class TernaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
3909 : InstVRV<opcode, (outs VR128:$V1),
3910 (ins VR128:$V1src, bdvaddr12only:$VBD2, index:$M3),
3911 mnemonic#"\t$V1, $VBD2, $M3", []> {
3912 let Constraints = "$V1 = $V1src";
3913 let DisableEncoding = "$V1src";
3915 let AccessBytes = bytes;
3918 class TernaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3919 TypedReg tr1, TypedReg tr2, bits<5> bytes, Immediate index>
3920 : InstVRX<opcode, (outs tr1.op:$V1),
3921 (ins tr2.op:$V1src, bdxaddr12only:$XBD2, index:$M3),
3922 mnemonic#"\t$V1, $XBD2, $M3",
3923 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src),
3924 bdxaddr12only:$XBD2,
3926 let Constraints = "$V1 = $V1src";
3927 let DisableEncoding = "$V1src";
3929 let AccessBytes = bytes;
3932 class QuaternaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3933 TypedReg tr1, TypedReg tr2, bits<4> type>
3934 : InstVRId<opcode, (outs tr1.op:$V1),
3935 (ins tr2.op:$V1src, tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
3936 mnemonic#"\t$V1, $V2, $V3, $I4",
3937 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src),
3938 (tr2.vt tr2.op:$V2),
3939 (tr2.vt tr2.op:$V3),
3941 let Constraints = "$V1 = $V1src";
3942 let DisableEncoding = "$V1src";
3946 class QuaternaryVRIdGeneric<string mnemonic, bits<16> opcode>
3947 : InstVRId<opcode, (outs VR128:$V1),
3948 (ins VR128:$V1src, VR128:$V2, VR128:$V3,
3949 imm32zx8:$I4, imm32zx4:$M5),
3950 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []> {
3951 let Constraints = "$V1 = $V1src";
3952 let DisableEncoding = "$V1src";
3955 class QuaternaryVRRd<string mnemonic, bits<16> opcode,
3956 SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
3957 bits<4> type, SDPatternOperator m6mask, bits<4> m6or>
3958 : InstVRRd<opcode, (outs tr1.op:$V1),
3959 (ins tr2.op:$V2, tr2.op:$V3, tr2.op:$V4, m6mask:$M6),
3960 mnemonic#"\t$V1, $V2, $V3, $V4, $M6",
3961 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2),
3962 (tr2.vt tr2.op:$V3),
3963 (tr2.vt tr2.op:$V4),
3969 // Declare a pair of instructions, one which sets CC and one which doesn't.
3970 // The CC-setting form ends with "S" and sets the low bit of M6.
3971 // Also create aliases to make use of M6 operand optional in assembler.
3972 multiclass QuaternaryOptVRRdSPair<string mnemonic, bits<16> opcode,
3973 SDPatternOperator operator,
3974 SDPatternOperator operator_cc,
3975 TypedReg tr1, TypedReg tr2, bits<4> type,
3976 bits<4> modifier = 0> {
3977 def "" : QuaternaryVRRd<mnemonic, opcode, operator, tr1, tr2, type,
3978 imm32zx4even, !and (modifier, 14)>;
3979 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4",
3980 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
3981 tr2.op:$V3, tr2.op:$V4, 0)>;
3983 def S : QuaternaryVRRd<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
3984 imm32zx4even, !add (!and (modifier, 14), 1)>;
3985 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3, $V4",
3986 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
3987 tr2.op:$V3, tr2.op:$V4, 0)>;
3990 multiclass QuaternaryOptVRRdSPairGeneric<string mnemonic, bits<16> opcode> {
3991 def "" : InstVRRd<opcode, (outs VR128:$V1),
3992 (ins VR128:$V2, VR128:$V3, VR128:$V4,
3993 imm32zx4:$M5, imm32zx4:$M6),
3994 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
3995 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5",
3996 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
3997 VR128:$V4, imm32zx4:$M5, 0)>;
4000 class SideEffectQuaternarySSe<string mnemonic, bits<8> opcode,
4001 RegisterOperand cls>
4002 : InstSSe<opcode, (outs),
4003 (ins cls:$R1, bdaddr12only:$BD2, cls:$R3, bdaddr12only:$BD4),
4004 mnemonic#"\t$R1, $BD2, $R3, $BD4", []>;
4006 class LoadAndOpRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4007 RegisterOperand cls, AddressingMode mode = bdaddr20only>
4008 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, mode:$BD2),
4009 mnemonic#"\t$R1, $R3, $BD2",
4010 [(set cls:$R1, (operator mode:$BD2, cls:$R3))]> {
4015 class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4016 RegisterOperand cls, AddressingMode mode = bdaddr12only>
4017 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
4018 mnemonic#"\t$R1, $R3, $BD2",
4019 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
4020 let Constraints = "$R1 = $R1src";
4021 let DisableEncoding = "$R1src";
4026 class CmpSwapRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4027 RegisterOperand cls, AddressingMode mode = bdaddr20only>
4028 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
4029 mnemonic#"\t$R1, $R3, $BD2",
4030 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
4031 let Constraints = "$R1 = $R1src";
4032 let DisableEncoding = "$R1src";
4037 multiclass CmpSwapRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4038 SDPatternOperator operator, RegisterOperand cls> {
4039 let DispKey = mnemonic ## #cls in {
4040 let DispSize = "12" in
4041 def "" : CmpSwapRS<mnemonic, rsOpcode, operator, cls, bdaddr12pair>;
4042 let DispSize = "20" in
4043 def Y : CmpSwapRSY<mnemonic#"y", rsyOpcode, operator, cls, bdaddr20pair>;
4047 class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1,
4048 RegisterOperand cls2>
4049 : InstRIEf<opcode, (outs cls1:$R1),
4050 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
4052 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> {
4053 let Constraints = "$R1 = $R1src";
4054 let DisableEncoding = "$R1src";
4057 class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator>
4058 : InstRXYb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr20only:$XBD2),
4059 mnemonic##"\t$M1, $XBD2",
4060 [(operator imm32zx4:$M1, bdxaddr20only:$XBD2)]>;
4062 class PrefetchRILPC<string mnemonic, bits<12> opcode,
4063 SDPatternOperator operator>
4064 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, pcrel32:$RI2),
4065 mnemonic##"\t$M1, $RI2",
4066 [(operator imm32zx4:$M1, pcrel32:$RI2)]> {
4067 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
4068 // However, BDXs have two extra operands and are therefore 6 units more
4070 let AddedComplexity = 7;
4073 class BranchPreloadSMI<string mnemonic, bits<8> opcode>
4074 : InstSMI<opcode, (outs),
4075 (ins imm32zx4:$M1, brtarget16bpp:$RI2, bdxaddr12only:$BD3),
4076 mnemonic#"\t$M1, $RI2, $BD3", []>;
4078 class BranchPreloadMII<string mnemonic, bits<8> opcode>
4079 : InstMII<opcode, (outs),
4080 (ins imm32zx4:$M1, brtarget12bpp:$RI2, brtarget24bpp:$RI3),
4081 mnemonic#"\t$M1, $RI2, $RI3", []>;
4083 // A floating-point load-and test operation. Create both a normal unary
4084 // operation and one that acts as a comparison against zero.
4085 // Note that the comparison against zero operation is not available if we
4086 // have vector support, since load-and-test instructions will partially
4087 // clobber the target (vector) register.
4088 multiclass LoadAndTestRRE<string mnemonic, bits<16> opcode,
4089 RegisterOperand cls> {
4090 def "" : UnaryRRE<mnemonic, opcode, null_frag, cls, cls>;
4091 let isCodeGenOnly = 1, Predicates = [FeatureNoVector] in
4092 def Compare : CompareRRE<mnemonic, opcode, null_frag, cls, cls>;
4095 //===----------------------------------------------------------------------===//
4096 // Pseudo instructions
4097 //===----------------------------------------------------------------------===//
4099 // Convenience instructions that get lowered to real instructions
4100 // by either SystemZTargetLowering::EmitInstrWithCustomInserter()
4101 // or SystemZInstrInfo::expandPostRAPseudo().
4103 //===----------------------------------------------------------------------===//
4105 class Pseudo<dag outs, dag ins, list<dag> pattern>
4106 : InstSystemZ<0, outs, ins, "", pattern> {
4108 let isCodeGenOnly = 1;
4111 // Like SideEffectBinarySIL, but expanded later.
4112 class SideEffectBinarySILPseudo<SDPatternOperator operator, Immediate imm>
4113 : Pseudo<(outs), (ins bdaddr12only:$BD1, imm:$I2),
4114 [(operator bdaddr12only:$BD1, imm:$I2)]>;
4116 // Like UnaryRI, but expanded after RA depending on the choice of register.
4117 class UnaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4119 : Pseudo<(outs cls:$R1), (ins imm:$I2),
4120 [(set cls:$R1, (operator imm:$I2))]>;
4122 // Like UnaryRXY, but expanded after RA depending on the choice of register.
4123 class UnaryRXYPseudo<string key, SDPatternOperator operator,
4124 RegisterOperand cls, bits<5> bytes,
4125 AddressingMode mode = bdxaddr20only>
4126 : Pseudo<(outs cls:$R1), (ins mode:$XBD2),
4127 [(set cls:$R1, (operator mode:$XBD2))]> {
4128 let OpKey = key#"r"#cls;
4131 let Has20BitOffset = 1;
4133 let AccessBytes = bytes;
4136 // Like UnaryRR, but expanded after RA depending on the choice of registers.
4137 class UnaryRRPseudo<string key, SDPatternOperator operator,
4138 RegisterOperand cls1, RegisterOperand cls2>
4139 : Pseudo<(outs cls1:$R1), (ins cls2:$R2),
4140 [(set cls1:$R1, (operator cls2:$R2))]> {
4141 let OpKey = key#cls1;
4145 // Like BinaryRI, but expanded after RA depending on the choice of register.
4146 class BinaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4148 : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2),
4149 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
4150 let Constraints = "$R1 = $R1src";
4153 // Like BinaryRIE, but expanded after RA depending on the choice of register.
4154 class BinaryRIEPseudo<SDPatternOperator operator, RegisterOperand cls,
4156 : Pseudo<(outs cls:$R1), (ins cls:$R3, imm:$I2),
4157 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
4159 // Like BinaryRIAndK, but expanded after RA depending on the choice of register.
4160 multiclass BinaryRIAndKPseudo<string key, SDPatternOperator operator,
4161 RegisterOperand cls, Immediate imm> {
4162 let NumOpsKey = key in {
4163 let NumOpsValue = "3" in
4164 def K : BinaryRIEPseudo<null_frag, cls, imm>,
4165 Requires<[FeatureHighWord, FeatureDistinctOps]>;
4166 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
4167 def "" : BinaryRIPseudo<operator, cls, imm>,
4168 Requires<[FeatureHighWord]>;
4172 // Like CompareRI, but expanded after RA depending on the choice of register.
4173 class CompareRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4175 : Pseudo<(outs), (ins cls:$R1, imm:$I2), [(operator cls:$R1, imm:$I2)]> {
4179 // Like CompareRXY, but expanded after RA depending on the choice of register.
4180 class CompareRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
4181 SDPatternOperator load, bits<5> bytes,
4182 AddressingMode mode = bdxaddr20only>
4183 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2),
4184 [(operator cls:$R1, (load mode:$XBD2))]> {
4186 let Has20BitOffset = 1;
4188 let AccessBytes = bytes;
4191 // Like CondBinaryRRF, but expanded after RA depending on the choice of
4193 class CondBinaryRRFPseudo<RegisterOperand cls1, RegisterOperand cls2>
4194 : Pseudo<(outs cls1:$R1),
4195 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3), []> {
4196 let Constraints = "$R1 = $R1src";
4197 let DisableEncoding = "$R1src";
4201 // Like CondBinaryRIE, but expanded after RA depending on the choice of
4203 class CondBinaryRIEPseudo<RegisterOperand cls, Immediate imm>
4204 : Pseudo<(outs cls:$R1),
4205 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
4206 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
4207 cond4:$valid, cond4:$M3))]> {
4208 let Constraints = "$R1 = $R1src";
4209 let DisableEncoding = "$R1src";
4213 // Like CondUnaryRSY, but expanded after RA depending on the choice of
4215 class CondUnaryRSYPseudo<SDPatternOperator operator, RegisterOperand cls,
4216 bits<5> bytes, AddressingMode mode = bdaddr20only>
4217 : Pseudo<(outs cls:$R1),
4218 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$R3),
4220 (z_select_ccmask (operator mode:$BD2), cls:$R1src,
4221 cond4:$valid, cond4:$R3))]> {
4222 let Constraints = "$R1 = $R1src";
4223 let DisableEncoding = "$R1src";
4225 let AccessBytes = bytes;
4229 // Like CondStoreRSY, but expanded after RA depending on the choice of
4231 class CondStoreRSYPseudo<RegisterOperand cls, bits<5> bytes,
4232 AddressingMode mode = bdaddr20only>
4233 : Pseudo<(outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$R3), []> {
4235 let AccessBytes = bytes;
4239 // Like StoreRXY, but expanded after RA depending on the choice of register.
4240 class StoreRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
4241 bits<5> bytes, AddressingMode mode = bdxaddr20only>
4242 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2),
4243 [(operator cls:$R1, mode:$XBD2)]> {
4245 let Has20BitOffset = 1;
4247 let AccessBytes = bytes;
4250 // Like RotateSelectRIEf, but expanded after RA depending on the choice
4252 class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2>
4253 : Pseudo<(outs cls1:$R1),
4254 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
4257 let Constraints = "$R1 = $R1src";
4258 let DisableEncoding = "$R1src";
4261 // Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is
4262 // the value of the PSW's 2-bit condition code field.
4263 class SelectWrapper<RegisterOperand cls>
4264 : Pseudo<(outs cls:$dst),
4265 (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc),
4266 [(set cls:$dst, (z_select_ccmask cls:$src1, cls:$src2,
4267 imm32zx4:$valid, imm32zx4:$cc))]> {
4268 let usesCustomInserter = 1;
4269 // Although the instructions used by these nodes do not in themselves
4270 // change CC, the insertion requires new blocks, and CC cannot be live
4276 // Stores $new to $addr if $cc is true ("" case) or false (Inv case).
4277 multiclass CondStores<RegisterOperand cls, SDPatternOperator store,
4278 SDPatternOperator load, AddressingMode mode> {
4279 let Defs = [CC], Uses = [CC], usesCustomInserter = 1 in {
4280 def "" : Pseudo<(outs),
4281 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
4282 [(store (z_select_ccmask cls:$new, (load mode:$addr),
4283 imm32zx4:$valid, imm32zx4:$cc),
4285 def Inv : Pseudo<(outs),
4286 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
4287 [(store (z_select_ccmask (load mode:$addr), cls:$new,
4288 imm32zx4:$valid, imm32zx4:$cc),
4293 // OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation. PAT and OPERAND
4294 // describe the second (non-memory) operand.
4295 class AtomicLoadBinary<SDPatternOperator operator, RegisterOperand cls,
4296 dag pat, DAGOperand operand>
4297 : Pseudo<(outs cls:$dst), (ins bdaddr20only:$ptr, operand:$src2),
4298 [(set cls:$dst, (operator bdaddr20only:$ptr, pat))]> {
4300 let Has20BitOffset = 1;
4303 let usesCustomInserter = 1;
4304 let hasNoSchedulingInfo = 1;
4307 // Specializations of AtomicLoadWBinary.
4308 class AtomicLoadBinaryReg32<SDPatternOperator operator>
4309 : AtomicLoadBinary<operator, GR32, (i32 GR32:$src2), GR32>;
4310 class AtomicLoadBinaryImm32<SDPatternOperator operator, Immediate imm>
4311 : AtomicLoadBinary<operator, GR32, (i32 imm:$src2), imm>;
4312 class AtomicLoadBinaryReg64<SDPatternOperator operator>
4313 : AtomicLoadBinary<operator, GR64, (i64 GR64:$src2), GR64>;
4314 class AtomicLoadBinaryImm64<SDPatternOperator operator, Immediate imm>
4315 : AtomicLoadBinary<operator, GR64, (i64 imm:$src2), imm>;
4317 // OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation. PAT and OPERAND
4318 // describe the second (non-memory) operand.
4319 class AtomicLoadWBinary<SDPatternOperator operator, dag pat,
4321 : Pseudo<(outs GR32:$dst),
4322 (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift,
4323 ADDR32:$negbitshift, uimm32:$bitsize),
4324 [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift,
4325 ADDR32:$negbitshift, uimm32:$bitsize))]> {
4327 let Has20BitOffset = 1;
4330 let usesCustomInserter = 1;
4331 let hasNoSchedulingInfo = 1;
4334 // Specializations of AtomicLoadWBinary.
4335 class AtomicLoadWBinaryReg<SDPatternOperator operator>
4336 : AtomicLoadWBinary<operator, (i32 GR32:$src2), GR32>;
4337 class AtomicLoadWBinaryImm<SDPatternOperator operator, Immediate imm>
4338 : AtomicLoadWBinary<operator, (i32 imm:$src2), imm>;
4340 // Define an instruction that operates on two fixed-length blocks of memory,
4341 // and associated pseudo instructions for operating on blocks of any size.
4342 // The Sequence form uses a straight-line sequence of instructions and
4343 // the Loop form uses a loop of length-256 instructions followed by
4344 // another instruction to handle the excess.
4345 multiclass MemorySS<string mnemonic, bits<8> opcode,
4346 SDPatternOperator sequence, SDPatternOperator loop> {
4347 def "" : SideEffectBinarySSa<mnemonic, opcode>;
4348 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in {
4349 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
4351 [(sequence bdaddr12only:$dest, bdaddr12only:$src,
4353 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
4354 imm64:$length, GR64:$count256),
4355 [(loop bdaddr12only:$dest, bdaddr12only:$src,
4356 imm64:$length, GR64:$count256)]>;
4360 // Define an instruction that operates on two strings, both terminated
4361 // by the character in R0. The instruction processes a CPU-determinated
4362 // number of bytes at a time and sets CC to 3 if the instruction needs
4363 // to be repeated. Also define a pseudo instruction that represents
4364 // the full loop (the main instruction plus the branch on CC==3).
4365 multiclass StringRRE<string mnemonic, bits<16> opcode,
4366 SDPatternOperator operator> {
4368 def "" : SideEffectBinaryMemMemRRE<mnemonic, opcode, GR64, GR64>;
4369 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in
4370 def Loop : Pseudo<(outs GR64:$end),
4371 (ins GR64:$start1, GR64:$start2, GR32:$char),
4372 [(set GR64:$end, (operator GR64:$start1, GR64:$start2,
4376 // A pseudo instruction that is a direct alias of a real instruction.
4377 // These aliases are used in cases where a particular register operand is
4378 // fixed or where the same instruction is used with different register sizes.
4379 // The size parameter is the size in bytes of the associated real instruction.
4380 class Alias<int size, dag outs, dag ins, list<dag> pattern>
4381 : InstSystemZ<size, outs, ins, "", pattern> {
4383 let isCodeGenOnly = 1;
4386 class UnaryAliasVRS<RegisterOperand cls1, RegisterOperand cls2>
4387 : Alias<6, (outs cls1:$src1), (ins cls2:$src2), []>;
4389 // An alias of a UnaryVRR*, but with different register sizes.
4390 class UnaryAliasVRR<SDPatternOperator operator, TypedReg tr1, TypedReg tr2>
4391 : Alias<6, (outs tr1.op:$V1), (ins tr2.op:$V2),
4392 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2))))]>;
4394 // An alias of a UnaryVRX, but with different register sizes.
4395 class UnaryAliasVRX<SDPatternOperator operator, TypedReg tr,
4396 AddressingMode mode = bdxaddr12only>
4397 : Alias<6, (outs tr.op:$V1), (ins mode:$XBD2),
4398 [(set tr.op:$V1, (tr.vt (operator mode:$XBD2)))]>;
4400 // An alias of a StoreVRX, but with different register sizes.
4401 class StoreAliasVRX<SDPatternOperator operator, TypedReg tr,
4402 AddressingMode mode = bdxaddr12only>
4403 : Alias<6, (outs), (ins tr.op:$V1, mode:$XBD2),
4404 [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>;
4406 // An alias of a BinaryRI, but with different register sizes.
4407 class BinaryAliasRI<SDPatternOperator operator, RegisterOperand cls,
4409 : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
4410 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
4411 let Constraints = "$R1 = $R1src";
4414 // An alias of a BinaryRIL, but with different register sizes.
4415 class BinaryAliasRIL<SDPatternOperator operator, RegisterOperand cls,
4417 : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
4418 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
4419 let Constraints = "$R1 = $R1src";
4422 // An alias of a BinaryVRRf, but with different register sizes.
4423 class BinaryAliasVRRf<RegisterOperand cls>
4424 : Alias<6, (outs VR128:$V1), (ins cls:$R2, cls:$R3), []>;
4426 // An alias of a CompareRI, but with different register sizes.
4427 class CompareAliasRI<SDPatternOperator operator, RegisterOperand cls,
4429 : Alias<4, (outs), (ins cls:$R1, imm:$I2), [(operator cls:$R1, imm:$I2)]> {
4433 // An alias of a RotateSelectRIEf, but with different register sizes.
4434 class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2>
4435 : Alias<6, (outs cls1:$R1),
4436 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
4437 imm32zx6:$I5), []> {
4438 let Constraints = "$R1 = $R1src";