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 let hasSideEffects = 0;
28 // Some instructions come in pairs, one having a 12-bit displacement
29 // and the other having a 20-bit displacement. Both instructions in
30 // the pair have the same DispKey and their DispSizes are "12" and "20"
33 string DispSize = "none";
35 // Many register-based <INSN>R instructions have a memory-based <INSN>
36 // counterpart. OpKey uniquely identifies <INSN>R, while OpType is
37 // "reg" for <INSN>R and "mem" for <INSN>.
39 string OpType = "none";
41 // Many distinct-operands instructions have older 2-operand equivalents.
42 // NumOpsKey uniquely identifies one of these 2-operand and 3-operand pairs,
43 // with NumOpsValue being "2" or "3" as appropriate.
44 string NumOpsKey = "";
45 string NumOpsValue = "none";
47 // True if this instruction is a simple D(X,B) load of a register
48 // (with no sign or zero extension).
49 bit SimpleBDXLoad = 0;
51 // True if this instruction is a simple D(X,B) store of a register
52 // (with no truncation).
53 bit SimpleBDXStore = 0;
55 // True if this instruction has a 20-bit displacement field.
56 bit Has20BitOffset = 0;
58 // True if addresses in this instruction have an index register.
61 // True if this is a 128-bit pseudo instruction that combines two 64-bit
65 // The access size of all memory operands in bytes, or 0 if not known.
66 bits<5> AccessBytes = 0;
68 // If the instruction sets CC to a useful value, this gives the mask
69 // of all possible CC results. The mask has the same form as
73 // The subset of CCValues that have the same meaning as they would after
74 // a comparison of the first operand against zero.
75 bits<4> CompareZeroCCMask = 0;
77 // True if the instruction is conditional and if the CC mask operand
78 // comes first (as for BRC, etc.).
81 // Similar, but true if the CC mask operand comes last (as for LOC, etc.).
84 // True if the instruction is the "logical" rather than "arithmetic" form,
85 // in cases where a distinction exists.
88 let TSFlags{0} = SimpleBDXLoad;
89 let TSFlags{1} = SimpleBDXStore;
90 let TSFlags{2} = Has20BitOffset;
91 let TSFlags{3} = HasIndex;
92 let TSFlags{4} = Is128Bit;
93 let TSFlags{9-5} = AccessBytes;
94 let TSFlags{13-10} = CCValues;
95 let TSFlags{17-14} = CompareZeroCCMask;
96 let TSFlags{18} = CCMaskFirst;
97 let TSFlags{19} = CCMaskLast;
98 let TSFlags{20} = IsLogical;
101 //===----------------------------------------------------------------------===//
102 // Mappings between instructions
103 //===----------------------------------------------------------------------===//
105 // Return the version of an instruction that has an unsigned 12-bit
107 def getDisp12Opcode : InstrMapping {
108 let FilterClass = "InstSystemZ";
109 let RowFields = ["DispKey"];
110 let ColFields = ["DispSize"];
112 let ValueCols = [["12"]];
115 // Return the version of an instruction that has a signed 20-bit displacement.
116 def getDisp20Opcode : InstrMapping {
117 let FilterClass = "InstSystemZ";
118 let RowFields = ["DispKey"];
119 let ColFields = ["DispSize"];
121 let ValueCols = [["20"]];
124 // Return the memory form of a register instruction.
125 def getMemOpcode : InstrMapping {
126 let FilterClass = "InstSystemZ";
127 let RowFields = ["OpKey"];
128 let ColFields = ["OpType"];
129 let KeyCol = ["reg"];
130 let ValueCols = [["mem"]];
133 // Return the 3-operand form of a 2-operand instruction.
134 def getThreeOperandOpcode : InstrMapping {
135 let FilterClass = "InstSystemZ";
136 let RowFields = ["NumOpsKey"];
137 let ColFields = ["NumOpsValue"];
139 let ValueCols = [["3"]];
142 //===----------------------------------------------------------------------===//
143 // Instruction formats
144 //===----------------------------------------------------------------------===//
146 // Formats are specified using operand field declarations of the form:
148 // bits<4> Rn : register input or output for operand n
149 // bits<5> Vn : vector register input or output for operand n
150 // bits<m> In : immediate value of width m for operand n
151 // bits<4> BDn : address operand n, which has a base and a displacement
152 // bits<m> XBDn : address operand n, which has an index, a base and a
154 // bits<m> VBDn : address operand n, which has a vector index, a base and a
156 // bits<4> Xn : index register for address operand n
157 // bits<4> Mn : mode value for operand n
159 // The operand numbers ("n" in the list above) follow the architecture manual.
160 // Assembly operands sometimes have a different order; in particular, R3 often
161 // is often written between operands 1 and 2.
163 //===----------------------------------------------------------------------===//
165 class InstE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
166 : InstSystemZ<2, outs, ins, asmstr, pattern> {
168 field bits<16> SoftFail = 0;
173 class InstI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
174 : InstSystemZ<2, outs, ins, asmstr, pattern> {
176 field bits<16> SoftFail = 0;
184 class InstIE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
185 : InstSystemZ<4, outs, ins, asmstr, pattern> {
187 field bits<32> SoftFail = 0;
192 let Inst{31-16} = op;
198 class InstMII<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
199 : InstSystemZ<6, outs, ins, asmstr, pattern> {
201 field bits<48> SoftFail = 0;
207 let Inst{47-40} = op;
208 let Inst{39-36} = M1;
209 let Inst{35-24} = RI2;
210 let Inst{23-0} = RI3;
213 class InstRIa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
214 : InstSystemZ<4, outs, ins, asmstr, pattern> {
216 field bits<32> SoftFail = 0;
221 let Inst{31-24} = op{11-4};
222 let Inst{23-20} = R1;
223 let Inst{19-16} = op{3-0};
227 class InstRIb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
228 : InstSystemZ<4, outs, ins, asmstr, pattern> {
230 field bits<32> SoftFail = 0;
235 let Inst{31-24} = op{11-4};
236 let Inst{23-20} = R1;
237 let Inst{19-16} = op{3-0};
238 let Inst{15-0} = RI2;
241 class InstRIc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
242 : InstSystemZ<4, outs, ins, asmstr, pattern> {
244 field bits<32> SoftFail = 0;
249 let Inst{31-24} = op{11-4};
250 let Inst{23-20} = M1;
251 let Inst{19-16} = op{3-0};
252 let Inst{15-0} = RI2;
255 class InstRIEa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
256 : InstSystemZ<6, outs, ins, asmstr, pattern> {
258 field bits<48> SoftFail = 0;
264 let Inst{47-40} = op{15-8};
265 let Inst{39-36} = R1;
267 let Inst{31-16} = I2;
268 let Inst{15-12} = M3;
270 let Inst{7-0} = op{7-0};
273 class InstRIEb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
274 : InstSystemZ<6, outs, ins, asmstr, pattern> {
276 field bits<48> SoftFail = 0;
283 let Inst{47-40} = op{15-8};
284 let Inst{39-36} = R1;
285 let Inst{35-32} = R2;
286 let Inst{31-16} = RI4;
287 let Inst{15-12} = M3;
289 let Inst{7-0} = op{7-0};
292 class InstRIEc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
293 : InstSystemZ<6, outs, ins, asmstr, pattern> {
295 field bits<48> SoftFail = 0;
302 let Inst{47-40} = op{15-8};
303 let Inst{39-36} = R1;
304 let Inst{35-32} = M3;
305 let Inst{31-16} = RI4;
307 let Inst{7-0} = op{7-0};
310 class InstRIEd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
311 : InstSystemZ<6, outs, ins, asmstr, pattern> {
313 field bits<48> SoftFail = 0;
319 let Inst{47-40} = op{15-8};
320 let Inst{39-36} = R1;
321 let Inst{35-32} = R3;
322 let Inst{31-16} = I2;
324 let Inst{7-0} = op{7-0};
327 class InstRIEe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
328 : InstSystemZ<6, outs, ins, asmstr, pattern> {
330 field bits<48> SoftFail = 0;
336 let Inst{47-40} = op{15-8};
337 let Inst{39-36} = R1;
338 let Inst{35-32} = R3;
339 let Inst{31-16} = RI2;
341 let Inst{7-0} = op{7-0};
344 class InstRIEf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
345 : InstSystemZ<6, outs, ins, asmstr, pattern> {
347 field bits<48> SoftFail = 0;
355 let Inst{47-40} = op{15-8};
356 let Inst{39-36} = R1;
357 let Inst{35-32} = R2;
358 let Inst{31-24} = I3;
359 let Inst{23-16} = I4;
361 let Inst{7-0} = op{7-0};
364 class InstRIEg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
365 : InstSystemZ<6, outs, ins, asmstr, pattern> {
367 field bits<48> SoftFail = 0;
373 let Inst{47-40} = op{15-8};
374 let Inst{39-36} = R1;
375 let Inst{35-32} = M3;
376 let Inst{31-16} = I2;
378 let Inst{7-0} = op{7-0};
381 class InstRILa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
382 : InstSystemZ<6, outs, ins, asmstr, pattern> {
384 field bits<48> SoftFail = 0;
389 let Inst{47-40} = op{11-4};
390 let Inst{39-36} = R1;
391 let Inst{35-32} = op{3-0};
395 class InstRILb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
396 : InstSystemZ<6, outs, ins, asmstr, pattern> {
398 field bits<48> SoftFail = 0;
403 let Inst{47-40} = op{11-4};
404 let Inst{39-36} = R1;
405 let Inst{35-32} = op{3-0};
406 let Inst{31-0} = RI2;
409 class InstRILc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
410 : InstSystemZ<6, outs, ins, asmstr, pattern> {
412 field bits<48> SoftFail = 0;
417 let Inst{47-40} = op{11-4};
418 let Inst{39-36} = M1;
419 let Inst{35-32} = op{3-0};
420 let Inst{31-0} = RI2;
423 class InstRIS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
424 : InstSystemZ<6, outs, ins, asmstr, pattern> {
426 field bits<48> SoftFail = 0;
433 let Inst{47-40} = op{15-8};
434 let Inst{39-36} = R1;
435 let Inst{35-32} = M3;
436 let Inst{31-16} = BD4;
438 let Inst{7-0} = op{7-0};
441 class InstRR<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
442 : InstSystemZ<2, outs, ins, asmstr, pattern> {
444 field bits<16> SoftFail = 0;
454 class InstRRD<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
455 : InstSystemZ<4, outs, ins, asmstr, pattern> {
457 field bits<32> SoftFail = 0;
463 let Inst{31-16} = op;
464 let Inst{15-12} = R1;
470 class InstRRE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
471 : InstSystemZ<4, outs, ins, asmstr, pattern> {
473 field bits<32> SoftFail = 0;
478 let Inst{31-16} = op;
484 class InstRRFa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
485 : InstSystemZ<4, outs, ins, asmstr, pattern> {
487 field bits<32> SoftFail = 0;
494 let Inst{31-16} = op;
495 let Inst{15-12} = R3;
501 class InstRRFb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
502 : InstSystemZ<4, outs, ins, asmstr, pattern> {
504 field bits<32> SoftFail = 0;
511 let Inst{31-16} = op;
512 let Inst{15-12} = R3;
518 class InstRRFc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
519 : InstSystemZ<4, outs, ins, asmstr, pattern> {
521 field bits<32> SoftFail = 0;
527 let Inst{31-16} = op;
528 let Inst{15-12} = M3;
534 class InstRRFd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
535 : InstSystemZ<4, outs, ins, asmstr, pattern> {
537 field bits<32> SoftFail = 0;
543 let Inst{31-16} = op;
550 class InstRRFe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
551 : InstSystemZ<4, outs, ins, asmstr, pattern> {
553 field bits<32> SoftFail = 0;
560 let Inst{31-16} = op;
561 let Inst{15-12} = M3;
567 class InstRRS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
568 : InstSystemZ<6, outs, ins, asmstr, pattern> {
570 field bits<48> SoftFail = 0;
577 let Inst{47-40} = op{15-8};
578 let Inst{39-36} = R1;
579 let Inst{35-32} = R2;
580 let Inst{31-16} = BD4;
581 let Inst{15-12} = M3;
583 let Inst{7-0} = op{7-0};
586 class InstRXa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
587 : InstSystemZ<4, outs, ins, asmstr, pattern> {
589 field bits<32> SoftFail = 0;
594 let Inst{31-24} = op;
595 let Inst{23-20} = R1;
596 let Inst{19-0} = XBD2;
601 class InstRXb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
602 : InstSystemZ<4, outs, ins, asmstr, pattern> {
604 field bits<32> SoftFail = 0;
609 let Inst{31-24} = op;
610 let Inst{23-20} = M1;
611 let Inst{19-0} = XBD2;
616 class InstRXE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
617 : InstSystemZ<6, outs, ins, asmstr, pattern> {
619 field bits<48> SoftFail = 0;
625 let Inst{47-40} = op{15-8};
626 let Inst{39-36} = R1;
627 let Inst{35-16} = XBD2;
628 let Inst{15-12} = M3;
630 let Inst{7-0} = op{7-0};
635 class InstRXF<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
636 : InstSystemZ<6, outs, ins, asmstr, pattern> {
638 field bits<48> SoftFail = 0;
644 let Inst{47-40} = op{15-8};
645 let Inst{39-36} = R3;
646 let Inst{35-16} = XBD2;
647 let Inst{15-12} = R1;
649 let Inst{7-0} = op{7-0};
654 class InstRXYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
655 : InstSystemZ<6, outs, ins, asmstr, pattern> {
657 field bits<48> SoftFail = 0;
662 let Inst{47-40} = op{15-8};
663 let Inst{39-36} = R1;
664 let Inst{35-8} = XBD2;
665 let Inst{7-0} = op{7-0};
667 let Has20BitOffset = 1;
671 class InstRXYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
672 : InstSystemZ<6, outs, ins, asmstr, pattern> {
674 field bits<48> SoftFail = 0;
679 let Inst{47-40} = op{15-8};
680 let Inst{39-36} = M1;
681 let Inst{35-8} = XBD2;
682 let Inst{7-0} = op{7-0};
684 let Has20BitOffset = 1;
688 class InstRSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
689 : InstSystemZ<4, outs, ins, asmstr, pattern> {
691 field bits<32> SoftFail = 0;
697 let Inst{31-24} = op;
698 let Inst{23-20} = R1;
699 let Inst{19-16} = R3;
700 let Inst{15-0} = BD2;
703 class InstRSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
704 : InstSystemZ<4, outs, ins, asmstr, pattern> {
706 field bits<32> SoftFail = 0;
712 let Inst{31-24} = op;
713 let Inst{23-20} = R1;
714 let Inst{19-16} = M3;
715 let Inst{15-0} = BD2;
718 class InstRSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
719 : InstSystemZ<4, outs, ins, asmstr, pattern> {
721 field bits<32> SoftFail = 0;
727 let Inst{31-24} = op;
728 let Inst{23-20} = R1;
729 let Inst{19-16} = R3;
730 let Inst{15-0} = RI2;
733 class InstRSLa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
734 : InstSystemZ<6, outs, ins, asmstr, pattern> {
736 field bits<48> SoftFail = 0;
740 let Inst{47-40} = op{15-8};
741 let Inst{39-36} = BDL1{19-16};
743 let Inst{31-16} = BDL1{15-0};
745 let Inst{7-0} = op{7-0};
748 class InstRSLb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
749 : InstSystemZ<6, outs, ins, asmstr, pattern> {
751 field bits<48> SoftFail = 0;
757 let Inst{47-40} = op{15-8};
758 let Inst{39-16} = BDL2;
759 let Inst{15-12} = R1;
761 let Inst{7-0} = op{7-0};
764 class InstRSYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
765 : InstSystemZ<6, outs, ins, asmstr, pattern> {
767 field bits<48> SoftFail = 0;
773 let Inst{47-40} = op{15-8};
774 let Inst{39-36} = R1;
775 let Inst{35-32} = R3;
776 let Inst{31-8} = BD2;
777 let Inst{7-0} = op{7-0};
779 let Has20BitOffset = 1;
782 class InstRSYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
783 : InstSystemZ<6, outs, ins, asmstr, pattern> {
785 field bits<48> SoftFail = 0;
791 let Inst{47-40} = op{15-8};
792 let Inst{39-36} = R1;
793 let Inst{35-32} = M3;
794 let Inst{31-8} = BD2;
795 let Inst{7-0} = op{7-0};
797 let Has20BitOffset = 1;
800 class InstSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
801 : InstSystemZ<4, outs, ins, asmstr, pattern> {
803 field bits<32> SoftFail = 0;
808 let Inst{31-24} = op;
809 let Inst{23-16} = I2;
810 let Inst{15-0} = BD1;
813 class InstSIL<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
814 : InstSystemZ<6, outs, ins, asmstr, pattern> {
816 field bits<48> SoftFail = 0;
821 let Inst{47-32} = op;
822 let Inst{31-16} = BD1;
826 class InstSIY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
827 : InstSystemZ<6, outs, ins, asmstr, pattern> {
829 field bits<48> SoftFail = 0;
834 let Inst{47-40} = op{15-8};
835 let Inst{39-32} = I2;
836 let Inst{31-8} = BD1;
837 let Inst{7-0} = op{7-0};
839 let Has20BitOffset = 1;
842 class InstSMI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
843 : InstSystemZ<6, outs, ins, asmstr, pattern> {
845 field bits<48> SoftFail = 0;
851 let Inst{47-40} = op;
852 let Inst{39-36} = M1;
854 let Inst{31-16} = BD3;
855 let Inst{15-0} = RI2;
858 class InstSSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
859 : InstSystemZ<6, outs, ins, asmstr, pattern> {
861 field bits<48> SoftFail = 0;
866 let Inst{47-40} = op;
867 let Inst{39-16} = BDL1;
868 let Inst{15-0} = BD2;
871 class InstSSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
872 : InstSystemZ<6, outs, ins, asmstr, pattern> {
874 field bits<48> SoftFail = 0;
879 let Inst{47-40} = op;
880 let Inst{39-36} = BDL1{19-16};
881 let Inst{35-32} = BDL2{19-16};
882 let Inst{31-16} = BDL1{15-0};
883 let Inst{15-0} = BDL2{15-0};
886 class InstSSc<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
887 : InstSystemZ<6, outs, ins, asmstr, pattern> {
889 field bits<48> SoftFail = 0;
895 let Inst{47-40} = op;
896 let Inst{39-36} = BDL1{19-16};
897 let Inst{35-32} = I3;
898 let Inst{31-16} = BDL1{15-0};
899 let Inst{15-0} = BD2;
902 class InstSSd<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
903 : InstSystemZ<6, outs, ins, asmstr, pattern> {
905 field bits<48> SoftFail = 0;
911 let Inst{47-40} = op;
912 let Inst{39-36} = RBD1{19-16};
913 let Inst{35-32} = R3;
914 let Inst{31-16} = RBD1{15-0};
915 let Inst{15-0} = BD2;
918 class InstSSe<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
919 : InstSystemZ<6, outs, ins, asmstr, pattern> {
921 field bits<48> SoftFail = 0;
928 let Inst{47-40} = op;
929 let Inst{39-36} = R1;
930 let Inst{35-32} = R3;
931 let Inst{31-16} = BD2;
932 let Inst{15-0} = BD4;
935 class InstSSf<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
936 : InstSystemZ<6, outs, ins, asmstr, pattern> {
938 field bits<48> SoftFail = 0;
943 let Inst{47-40} = op;
944 let Inst{39-32} = BDL2{23-16};
945 let Inst{31-16} = BD1;
946 let Inst{15-0} = BDL2{15-0};
949 class InstSSE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
950 : InstSystemZ<6, outs, ins, asmstr, pattern> {
952 field bits<48> SoftFail = 0;
957 let Inst{47-32} = op;
958 let Inst{31-16} = BD1;
959 let Inst{15-0} = BD2;
962 class InstSSF<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
963 : InstSystemZ<6, outs, ins, asmstr, pattern> {
965 field bits<48> SoftFail = 0;
971 let Inst{47-40} = op{11-4};
972 let Inst{39-36} = R3;
973 let Inst{35-32} = op{3-0};
974 let Inst{31-16} = BD1;
975 let Inst{15-0} = BD2;
978 class InstS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
979 : InstSystemZ<4, outs, ins, asmstr, pattern> {
981 field bits<32> SoftFail = 0;
985 let Inst{31-16} = op;
986 let Inst{15-0} = BD2;
989 class InstVRIa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
990 : InstSystemZ<6, outs, ins, asmstr, pattern> {
992 field bits<48> SoftFail = 0;
998 let Inst{47-40} = op{15-8};
999 let Inst{39-36} = V1{3-0};
1000 let Inst{35-32} = 0;
1001 let Inst{31-16} = I2;
1002 let Inst{15-12} = M3;
1003 let Inst{11} = V1{4};
1005 let Inst{7-0} = op{7-0};
1008 class InstVRIb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1009 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1010 field bits<48> Inst;
1011 field bits<48> SoftFail = 0;
1018 let Inst{47-40} = op{15-8};
1019 let Inst{39-36} = V1{3-0};
1020 let Inst{35-32} = 0;
1021 let Inst{31-24} = I2;
1022 let Inst{23-16} = I3;
1023 let Inst{15-12} = M4;
1024 let Inst{11} = V1{4};
1026 let Inst{7-0} = op{7-0};
1029 class InstVRIc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1030 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1031 field bits<48> Inst;
1032 field bits<48> SoftFail = 0;
1039 let Inst{47-40} = op{15-8};
1040 let Inst{39-36} = V1{3-0};
1041 let Inst{35-32} = V3{3-0};
1042 let Inst{31-16} = I2;
1043 let Inst{15-12} = M4;
1044 let Inst{11} = V1{4};
1045 let Inst{10} = V3{4};
1047 let Inst{7-0} = op{7-0};
1050 class InstVRId<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1051 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1052 field bits<48> Inst;
1053 field bits<48> SoftFail = 0;
1061 let Inst{47-40} = op{15-8};
1062 let Inst{39-36} = V1{3-0};
1063 let Inst{35-32} = V2{3-0};
1064 let Inst{31-28} = V3{3-0};
1065 let Inst{27-24} = 0;
1066 let Inst{23-16} = I4;
1067 let Inst{15-12} = M5;
1068 let Inst{11} = V1{4};
1069 let Inst{10} = V2{4};
1070 let Inst{9} = V3{4};
1072 let Inst{7-0} = op{7-0};
1075 class InstVRIe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1076 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1077 field bits<48> Inst;
1078 field bits<48> SoftFail = 0;
1086 let Inst{47-40} = op{15-8};
1087 let Inst{39-36} = V1{3-0};
1088 let Inst{35-32} = V2{3-0};
1089 let Inst{31-20} = I3;
1090 let Inst{19-16} = M5;
1091 let Inst{15-12} = M4;
1092 let Inst{11} = V1{4};
1093 let Inst{10} = V2{4};
1095 let Inst{7-0} = op{7-0};
1098 class InstVRIf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1099 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1100 field bits<48> Inst;
1101 field bits<48> SoftFail = 0;
1109 let Inst{47-40} = op{15-8};
1110 let Inst{39-36} = V1{3-0};
1111 let Inst{35-32} = V2{3-0};
1112 let Inst{31-28} = V3{3-0};
1113 let Inst{27-24} = 0;
1114 let Inst{23-20} = M5;
1115 let Inst{19-12} = I4;
1116 let Inst{11} = V1{4};
1117 let Inst{10} = V2{4};
1118 let Inst{9} = V3{4};
1120 let Inst{7-0} = op{7-0};
1123 class InstVRIg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1124 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1125 field bits<48> Inst;
1126 field bits<48> SoftFail = 0;
1134 let Inst{47-40} = op{15-8};
1135 let Inst{39-36} = V1{3-0};
1136 let Inst{35-32} = V2{3-0};
1137 let Inst{31-24} = I4;
1138 let Inst{23-20} = M5;
1139 let Inst{19-12} = I3;
1140 let Inst{11} = V1{4};
1141 let Inst{10} = V2{4};
1143 let Inst{7-0} = op{7-0};
1146 class InstVRIh<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1147 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1148 field bits<48> Inst;
1149 field bits<48> SoftFail = 0;
1155 let Inst{47-40} = op{15-8};
1156 let Inst{39-36} = V1{3-0};
1157 let Inst{35-32} = 0;
1158 let Inst{31-16} = I2;
1159 let Inst{15-12} = I3;
1160 let Inst{11} = V1{4};
1162 let Inst{7-0} = op{7-0};
1165 class InstVRIi<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1166 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1167 field bits<48> Inst;
1168 field bits<48> SoftFail = 0;
1175 let Inst{47-40} = op{15-8};
1176 let Inst{39-36} = V1{3-0};
1177 let Inst{35-32} = R2;
1178 let Inst{31-24} = 0;
1179 let Inst{23-20} = M4;
1180 let Inst{19-12} = I3;
1181 let Inst{11} = V1{4};
1183 let Inst{7-0} = op{7-0};
1186 // Depending on the instruction mnemonic, certain bits may be or-ed into
1187 // the M4 value provided as explicit operand. These are passed as m4or.
1188 class InstVRRa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1190 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1191 field bits<48> Inst;
1192 field bits<48> SoftFail = 0;
1200 let Inst{47-40} = op{15-8};
1201 let Inst{39-36} = V1{3-0};
1202 let Inst{35-32} = V2{3-0};
1203 let Inst{31-24} = 0;
1204 let Inst{23-20} = M5;
1205 let Inst{19} = !if (!eq (m4or{3}, 1), 1, M4{3});
1206 let Inst{18} = !if (!eq (m4or{2}, 1), 1, M4{2});
1207 let Inst{17} = !if (!eq (m4or{1}, 1), 1, M4{1});
1208 let Inst{16} = !if (!eq (m4or{0}, 1), 1, M4{0});
1209 let Inst{15-12} = M3;
1210 let Inst{11} = V1{4};
1211 let Inst{10} = V2{4};
1213 let Inst{7-0} = op{7-0};
1216 // Depending on the instruction mnemonic, certain bits may be or-ed into
1217 // the M5 value provided as explicit operand. These are passed as m5or.
1218 class InstVRRb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1220 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1221 field bits<48> Inst;
1222 field bits<48> SoftFail = 0;
1230 let Inst{47-40} = op{15-8};
1231 let Inst{39-36} = V1{3-0};
1232 let Inst{35-32} = V2{3-0};
1233 let Inst{31-28} = V3{3-0};
1234 let Inst{27-24} = 0;
1235 let Inst{23} = !if (!eq (m5or{3}, 1), 1, M5{3});
1236 let Inst{22} = !if (!eq (m5or{2}, 1), 1, M5{2});
1237 let Inst{21} = !if (!eq (m5or{1}, 1), 1, M5{1});
1238 let Inst{20} = !if (!eq (m5or{0}, 1), 1, M5{0});
1239 let Inst{19-16} = 0;
1240 let Inst{15-12} = M4;
1241 let Inst{11} = V1{4};
1242 let Inst{10} = V2{4};
1243 let Inst{9} = V3{4};
1245 let Inst{7-0} = op{7-0};
1248 class InstVRRc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1249 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1250 field bits<48> Inst;
1251 field bits<48> SoftFail = 0;
1260 let Inst{47-40} = op{15-8};
1261 let Inst{39-36} = V1{3-0};
1262 let Inst{35-32} = V2{3-0};
1263 let Inst{31-28} = V3{3-0};
1264 let Inst{27-24} = 0;
1265 let Inst{23-20} = M6;
1266 let Inst{19-16} = M5;
1267 let Inst{15-12} = M4;
1268 let Inst{11} = V1{4};
1269 let Inst{10} = V2{4};
1270 let Inst{9} = V3{4};
1272 let Inst{7-0} = op{7-0};
1275 // Depending on the instruction mnemonic, certain bits may be or-ed into
1276 // the M6 value provided as explicit operand. These are passed as m6or.
1277 class InstVRRd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1279 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1280 field bits<48> Inst;
1281 field bits<48> SoftFail = 0;
1290 let Inst{47-40} = op{15-8};
1291 let Inst{39-36} = V1{3-0};
1292 let Inst{35-32} = V2{3-0};
1293 let Inst{31-28} = V3{3-0};
1294 let Inst{27-24} = M5;
1295 let Inst{23} = !if (!eq (m6or{3}, 1), 1, M6{3});
1296 let Inst{22} = !if (!eq (m6or{2}, 1), 1, M6{2});
1297 let Inst{21} = !if (!eq (m6or{1}, 1), 1, M6{1});
1298 let Inst{20} = !if (!eq (m6or{0}, 1), 1, M6{0});
1299 let Inst{19-16} = 0;
1300 let Inst{15-12} = V4{3-0};
1301 let Inst{11} = V1{4};
1302 let Inst{10} = V2{4};
1303 let Inst{9} = V3{4};
1304 let Inst{8} = V4{4};
1305 let Inst{7-0} = op{7-0};
1308 class InstVRRe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1309 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1310 field bits<48> Inst;
1311 field bits<48> SoftFail = 0;
1320 let Inst{47-40} = op{15-8};
1321 let Inst{39-36} = V1{3-0};
1322 let Inst{35-32} = V2{3-0};
1323 let Inst{31-28} = V3{3-0};
1324 let Inst{27-24} = M6;
1325 let Inst{23-20} = 0;
1326 let Inst{19-16} = M5;
1327 let Inst{15-12} = V4{3-0};
1328 let Inst{11} = V1{4};
1329 let Inst{10} = V2{4};
1330 let Inst{9} = V3{4};
1331 let Inst{8} = V4{4};
1332 let Inst{7-0} = op{7-0};
1335 class InstVRRf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1336 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1337 field bits<48> Inst;
1338 field bits<48> SoftFail = 0;
1344 let Inst{47-40} = op{15-8};
1345 let Inst{39-36} = V1{3-0};
1346 let Inst{35-32} = R2;
1347 let Inst{31-28} = R3;
1348 let Inst{27-12} = 0;
1349 let Inst{11} = V1{4};
1351 let Inst{7-0} = op{7-0};
1354 class InstVRRg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1355 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1356 field bits<48> Inst;
1357 field bits<48> SoftFail = 0;
1361 let Inst{47-40} = op{15-8};
1362 let Inst{39-36} = 0;
1363 let Inst{35-32} = V1{3-0};
1364 let Inst{31-12} = 0;
1366 let Inst{10} = V1{4};
1368 let Inst{7-0} = op{7-0};
1371 class InstVRRh<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1372 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1373 field bits<48> Inst;
1374 field bits<48> SoftFail = 0;
1380 let Inst{47-40} = op{15-8};
1381 let Inst{39-36} = 0;
1382 let Inst{35-32} = V1{3-0};
1383 let Inst{31-28} = V2{3-0};
1384 let Inst{27-24} = 0;
1385 let Inst{23-20} = M3;
1386 let Inst{19-12} = 0;
1388 let Inst{10} = V1{4};
1389 let Inst{9} = V2{4};
1391 let Inst{7-0} = op{7-0};
1394 class InstVRRi<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1395 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1396 field bits<48> Inst;
1397 field bits<48> SoftFail = 0;
1403 let Inst{47-40} = op{15-8};
1404 let Inst{39-36} = R1;
1405 let Inst{35-32} = V2{3-0};
1406 let Inst{31-24} = 0;
1407 let Inst{23-20} = M3;
1408 let Inst{19-12} = 0;
1410 let Inst{10} = V2{4};
1412 let Inst{7-0} = op{7-0};
1415 class InstVRSa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1416 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1417 field bits<48> Inst;
1418 field bits<48> SoftFail = 0;
1425 let Inst{47-40} = op{15-8};
1426 let Inst{39-36} = V1{3-0};
1427 let Inst{35-32} = V3{3-0};
1428 let Inst{31-16} = BD2;
1429 let Inst{15-12} = M4;
1430 let Inst{11} = V1{4};
1431 let Inst{10} = V3{4};
1433 let Inst{7-0} = op{7-0};
1436 class InstVRSb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1437 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1438 field bits<48> Inst;
1439 field bits<48> SoftFail = 0;
1446 let Inst{47-40} = op{15-8};
1447 let Inst{39-36} = V1{3-0};
1448 let Inst{35-32} = R3;
1449 let Inst{31-16} = BD2;
1450 let Inst{15-12} = M4;
1451 let Inst{11} = V1{4};
1453 let Inst{7-0} = op{7-0};
1456 class InstVRSc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1457 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1458 field bits<48> Inst;
1459 field bits<48> SoftFail = 0;
1466 let Inst{47-40} = op{15-8};
1467 let Inst{39-36} = R1;
1468 let Inst{35-32} = V3{3-0};
1469 let Inst{31-16} = BD2;
1470 let Inst{15-12} = M4;
1472 let Inst{10} = V3{4};
1474 let Inst{7-0} = op{7-0};
1477 class InstVRSd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1478 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1479 field bits<48> Inst;
1480 field bits<48> SoftFail = 0;
1486 let Inst{47-40} = op{15-8};
1487 let Inst{39-36} = 0;
1488 let Inst{35-32} = R3;
1489 let Inst{31-16} = BD2;
1490 let Inst{15-12} = V1{3-0};
1492 let Inst{8} = V1{4};
1493 let Inst{7-0} = op{7-0};
1496 class InstVRV<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1497 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1498 field bits<48> Inst;
1499 field bits<48> SoftFail = 0;
1505 let Inst{47-40} = op{15-8};
1506 let Inst{39-36} = V1{3-0};
1507 let Inst{35-16} = VBD2{19-0};
1508 let Inst{15-12} = M3;
1509 let Inst{11} = V1{4};
1510 let Inst{10} = VBD2{20};
1512 let Inst{7-0} = op{7-0};
1515 class InstVRX<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1516 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1517 field bits<48> Inst;
1518 field bits<48> SoftFail = 0;
1524 let Inst{47-40} = op{15-8};
1525 let Inst{39-36} = V1{3-0};
1526 let Inst{35-16} = XBD2;
1527 let Inst{15-12} = M3;
1528 let Inst{11} = V1{4};
1530 let Inst{7-0} = op{7-0};
1533 class InstVSI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1534 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1535 field bits<48> Inst;
1536 field bits<48> SoftFail = 0;
1542 let Inst{47-40} = op{15-8};
1543 let Inst{39-32} = I3;
1544 let Inst{31-16} = BD2;
1545 let Inst{15-12} = V1{3-0};
1547 let Inst{8} = V1{4};
1548 let Inst{7-0} = op{7-0};
1551 //===----------------------------------------------------------------------===//
1552 // Instruction classes for .insn directives
1553 //===----------------------------------------------------------------------===//
1555 class DirectiveInsnE<dag outs, dag ins, string asmstr, list<dag> pattern>
1556 : InstE<0, outs, ins, asmstr, pattern> {
1562 class DirectiveInsnRI<dag outs, dag ins, string asmstr, list<dag> pattern>
1563 : InstRIa<0, outs, ins, asmstr, pattern> {
1566 let Inst{31-24} = enc{31-24};
1567 let Inst{19-16} = enc{19-16};
1570 class DirectiveInsnRIE<dag outs, dag ins, string asmstr, list<dag> pattern>
1571 : InstRIEd<0, outs, ins, asmstr, pattern> {
1574 let Inst{47-40} = enc{47-40};
1575 let Inst{7-0} = enc{7-0};
1578 class DirectiveInsnRIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1579 : InstRILa<0, outs, ins, asmstr, pattern> {
1583 let Inst{47-40} = enc{47-40};
1584 let Inst{35-32} = enc{35-32};
1587 class DirectiveInsnRIS<dag outs, dag ins, string asmstr, list<dag> pattern>
1588 : InstRIS<0, outs, ins, asmstr, pattern> {
1591 let Inst{47-40} = enc{47-40};
1592 let Inst{7-0} = enc{7-0};
1595 class DirectiveInsnRR<dag outs, dag ins, string asmstr, list<dag> pattern>
1596 : InstRR<0, outs, ins, asmstr, pattern> {
1599 let Inst{15-8} = enc{15-8};
1602 class DirectiveInsnRRE<dag outs, dag ins, string asmstr, list<dag> pattern>
1603 : InstRRE<0, outs, ins, asmstr, pattern> {
1606 let Inst{31-16} = enc{31-16};
1609 class DirectiveInsnRRF<dag outs, dag ins, string asmstr, list<dag> pattern>
1610 : InstRRFa<0, outs, ins, asmstr, pattern> {
1613 let Inst{31-16} = enc{31-16};
1616 class DirectiveInsnRRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1617 : InstRRS<0, outs, ins, asmstr, pattern> {
1620 let Inst{47-40} = enc{47-40};
1621 let Inst{7-0} = enc{7-0};
1624 class DirectiveInsnRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1625 : InstRSa<0, outs, ins, asmstr, pattern> {
1628 let Inst{31-24} = enc{31-24};
1631 // RSE is like RSY except with a 12 bit displacement (instead of 20).
1632 class DirectiveInsnRSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1633 : InstRSYa<6, outs, ins, asmstr, pattern> {
1636 let Inst{47-40} = enc{47-40};
1637 let Inst{31-16} = BD2{15-0};
1639 let Inst{7-0} = enc{7-0};
1642 class DirectiveInsnRSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1643 : InstRSI<0, outs, ins, asmstr, pattern> {
1646 let Inst{31-24} = enc{31-24};
1649 class DirectiveInsnRSY<dag outs, dag ins, string asmstr, list<dag> pattern>
1650 : InstRSYa<0, outs, ins, asmstr, pattern> {
1653 let Inst{47-40} = enc{47-40};
1654 let Inst{7-0} = enc{7-0};
1657 class DirectiveInsnRX<dag outs, dag ins, string asmstr, list<dag> pattern>
1658 : InstRXa<0, outs, ins, asmstr, pattern> {
1661 let Inst{31-24} = enc{31-24};
1664 class DirectiveInsnRXE<dag outs, dag ins, string asmstr, list<dag> pattern>
1665 : InstRXE<0, outs, ins, asmstr, pattern> {
1670 let Inst{47-40} = enc{47-40};
1671 let Inst{7-0} = enc{7-0};
1674 class DirectiveInsnRXF<dag outs, dag ins, string asmstr, list<dag> pattern>
1675 : InstRXF<0, outs, ins, asmstr, pattern> {
1678 let Inst{47-40} = enc{47-40};
1679 let Inst{7-0} = enc{7-0};
1682 class DirectiveInsnRXY<dag outs, dag ins, string asmstr, list<dag> pattern>
1683 : InstRXYa<0, outs, ins, asmstr, pattern> {
1686 let Inst{47-40} = enc{47-40};
1687 let Inst{7-0} = enc{7-0};
1690 class DirectiveInsnS<dag outs, dag ins, string asmstr, list<dag> pattern>
1691 : InstS<0, outs, ins, asmstr, pattern> {
1694 let Inst{31-16} = enc{31-16};
1697 class DirectiveInsnSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1698 : InstSI<0, outs, ins, asmstr, pattern> {
1701 let Inst{31-24} = enc{31-24};
1704 class DirectiveInsnSIY<dag outs, dag ins, string asmstr, list<dag> pattern>
1705 : InstSIY<0, outs, ins, asmstr, pattern> {
1708 let Inst{47-40} = enc{47-40};
1709 let Inst{7-0} = enc{7-0};
1712 class DirectiveInsnSIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1713 : InstSIL<0, outs, ins, asmstr, pattern> {
1716 let Inst{47-32} = enc{47-32};
1719 class DirectiveInsnSS<dag outs, dag ins, string asmstr, list<dag> pattern>
1720 : InstSSd<0, outs, ins, asmstr, pattern> {
1723 let Inst{47-40} = enc{47-40};
1726 class DirectiveInsnSSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1727 : InstSSE<0, outs, ins, asmstr, pattern> {
1730 let Inst{47-32} = enc{47-32};
1733 class DirectiveInsnSSF<dag outs, dag ins, string asmstr, list<dag> pattern>
1734 : InstSSF<0, outs, ins, asmstr, pattern> {
1737 let Inst{47-40} = enc{47-40};
1738 let Inst{35-32} = enc{35-32};
1741 //===----------------------------------------------------------------------===//
1742 // Variants of instructions with condition mask
1743 //===----------------------------------------------------------------------===//
1745 // For instructions using a condition mask (e.g. conditional branches,
1746 // compare-and-branch instructions, or conditional move instructions),
1747 // we generally need to create multiple instruction patterns:
1749 // - One used for code generation, which encodes the condition mask as an
1750 // MI operand, but writes out an extended mnemonic for better readability.
1751 // - One pattern for the base form of the instruction with an explicit
1752 // condition mask (encoded as a plain integer MI operand).
1753 // - Specific patterns for each extended mnemonic, where the condition mask
1754 // is implied by the pattern name and not otherwise encoded at all.
1756 // We need the latter primarily for the assembler and disassembler, since the
1757 // assembler parser is not able to decode part of an instruction mnemonic
1758 // into an operand. Thus we provide separate patterns for each mnemonic.
1760 // Note that in some cases there are two different mnemonics for the same
1761 // condition mask. In this case we cannot have both instructions available
1762 // to the disassembler at the same time since the encodings are not distinct.
1763 // Therefore the alternate forms are marked isAsmParserOnly.
1765 // We don't make one of the two names an alias of the other because
1766 // we need the custom parsing routines to select the correct register class.
1768 // This section provides helpers for generating the specific forms.
1770 //===----------------------------------------------------------------------===//
1772 // A class to describe a variant of an instruction with condition mask.
1773 class CondVariant<bits<4> ccmaskin, string suffixin, bit alternatein> {
1774 // The fixed condition mask to use.
1775 bits<4> ccmask = ccmaskin;
1777 // The suffix to use for the extended assembler mnemonic.
1778 string suffix = suffixin;
1780 // Whether this is an alternate that needs to be marked isAsmParserOnly.
1781 bit alternate = alternatein;
1784 // Condition mask 15 means "always true", which is used to define
1785 // unconditional branches as a variant of conditional branches.
1786 def CondAlways : CondVariant<15, "", 0>;
1788 // Condition masks for general instructions that can set all 4 bits.
1789 def CondVariantO : CondVariant<1, "o", 0>;
1790 def CondVariantH : CondVariant<2, "h", 0>;
1791 def CondVariantP : CondVariant<2, "p", 1>;
1792 def CondVariantNLE : CondVariant<3, "nle", 0>;
1793 def CondVariantL : CondVariant<4, "l", 0>;
1794 def CondVariantM : CondVariant<4, "m", 1>;
1795 def CondVariantNHE : CondVariant<5, "nhe", 0>;
1796 def CondVariantLH : CondVariant<6, "lh", 0>;
1797 def CondVariantNE : CondVariant<7, "ne", 0>;
1798 def CondVariantNZ : CondVariant<7, "nz", 1>;
1799 def CondVariantE : CondVariant<8, "e", 0>;
1800 def CondVariantZ : CondVariant<8, "z", 1>;
1801 def CondVariantNLH : CondVariant<9, "nlh", 0>;
1802 def CondVariantHE : CondVariant<10, "he", 0>;
1803 def CondVariantNL : CondVariant<11, "nl", 0>;
1804 def CondVariantNM : CondVariant<11, "nm", 1>;
1805 def CondVariantLE : CondVariant<12, "le", 0>;
1806 def CondVariantNH : CondVariant<13, "nh", 0>;
1807 def CondVariantNP : CondVariant<13, "np", 1>;
1808 def CondVariantNO : CondVariant<14, "no", 0>;
1810 // A helper class to look up one of the above by name.
1811 class CV<string name>
1812 : CondVariant<!cast<CondVariant>("CondVariant"#name).ccmask,
1813 !cast<CondVariant>("CondVariant"#name).suffix,
1814 !cast<CondVariant>("CondVariant"#name).alternate>;
1816 // Condition masks for integer instructions (e.g. compare-and-branch).
1817 // This is like the list above, except that condition 3 is not possible
1818 // and that the low bit of the mask is therefore always 0. This means
1819 // that each condition has two names. Conditions "o" and "no" are not used.
1820 def IntCondVariantH : CondVariant<2, "h", 0>;
1821 def IntCondVariantNLE : CondVariant<2, "nle", 1>;
1822 def IntCondVariantL : CondVariant<4, "l", 0>;
1823 def IntCondVariantNHE : CondVariant<4, "nhe", 1>;
1824 def IntCondVariantLH : CondVariant<6, "lh", 0>;
1825 def IntCondVariantNE : CondVariant<6, "ne", 1>;
1826 def IntCondVariantE : CondVariant<8, "e", 0>;
1827 def IntCondVariantNLH : CondVariant<8, "nlh", 1>;
1828 def IntCondVariantHE : CondVariant<10, "he", 0>;
1829 def IntCondVariantNL : CondVariant<10, "nl", 1>;
1830 def IntCondVariantLE : CondVariant<12, "le", 0>;
1831 def IntCondVariantNH : CondVariant<12, "nh", 1>;
1833 // A helper class to look up one of the above by name.
1834 class ICV<string name>
1835 : CondVariant<!cast<CondVariant>("IntCondVariant"#name).ccmask,
1836 !cast<CondVariant>("IntCondVariant"#name).suffix,
1837 !cast<CondVariant>("IntCondVariant"#name).alternate>;
1839 //===----------------------------------------------------------------------===//
1840 // Instruction definitions with semantics
1841 //===----------------------------------------------------------------------===//
1843 // These classes have the form [Cond]<Category><Format>, where <Format> is one
1844 // of the formats defined above and where <Category> describes the inputs
1845 // and outputs. "Cond" is used if the instruction is conditional,
1846 // in which case the 4-bit condition-code mask is added as a final operand.
1847 // <Category> can be one of:
1850 // One register output operand and no input operands.
1853 // Two register output operands and no input operands.
1856 // One address operand. The instruction stores to the address.
1858 // SideEffectInherent:
1859 // No input or output operands, but causes some side effect.
1862 // One branch target. The instruction branches to the target.
1865 // One output operand and one branch target. The instruction stores
1866 // the return address to the output operand and branches to the target.
1869 // Two input operands and one optional branch target. The instruction
1870 // compares the two input operands and branches or traps on the result.
1873 // One register output operand, one register input operand and one branch
1874 // target. The instructions stores a modified form of the source register
1875 // in the destination register and branches on the result.
1878 // One register output operand, two register input operands and one branch
1879 // target. The instructions stores a modified form of one of the source
1880 // registers in the destination register and branches on the result.
1883 // One address input operand and two explicit output operands.
1884 // The instruction loads a range of registers from the address,
1885 // with the explicit operands giving the first and last register
1886 // to load. Other loaded registers are added as implicit definitions.
1889 // Two explicit input register operands and an address operand.
1890 // The instruction stores a range of registers to the address,
1891 // with the explicit operands giving the first and last register
1892 // to store. Other stored registers are added as implicit uses.
1895 // One value operand, one length operand and one address operand.
1896 // The instruction stores the value operand to the address but
1897 // doesn't write more than the number of bytes specified by the
1901 // One register output operand and one address operand.
1903 // SideEffectAddress:
1904 // One address operand. No output operands, but causes some side effect.
1907 // One register output operand and one input operand.
1910 // One address operand and one other input operand. The instruction
1911 // stores to the address.
1914 // One input operand. No output operands, but causes some side effect.
1917 // One register output operand and two input operands.
1920 // One address operand and two other input operands. The instruction
1921 // stores to the address.
1923 // SideEffectBinary:
1924 // Two input operands. No output operands, but causes some side effect.
1927 // Two input operands and an implicit CC output operand.
1930 // One or two input operands and an implicit CC output operand. If
1931 // present, the second input operand is an "address" operand used as
1932 // a test class mask.
1935 // One register output operand and three input operands.
1937 // SideEffectTernary:
1938 // Three input operands. No output operands, but causes some side effect.
1941 // One register output operand and four input operands.
1944 // One output operand and two input operands, one of which is an address.
1945 // The instruction both reads from and writes to the address.
1948 // One output operand and three input operands, one of which is an address.
1949 // The instruction both reads from and writes to the address.
1952 // One output operand and five input operands. The first two operands
1953 // are registers and the other three are immediates.
1956 // One 4-bit immediate operand and one address operand. The immediate
1957 // operand is 1 for a load prefetch and 2 for a store prefetch.
1960 // One 4-bit immediate operand and two address operands.
1962 // The format determines which input operands are tied to output operands,
1963 // and also determines the shape of any address operand.
1965 // Multiclasses of the form <Category><Format>Pair define two instructions,
1966 // one with <Category><Format> and one with <Category><Format>Y. The name
1967 // of the first instruction has no suffix, the name of the second has
1970 //===----------------------------------------------------------------------===//
1972 class InherentRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
1973 SDPatternOperator operator>
1974 : InstRRE<opcode, (outs cls:$R1), (ins),
1976 [(set cls:$R1, (operator))]> {
1980 class InherentDualRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
1981 : InstRRE<opcode, (outs cls:$R1, cls:$R2), (ins),
1982 mnemonic#"\t$R1, $R2", []>;
1984 class InherentVRIa<string mnemonic, bits<16> opcode, bits<16> value>
1985 : InstVRIa<opcode, (outs VR128:$V1), (ins), mnemonic#"\t$V1", []> {
1990 class StoreInherentS<string mnemonic, bits<16> opcode,
1991 SDPatternOperator operator, bits<5> bytes>
1992 : InstS<opcode, (outs), (ins bdaddr12only:$BD2),
1993 mnemonic#"\t$BD2", [(operator bdaddr12only:$BD2)]> {
1995 let AccessBytes = bytes;
1998 class SideEffectInherentE<string mnemonic, bits<16>opcode>
1999 : InstE<opcode, (outs), (ins), mnemonic, []>;
2001 class SideEffectInherentS<string mnemonic, bits<16> opcode,
2002 SDPatternOperator operator>
2003 : InstS<opcode, (outs), (ins), mnemonic, [(operator)]> {
2007 class SideEffectInherentRRE<string mnemonic, bits<16> opcode>
2008 : InstRRE<opcode, (outs), (ins), mnemonic, []> {
2013 // Allow an optional TLS marker symbol to generate TLS call relocations.
2014 class CallRI<string mnemonic, bits<12> opcode>
2015 : InstRIb<opcode, (outs), (ins GR64:$R1, brtarget16tls:$RI2),
2016 mnemonic#"\t$R1, $RI2", []>;
2018 // Allow an optional TLS marker symbol to generate TLS call relocations.
2019 class CallRIL<string mnemonic, bits<12> opcode>
2020 : InstRILb<opcode, (outs), (ins GR64:$R1, brtarget32tls:$RI2),
2021 mnemonic#"\t$R1, $RI2", []>;
2023 class CallRR<string mnemonic, bits<8> opcode>
2024 : InstRR<opcode, (outs), (ins GR64:$R1, ADDR64:$R2),
2025 mnemonic#"\t$R1, $R2", []>;
2027 class CallRX<string mnemonic, bits<8> opcode>
2028 : InstRXa<opcode, (outs), (ins GR64:$R1, bdxaddr12only:$XBD2),
2029 mnemonic#"\t$R1, $XBD2", []>;
2031 class CondBranchRI<string mnemonic, bits<12> opcode,
2032 SDPatternOperator operator = null_frag>
2033 : InstRIc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget16:$RI2),
2034 !subst("#", "${M1}", mnemonic)#"\t$RI2",
2035 [(operator cond4:$valid, cond4:$M1, bb:$RI2)]> {
2036 let CCMaskFirst = 1;
2039 class AsmCondBranchRI<string mnemonic, bits<12> opcode>
2040 : InstRIc<opcode, (outs), (ins imm32zx4:$M1, brtarget16:$RI2),
2041 mnemonic#"\t$M1, $RI2", []>;
2043 class FixedCondBranchRI<CondVariant V, string mnemonic, bits<12> opcode,
2044 SDPatternOperator operator = null_frag>
2045 : InstRIc<opcode, (outs), (ins brtarget16:$RI2),
2046 !subst("#", V.suffix, mnemonic)#"\t$RI2", [(operator bb:$RI2)]> {
2047 let isAsmParserOnly = V.alternate;
2051 class CondBranchRIL<string mnemonic, bits<12> opcode>
2052 : InstRILc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget32:$RI2),
2053 !subst("#", "${M1}", mnemonic)#"\t$RI2", []> {
2054 let CCMaskFirst = 1;
2057 class AsmCondBranchRIL<string mnemonic, bits<12> opcode>
2058 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, brtarget32:$RI2),
2059 mnemonic#"\t$M1, $RI2", []>;
2061 class FixedCondBranchRIL<CondVariant V, string mnemonic, bits<12> opcode>
2062 : InstRILc<opcode, (outs), (ins brtarget32:$RI2),
2063 !subst("#", V.suffix, mnemonic)#"\t$RI2", []> {
2064 let isAsmParserOnly = V.alternate;
2068 class CondBranchRR<string mnemonic, bits<8> opcode>
2069 : InstRR<opcode, (outs), (ins cond4:$valid, cond4:$R1, GR64:$R2),
2070 !subst("#", "${R1}", mnemonic)#"\t$R2", []> {
2071 let CCMaskFirst = 1;
2074 class AsmCondBranchRR<string mnemonic, bits<8> opcode>
2075 : InstRR<opcode, (outs), (ins imm32zx4:$R1, GR64:$R2),
2076 mnemonic#"\t$R1, $R2", []>;
2078 class FixedCondBranchRR<CondVariant V, string mnemonic, bits<8> opcode,
2079 SDPatternOperator operator = null_frag>
2080 : InstRR<opcode, (outs), (ins ADDR64:$R2),
2081 !subst("#", V.suffix, mnemonic)#"\t$R2", [(operator ADDR64:$R2)]> {
2082 let isAsmParserOnly = V.alternate;
2086 class CondBranchRX<string mnemonic, bits<8> opcode>
2087 : InstRXb<opcode, (outs), (ins cond4:$valid, cond4:$M1, bdxaddr12only:$XBD2),
2088 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
2089 let CCMaskFirst = 1;
2092 class AsmCondBranchRX<string mnemonic, bits<8> opcode>
2093 : InstRXb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr12only:$XBD2),
2094 mnemonic#"\t$M1, $XBD2", []>;
2096 class FixedCondBranchRX<CondVariant V, string mnemonic, bits<8> opcode>
2097 : InstRXb<opcode, (outs), (ins bdxaddr12only:$XBD2),
2098 !subst("#", V.suffix, mnemonic)#"\t$XBD2", []> {
2099 let isAsmParserOnly = V.alternate;
2103 class CondBranchRXY<string mnemonic, bits<16> opcode>
2104 : InstRXYb<opcode, (outs), (ins cond4:$valid, cond4:$M1, bdxaddr20only:$XBD2),
2105 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
2106 let CCMaskFirst = 1;
2110 class AsmCondBranchRXY<string mnemonic, bits<16> opcode>
2111 : InstRXYb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr20only:$XBD2),
2112 mnemonic#"\t$M1, $XBD2", []> {
2116 class FixedCondBranchRXY<CondVariant V, string mnemonic, bits<16> opcode,
2117 SDPatternOperator operator = null_frag>
2118 : InstRXYb<opcode, (outs), (ins bdxaddr20only:$XBD2),
2119 !subst("#", V.suffix, mnemonic)#"\t$XBD2",
2120 [(operator (load bdxaddr20only:$XBD2))]> {
2121 let isAsmParserOnly = V.alternate;
2126 class CmpBranchRIEa<string mnemonic, bits<16> opcode,
2127 RegisterOperand cls, Immediate imm>
2128 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, cond4:$M3),
2129 mnemonic#"$M3\t$R1, $I2", []>;
2131 class AsmCmpBranchRIEa<string mnemonic, bits<16> opcode,
2132 RegisterOperand cls, Immediate imm>
2133 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, imm32zx4:$M3),
2134 mnemonic#"\t$R1, $I2, $M3", []>;
2136 class FixedCmpBranchRIEa<CondVariant V, string mnemonic, bits<16> opcode,
2137 RegisterOperand cls, Immediate imm>
2138 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2),
2139 mnemonic#V.suffix#"\t$R1, $I2", []> {
2140 let isAsmParserOnly = V.alternate;
2144 multiclass CmpBranchRIEaPair<string mnemonic, bits<16> opcode,
2145 RegisterOperand cls, Immediate imm> {
2146 let isCodeGenOnly = 1 in
2147 def "" : CmpBranchRIEa<mnemonic, opcode, cls, imm>;
2148 def Asm : AsmCmpBranchRIEa<mnemonic, opcode, cls, imm>;
2151 class CmpBranchRIEb<string mnemonic, bits<16> opcode,
2152 RegisterOperand cls>
2153 : InstRIEb<opcode, (outs),
2154 (ins cls:$R1, cls:$R2, cond4:$M3, brtarget16:$RI4),
2155 mnemonic#"$M3\t$R1, $R2, $RI4", []>;
2157 class AsmCmpBranchRIEb<string mnemonic, bits<16> opcode,
2158 RegisterOperand cls>
2159 : InstRIEb<opcode, (outs),
2160 (ins cls:$R1, cls:$R2, imm32zx4:$M3, brtarget16:$RI4),
2161 mnemonic#"\t$R1, $R2, $M3, $RI4", []>;
2163 class FixedCmpBranchRIEb<CondVariant V, string mnemonic, bits<16> opcode,
2164 RegisterOperand cls>
2165 : InstRIEb<opcode, (outs), (ins cls:$R1, cls:$R2, brtarget16:$RI4),
2166 mnemonic#V.suffix#"\t$R1, $R2, $RI4", []> {
2167 let isAsmParserOnly = V.alternate;
2171 multiclass CmpBranchRIEbPair<string mnemonic, bits<16> opcode,
2172 RegisterOperand cls> {
2173 let isCodeGenOnly = 1 in
2174 def "" : CmpBranchRIEb<mnemonic, opcode, cls>;
2175 def Asm : AsmCmpBranchRIEb<mnemonic, opcode, cls>;
2178 class CmpBranchRIEc<string mnemonic, bits<16> opcode,
2179 RegisterOperand cls, Immediate imm>
2180 : InstRIEc<opcode, (outs),
2181 (ins cls:$R1, imm:$I2, cond4:$M3, brtarget16:$RI4),
2182 mnemonic#"$M3\t$R1, $I2, $RI4", []>;
2184 class AsmCmpBranchRIEc<string mnemonic, bits<16> opcode,
2185 RegisterOperand cls, Immediate imm>
2186 : InstRIEc<opcode, (outs),
2187 (ins cls:$R1, imm:$I2, imm32zx4:$M3, brtarget16:$RI4),
2188 mnemonic#"\t$R1, $I2, $M3, $RI4", []>;
2190 class FixedCmpBranchRIEc<CondVariant V, string mnemonic, bits<16> opcode,
2191 RegisterOperand cls, Immediate imm>
2192 : InstRIEc<opcode, (outs), (ins cls:$R1, imm:$I2, brtarget16:$RI4),
2193 mnemonic#V.suffix#"\t$R1, $I2, $RI4", []> {
2194 let isAsmParserOnly = V.alternate;
2198 multiclass CmpBranchRIEcPair<string mnemonic, bits<16> opcode,
2199 RegisterOperand cls, Immediate imm> {
2200 let isCodeGenOnly = 1 in
2201 def "" : CmpBranchRIEc<mnemonic, opcode, cls, imm>;
2202 def Asm : AsmCmpBranchRIEc<mnemonic, opcode, cls, imm>;
2205 class CmpBranchRRFc<string mnemonic, bits<16> opcode,
2206 RegisterOperand cls>
2207 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, cond4:$M3),
2208 mnemonic#"$M3\t$R1, $R2", []>;
2210 class AsmCmpBranchRRFc<string mnemonic, bits<16> opcode,
2211 RegisterOperand cls>
2212 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, imm32zx4:$M3),
2213 mnemonic#"\t$R1, $R2, $M3", []>;
2215 multiclass CmpBranchRRFcPair<string mnemonic, bits<16> opcode,
2216 RegisterOperand cls> {
2217 let isCodeGenOnly = 1 in
2218 def "" : CmpBranchRRFc<mnemonic, opcode, cls>;
2219 def Asm : AsmCmpBranchRRFc<mnemonic, opcode, cls>;
2222 class FixedCmpBranchRRFc<CondVariant V, string mnemonic, bits<16> opcode,
2223 RegisterOperand cls>
2224 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2),
2225 mnemonic#V.suffix#"\t$R1, $R2", []> {
2226 let isAsmParserOnly = V.alternate;
2230 class CmpBranchRRS<string mnemonic, bits<16> opcode,
2231 RegisterOperand cls>
2232 : InstRRS<opcode, (outs),
2233 (ins cls:$R1, cls:$R2, cond4:$M3, bdaddr12only:$BD4),
2234 mnemonic#"$M3\t$R1, $R2, $BD4", []>;
2236 class AsmCmpBranchRRS<string mnemonic, bits<16> opcode,
2237 RegisterOperand cls>
2238 : InstRRS<opcode, (outs),
2239 (ins cls:$R1, cls:$R2, imm32zx4:$M3, bdaddr12only:$BD4),
2240 mnemonic#"\t$R1, $R2, $M3, $BD4", []>;
2242 class FixedCmpBranchRRS<CondVariant V, string mnemonic, bits<16> opcode,
2243 RegisterOperand cls>
2244 : InstRRS<opcode, (outs), (ins cls:$R1, cls:$R2, bdaddr12only:$BD4),
2245 mnemonic#V.suffix#"\t$R1, $R2, $BD4", []> {
2246 let isAsmParserOnly = V.alternate;
2250 multiclass CmpBranchRRSPair<string mnemonic, bits<16> opcode,
2251 RegisterOperand cls> {
2252 let isCodeGenOnly = 1 in
2253 def "" : CmpBranchRRS<mnemonic, opcode, cls>;
2254 def Asm : AsmCmpBranchRRS<mnemonic, opcode, cls>;
2257 class CmpBranchRIS<string mnemonic, bits<16> opcode,
2258 RegisterOperand cls, Immediate imm>
2259 : InstRIS<opcode, (outs),
2260 (ins cls:$R1, imm:$I2, cond4:$M3, bdaddr12only:$BD4),
2261 mnemonic#"$M3\t$R1, $I2, $BD4", []>;
2263 class AsmCmpBranchRIS<string mnemonic, bits<16> opcode,
2264 RegisterOperand cls, Immediate imm>
2265 : InstRIS<opcode, (outs),
2266 (ins cls:$R1, imm:$I2, imm32zx4:$M3, bdaddr12only:$BD4),
2267 mnemonic#"\t$R1, $I2, $M3, $BD4", []>;
2269 class FixedCmpBranchRIS<CondVariant V, string mnemonic, bits<16> opcode,
2270 RegisterOperand cls, Immediate imm>
2271 : InstRIS<opcode, (outs), (ins cls:$R1, imm:$I2, bdaddr12only:$BD4),
2272 mnemonic#V.suffix#"\t$R1, $I2, $BD4", []> {
2273 let isAsmParserOnly = V.alternate;
2277 multiclass CmpBranchRISPair<string mnemonic, bits<16> opcode,
2278 RegisterOperand cls, Immediate imm> {
2279 let isCodeGenOnly = 1 in
2280 def "" : CmpBranchRIS<mnemonic, opcode, cls, imm>;
2281 def Asm : AsmCmpBranchRIS<mnemonic, opcode, cls, imm>;
2284 class CmpBranchRSYb<string mnemonic, bits<16> opcode,
2285 RegisterOperand cls>
2286 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, cond4:$M3),
2287 mnemonic#"$M3\t$R1, $BD2", []>;
2289 class AsmCmpBranchRSYb<string mnemonic, bits<16> opcode,
2290 RegisterOperand cls>
2291 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, imm32zx4:$M3),
2292 mnemonic#"\t$R1, $M3, $BD2", []>;
2294 multiclass CmpBranchRSYbPair<string mnemonic, bits<16> opcode,
2295 RegisterOperand cls> {
2296 let isCodeGenOnly = 1 in
2297 def "" : CmpBranchRSYb<mnemonic, opcode, cls>;
2298 def Asm : AsmCmpBranchRSYb<mnemonic, opcode, cls>;
2301 class FixedCmpBranchRSYb<CondVariant V, string mnemonic, bits<16> opcode,
2302 RegisterOperand cls>
2303 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2),
2304 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2305 let isAsmParserOnly = V.alternate;
2309 class BranchUnaryRI<string mnemonic, bits<12> opcode, RegisterOperand cls>
2310 : InstRIb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget16:$RI2),
2311 mnemonic##"\t$R1, $RI2", []> {
2312 let Constraints = "$R1 = $R1src";
2313 let DisableEncoding = "$R1src";
2316 class BranchUnaryRIL<string mnemonic, bits<12> opcode, RegisterOperand cls>
2317 : InstRILb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget32:$RI2),
2318 mnemonic##"\t$R1, $RI2", []> {
2319 let Constraints = "$R1 = $R1src";
2320 let DisableEncoding = "$R1src";
2323 class BranchUnaryRR<string mnemonic, bits<8> opcode, RegisterOperand cls>
2324 : InstRR<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2325 mnemonic##"\t$R1, $R2", []> {
2326 let Constraints = "$R1 = $R1src";
2327 let DisableEncoding = "$R1src";
2330 class BranchUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2331 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2332 mnemonic##"\t$R1, $R2", []> {
2333 let Constraints = "$R1 = $R1src";
2334 let DisableEncoding = "$R1src";
2337 class BranchUnaryRX<string mnemonic, bits<8> opcode, RegisterOperand cls>
2338 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2),
2339 mnemonic##"\t$R1, $XBD2", []> {
2340 let Constraints = "$R1 = $R1src";
2341 let DisableEncoding = "$R1src";
2344 class BranchUnaryRXY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2345 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr20only:$XBD2),
2346 mnemonic##"\t$R1, $XBD2", []> {
2347 let Constraints = "$R1 = $R1src";
2348 let DisableEncoding = "$R1src";
2351 class BranchBinaryRSI<string mnemonic, bits<8> opcode, RegisterOperand cls>
2352 : InstRSI<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2353 mnemonic##"\t$R1, $R3, $RI2", []> {
2354 let Constraints = "$R1 = $R1src";
2355 let DisableEncoding = "$R1src";
2358 class BranchBinaryRIEe<string mnemonic, bits<16> opcode, RegisterOperand cls>
2359 : InstRIEe<opcode, (outs cls:$R1),
2360 (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2361 mnemonic##"\t$R1, $R3, $RI2", []> {
2362 let Constraints = "$R1 = $R1src";
2363 let DisableEncoding = "$R1src";
2366 class BranchBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls>
2367 : InstRSa<opcode, (outs cls:$R1),
2368 (ins cls:$R1src, cls:$R3, bdaddr12only:$BD2),
2369 mnemonic##"\t$R1, $R3, $BD2", []> {
2370 let Constraints = "$R1 = $R1src";
2371 let DisableEncoding = "$R1src";
2374 class BranchBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2376 (outs cls:$R1), (ins cls:$R1src, cls:$R3, bdaddr20only:$BD2),
2377 mnemonic##"\t$R1, $R3, $BD2", []> {
2378 let Constraints = "$R1 = $R1src";
2379 let DisableEncoding = "$R1src";
2382 class LoadMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2383 AddressingMode mode = bdaddr12only>
2384 : InstRSa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2),
2385 mnemonic#"\t$R1, $R3, $BD2", []> {
2389 class LoadMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2390 AddressingMode mode = bdaddr20only>
2391 : InstRSYa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2),
2392 mnemonic#"\t$R1, $R3, $BD2", []> {
2396 multiclass LoadMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2397 bits<16> rsyOpcode, RegisterOperand cls> {
2398 let DispKey = mnemonic ## #cls in {
2399 let DispSize = "12" in
2400 def "" : LoadMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2401 let DispSize = "20" in
2402 def Y : LoadMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2406 class LoadMultipleSSe<string mnemonic, bits<8> opcode, RegisterOperand cls>
2407 : InstSSe<opcode, (outs cls:$R1, cls:$R3),
2408 (ins bdaddr12only:$BD2, bdaddr12only:$BD4),
2409 mnemonic#"\t$R1, $R3, $BD2, $BD4", []> {
2413 class LoadMultipleVRSa<string mnemonic, bits<16> opcode>
2414 : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3), (ins bdaddr12only:$BD2),
2415 mnemonic#"\t$V1, $V3, $BD2", []> {
2420 class StoreRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2421 RegisterOperand cls>
2422 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
2423 mnemonic#"\t$R1, $RI2",
2424 [(operator cls:$R1, pcrel32:$RI2)]> {
2426 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2427 // However, BDXs have two extra operands and are therefore 6 units more
2429 let AddedComplexity = 7;
2432 class StoreRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2433 RegisterOperand cls, bits<5> bytes,
2434 AddressingMode mode = bdxaddr12only>
2435 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
2436 mnemonic#"\t$R1, $XBD2",
2437 [(operator cls:$R1, mode:$XBD2)]> {
2438 let OpKey = mnemonic#"r"#cls;
2441 let AccessBytes = bytes;
2444 class StoreRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2445 RegisterOperand cls, bits<5> bytes,
2446 AddressingMode mode = bdxaddr20only>
2447 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
2448 mnemonic#"\t$R1, $XBD2",
2449 [(operator cls:$R1, mode:$XBD2)]> {
2450 let OpKey = mnemonic#"r"#cls;
2453 let AccessBytes = bytes;
2456 multiclass StoreRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
2457 SDPatternOperator operator, RegisterOperand cls,
2459 let DispKey = mnemonic ## #cls in {
2460 let DispSize = "12" in
2461 def "" : StoreRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
2462 let DispSize = "20" in
2463 def Y : StoreRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
2468 class StoreVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2469 TypedReg tr, bits<5> bytes, bits<4> type = 0>
2470 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2),
2471 mnemonic#"\t$V1, $XBD2",
2472 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2))]> {
2475 let AccessBytes = bytes;
2478 class StoreLengthVRSb<string mnemonic, bits<16> opcode,
2479 SDPatternOperator operator, bits<5> bytes>
2480 : InstVRSb<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2),
2481 mnemonic#"\t$V1, $R3, $BD2",
2482 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2485 let AccessBytes = bytes;
2488 class StoreLengthVRSd<string mnemonic, bits<16> opcode,
2489 SDPatternOperator operator, bits<5> bytes>
2490 : InstVRSd<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2),
2491 mnemonic#"\t$V1, $R3, $BD2",
2492 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2494 let AccessBytes = bytes;
2497 class StoreLengthVSI<string mnemonic, bits<16> opcode,
2498 SDPatternOperator operator, bits<5> bytes>
2499 : InstVSI<opcode, (outs), (ins VR128:$V1, bdaddr12only:$BD2, imm32zx8:$I3),
2500 mnemonic#"\t$V1, $BD2, $I3",
2501 [(operator VR128:$V1, imm32zx8:$I3, bdaddr12only:$BD2)]> {
2503 let AccessBytes = bytes;
2506 class StoreMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2507 AddressingMode mode = bdaddr12only>
2508 : InstRSa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2),
2509 mnemonic#"\t$R1, $R3, $BD2", []> {
2513 class StoreMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2514 AddressingMode mode = bdaddr20only>
2515 : InstRSYa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2),
2516 mnemonic#"\t$R1, $R3, $BD2", []> {
2520 multiclass StoreMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2521 bits<16> rsyOpcode, RegisterOperand cls> {
2522 let DispKey = mnemonic ## #cls in {
2523 let DispSize = "12" in
2524 def "" : StoreMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2525 let DispSize = "20" in
2526 def Y : StoreMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2530 class StoreMultipleVRSa<string mnemonic, bits<16> opcode>
2531 : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3, bdaddr12only:$BD2),
2532 mnemonic#"\t$V1, $V3, $BD2", []> {
2537 // StoreSI* instructions are used to store an integer to memory, but the
2538 // addresses are more restricted than for normal stores. If we are in the
2539 // situation of having to force either the address into a register or the
2540 // constant into a register, it's usually better to do the latter.
2541 // We therefore match the address in the same way as a normal store and
2542 // only use the StoreSI* instruction if the matched address is suitable.
2543 class StoreSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2545 : InstSI<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2),
2546 mnemonic#"\t$BD1, $I2",
2547 [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2551 class StoreSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2553 : InstSIY<opcode, (outs), (ins mviaddr20pair:$BD1, imm:$I2),
2554 mnemonic#"\t$BD1, $I2",
2555 [(operator imm:$I2, mviaddr20pair:$BD1)]> {
2559 class StoreSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2561 : InstSIL<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2),
2562 mnemonic#"\t$BD1, $I2",
2563 [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2567 multiclass StoreSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
2568 SDPatternOperator operator, Immediate imm> {
2569 let DispKey = mnemonic in {
2570 let DispSize = "12" in
2571 def "" : StoreSI<mnemonic, siOpcode, operator, imm>;
2572 let DispSize = "20" in
2573 def Y : StoreSIY<mnemonic#"y", siyOpcode, operator, imm>;
2577 class StoreSSE<string mnemonic, bits<16> opcode>
2578 : InstSSE<opcode, (outs), (ins bdaddr12only:$BD1, bdaddr12only:$BD2),
2579 mnemonic#"\t$BD1, $BD2", []> {
2583 class CondStoreRSY<string mnemonic, bits<16> opcode,
2584 RegisterOperand cls, bits<5> bytes,
2585 AddressingMode mode = bdaddr20only>
2586 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$M3),
2587 mnemonic#"$M3\t$R1, $BD2", []> {
2589 let AccessBytes = bytes;
2593 // Like CondStoreRSY, but used for the raw assembly form. The condition-code
2594 // mask is the third operand rather than being part of the mnemonic.
2595 class AsmCondStoreRSY<string mnemonic, bits<16> opcode,
2596 RegisterOperand cls, bits<5> bytes,
2597 AddressingMode mode = bdaddr20only>
2598 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, imm32zx4:$M3),
2599 mnemonic#"\t$R1, $BD2, $M3", []> {
2601 let AccessBytes = bytes;
2604 // Like CondStoreRSY, but with a fixed CC mask.
2605 class FixedCondStoreRSY<CondVariant V, string mnemonic, bits<16> opcode,
2606 RegisterOperand cls, bits<5> bytes,
2607 AddressingMode mode = bdaddr20only>
2608 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2),
2609 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2611 let AccessBytes = bytes;
2612 let isAsmParserOnly = V.alternate;
2616 multiclass CondStoreRSYPair<string mnemonic, bits<16> opcode,
2617 RegisterOperand cls, bits<5> bytes,
2618 AddressingMode mode = bdaddr20only> {
2619 let isCodeGenOnly = 1 in
2620 def "" : CondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
2621 def Asm : AsmCondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
2624 class SideEffectUnaryI<string mnemonic, bits<8> opcode, Immediate imm>
2625 : InstI<opcode, (outs), (ins imm:$I1),
2626 mnemonic#"\t$I1", []>;
2628 class SideEffectUnaryRR<string mnemonic, bits<8>opcode, RegisterOperand cls>
2629 : InstRR<opcode, (outs), (ins cls:$R1),
2630 mnemonic#"\t$R1", []> {
2634 class SideEffectUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
2635 SDPatternOperator operator>
2636 : InstRRE<opcode, (outs), (ins cls:$R1),
2637 mnemonic#"\t$R1", [(operator cls:$R1)]> {
2641 class SideEffectUnaryS<string mnemonic, bits<16> opcode,
2642 SDPatternOperator operator, bits<5> bytes,
2643 AddressingMode mode = bdaddr12only>
2644 : InstS<opcode, (outs), (ins mode:$BD2),
2645 mnemonic#"\t$BD2", [(operator mode:$BD2)]> {
2647 let AccessBytes = bytes;
2650 class SideEffectAddressS<string mnemonic, bits<16> opcode,
2651 SDPatternOperator operator,
2652 AddressingMode mode = bdaddr12only>
2653 : InstS<opcode, (outs), (ins mode:$BD2),
2654 mnemonic#"\t$BD2", [(operator mode:$BD2)]>;
2656 class LoadAddressRX<string mnemonic, bits<8> opcode,
2657 SDPatternOperator operator, AddressingMode mode>
2658 : InstRXa<opcode, (outs GR64:$R1), (ins mode:$XBD2),
2659 mnemonic#"\t$R1, $XBD2",
2660 [(set GR64:$R1, (operator mode:$XBD2))]>;
2662 class LoadAddressRXY<string mnemonic, bits<16> opcode,
2663 SDPatternOperator operator, AddressingMode mode>
2664 : InstRXYa<opcode, (outs GR64:$R1), (ins mode:$XBD2),
2665 mnemonic#"\t$R1, $XBD2",
2666 [(set GR64:$R1, (operator mode:$XBD2))]>;
2668 multiclass LoadAddressRXPair<string mnemonic, bits<8> rxOpcode,
2669 bits<16> rxyOpcode, SDPatternOperator operator> {
2670 let DispKey = mnemonic in {
2671 let DispSize = "12" in
2672 def "" : LoadAddressRX<mnemonic, rxOpcode, operator, laaddr12pair>;
2673 let DispSize = "20" in
2674 def Y : LoadAddressRXY<mnemonic#"y", rxyOpcode, operator, laaddr20pair>;
2678 class LoadAddressRIL<string mnemonic, bits<12> opcode,
2679 SDPatternOperator operator>
2680 : InstRILb<opcode, (outs GR64:$R1), (ins pcrel32:$RI2),
2681 mnemonic#"\t$R1, $RI2",
2682 [(set GR64:$R1, (operator pcrel32:$RI2))]>;
2684 class UnaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2685 RegisterOperand cls1, RegisterOperand cls2>
2686 : InstRR<opcode, (outs cls1:$R1), (ins cls2:$R2),
2687 mnemonic#"\t$R1, $R2",
2688 [(set cls1:$R1, (operator cls2:$R2))]> {
2689 let OpKey = mnemonic#cls1;
2693 class UnaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2694 RegisterOperand cls1, RegisterOperand cls2>
2695 : InstRRE<opcode, (outs cls1:$R1), (ins cls2:$R2),
2696 mnemonic#"\t$R1, $R2",
2697 [(set cls1:$R1, (operator cls2:$R2))]> {
2698 let OpKey = mnemonic#cls1;
2702 class UnaryTiedRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2703 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src),
2704 mnemonic#"\t$R1", []> {
2705 let Constraints = "$R1 = $R1src";
2706 let DisableEncoding = "$R1src";
2710 class UnaryMemRRFc<string mnemonic, bits<16> opcode,
2711 RegisterOperand cls1, RegisterOperand cls2>
2712 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src),
2713 mnemonic#"\t$R1, $R2", []> {
2714 let Constraints = "$R1 = $R1src";
2715 let DisableEncoding = "$R1src";
2719 class UnaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2720 RegisterOperand cls, Immediate imm>
2721 : InstRIa<opcode, (outs cls:$R1), (ins imm:$I2),
2722 mnemonic#"\t$R1, $I2",
2723 [(set cls:$R1, (operator imm:$I2))]>;
2725 class UnaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2726 RegisterOperand cls, Immediate imm>
2727 : InstRILa<opcode, (outs cls:$R1), (ins imm:$I2),
2728 mnemonic#"\t$R1, $I2",
2729 [(set cls:$R1, (operator imm:$I2))]>;
2731 class UnaryRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2732 RegisterOperand cls>
2733 : InstRILb<opcode, (outs cls:$R1), (ins pcrel32:$RI2),
2734 mnemonic#"\t$R1, $RI2",
2735 [(set cls:$R1, (operator pcrel32:$RI2))]> {
2737 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2738 // However, BDXs have two extra operands and are therefore 6 units more
2740 let AddedComplexity = 7;
2743 class CondUnaryRSY<string mnemonic, bits<16> opcode,
2744 SDPatternOperator operator, RegisterOperand cls,
2745 bits<5> bytes, AddressingMode mode = bdaddr20only>
2746 : InstRSYb<opcode, (outs cls:$R1),
2747 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$M3),
2748 mnemonic#"$M3\t$R1, $BD2",
2750 (z_select_ccmask (operator bdaddr20only:$BD2), cls:$R1src,
2751 cond4:$valid, cond4:$M3))]> {
2752 let Constraints = "$R1 = $R1src";
2753 let DisableEncoding = "$R1src";
2755 let AccessBytes = bytes;
2759 // Like CondUnaryRSY, but used for the raw assembly form. The condition-code
2760 // mask is the third operand rather than being part of the mnemonic.
2761 class AsmCondUnaryRSY<string mnemonic, bits<16> opcode,
2762 RegisterOperand cls, bits<5> bytes,
2763 AddressingMode mode = bdaddr20only>
2764 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2, imm32zx4:$M3),
2765 mnemonic#"\t$R1, $BD2, $M3", []> {
2767 let AccessBytes = bytes;
2768 let Constraints = "$R1 = $R1src";
2769 let DisableEncoding = "$R1src";
2772 // Like CondUnaryRSY, but with a fixed CC mask.
2773 class FixedCondUnaryRSY<CondVariant V, string mnemonic, bits<16> opcode,
2774 RegisterOperand cls, bits<5> bytes,
2775 AddressingMode mode = bdaddr20only>
2776 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2),
2777 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2778 let Constraints = "$R1 = $R1src";
2779 let DisableEncoding = "$R1src";
2781 let AccessBytes = bytes;
2782 let isAsmParserOnly = V.alternate;
2786 multiclass CondUnaryRSYPair<string mnemonic, bits<16> opcode,
2787 SDPatternOperator operator,
2788 RegisterOperand cls, bits<5> bytes,
2789 AddressingMode mode = bdaddr20only> {
2790 let isCodeGenOnly = 1 in
2791 def "" : CondUnaryRSY<mnemonic, opcode, operator, cls, bytes, mode>;
2792 def Asm : AsmCondUnaryRSY<mnemonic, opcode, cls, bytes, mode>;
2795 class UnaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2796 RegisterOperand cls, bits<5> bytes,
2797 AddressingMode mode = bdxaddr12only>
2798 : InstRXa<opcode, (outs cls:$R1), (ins mode:$XBD2),
2799 mnemonic#"\t$R1, $XBD2",
2800 [(set cls:$R1, (operator mode:$XBD2))]> {
2801 let OpKey = mnemonic#"r"#cls;
2804 let AccessBytes = bytes;
2807 class UnaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2808 RegisterOperand cls, bits<5> bytes>
2809 : InstRXE<opcode, (outs cls:$R1), (ins bdxaddr12only:$XBD2),
2810 mnemonic#"\t$R1, $XBD2",
2811 [(set cls:$R1, (operator bdxaddr12only:$XBD2))]> {
2812 let OpKey = mnemonic#"r"#cls;
2815 let AccessBytes = bytes;
2819 class UnaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2820 RegisterOperand cls, bits<5> bytes,
2821 AddressingMode mode = bdxaddr20only>
2822 : InstRXYa<opcode, (outs cls:$R1), (ins mode:$XBD2),
2823 mnemonic#"\t$R1, $XBD2",
2824 [(set cls:$R1, (operator mode:$XBD2))]> {
2825 let OpKey = mnemonic#"r"#cls;
2828 let AccessBytes = bytes;
2831 multiclass UnaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
2832 SDPatternOperator operator, RegisterOperand cls,
2834 let DispKey = mnemonic ## #cls in {
2835 let DispSize = "12" in
2836 def "" : UnaryRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
2837 let DispSize = "20" in
2838 def Y : UnaryRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
2843 class UnaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2844 TypedReg tr, Immediate imm, bits<4> type = 0>
2845 : InstVRIa<opcode, (outs tr.op:$V1), (ins imm:$I2),
2846 mnemonic#"\t$V1, $I2",
2847 [(set (tr.vt tr.op:$V1), (operator imm:$I2))]> {
2851 class UnaryVRIaGeneric<string mnemonic, bits<16> opcode, Immediate imm>
2852 : InstVRIa<opcode, (outs VR128:$V1), (ins imm:$I2, imm32zx4:$M3),
2853 mnemonic#"\t$V1, $I2, $M3", []>;
2855 class UnaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2856 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0,
2858 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2),
2859 mnemonic#"\t$V1, $V2",
2860 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]> {
2866 class UnaryVRRaGeneric<string mnemonic, bits<16> opcode, bits<4> m4 = 0,
2868 : InstVRRa<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3),
2869 mnemonic#"\t$V1, $V2, $M3", []> {
2874 class UnaryVRRaFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0>
2875 : InstVRRa<opcode, (outs VR128:$V1),
2876 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4),
2877 mnemonic#"\t$V1, $V2, $M3, $M4", []> {
2881 // Declare a pair of instructions, one which sets CC and one which doesn't.
2882 // The CC-setting form ends with "S" and sets the low bit of M5.
2883 // The form that does not set CC has an extra operand to optionally allow
2884 // specifying arbitrary M5 values in assembler.
2885 multiclass UnaryExtraVRRaSPair<string mnemonic, bits<16> opcode,
2886 SDPatternOperator operator,
2887 SDPatternOperator operator_cc,
2888 TypedReg tr1, TypedReg tr2, bits<4> type> {
2889 let M3 = type, M4 = 0 in
2890 def "" : InstVRRa<opcode, (outs tr1.op:$V1),
2891 (ins tr2.op:$V2, imm32zx4:$M5),
2892 mnemonic#"\t$V1, $V2, $M5", []>;
2893 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2))),
2894 (!cast<Instruction>(NAME) tr2.op:$V2, 0)>;
2895 def : InstAlias<mnemonic#"\t$V1, $V2",
2896 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 0)>;
2898 def S : UnaryVRRa<mnemonic##"s", opcode, operator_cc, tr1, tr2,
2902 multiclass UnaryExtraVRRaSPairGeneric<string mnemonic, bits<16> opcode> {
2904 def "" : InstVRRa<opcode, (outs VR128:$V1),
2905 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M5),
2906 mnemonic#"\t$V1, $V2, $M3, $M5", []>;
2907 def : InstAlias<mnemonic#"\t$V1, $V2, $M3",
2908 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2,
2912 class UnaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2913 TypedReg tr, bits<5> bytes, bits<4> type = 0>
2914 : InstVRX<opcode, (outs tr.op:$V1), (ins bdxaddr12only:$XBD2),
2915 mnemonic#"\t$V1, $XBD2",
2916 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2))]> {
2919 let AccessBytes = bytes;
2922 class UnaryVRXGeneric<string mnemonic, bits<16> opcode>
2923 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
2924 mnemonic#"\t$V1, $XBD2, $M3", []> {
2928 class SideEffectBinaryRX<string mnemonic, bits<8> opcode,
2929 RegisterOperand cls>
2930 : InstRXa<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
2931 mnemonic##"\t$R1, $XBD2", []>;
2933 class SideEffectBinaryRXY<string mnemonic, bits<16> opcode,
2934 RegisterOperand cls>
2935 : InstRXYa<opcode, (outs), (ins cls:$R1, bdxaddr20only:$XBD2),
2936 mnemonic##"\t$R1, $XBD2", []>;
2938 class SideEffectBinaryRILPC<string mnemonic, bits<12> opcode,
2939 RegisterOperand cls>
2940 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
2941 mnemonic##"\t$R1, $RI2", []> {
2942 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2943 // However, BDXs have two extra operands and are therefore 6 units more
2945 let AddedComplexity = 7;
2948 class SideEffectBinaryRRE<string mnemonic, bits<16> opcode,
2949 RegisterOperand cls1, RegisterOperand cls2>
2950 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
2951 mnemonic#"\t$R1, $R2", []>;
2953 class SideEffectBinaryRRFa<string mnemonic, bits<16> opcode,
2954 RegisterOperand cls1, RegisterOperand cls2>
2955 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2),
2956 mnemonic#"\t$R1, $R2", []> {
2961 class SideEffectBinaryRRFc<string mnemonic, bits<16> opcode,
2962 RegisterOperand cls1, RegisterOperand cls2>
2963 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2),
2964 mnemonic#"\t$R1, $R2", []> {
2968 class SideEffectBinaryIE<string mnemonic, bits<16> opcode,
2969 Immediate imm1, Immediate imm2>
2970 : InstIE<opcode, (outs), (ins imm1:$I1, imm2:$I2),
2971 mnemonic#"\t$I1, $I2", []>;
2973 class SideEffectBinarySI<string mnemonic, bits<8> opcode, Operand imm>
2974 : InstSI<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
2975 mnemonic#"\t$BD1, $I2", []>;
2977 class SideEffectBinarySIL<string mnemonic, bits<16> opcode,
2978 SDPatternOperator operator, Immediate imm>
2979 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
2980 mnemonic#"\t$BD1, $I2", [(operator bdaddr12only:$BD1, imm:$I2)]>;
2982 class SideEffectBinarySSa<string mnemonic, bits<8> opcode>
2983 : InstSSa<opcode, (outs), (ins bdladdr12onlylen8:$BDL1, bdaddr12only:$BD2),
2984 mnemonic##"\t$BDL1, $BD2", []>;
2986 class SideEffectBinarySSb<string mnemonic, bits<8> opcode>
2988 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2),
2989 mnemonic##"\t$BDL1, $BDL2", []>;
2991 class SideEffectBinarySSf<string mnemonic, bits<8> opcode>
2992 : InstSSf<opcode, (outs), (ins bdaddr12only:$BD1, bdladdr12onlylen8:$BDL2),
2993 mnemonic##"\t$BD1, $BDL2", []>;
2995 class SideEffectBinarySSE<string mnemonic, bits<16> opcode>
2996 : InstSSE<opcode, (outs), (ins bdaddr12only:$BD1, bdaddr12only:$BD2),
2997 mnemonic#"\t$BD1, $BD2", []>;
2999 class SideEffectBinaryMemMemRR<string mnemonic, bits<8> opcode,
3000 RegisterOperand cls1, RegisterOperand cls2>
3001 : InstRR<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3002 mnemonic#"\t$R1, $R2", []> {
3003 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3004 let DisableEncoding = "$R1src, $R2src";
3007 class SideEffectBinaryMemRRE<string mnemonic, bits<16> opcode,
3008 RegisterOperand cls1, RegisterOperand cls2>
3009 : InstRRE<opcode, (outs cls2:$R2), (ins cls1:$R1, cls2:$R2src),
3010 mnemonic#"\t$R1, $R2", []> {
3011 let Constraints = "$R2 = $R2src";
3012 let DisableEncoding = "$R2src";
3015 class SideEffectBinaryMemMemRRE<string mnemonic, bits<16> opcode,
3016 RegisterOperand cls1, RegisterOperand cls2>
3017 : InstRRE<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3018 mnemonic#"\t$R1, $R2", []> {
3019 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3020 let DisableEncoding = "$R1src, $R2src";
3023 class SideEffectBinaryMemMemRRFc<string mnemonic, bits<16> opcode,
3024 RegisterOperand cls1, RegisterOperand cls2>
3025 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3026 mnemonic#"\t$R1, $R2", []> {
3027 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3028 let DisableEncoding = "$R1src, $R2src";
3032 class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3033 RegisterOperand cls1, RegisterOperand cls2>
3034 : InstRR<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3035 mnemonic#"\t$R1, $R2",
3036 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
3037 let OpKey = mnemonic#cls1;
3039 let Constraints = "$R1 = $R1src";
3040 let DisableEncoding = "$R1src";
3043 class BinaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3044 RegisterOperand cls1, RegisterOperand cls2>
3045 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3046 mnemonic#"\t$R1, $R2",
3047 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
3048 let OpKey = mnemonic#cls1;
3050 let Constraints = "$R1 = $R1src";
3051 let DisableEncoding = "$R1src";
3054 class BinaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3055 RegisterOperand cls1, RegisterOperand cls2>
3056 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R3, cls2:$R2),
3057 mnemonic#"\t$R1, $R3, $R2",
3058 [(set cls1:$R1, (operator cls2:$R3, cls2:$R2))]> {
3059 let OpKey = mnemonic#cls;
3063 class BinaryRRFa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3064 RegisterOperand cls1, RegisterOperand cls2,
3065 RegisterOperand cls3>
3066 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
3067 mnemonic#"\t$R1, $R2, $R3",
3068 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
3072 multiclass BinaryRRAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
3073 SDPatternOperator operator, RegisterOperand cls1,
3074 RegisterOperand cls2> {
3075 let NumOpsKey = mnemonic in {
3076 let NumOpsValue = "3" in
3077 def K : BinaryRRFa<mnemonic#"k", opcode2, null_frag, cls1, cls1, cls2>,
3078 Requires<[FeatureDistinctOps]>;
3079 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
3080 def "" : BinaryRR<mnemonic, opcode1, operator, cls1, cls2>;
3084 multiclass BinaryRREAndK<string mnemonic, bits<16> opcode1, bits<16> opcode2,
3085 SDPatternOperator operator, RegisterOperand cls1,
3086 RegisterOperand cls2> {
3087 let NumOpsKey = mnemonic in {
3088 let NumOpsValue = "3" in
3089 def K : BinaryRRFa<mnemonic#"k", opcode2, null_frag, cls1, cls1, cls2>,
3090 Requires<[FeatureDistinctOps]>;
3091 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
3092 def "" : BinaryRRE<mnemonic, opcode1, operator, cls1, cls2>;
3096 class BinaryRRFb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3097 RegisterOperand cls1, RegisterOperand cls2,
3098 RegisterOperand cls3>
3099 : InstRRFb<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
3100 mnemonic#"\t$R1, $R3, $R2",
3101 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
3105 class BinaryMemRRFc<string mnemonic, bits<16> opcode,
3106 RegisterOperand cls1, RegisterOperand cls2, Immediate imm>
3107 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src, imm:$M3),
3108 mnemonic#"\t$R1, $R2, $M3", []> {
3109 let Constraints = "$R1 = $R1src";
3110 let DisableEncoding = "$R1src";
3113 multiclass BinaryMemRRFcOpt<string mnemonic, bits<16> opcode,
3114 RegisterOperand cls1, RegisterOperand cls2> {
3115 def "" : BinaryMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
3116 def Opt : UnaryMemRRFc<mnemonic, opcode, cls1, cls2>;
3119 class BinaryRRFd<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3120 RegisterOperand cls2>
3121 : InstRRFd<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M4),
3122 mnemonic#"\t$R1, $R2, $M4", []>;
3124 class BinaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3125 RegisterOperand cls2>
3126 : InstRRFe<opcode, (outs cls1:$R1), (ins imm32zx4:$M3, cls2:$R2),
3127 mnemonic#"\t$R1, $M3, $R2", []> {
3131 class CondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3132 RegisterOperand cls2>
3133 : InstRRFc<opcode, (outs cls1:$R1),
3134 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
3135 mnemonic#"$M3\t$R1, $R2",
3136 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src,
3137 cond4:$valid, cond4:$M3))]> {
3138 let Constraints = "$R1 = $R1src";
3139 let DisableEncoding = "$R1src";
3143 // Like CondBinaryRRF, but used for the raw assembly form. The condition-code
3144 // mask is the third operand rather than being part of the mnemonic.
3145 class AsmCondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3146 RegisterOperand cls2>
3147 : InstRRFc<opcode, (outs cls1:$R1),
3148 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M3),
3149 mnemonic#"\t$R1, $R2, $M3", []> {
3150 let Constraints = "$R1 = $R1src";
3151 let DisableEncoding = "$R1src";
3154 // Like CondBinaryRRF, but with a fixed CC mask.
3155 class FixedCondBinaryRRF<CondVariant V, string mnemonic, bits<16> opcode,
3156 RegisterOperand cls1, RegisterOperand cls2>
3157 : InstRRFc<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3158 mnemonic#V.suffix#"\t$R1, $R2", []> {
3159 let Constraints = "$R1 = $R1src";
3160 let DisableEncoding = "$R1src";
3161 let isAsmParserOnly = V.alternate;
3165 multiclass CondBinaryRRFPair<string mnemonic, bits<16> opcode,
3166 RegisterOperand cls1, RegisterOperand cls2> {
3167 let isCodeGenOnly = 1 in
3168 def "" : CondBinaryRRF<mnemonic, opcode, cls1, cls2>;
3169 def Asm : AsmCondBinaryRRF<mnemonic, opcode, cls1, cls2>;
3172 class BinaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3173 RegisterOperand cls, Immediate imm>
3174 : InstRIa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3175 mnemonic#"\t$R1, $I2",
3176 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
3177 let Constraints = "$R1 = $R1src";
3178 let DisableEncoding = "$R1src";
3181 class BinaryRIE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3182 RegisterOperand cls, Immediate imm>
3183 : InstRIEd<opcode, (outs cls:$R1), (ins cls:$R3, imm:$I2),
3184 mnemonic#"\t$R1, $R3, $I2",
3185 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
3187 multiclass BinaryRIAndK<string mnemonic, bits<12> opcode1, bits<16> opcode2,
3188 SDPatternOperator operator, RegisterOperand cls,
3190 let NumOpsKey = mnemonic in {
3191 let NumOpsValue = "3" in
3192 def K : BinaryRIE<mnemonic##"k", opcode2, null_frag, cls, imm>,
3193 Requires<[FeatureDistinctOps]>;
3194 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
3195 def "" : BinaryRI<mnemonic, opcode1, operator, cls, imm>;
3199 class CondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3201 : InstRIEg<opcode, (outs cls:$R1),
3202 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
3203 mnemonic#"$M3\t$R1, $I2",
3204 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
3205 cond4:$valid, cond4:$M3))]> {
3206 let Constraints = "$R1 = $R1src";
3207 let DisableEncoding = "$R1src";
3211 // Like CondBinaryRIE, but used for the raw assembly form. The condition-code
3212 // mask is the third operand rather than being part of the mnemonic.
3213 class AsmCondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3215 : InstRIEg<opcode, (outs cls:$R1),
3216 (ins cls:$R1src, imm:$I2, imm32zx4:$M3),
3217 mnemonic#"\t$R1, $I2, $M3", []> {
3218 let Constraints = "$R1 = $R1src";
3219 let DisableEncoding = "$R1src";
3222 // Like CondBinaryRIE, but with a fixed CC mask.
3223 class FixedCondBinaryRIE<CondVariant V, string mnemonic, bits<16> opcode,
3224 RegisterOperand cls, Immediate imm>
3225 : InstRIEg<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3226 mnemonic#V.suffix#"\t$R1, $I2", []> {
3227 let Constraints = "$R1 = $R1src";
3228 let DisableEncoding = "$R1src";
3229 let isAsmParserOnly = V.alternate;
3233 multiclass CondBinaryRIEPair<string mnemonic, bits<16> opcode,
3234 RegisterOperand cls, Immediate imm> {
3235 let isCodeGenOnly = 1 in
3236 def "" : CondBinaryRIE<mnemonic, opcode, cls, imm>;
3237 def Asm : AsmCondBinaryRIE<mnemonic, opcode, cls, imm>;
3240 class BinaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3241 RegisterOperand cls, Immediate imm>
3242 : InstRILa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3243 mnemonic#"\t$R1, $I2",
3244 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
3245 let Constraints = "$R1 = $R1src";
3246 let DisableEncoding = "$R1src";
3249 class BinaryRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3250 RegisterOperand cls>
3251 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, shift12only:$BD2),
3252 mnemonic#"\t$R1, $BD2",
3253 [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> {
3255 let Constraints = "$R1 = $R1src";
3256 let DisableEncoding = "$R1src";
3259 class BinaryRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3260 RegisterOperand cls>
3261 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, shift20only:$BD2),
3262 mnemonic#"\t$R1, $R3, $BD2",
3263 [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>;
3265 multiclass BinaryRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
3266 SDPatternOperator operator, RegisterOperand cls> {
3267 let NumOpsKey = mnemonic in {
3268 let NumOpsValue = "3" in
3269 def K : BinaryRSY<mnemonic##"k", opcode2, null_frag, cls>,
3270 Requires<[FeatureDistinctOps]>;
3271 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
3272 def "" : BinaryRS<mnemonic, opcode1, operator, cls>;
3276 class BinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
3277 : InstRSLb<opcode, (outs cls:$R1),
3278 (ins bdladdr12onlylen8:$BDL2, imm32zx4:$M3),
3279 mnemonic#"\t$R1, $BDL2, $M3", []> {
3283 class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3284 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3285 AddressingMode mode = bdxaddr12only>
3286 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2),
3287 mnemonic#"\t$R1, $XBD2",
3288 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3289 let OpKey = mnemonic#"r"#cls;
3291 let Constraints = "$R1 = $R1src";
3292 let DisableEncoding = "$R1src";
3294 let AccessBytes = bytes;
3297 class BinaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3298 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
3299 : InstRXE<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2),
3300 mnemonic#"\t$R1, $XBD2",
3301 [(set cls:$R1, (operator cls:$R1src,
3302 (load bdxaddr12only:$XBD2)))]> {
3303 let OpKey = mnemonic#"r"#cls;
3305 let Constraints = "$R1 = $R1src";
3306 let DisableEncoding = "$R1src";
3308 let AccessBytes = bytes;
3312 class BinaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3313 RegisterOperand cls1, RegisterOperand cls2,
3314 SDPatternOperator load, bits<5> bytes>
3315 : InstRXF<opcode, (outs cls1:$R1), (ins cls2:$R3, bdxaddr12only:$XBD2),
3316 mnemonic#"\t$R1, $R3, $XBD2",
3317 [(set cls1:$R1, (operator cls2:$R3, (load bdxaddr12only:$XBD2)))]> {
3318 let OpKey = mnemonic#"r"#cls;
3321 let AccessBytes = bytes;
3324 class BinaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3325 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3326 AddressingMode mode = bdxaddr20only>
3327 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2),
3328 mnemonic#"\t$R1, $XBD2",
3329 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3330 let OpKey = mnemonic#"r"#cls;
3332 let Constraints = "$R1 = $R1src";
3333 let DisableEncoding = "$R1src";
3335 let AccessBytes = bytes;
3338 multiclass BinaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3339 SDPatternOperator operator, RegisterOperand cls,
3340 SDPatternOperator load, bits<5> bytes> {
3341 let DispKey = mnemonic ## #cls in {
3342 let DispSize = "12" in
3343 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes,
3345 let DispSize = "20" in
3346 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load, bytes,
3351 class BinarySI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3352 Operand imm, AddressingMode mode = bdaddr12only>
3353 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
3354 mnemonic#"\t$BD1, $I2",
3355 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
3360 class BinarySIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3361 Operand imm, AddressingMode mode = bdaddr20only>
3362 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
3363 mnemonic#"\t$BD1, $I2",
3364 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
3369 multiclass BinarySIPair<string mnemonic, bits<8> siOpcode,
3370 bits<16> siyOpcode, SDPatternOperator operator,
3372 let DispKey = mnemonic ## #cls in {
3373 let DispSize = "12" in
3374 def "" : BinarySI<mnemonic, siOpcode, operator, imm, bdaddr12pair>;
3375 let DispSize = "20" in
3376 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>;
3380 class BinarySSF<string mnemonic, bits<12> opcode, RegisterOperand cls>
3381 : InstSSF<opcode, (outs cls:$R3), (ins bdaddr12pair:$BD1, bdaddr12pair:$BD2),
3382 mnemonic#"\t$R3, $BD1, $BD2", []> {
3386 class BinaryVRIb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3387 TypedReg tr, bits<4> type>
3388 : InstVRIb<opcode, (outs tr.op:$V1), (ins imm32zx8:$I2, imm32zx8:$I3),
3389 mnemonic#"\t$V1, $I2, $I3",
3390 [(set (tr.vt tr.op:$V1), (operator imm32zx8:$I2, imm32zx8:$I3))]> {
3394 class BinaryVRIbGeneric<string mnemonic, bits<16> opcode>
3395 : InstVRIb<opcode, (outs VR128:$V1),
3396 (ins imm32zx8:$I2, imm32zx8:$I3, imm32zx4:$M4),
3397 mnemonic#"\t$V1, $I2, $I3, $M4", []>;
3399 class BinaryVRIc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3400 TypedReg tr1, TypedReg tr2, bits<4> type>
3401 : InstVRIc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, imm32zx16:$I2),
3402 mnemonic#"\t$V1, $V3, $I2",
3403 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3),
3408 class BinaryVRIcGeneric<string mnemonic, bits<16> opcode>
3409 : InstVRIc<opcode, (outs VR128:$V1),
3410 (ins VR128:$V3, imm32zx16:$I2, imm32zx4:$M4),
3411 mnemonic#"\t$V1, $V3, $I2, $M4", []>;
3413 class BinaryVRIe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3414 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5>
3415 : InstVRIe<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx12:$I3),
3416 mnemonic#"\t$V1, $V2, $I3",
3417 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3423 class BinaryVRIeFloatGeneric<string mnemonic, bits<16> opcode>
3424 : InstVRIe<opcode, (outs VR128:$V1),
3425 (ins VR128:$V2, imm32zx12:$I3, imm32zx4:$M4, imm32zx4:$M5),
3426 mnemonic#"\t$V1, $V2, $I3, $M4, $M5", []>;
3428 class BinaryVRIh<string mnemonic, bits<16> opcode>
3429 : InstVRIh<opcode, (outs VR128:$V1),
3430 (ins imm32zx16:$I2, imm32zx4:$I3),
3431 mnemonic#"\t$V1, $I2, $I3", []>;
3433 class BinaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3434 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0>
3435 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx4:$M5),
3436 mnemonic#"\t$V1, $V2, $M5",
3437 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3443 class BinaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
3444 : InstVRRa<opcode, (outs VR128:$V1),
3445 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
3446 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
3448 class BinaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3449 TypedReg tr1, TypedReg tr2, bits<4> type = 0,
3450 bits<4> modifier = 0>
3451 : InstVRRb<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3452 mnemonic#"\t$V1, $V2, $V3",
3453 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3454 (tr2.vt tr2.op:$V3)))]> {
3459 // Declare a pair of instructions, one which sets CC and one which doesn't.
3460 // The CC-setting form ends with "S" and sets the low bit of M5.
3461 multiclass BinaryVRRbSPair<string mnemonic, bits<16> opcode,
3462 SDPatternOperator operator,
3463 SDPatternOperator operator_cc, TypedReg tr1,
3464 TypedReg tr2, bits<4> type, bits<4> modifier = 0> {
3465 def "" : BinaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
3466 !and (modifier, 14)>;
3468 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
3469 !add (!and (modifier, 14), 1)>;
3472 class BinaryVRRbSPairGeneric<string mnemonic, bits<16> opcode>
3473 : InstVRRb<opcode, (outs VR128:$V1),
3474 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3475 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
3477 // Declare a pair of instructions, one which sets CC and one which doesn't.
3478 // The CC-setting form ends with "S" and sets the low bit of M5.
3479 // The form that does not set CC has an extra operand to optionally allow
3480 // specifying arbitrary M5 values in assembler.
3481 multiclass BinaryExtraVRRbSPair<string mnemonic, bits<16> opcode,
3482 SDPatternOperator operator,
3483 SDPatternOperator operator_cc,
3484 TypedReg tr1, TypedReg tr2, bits<4> type> {
3486 def "" : InstVRRb<opcode, (outs tr1.op:$V1),
3487 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M5),
3488 mnemonic#"\t$V1, $V2, $V3, $M5", []>;
3489 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3))),
3490 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, 0)>;
3491 def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
3492 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
3495 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 1>;
3498 multiclass BinaryExtraVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
3499 def "" : InstVRRb<opcode, (outs VR128:$V1),
3500 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3501 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
3502 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
3503 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
3507 class BinaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3508 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0,
3510 : InstVRRc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3511 mnemonic#"\t$V1, $V2, $V3",
3512 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3513 (tr2.vt tr2.op:$V3)))]> {
3519 class BinaryVRRcGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0,
3521 : InstVRRc<opcode, (outs VR128:$V1),
3522 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4),
3523 mnemonic#"\t$V1, $V2, $V3, $M4", []> {
3528 class BinaryVRRcFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m6 = 0>
3529 : InstVRRc<opcode, (outs VR128:$V1),
3530 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3531 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> {
3535 // Declare a pair of instructions, one which sets CC and one which doesn't.
3536 // The CC-setting form ends with "S" and sets the low bit of M5.
3537 multiclass BinaryVRRcSPair<string mnemonic, bits<16> opcode,
3538 SDPatternOperator operator,
3539 SDPatternOperator operator_cc, TypedReg tr1,
3540 TypedReg tr2, bits<4> type, bits<4> m5,
3541 bits<4> modifier = 0> {
3542 def "" : BinaryVRRc<mnemonic, opcode, operator, tr1, tr2, type,
3543 m5, !and (modifier, 14)>;
3545 def S : BinaryVRRc<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
3546 m5, !add (!and (modifier, 14), 1)>;
3549 class BinaryVRRcSPairFloatGeneric<string mnemonic, bits<16> opcode>
3550 : InstVRRc<opcode, (outs VR128:$V1),
3551 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
3553 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
3555 class BinaryVRRf<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3557 : InstVRRf<opcode, (outs tr.op:$V1), (ins GR64:$R2, GR64:$R3),
3558 mnemonic#"\t$V1, $R2, $R3",
3559 [(set (tr.vt tr.op:$V1), (operator GR64:$R2, GR64:$R3))]>;
3561 class BinaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls>
3562 : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2, imm32zx4:$M3),
3563 mnemonic#"\t$R1, $V2, $M3", []>;
3565 class BinaryVRSa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3566 TypedReg tr1, TypedReg tr2, bits<4> type>
3567 : InstVRSa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, shift12only:$BD2),
3568 mnemonic#"\t$V1, $V3, $BD2",
3569 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3),
3570 shift12only:$BD2))]> {
3574 class BinaryVRSaGeneric<string mnemonic, bits<16> opcode>
3575 : InstVRSa<opcode, (outs VR128:$V1),
3576 (ins VR128:$V3, shift12only:$BD2, imm32zx4:$M4),
3577 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
3579 class BinaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3581 : InstVRSb<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2),
3582 mnemonic#"\t$V1, $R3, $BD2",
3583 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
3586 let AccessBytes = bytes;
3589 class BinaryVRSc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3590 TypedReg tr, bits<4> type>
3591 : InstVRSc<opcode, (outs GR64:$R1), (ins tr.op:$V3, shift12only:$BD2),
3592 mnemonic#"\t$R1, $V3, $BD2",
3593 [(set GR64:$R1, (operator (tr.vt tr.op:$V3), shift12only:$BD2))]> {
3597 class BinaryVRScGeneric<string mnemonic, bits<16> opcode>
3598 : InstVRSc<opcode, (outs GR64:$R1),
3599 (ins VR128:$V3, shift12only:$BD2, imm32zx4: $M4),
3600 mnemonic#"\t$R1, $V3, $BD2, $M4", []>;
3602 class BinaryVRSd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3604 : InstVRSd<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2),
3605 mnemonic#"\t$V1, $R3, $BD2",
3606 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
3608 let AccessBytes = bytes;
3611 class BinaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3612 TypedReg tr, bits<5> bytes>
3613 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3),
3614 mnemonic#"\t$V1, $XBD2, $M3",
3615 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2,
3618 let AccessBytes = bytes;
3621 class StoreBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
3622 bits<5> bytes, AddressingMode mode = bdaddr12only>
3623 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3624 mnemonic#"\t$R1, $M3, $BD2", []> {
3626 let AccessBytes = bytes;
3629 class StoreBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
3630 bits<5> bytes, AddressingMode mode = bdaddr20only>
3631 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3632 mnemonic#"\t$R1, $M3, $BD2", []> {
3634 let AccessBytes = bytes;
3637 multiclass StoreBinaryRSPair<string mnemonic, bits<8> rsOpcode,
3638 bits<16> rsyOpcode, RegisterOperand cls,
3640 let DispKey = mnemonic ## #cls in {
3641 let DispSize = "12" in
3642 def "" : StoreBinaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
3643 let DispSize = "20" in
3644 def Y : StoreBinaryRSY<mnemonic#"y", rsyOpcode, cls, bytes,
3649 class StoreBinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
3650 : InstRSLb<opcode, (outs),
3651 (ins cls:$R1, bdladdr12onlylen8:$BDL2, imm32zx4:$M3),
3652 mnemonic#"\t$R1, $BDL2, $M3", []> {
3656 class BinaryVSI<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3658 : InstVSI<opcode, (outs VR128:$V1), (ins bdaddr12only:$BD2, imm32zx8:$I3),
3659 mnemonic#"\t$V1, $BD2, $I3",
3660 [(set VR128:$V1, (operator imm32zx8:$I3, bdaddr12only:$BD2))]> {
3662 let AccessBytes = bytes;
3665 class StoreBinaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
3667 : InstVRV<opcode, (outs), (ins VR128:$V1, bdvaddr12only:$VBD2, index:$M3),
3668 mnemonic#"\t$V1, $VBD2, $M3", []> {
3670 let AccessBytes = bytes;
3673 class StoreBinaryVRX<string mnemonic, bits<16> opcode,
3674 SDPatternOperator operator, TypedReg tr, bits<5> bytes,
3676 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2, index:$M3),
3677 mnemonic#"\t$V1, $XBD2, $M3",
3678 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2, index:$M3)]> {
3680 let AccessBytes = bytes;
3683 class MemoryBinarySSd<string mnemonic, bits<8> opcode,
3684 RegisterOperand cls>
3685 : InstSSd<opcode, (outs),
3686 (ins bdraddr12only:$RBD1, bdaddr12only:$BD2, cls:$R3),
3687 mnemonic#"\t$RBD1, $BD2, $R3", []>;
3689 class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3690 RegisterOperand cls1, RegisterOperand cls2>
3691 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3692 mnemonic#"\t$R1, $R2",
3693 [(set CC, (operator cls1:$R1, cls2:$R2))]> {
3694 let OpKey = mnemonic#cls1;
3699 class CompareRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3700 RegisterOperand cls1, RegisterOperand cls2>
3701 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3702 mnemonic#"\t$R1, $R2",
3703 [(set CC, (operator cls1:$R1, cls2:$R2))]> {
3704 let OpKey = mnemonic#cls1;
3709 class CompareRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3710 RegisterOperand cls, Immediate imm>
3711 : InstRIa<opcode, (outs), (ins cls:$R1, imm:$I2),
3712 mnemonic#"\t$R1, $I2",
3713 [(set CC, (operator cls:$R1, imm:$I2))]> {
3717 class CompareRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3718 RegisterOperand cls, Immediate imm>
3719 : InstRILa<opcode, (outs), (ins cls:$R1, imm:$I2),
3720 mnemonic#"\t$R1, $I2",
3721 [(set CC, (operator cls:$R1, imm:$I2))]> {
3725 class CompareRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3726 RegisterOperand cls, SDPatternOperator load>
3727 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
3728 mnemonic#"\t$R1, $RI2",
3729 [(set CC, (operator cls:$R1, (load pcrel32:$RI2)))]> {
3732 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
3733 // However, BDXs have two extra operands and are therefore 6 units more
3735 let AddedComplexity = 7;
3738 class CompareRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3739 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3740 AddressingMode mode = bdxaddr12only>
3741 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
3742 mnemonic#"\t$R1, $XBD2",
3743 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
3744 let OpKey = mnemonic#"r"#cls;
3748 let AccessBytes = bytes;
3751 class CompareRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3752 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
3753 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
3754 mnemonic#"\t$R1, $XBD2",
3755 [(set CC, (operator cls:$R1, (load bdxaddr12only:$XBD2)))]> {
3756 let OpKey = mnemonic#"r"#cls;
3760 let AccessBytes = bytes;
3764 class CompareRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3765 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3766 AddressingMode mode = bdxaddr20only>
3767 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2),
3768 mnemonic#"\t$R1, $XBD2",
3769 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
3770 let OpKey = mnemonic#"r"#cls;
3774 let AccessBytes = bytes;
3777 multiclass CompareRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3778 SDPatternOperator operator, RegisterOperand cls,
3779 SDPatternOperator load, bits<5> bytes> {
3780 let DispKey = mnemonic ## #cls in {
3781 let DispSize = "12" in
3782 def "" : CompareRX<mnemonic, rxOpcode, operator, cls,
3783 load, bytes, bdxaddr12pair>;
3784 let DispSize = "20" in
3785 def Y : CompareRXY<mnemonic#"y", rxyOpcode, operator, cls,
3786 load, bytes, bdxaddr20pair>;
3790 class CompareRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
3791 bits<5> bytes, AddressingMode mode = bdaddr12only>
3792 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3793 mnemonic#"\t$R1, $M3, $BD2", []> {
3795 let AccessBytes = bytes;
3798 class CompareRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
3799 bits<5> bytes, AddressingMode mode = bdaddr20only>
3800 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2),
3801 mnemonic#"\t$R1, $M3, $BD2", []> {
3803 let AccessBytes = bytes;
3806 multiclass CompareRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
3807 RegisterOperand cls, bits<5> bytes> {
3808 let DispKey = mnemonic ## #cls in {
3809 let DispSize = "12" in
3810 def "" : CompareRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
3811 let DispSize = "20" in
3812 def Y : CompareRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
3816 class CompareSSb<string mnemonic, bits<8> opcode>
3818 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2),
3819 mnemonic##"\t$BDL1, $BDL2", []> {
3824 class CompareSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3825 SDPatternOperator load, Immediate imm,
3826 AddressingMode mode = bdaddr12only>
3827 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
3828 mnemonic#"\t$BD1, $I2",
3829 [(set CC, (operator (load mode:$BD1), imm:$I2))]> {
3834 class CompareSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3835 SDPatternOperator load, Immediate imm>
3836 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
3837 mnemonic#"\t$BD1, $I2",
3838 [(set CC, (operator (load bdaddr12only:$BD1), imm:$I2))]> {
3843 class CompareSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3844 SDPatternOperator load, Immediate imm,
3845 AddressingMode mode = bdaddr20only>
3846 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
3847 mnemonic#"\t$BD1, $I2",
3848 [(set CC, (operator (load mode:$BD1), imm:$I2))]> {
3853 multiclass CompareSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
3854 SDPatternOperator operator, SDPatternOperator load,
3856 let DispKey = mnemonic in {
3857 let DispSize = "12" in
3858 def "" : CompareSI<mnemonic, siOpcode, operator, load, imm, bdaddr12pair>;
3859 let DispSize = "20" in
3860 def Y : CompareSIY<mnemonic#"y", siyOpcode, operator, load, imm,
3865 class CompareVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3866 TypedReg tr, bits<4> type>
3867 : InstVRRa<opcode, (outs), (ins tr.op:$V1, tr.op:$V2),
3868 mnemonic#"\t$V1, $V2",
3869 [(set CC, (operator (tr.vt tr.op:$V1), (tr.vt tr.op:$V2)))]> {
3876 class CompareVRRaGeneric<string mnemonic, bits<16> opcode>
3877 : InstVRRa<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
3878 mnemonic#"\t$V1, $V2, $M3", []> {
3884 class CompareVRRaFloatGeneric<string mnemonic, bits<16> opcode>
3885 : InstVRRa<opcode, (outs),
3886 (ins VR64:$V1, VR64:$V2, imm32zx4:$M3, imm32zx4:$M4),
3887 mnemonic#"\t$V1, $V2, $M3, $M4", []> {
3892 class CompareVRRh<string mnemonic, bits<16> opcode>
3893 : InstVRRh<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
3894 mnemonic#"\t$V1, $V2, $M3", []> {
3898 class TestInherentS<string mnemonic, bits<16> opcode,
3899 SDPatternOperator operator>
3900 : InstS<opcode, (outs), (ins), mnemonic, [(set CC, (operator))]> {
3904 class TestRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3905 RegisterOperand cls>
3906 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
3907 mnemonic#"\t$R1, $XBD2",
3908 [(set CC, (operator cls:$R1, bdxaddr12only:$XBD2))]> {
3912 class TestBinarySIL<string mnemonic, bits<16> opcode,
3913 SDPatternOperator operator, Immediate imm>
3914 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
3915 mnemonic#"\t$BD1, $I2",
3916 [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>;
3918 class TestRSL<string mnemonic, bits<16> opcode>
3919 : InstRSLa<opcode, (outs), (ins bdladdr12onlylen4:$BDL1),
3920 mnemonic#"\t$BDL1", []> {
3924 class TestVRRg<string mnemonic, bits<16> opcode>
3925 : InstVRRg<opcode, (outs), (ins VR128:$V1),
3926 mnemonic#"\t$V1", []>;
3928 class SideEffectTernarySSc<string mnemonic, bits<8> opcode>
3929 : InstSSc<opcode, (outs), (ins bdladdr12onlylen4:$BDL1,
3930 shift12only:$BD2, imm32zx4:$I3),
3931 mnemonic##"\t$BDL1, $BD2, $I3", []>;
3933 class SideEffectTernaryRRFa<string mnemonic, bits<16> opcode,
3934 RegisterOperand cls1, RegisterOperand cls2,
3935 RegisterOperand cls3>
3936 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3),
3937 mnemonic#"\t$R1, $R2, $R3", []> {
3941 class SideEffectTernaryRRFb<string mnemonic, bits<16> opcode,
3942 RegisterOperand cls1, RegisterOperand cls2,
3943 RegisterOperand cls3>
3944 : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3),
3945 mnemonic#"\t$R1, $R3, $R2", []> {
3949 class SideEffectTernaryMemMemMemRRFb<string mnemonic, bits<16> opcode,
3950 RegisterOperand cls1,
3951 RegisterOperand cls2,
3952 RegisterOperand cls3>
3953 : InstRRFb<opcode, (outs cls1:$R1, cls2:$R2, cls3:$R3),
3954 (ins cls1:$R1src, cls2:$R2src, cls3:$R3src),
3955 mnemonic#"\t$R1, $R3, $R2", []> {
3956 let Constraints = "$R1 = $R1src, $R2 = $R2src, $R3 = $R3src";
3957 let DisableEncoding = "$R1src, $R2src, $R3src";
3961 class SideEffectTernaryRRFc<string mnemonic, bits<16> opcode,
3962 RegisterOperand cls1, RegisterOperand cls2,
3964 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2, imm:$M3),
3965 mnemonic#"\t$R1, $R2, $M3", []>;
3967 multiclass SideEffectTernaryRRFcOpt<string mnemonic, bits<16> opcode,
3968 RegisterOperand cls1,
3969 RegisterOperand cls2> {
3970 def "" : SideEffectTernaryRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
3971 def Opt : SideEffectBinaryRRFc<mnemonic, opcode, cls1, cls2>;
3974 class SideEffectTernaryMemMemRRFc<string mnemonic, bits<16> opcode,
3975 RegisterOperand cls1, RegisterOperand cls2,
3977 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2),
3978 (ins cls1:$R1src, cls2:$R2src, imm:$M3),
3979 mnemonic#"\t$R1, $R2, $M3", []> {
3980 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3981 let DisableEncoding = "$R1src, $R2src";
3984 multiclass SideEffectTernaryMemMemRRFcOpt<string mnemonic, bits<16> opcode,
3985 RegisterOperand cls1,
3986 RegisterOperand cls2> {
3987 def "" : SideEffectTernaryMemMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
3988 def Opt : SideEffectBinaryMemMemRRFc<mnemonic, opcode, cls1, cls2>;
3991 class SideEffectTernarySSF<string mnemonic, bits<12> opcode,
3992 RegisterOperand cls>
3993 : InstSSF<opcode, (outs),
3994 (ins bdaddr12only:$BD1, bdaddr12only:$BD2, cls:$R3),
3995 mnemonic#"\t$BD1, $BD2, $R3", []>;
3997 class TernaryRRFa<string mnemonic, bits<16> opcode,
3998 RegisterOperand cls1, RegisterOperand cls2,
3999 RegisterOperand cls3>
4000 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3, imm32zx4:$M4),
4001 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
4003 class TernaryRRFb<string mnemonic, bits<16> opcode,
4004 RegisterOperand cls1, RegisterOperand cls2,
4005 RegisterOperand cls3>
4006 : InstRRFb<opcode, (outs cls1:$R1, cls3:$R3),
4007 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M4),
4008 mnemonic#"\t$R1, $R3, $R2, $M4", []> {
4009 let Constraints = "$R1 = $R1src";
4010 let DisableEncoding = "$R1src";
4013 class TernaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
4014 RegisterOperand cls2>
4015 : InstRRFe<opcode, (outs cls1:$R1),
4016 (ins imm32zx4:$M3, cls2:$R2, imm32zx4:$M4),
4017 mnemonic#"\t$R1, $M3, $R2, $M4", []>;
4019 class TernaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4020 RegisterOperand cls1, RegisterOperand cls2>
4021 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R1src, cls2:$R3, cls2:$R2),
4022 mnemonic#"\t$R1, $R3, $R2",
4023 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3, cls2:$R2))]> {
4024 let OpKey = mnemonic#cls;
4026 let Constraints = "$R1 = $R1src";
4027 let DisableEncoding = "$R1src";
4030 class TernaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
4031 bits<5> bytes, AddressingMode mode = bdaddr12only>
4032 : InstRSb<opcode, (outs cls:$R1),
4033 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2),
4034 mnemonic#"\t$R1, $M3, $BD2", []> {
4036 let Constraints = "$R1 = $R1src";
4037 let DisableEncoding = "$R1src";
4039 let AccessBytes = bytes;
4042 class TernaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
4043 bits<5> bytes, AddressingMode mode = bdaddr20only>
4044 : InstRSYb<opcode, (outs cls:$R1),
4045 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2),
4046 mnemonic#"\t$R1, $M3, $BD2", []> {
4048 let Constraints = "$R1 = $R1src";
4049 let DisableEncoding = "$R1src";
4051 let AccessBytes = bytes;
4054 multiclass TernaryRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4055 RegisterOperand cls, bits<5> bytes> {
4056 let DispKey = mnemonic ## #cls in {
4057 let DispSize = "12" in
4058 def "" : TernaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
4059 let DispSize = "20" in
4060 def Y : TernaryRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
4064 class SideEffectTernaryRS<string mnemonic, bits<8> opcode,
4065 RegisterOperand cls1, RegisterOperand cls2>
4066 : InstRSa<opcode, (outs),
4067 (ins cls1:$R1, cls2:$R3, bdaddr12only:$BD2),
4068 mnemonic#"\t$R1, $R3, $BD2", []>;
4070 class SideEffectTernaryRSY<string mnemonic, bits<16> opcode,
4071 RegisterOperand cls1, RegisterOperand cls2>
4072 : InstRSYa<opcode, (outs),
4073 (ins cls1:$R1, cls2:$R3, bdaddr20only:$BD2),
4074 mnemonic#"\t$R1, $R3, $BD2", []>;
4076 class SideEffectTernaryMemMemRS<string mnemonic, bits<8> opcode,
4077 RegisterOperand cls1, RegisterOperand cls2>
4078 : InstRSa<opcode, (outs cls1:$R1, cls2:$R3),
4079 (ins cls1:$R1src, cls2:$R3src, shift12only:$BD2),
4080 mnemonic#"\t$R1, $R3, $BD2", []> {
4081 let Constraints = "$R1 = $R1src, $R3 = $R3src";
4082 let DisableEncoding = "$R1src, $R3src";
4085 class SideEffectTernaryMemMemRSY<string mnemonic, bits<16> opcode,
4086 RegisterOperand cls1, RegisterOperand cls2>
4087 : InstRSYa<opcode, (outs cls1:$R1, cls2:$R3),
4088 (ins cls1:$R1src, cls2:$R3src, shift20only:$BD2),
4089 mnemonic#"\t$R1, $R3, $BD2", []> {
4090 let Constraints = "$R1 = $R1src, $R3 = $R3src";
4091 let DisableEncoding = "$R1src, $R3src";
4094 class TernaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4095 RegisterOperand cls1, RegisterOperand cls2,
4096 SDPatternOperator load, bits<5> bytes>
4097 : InstRXF<opcode, (outs cls1:$R1),
4098 (ins cls2:$R1src, cls2:$R3, bdxaddr12only:$XBD2),
4099 mnemonic#"\t$R1, $R3, $XBD2",
4100 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3,
4101 (load bdxaddr12only:$XBD2)))]> {
4102 let OpKey = mnemonic#"r"#cls;
4104 let Constraints = "$R1 = $R1src";
4105 let DisableEncoding = "$R1src";
4107 let AccessBytes = bytes;
4110 class TernaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4111 TypedReg tr1, TypedReg tr2, Immediate imm, Immediate index>
4112 : InstVRIa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V1src, imm:$I2, index:$M3),
4113 mnemonic#"\t$V1, $I2, $M3",
4114 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4115 imm:$I2, index:$M3))]> {
4116 let Constraints = "$V1 = $V1src";
4117 let DisableEncoding = "$V1src";
4120 class TernaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4121 TypedReg tr1, TypedReg tr2, bits<4> type>
4122 : InstVRId<opcode, (outs tr1.op:$V1),
4123 (ins tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
4124 mnemonic#"\t$V1, $V2, $V3, $I4",
4125 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4126 (tr2.vt tr2.op:$V3),
4131 class TernaryVRIi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4132 : InstVRIi<opcode, (outs VR128:$V1),
4133 (ins cls:$R2, imm32zx8:$I3, imm32zx4:$M4),
4134 mnemonic#"\t$V1, $R2, $I3, $M4", []>;
4136 class TernaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4137 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m4or>
4138 : InstVRRa<opcode, (outs tr1.op:$V1),
4139 (ins tr2.op:$V2, imm32zx4:$M4, imm32zx4:$M5),
4140 mnemonic#"\t$V1, $V2, $M4, $M5",
4141 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4148 class TernaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
4149 : InstVRRa<opcode, (outs VR128:$V1),
4150 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
4151 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
4153 class TernaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4154 TypedReg tr1, TypedReg tr2, bits<4> type,
4155 SDPatternOperator m5mask, bits<4> m5or>
4156 : InstVRRb<opcode, (outs tr1.op:$V1),
4157 (ins tr2.op:$V2, tr2.op:$V3, m5mask:$M5),
4158 mnemonic#"\t$V1, $V2, $V3, $M5",
4159 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4160 (tr2.vt tr2.op:$V3),
4166 // Declare a pair of instructions, one which sets CC and one which doesn't.
4167 // The CC-setting form ends with "S" and sets the low bit of M5.
4168 // Also create aliases to make use of M5 operand optional in assembler.
4169 multiclass TernaryOptVRRbSPair<string mnemonic, bits<16> opcode,
4170 SDPatternOperator operator,
4171 SDPatternOperator operator_cc,
4172 TypedReg tr1, TypedReg tr2, bits<4> type,
4173 bits<4> modifier = 0> {
4174 def "" : TernaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
4175 imm32zx4even, !and (modifier, 14)>;
4176 def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
4177 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4180 def S : TernaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type,
4181 imm32zx4even, !add(!and (modifier, 14), 1)>;
4182 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3",
4183 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
4187 multiclass TernaryOptVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
4188 def "" : InstVRRb<opcode, (outs VR128:$V1),
4189 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
4190 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
4191 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
4192 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4196 class TernaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4197 TypedReg tr1, TypedReg tr2>
4198 : InstVRRc<opcode, (outs tr1.op:$V1),
4199 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M4),
4200 mnemonic#"\t$V1, $V2, $V3, $M4",
4201 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4202 (tr2.vt tr2.op:$V3),
4208 class TernaryVRRcFloat<string mnemonic, bits<16> opcode,
4209 SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
4210 bits<4> type = 0, bits<4> m5 = 0>
4211 : InstVRRc<opcode, (outs tr1.op:$V1),
4212 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M6),
4213 mnemonic#"\t$V1, $V2, $V3, $M6",
4214 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4215 (tr2.vt tr2.op:$V3),
4221 class TernaryVRRcFloatGeneric<string mnemonic, bits<16> opcode>
4222 : InstVRRc<opcode, (outs VR128:$V1),
4223 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
4225 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
4227 class TernaryVRRd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4228 TypedReg tr1, TypedReg tr2, bits<4> type = 0>
4229 : InstVRRd<opcode, (outs tr1.op:$V1),
4230 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
4231 mnemonic#"\t$V1, $V2, $V3, $V4",
4232 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4233 (tr2.vt tr2.op:$V3),
4234 (tr1.vt tr1.op:$V4)))]> {
4239 class TernaryVRRdGeneric<string mnemonic, bits<16> opcode>
4240 : InstVRRd<opcode, (outs VR128:$V1),
4241 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5),
4242 mnemonic#"\t$V1, $V2, $V3, $V4, $M5", []> {
4246 class TernaryVRRe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4247 TypedReg tr1, TypedReg tr2, bits<4> m5 = 0, bits<4> type = 0>
4248 : InstVRRe<opcode, (outs tr1.op:$V1),
4249 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
4250 mnemonic#"\t$V1, $V2, $V3, $V4",
4251 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4252 (tr2.vt tr2.op:$V3),
4253 (tr1.vt tr1.op:$V4)))]> {
4258 class TernaryVRReFloatGeneric<string mnemonic, bits<16> opcode>
4259 : InstVRRe<opcode, (outs VR128:$V1),
4260 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
4261 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4263 class TernaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4264 TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type>
4265 : InstVRSb<opcode, (outs tr1.op:$V1),
4266 (ins tr2.op:$V1src, cls:$R3, shift12only:$BD2),
4267 mnemonic#"\t$V1, $R3, $BD2",
4268 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4270 shift12only:$BD2))]> {
4271 let Constraints = "$V1 = $V1src";
4272 let DisableEncoding = "$V1src";
4276 class TernaryVRSbGeneric<string mnemonic, bits<16> opcode>
4277 : InstVRSb<opcode, (outs VR128:$V1),
4278 (ins VR128:$V1src, GR64:$R3, shift12only:$BD2, imm32zx4:$M4),
4279 mnemonic#"\t$V1, $R3, $BD2, $M4", []> {
4280 let Constraints = "$V1 = $V1src";
4281 let DisableEncoding = "$V1src";
4284 class TernaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
4286 : InstVRV<opcode, (outs VR128:$V1),
4287 (ins VR128:$V1src, bdvaddr12only:$VBD2, index:$M3),
4288 mnemonic#"\t$V1, $VBD2, $M3", []> {
4289 let Constraints = "$V1 = $V1src";
4290 let DisableEncoding = "$V1src";
4292 let AccessBytes = bytes;
4295 class TernaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4296 TypedReg tr1, TypedReg tr2, bits<5> bytes, Immediate index>
4297 : InstVRX<opcode, (outs tr1.op:$V1),
4298 (ins tr2.op:$V1src, bdxaddr12only:$XBD2, index:$M3),
4299 mnemonic#"\t$V1, $XBD2, $M3",
4300 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4301 bdxaddr12only:$XBD2,
4303 let Constraints = "$V1 = $V1src";
4304 let DisableEncoding = "$V1src";
4306 let AccessBytes = bytes;
4309 class QuaternaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4310 TypedReg tr1, TypedReg tr2, bits<4> type>
4311 : InstVRId<opcode, (outs tr1.op:$V1),
4312 (ins tr2.op:$V1src, tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
4313 mnemonic#"\t$V1, $V2, $V3, $I4",
4314 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4315 (tr2.vt tr2.op:$V2),
4316 (tr2.vt tr2.op:$V3),
4318 let Constraints = "$V1 = $V1src";
4319 let DisableEncoding = "$V1src";
4323 class QuaternaryVRIdGeneric<string mnemonic, bits<16> opcode>
4324 : InstVRId<opcode, (outs VR128:$V1),
4325 (ins VR128:$V1src, VR128:$V2, VR128:$V3,
4326 imm32zx8:$I4, imm32zx4:$M5),
4327 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []> {
4328 let Constraints = "$V1 = $V1src";
4329 let DisableEncoding = "$V1src";
4332 class QuaternaryVRIf<string mnemonic, bits<16> opcode>
4333 : InstVRIf<opcode, (outs VR128:$V1),
4334 (ins VR128:$V2, VR128:$V3,
4335 imm32zx8:$I4, imm32zx4:$M5),
4336 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []>;
4338 class QuaternaryVRIg<string mnemonic, bits<16> opcode>
4339 : InstVRIg<opcode, (outs VR128:$V1),
4340 (ins VR128:$V2, imm32zx8:$I3,
4341 imm32zx8:$I4, imm32zx4:$M5),
4342 mnemonic#"\t$V1, $V2, $I3, $I4, $M5", []>;
4344 class QuaternaryVRRd<string mnemonic, bits<16> opcode,
4345 SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
4346 TypedReg tr3, TypedReg tr4, bits<4> type,
4347 SDPatternOperator m6mask = imm32zx4, bits<4> m6or = 0>
4348 : InstVRRd<opcode, (outs tr1.op:$V1),
4349 (ins tr2.op:$V2, tr3.op:$V3, tr4.op:$V4, m6mask:$M6),
4350 mnemonic#"\t$V1, $V2, $V3, $V4, $M6",
4351 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4352 (tr3.vt tr3.op:$V3),
4353 (tr4.vt tr4.op:$V4),
4359 class QuaternaryVRRdGeneric<string mnemonic, bits<16> opcode>
4360 : InstVRRd<opcode, (outs VR128:$V1),
4361 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
4362 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4364 // Declare a pair of instructions, one which sets CC and one which doesn't.
4365 // The CC-setting form ends with "S" and sets the low bit of M6.
4366 // Also create aliases to make use of M6 operand optional in assembler.
4367 multiclass QuaternaryOptVRRdSPair<string mnemonic, bits<16> opcode,
4368 SDPatternOperator operator,
4369 SDPatternOperator operator_cc,
4370 TypedReg tr1, TypedReg tr2, bits<4> type,
4371 bits<4> modifier = 0> {
4372 def "" : QuaternaryVRRd<mnemonic, opcode, operator,
4373 tr1, tr2, tr2, tr2, type,
4374 imm32zx4even, !and (modifier, 14)>;
4375 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4",
4376 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4377 tr2.op:$V3, tr2.op:$V4, 0)>;
4379 def S : QuaternaryVRRd<mnemonic##"s", opcode, operator_cc,
4380 tr1, tr2, tr2, tr2, type,
4381 imm32zx4even, !add (!and (modifier, 14), 1)>;
4382 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3, $V4",
4383 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
4384 tr2.op:$V3, tr2.op:$V4, 0)>;
4387 multiclass QuaternaryOptVRRdSPairGeneric<string mnemonic, bits<16> opcode> {
4388 def "" : QuaternaryVRRdGeneric<mnemonic, opcode>;
4389 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5",
4390 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4391 VR128:$V4, imm32zx4:$M5, 0)>;
4394 class SideEffectQuaternaryRRFa<string mnemonic, bits<16> opcode,
4395 RegisterOperand cls1, RegisterOperand cls2,
4396 RegisterOperand cls3>
4397 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4),
4398 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
4400 multiclass SideEffectQuaternaryRRFaOptOpt<string mnemonic, bits<16> opcode,
4401 RegisterOperand cls1,
4402 RegisterOperand cls2,
4403 RegisterOperand cls3> {
4404 def "" : SideEffectQuaternaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
4405 def Opt : SideEffectTernaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
4406 def OptOpt : SideEffectBinaryRRFa<mnemonic, opcode, cls1, cls2>;
4409 class SideEffectQuaternaryRRFb<string mnemonic, bits<16> opcode,
4410 RegisterOperand cls1, RegisterOperand cls2,
4411 RegisterOperand cls3>
4412 : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4),
4413 mnemonic#"\t$R1, $R3, $R2, $M4", []>;
4415 multiclass SideEffectQuaternaryRRFbOpt<string mnemonic, bits<16> opcode,
4416 RegisterOperand cls1,
4417 RegisterOperand cls2,
4418 RegisterOperand cls3> {
4419 def "" : SideEffectQuaternaryRRFb<mnemonic, opcode, cls1, cls2, cls3>;
4420 def Opt : SideEffectTernaryRRFb<mnemonic, opcode, cls1, cls2, cls3>;
4423 class SideEffectQuaternarySSe<string mnemonic, bits<8> opcode,
4424 RegisterOperand cls>
4425 : InstSSe<opcode, (outs),
4426 (ins cls:$R1, bdaddr12only:$BD2, cls:$R3, bdaddr12only:$BD4),
4427 mnemonic#"\t$R1, $BD2, $R3, $BD4", []>;
4429 class LoadAndOpRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4430 RegisterOperand cls, AddressingMode mode = bdaddr20only>
4431 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, mode:$BD2),
4432 mnemonic#"\t$R1, $R3, $BD2",
4433 [(set cls:$R1, (operator mode:$BD2, cls:$R3))]> {
4438 class CmpSwapRRE<string mnemonic, bits<16> opcode,
4439 RegisterOperand cls1, RegisterOperand cls2>
4440 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
4441 mnemonic#"\t$R1, $R2", []> {
4442 let Constraints = "$R1 = $R1src";
4443 let DisableEncoding = "$R1src";
4448 class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4449 RegisterOperand cls, AddressingMode mode = bdaddr12only>
4450 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
4451 mnemonic#"\t$R1, $R3, $BD2",
4452 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
4453 let Constraints = "$R1 = $R1src";
4454 let DisableEncoding = "$R1src";
4459 class CmpSwapRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4460 RegisterOperand cls, AddressingMode mode = bdaddr20only>
4461 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
4462 mnemonic#"\t$R1, $R3, $BD2",
4463 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
4464 let Constraints = "$R1 = $R1src";
4465 let DisableEncoding = "$R1src";
4470 multiclass CmpSwapRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4471 SDPatternOperator operator, RegisterOperand cls> {
4472 let DispKey = mnemonic ## #cls in {
4473 let DispSize = "12" in
4474 def "" : CmpSwapRS<mnemonic, rsOpcode, operator, cls, bdaddr12pair>;
4475 let DispSize = "20" in
4476 def Y : CmpSwapRSY<mnemonic#"y", rsyOpcode, operator, cls, bdaddr20pair>;
4480 class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1,
4481 RegisterOperand cls2>
4482 : InstRIEf<opcode, (outs cls1:$R1),
4483 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
4485 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> {
4486 let Constraints = "$R1 = $R1src";
4487 let DisableEncoding = "$R1src";
4490 class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator>
4491 : InstRXYb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr20only:$XBD2),
4492 mnemonic##"\t$M1, $XBD2",
4493 [(operator imm32zx4:$M1, bdxaddr20only:$XBD2)]>;
4495 class PrefetchRILPC<string mnemonic, bits<12> opcode,
4496 SDPatternOperator operator>
4497 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, pcrel32:$RI2),
4498 mnemonic##"\t$M1, $RI2",
4499 [(operator imm32zx4:$M1, pcrel32:$RI2)]> {
4500 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
4501 // However, BDXs have two extra operands and are therefore 6 units more
4503 let AddedComplexity = 7;
4506 class BranchPreloadSMI<string mnemonic, bits<8> opcode>
4507 : InstSMI<opcode, (outs),
4508 (ins imm32zx4:$M1, brtarget16bpp:$RI2, bdxaddr12only:$BD3),
4509 mnemonic#"\t$M1, $RI2, $BD3", []>;
4511 class BranchPreloadMII<string mnemonic, bits<8> opcode>
4512 : InstMII<opcode, (outs),
4513 (ins imm32zx4:$M1, brtarget12bpp:$RI2, brtarget24bpp:$RI3),
4514 mnemonic#"\t$M1, $RI2, $RI3", []>;
4516 // A floating-point load-and test operation. Create both a normal unary
4517 // operation and one that acts as a comparison against zero.
4518 // Note that the comparison against zero operation is not available if we
4519 // have vector support, since load-and-test instructions will partially
4520 // clobber the target (vector) register.
4521 multiclass LoadAndTestRRE<string mnemonic, bits<16> opcode,
4522 RegisterOperand cls> {
4523 def "" : UnaryRRE<mnemonic, opcode, null_frag, cls, cls>;
4524 let isCodeGenOnly = 1, Predicates = [FeatureNoVector] in
4525 def Compare : CompareRRE<mnemonic, opcode, null_frag, cls, cls>;
4528 //===----------------------------------------------------------------------===//
4529 // Pseudo instructions
4530 //===----------------------------------------------------------------------===//
4532 // Convenience instructions that get lowered to real instructions
4533 // by either SystemZTargetLowering::EmitInstrWithCustomInserter()
4534 // or SystemZInstrInfo::expandPostRAPseudo().
4536 //===----------------------------------------------------------------------===//
4538 class Pseudo<dag outs, dag ins, list<dag> pattern>
4539 : InstSystemZ<0, outs, ins, "", pattern> {
4541 let isCodeGenOnly = 1;
4544 // Like UnaryRI, but expanded after RA depending on the choice of register.
4545 class UnaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4547 : Pseudo<(outs cls:$R1), (ins imm:$I2),
4548 [(set cls:$R1, (operator imm:$I2))]>;
4550 // Like UnaryRXY, but expanded after RA depending on the choice of register.
4551 class UnaryRXYPseudo<string key, SDPatternOperator operator,
4552 RegisterOperand cls, bits<5> bytes,
4553 AddressingMode mode = bdxaddr20only>
4554 : Pseudo<(outs cls:$R1), (ins mode:$XBD2),
4555 [(set cls:$R1, (operator mode:$XBD2))]> {
4556 let OpKey = key#"r"#cls;
4559 let Has20BitOffset = 1;
4561 let AccessBytes = bytes;
4564 // Like UnaryRR, but expanded after RA depending on the choice of registers.
4565 class UnaryRRPseudo<string key, SDPatternOperator operator,
4566 RegisterOperand cls1, RegisterOperand cls2>
4567 : Pseudo<(outs cls1:$R1), (ins cls2:$R2),
4568 [(set cls1:$R1, (operator cls2:$R2))]> {
4569 let OpKey = key#cls1;
4573 // Like BinaryRI, but expanded after RA depending on the choice of register.
4574 class BinaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4576 : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2),
4577 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
4578 let Constraints = "$R1 = $R1src";
4581 // Like BinaryRIE, but expanded after RA depending on the choice of register.
4582 class BinaryRIEPseudo<SDPatternOperator operator, RegisterOperand cls,
4584 : Pseudo<(outs cls:$R1), (ins cls:$R3, imm:$I2),
4585 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
4587 // Like BinaryRIAndK, but expanded after RA depending on the choice of register.
4588 multiclass BinaryRIAndKPseudo<string key, SDPatternOperator operator,
4589 RegisterOperand cls, Immediate imm> {
4590 let NumOpsKey = key in {
4591 let NumOpsValue = "3" in
4592 def K : BinaryRIEPseudo<null_frag, cls, imm>,
4593 Requires<[FeatureHighWord, FeatureDistinctOps]>;
4594 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
4595 def "" : BinaryRIPseudo<operator, cls, imm>,
4596 Requires<[FeatureHighWord]>;
4600 // Like CompareRI, but expanded after RA depending on the choice of register.
4601 class CompareRIPseudo<SDPatternOperator operator, RegisterOperand cls,
4603 : Pseudo<(outs), (ins cls:$R1, imm:$I2),
4604 [(set CC, (operator cls:$R1, imm:$I2))]> {
4608 // Like CompareRXY, but expanded after RA depending on the choice of register.
4609 class CompareRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
4610 SDPatternOperator load, bits<5> bytes,
4611 AddressingMode mode = bdxaddr20only>
4612 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2),
4613 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
4615 let Has20BitOffset = 1;
4617 let AccessBytes = bytes;
4620 // Like TestBinarySIL, but expanded later.
4621 class TestBinarySILPseudo<SDPatternOperator operator, Immediate imm>
4622 : Pseudo<(outs), (ins bdaddr12only:$BD1, imm:$I2),
4623 [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>;
4625 // Like CondBinaryRRF, but expanded after RA depending on the choice of
4627 class CondBinaryRRFPseudo<RegisterOperand cls1, RegisterOperand cls2>
4628 : Pseudo<(outs cls1:$R1),
4629 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
4630 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src,
4631 cond4:$valid, cond4:$M3))]> {
4632 let Constraints = "$R1 = $R1src";
4633 let DisableEncoding = "$R1src";
4637 // Like CondBinaryRIE, but expanded after RA depending on the choice of
4639 class CondBinaryRIEPseudo<RegisterOperand cls, Immediate imm>
4640 : Pseudo<(outs cls:$R1),
4641 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
4642 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
4643 cond4:$valid, cond4:$M3))]> {
4644 let Constraints = "$R1 = $R1src";
4645 let DisableEncoding = "$R1src";
4649 // Like CondUnaryRSY, but expanded after RA depending on the choice of
4651 class CondUnaryRSYPseudo<SDPatternOperator operator, RegisterOperand cls,
4652 bits<5> bytes, AddressingMode mode = bdaddr20only>
4653 : Pseudo<(outs cls:$R1),
4654 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$R3),
4656 (z_select_ccmask (operator mode:$BD2), cls:$R1src,
4657 cond4:$valid, cond4:$R3))]> {
4658 let Constraints = "$R1 = $R1src";
4659 let DisableEncoding = "$R1src";
4661 let AccessBytes = bytes;
4665 // Like CondStoreRSY, but expanded after RA depending on the choice of
4667 class CondStoreRSYPseudo<RegisterOperand cls, bits<5> bytes,
4668 AddressingMode mode = bdaddr20only>
4669 : Pseudo<(outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$R3), []> {
4671 let AccessBytes = bytes;
4675 // Like StoreRXY, but expanded after RA depending on the choice of register.
4676 class StoreRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
4677 bits<5> bytes, AddressingMode mode = bdxaddr20only>
4678 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2),
4679 [(operator cls:$R1, mode:$XBD2)]> {
4681 let Has20BitOffset = 1;
4683 let AccessBytes = bytes;
4686 // Like RotateSelectRIEf, but expanded after RA depending on the choice
4688 class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2>
4689 : Pseudo<(outs cls1:$R1),
4690 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
4693 let Constraints = "$R1 = $R1src";
4694 let DisableEncoding = "$R1src";
4697 // Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is
4698 // the value of the PSW's 2-bit condition code field.
4699 class SelectWrapper<ValueType vt, RegisterOperand cls>
4700 : Pseudo<(outs cls:$dst),
4701 (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc),
4702 [(set (vt cls:$dst), (z_select_ccmask cls:$src1, cls:$src2,
4703 imm32zx4:$valid, imm32zx4:$cc))]> {
4704 let usesCustomInserter = 1;
4705 let hasNoSchedulingInfo = 1;
4709 // Stores $new to $addr if $cc is true ("" case) or false (Inv case).
4710 multiclass CondStores<RegisterOperand cls, SDPatternOperator store,
4711 SDPatternOperator load, AddressingMode mode> {
4712 let Uses = [CC], usesCustomInserter = 1, hasNoSchedulingInfo = 1,
4713 mayLoad = 1, mayStore = 1 in {
4714 def "" : Pseudo<(outs),
4715 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
4716 [(store (z_select_ccmask cls:$new, (load mode:$addr),
4717 imm32zx4:$valid, imm32zx4:$cc),
4719 def Inv : Pseudo<(outs),
4720 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
4721 [(store (z_select_ccmask (load mode:$addr), cls:$new,
4722 imm32zx4:$valid, imm32zx4:$cc),
4727 // OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation. PAT and OPERAND
4728 // describe the second (non-memory) operand.
4729 class AtomicLoadBinary<SDPatternOperator operator, RegisterOperand cls,
4730 dag pat, DAGOperand operand>
4731 : Pseudo<(outs cls:$dst), (ins bdaddr20only:$ptr, operand:$src2),
4732 [(set cls:$dst, (operator bdaddr20only:$ptr, pat))]> {
4734 let Has20BitOffset = 1;
4737 let usesCustomInserter = 1;
4738 let hasNoSchedulingInfo = 1;
4741 // Specializations of AtomicLoadWBinary.
4742 class AtomicLoadBinaryReg32<SDPatternOperator operator>
4743 : AtomicLoadBinary<operator, GR32, (i32 GR32:$src2), GR32>;
4744 class AtomicLoadBinaryImm32<SDPatternOperator operator, Immediate imm>
4745 : AtomicLoadBinary<operator, GR32, (i32 imm:$src2), imm>;
4746 class AtomicLoadBinaryReg64<SDPatternOperator operator>
4747 : AtomicLoadBinary<operator, GR64, (i64 GR64:$src2), GR64>;
4748 class AtomicLoadBinaryImm64<SDPatternOperator operator, Immediate imm>
4749 : AtomicLoadBinary<operator, GR64, (i64 imm:$src2), imm>;
4751 // OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation. PAT and OPERAND
4752 // describe the second (non-memory) operand.
4753 class AtomicLoadWBinary<SDPatternOperator operator, dag pat,
4755 : Pseudo<(outs GR32:$dst),
4756 (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift,
4757 ADDR32:$negbitshift, uimm32:$bitsize),
4758 [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift,
4759 ADDR32:$negbitshift, uimm32:$bitsize))]> {
4761 let Has20BitOffset = 1;
4764 let usesCustomInserter = 1;
4765 let hasNoSchedulingInfo = 1;
4768 // Specializations of AtomicLoadWBinary.
4769 class AtomicLoadWBinaryReg<SDPatternOperator operator>
4770 : AtomicLoadWBinary<operator, (i32 GR32:$src2), GR32>;
4771 class AtomicLoadWBinaryImm<SDPatternOperator operator, Immediate imm>
4772 : AtomicLoadWBinary<operator, (i32 imm:$src2), imm>;
4774 // Define an instruction that operates on two fixed-length blocks of memory,
4775 // and associated pseudo instructions for operating on blocks of any size.
4776 // The Sequence form uses a straight-line sequence of instructions and
4777 // the Loop form uses a loop of length-256 instructions followed by
4778 // another instruction to handle the excess.
4779 multiclass MemorySS<string mnemonic, bits<8> opcode,
4780 SDPatternOperator sequence, SDPatternOperator loop> {
4781 def "" : SideEffectBinarySSa<mnemonic, opcode>;
4782 let usesCustomInserter = 1, hasNoSchedulingInfo = 1, Defs = [CC] in {
4783 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
4785 [(sequence bdaddr12only:$dest, bdaddr12only:$src,
4787 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
4788 imm64:$length, GR64:$count256),
4789 [(loop bdaddr12only:$dest, bdaddr12only:$src,
4790 imm64:$length, GR64:$count256)]>;
4794 // The same, but setting a CC result as comparion operator.
4795 multiclass CompareMemorySS<string mnemonic, bits<8> opcode,
4796 SDPatternOperator sequence, SDPatternOperator loop> {
4797 def "" : SideEffectBinarySSa<mnemonic, opcode>;
4798 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in {
4799 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
4801 [(set CC, (sequence bdaddr12only:$dest, bdaddr12only:$src,
4803 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
4804 imm64:$length, GR64:$count256),
4805 [(set CC, (loop bdaddr12only:$dest, bdaddr12only:$src,
4806 imm64:$length, GR64:$count256))]>;
4810 // Define an instruction that operates on two strings, both terminated
4811 // by the character in R0. The instruction processes a CPU-determinated
4812 // number of bytes at a time and sets CC to 3 if the instruction needs
4813 // to be repeated. Also define a pseudo instruction that represents
4814 // the full loop (the main instruction plus the branch on CC==3).
4815 multiclass StringRRE<string mnemonic, bits<16> opcode,
4816 SDPatternOperator operator> {
4818 def "" : SideEffectBinaryMemMemRRE<mnemonic, opcode, GR64, GR64>;
4819 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in
4820 def Loop : Pseudo<(outs GR64:$end),
4821 (ins GR64:$start1, GR64:$start2, GR32:$char),
4822 [(set GR64:$end, (operator GR64:$start1, GR64:$start2,
4826 // A pseudo instruction that is a direct alias of a real instruction.
4827 // These aliases are used in cases where a particular register operand is
4828 // fixed or where the same instruction is used with different register sizes.
4829 // The size parameter is the size in bytes of the associated real instruction.
4830 class Alias<int size, dag outs, dag ins, list<dag> pattern>
4831 : InstSystemZ<size, outs, ins, "", pattern> {
4833 let isCodeGenOnly = 1;
4836 class UnaryAliasVRS<RegisterOperand cls1, RegisterOperand cls2>
4837 : Alias<6, (outs cls1:$src1), (ins cls2:$src2), []>;
4839 // An alias of a UnaryVRR*, but with different register sizes.
4840 class UnaryAliasVRR<SDPatternOperator operator, TypedReg tr1, TypedReg tr2>
4841 : Alias<6, (outs tr1.op:$V1), (ins tr2.op:$V2),
4842 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]>;
4844 // An alias of a UnaryVRX, but with different register sizes.
4845 class UnaryAliasVRX<SDPatternOperator operator, TypedReg tr,
4846 AddressingMode mode = bdxaddr12only>
4847 : Alias<6, (outs tr.op:$V1), (ins mode:$XBD2),
4848 [(set (tr.vt tr.op:$V1), (operator mode:$XBD2))]>;
4850 // An alias of a StoreVRX, but with different register sizes.
4851 class StoreAliasVRX<SDPatternOperator operator, TypedReg tr,
4852 AddressingMode mode = bdxaddr12only>
4853 : Alias<6, (outs), (ins tr.op:$V1, mode:$XBD2),
4854 [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>;
4856 // An alias of a BinaryRI, but with different register sizes.
4857 class BinaryAliasRI<SDPatternOperator operator, RegisterOperand cls,
4859 : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
4860 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
4861 let Constraints = "$R1 = $R1src";
4864 // An alias of a BinaryRIL, but with different register sizes.
4865 class BinaryAliasRIL<SDPatternOperator operator, RegisterOperand cls,
4867 : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
4868 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
4869 let Constraints = "$R1 = $R1src";
4872 // An alias of a BinaryVRRf, but with different register sizes.
4873 class BinaryAliasVRRf<RegisterOperand cls>
4874 : Alias<6, (outs VR128:$V1), (ins cls:$R2, cls:$R3), []>;
4876 // An alias of a CompareRI, but with different register sizes.
4877 class CompareAliasRI<SDPatternOperator operator, RegisterOperand cls,
4879 : Alias<4, (outs), (ins cls:$R1, imm:$I2),
4880 [(set CC, (operator cls:$R1, imm:$I2))]> {
4884 // An alias of a RotateSelectRIEf, but with different register sizes.
4885 class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2>
4886 : Alias<6, (outs cls1:$R1),
4887 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
4888 imm32zx6:$I5), []> {
4889 let Constraints = "$R1 = $R1src";