1 //==- SystemZInstrFormats.td - SystemZ Instruction Formats --*- tablegen -*-==//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 //===----------------------------------------------------------------------===//
10 // Basic SystemZ instruction definition
11 //===----------------------------------------------------------------------===//
13 class InstSystemZ<int size, dag outs, dag ins, string asmstr,
14 list<dag> pattern> : Instruction {
15 let Namespace = "SystemZ";
17 dag OutOperandList = outs;
18 dag InOperandList = ins;
20 let Pattern = pattern;
21 // Convert tabs to spaces, and remove space after comma for HLASM syntax
22 let AsmString = !subst("\t", "{\t| }", !subst(", ", "{, |,}", 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 // MemKey identifies a targe reg-mem opcode, while MemType can be either
42 // "pseudo" or "target". This is used to map a pseduo memory instruction to
43 // its corresponding target opcode. See comment at MemFoldPseudo.
45 string MemType = "none";
47 // Many distinct-operands instructions have older 2-operand equivalents.
48 // NumOpsKey uniquely identifies one of these 2-operand and 3-operand pairs,
49 // with NumOpsValue being "2" or "3" as appropriate.
50 string NumOpsKey = "";
51 string NumOpsValue = "none";
53 // True if this instruction is a simple D(X,B) load of a register
54 // (with no sign or zero extension).
55 bit SimpleBDXLoad = 0;
57 // True if this instruction is a simple D(X,B) store of a register
58 // (with no truncation).
59 bit SimpleBDXStore = 0;
61 // True if this instruction has a 20-bit displacement field.
62 bit Has20BitOffset = 0;
64 // True if addresses in this instruction have an index register.
67 // True if this is a 128-bit pseudo instruction that combines two 64-bit
71 // The access size of all memory operands in bytes, or 0 if not known.
72 bits<5> AccessBytes = 0;
74 // If the instruction sets CC to a useful value, this gives the mask
75 // of all possible CC results. The mask has the same form as
79 // The subset of CCValues that have the same meaning as they would after a
80 // comparison of the first operand against zero. "Logical" instructions
81 // leave this blank as they set CC in a different way.
82 bits<4> CompareZeroCCMask = 0;
84 // True if the instruction is conditional and if the CC mask operand
85 // comes first (as for BRC, etc.).
88 // Similar, but true if the CC mask operand comes last (as for LOC, etc.).
91 // True if the instruction is the "logical" rather than "arithmetic" form,
92 // in cases where a distinction exists. Except for logical compares, if the
93 // instruction sets this flag along with a non-zero CCValues field, it is
94 // assumed to set CC to either CCMASK_LOGICAL_ZERO or
95 // CCMASK_LOGICAL_NONZERO.
98 // True if the (add or sub) instruction sets CC like a compare of the
99 // result against zero, but only if the 'nsw' flag is set.
100 bit CCIfNoSignedWrap = 0;
102 let TSFlags{0} = SimpleBDXLoad;
103 let TSFlags{1} = SimpleBDXStore;
104 let TSFlags{2} = Has20BitOffset;
105 let TSFlags{3} = HasIndex;
106 let TSFlags{4} = Is128Bit;
107 let TSFlags{9-5} = AccessBytes;
108 let TSFlags{13-10} = CCValues;
109 let TSFlags{17-14} = CompareZeroCCMask;
110 let TSFlags{18} = CCMaskFirst;
111 let TSFlags{19} = CCMaskLast;
112 let TSFlags{20} = IsLogical;
113 let TSFlags{21} = CCIfNoSignedWrap;
116 //===----------------------------------------------------------------------===//
117 // Mappings between instructions
118 //===----------------------------------------------------------------------===//
120 // Return the version of an instruction that has an unsigned 12-bit
122 def getDisp12Opcode : InstrMapping {
123 let FilterClass = "InstSystemZ";
124 let RowFields = ["DispKey"];
125 let ColFields = ["DispSize"];
127 let ValueCols = [["12"]];
130 // Return the version of an instruction that has a signed 20-bit displacement.
131 def getDisp20Opcode : InstrMapping {
132 let FilterClass = "InstSystemZ";
133 let RowFields = ["DispKey"];
134 let ColFields = ["DispSize"];
136 let ValueCols = [["20"]];
139 // Return the memory form of a register instruction. Note that this may
140 // return a MemFoldPseudo instruction (see below).
141 def getMemOpcode : InstrMapping {
142 let FilterClass = "InstSystemZ";
143 let RowFields = ["OpKey"];
144 let ColFields = ["OpType"];
145 let KeyCol = ["reg"];
146 let ValueCols = [["mem"]];
149 // Return the target memory instruction for a MemFoldPseudo.
150 def getTargetMemOpcode : InstrMapping {
151 let FilterClass = "InstSystemZ";
152 let RowFields = ["MemKey"];
153 let ColFields = ["MemType"];
154 let KeyCol = ["pseudo"];
155 let ValueCols = [["target"]];
158 // Return the 2-operand form of a 3-operand instruction.
159 def getTwoOperandOpcode : InstrMapping {
160 let FilterClass = "InstSystemZ";
161 let RowFields = ["NumOpsKey"];
162 let ColFields = ["NumOpsValue"];
164 let ValueCols = [["2"]];
167 //===----------------------------------------------------------------------===//
168 // Instruction formats
169 //===----------------------------------------------------------------------===//
171 // Formats are specified using operand field declarations of the form:
173 // bits<4> Rn : register input or output for operand n
174 // bits<5> Vn : vector register input or output for operand n
175 // bits<m> In : immediate value of width m for operand n
176 // bits<4> Bn : base register for address operand n
177 // bits<m> Dn : displacement for address operand n
178 // bits<5> Vn : vector index for address operand n
179 // bits<4> Xn : index register for address operand n
180 // bits<4> Mn : mode value for operand n
182 // The operand numbers ("n" in the list above) follow the architecture manual.
183 // Assembly operands sometimes have a different order; in particular, R3 often
184 // is often written between operands 1 and 2.
186 //===----------------------------------------------------------------------===//
188 class InstE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
189 : InstSystemZ<2, outs, ins, asmstr, pattern> {
191 field bits<16> SoftFail = 0;
196 class InstI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
197 : InstSystemZ<2, outs, ins, asmstr, pattern> {
199 field bits<16> SoftFail = 0;
207 class InstIE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
208 : InstSystemZ<4, outs, ins, asmstr, pattern> {
210 field bits<32> SoftFail = 0;
215 let Inst{31-16} = op;
221 class InstMII<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
222 : InstSystemZ<6, outs, ins, asmstr, pattern> {
224 field bits<48> SoftFail = 0;
230 let Inst{47-40} = op;
231 let Inst{39-36} = M1;
232 let Inst{35-24} = RI2;
233 let Inst{23-0} = RI3;
236 class InstRIa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
237 : InstSystemZ<4, outs, ins, asmstr, pattern> {
239 field bits<32> SoftFail = 0;
244 let Inst{31-24} = op{11-4};
245 let Inst{23-20} = R1;
246 let Inst{19-16} = op{3-0};
250 class InstRIb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
251 : InstSystemZ<4, outs, ins, asmstr, pattern> {
253 field bits<32> SoftFail = 0;
258 let Inst{31-24} = op{11-4};
259 let Inst{23-20} = R1;
260 let Inst{19-16} = op{3-0};
261 let Inst{15-0} = RI2;
264 class InstRIc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
265 : InstSystemZ<4, outs, ins, asmstr, pattern> {
267 field bits<32> SoftFail = 0;
272 let Inst{31-24} = op{11-4};
273 let Inst{23-20} = M1;
274 let Inst{19-16} = op{3-0};
275 let Inst{15-0} = RI2;
278 class InstRIEa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
279 : InstSystemZ<6, outs, ins, asmstr, pattern> {
281 field bits<48> SoftFail = 0;
287 let Inst{47-40} = op{15-8};
288 let Inst{39-36} = R1;
290 let Inst{31-16} = I2;
291 let Inst{15-12} = M3;
293 let Inst{7-0} = op{7-0};
296 class InstRIEb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
297 : InstSystemZ<6, outs, ins, asmstr, pattern> {
299 field bits<48> SoftFail = 0;
306 let Inst{47-40} = op{15-8};
307 let Inst{39-36} = R1;
308 let Inst{35-32} = R2;
309 let Inst{31-16} = RI4;
310 let Inst{15-12} = M3;
312 let Inst{7-0} = op{7-0};
315 class InstRIEc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
316 : InstSystemZ<6, outs, ins, asmstr, pattern> {
318 field bits<48> SoftFail = 0;
325 let Inst{47-40} = op{15-8};
326 let Inst{39-36} = R1;
327 let Inst{35-32} = M3;
328 let Inst{31-16} = RI4;
330 let Inst{7-0} = op{7-0};
333 class InstRIEd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
334 : InstSystemZ<6, outs, ins, asmstr, pattern> {
336 field bits<48> SoftFail = 0;
342 let Inst{47-40} = op{15-8};
343 let Inst{39-36} = R1;
344 let Inst{35-32} = R3;
345 let Inst{31-16} = I2;
347 let Inst{7-0} = op{7-0};
350 class InstRIEe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
351 : InstSystemZ<6, outs, ins, asmstr, pattern> {
353 field bits<48> SoftFail = 0;
359 let Inst{47-40} = op{15-8};
360 let Inst{39-36} = R1;
361 let Inst{35-32} = R3;
362 let Inst{31-16} = RI2;
364 let Inst{7-0} = op{7-0};
367 class InstRIEf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
368 bits<8> I3Or = 0, bits<8> I4Or = 0>
369 : InstSystemZ<6, outs, ins, asmstr, pattern> {
371 field bits<48> SoftFail = 0;
379 let Inst{47-40} = op{15-8};
380 let Inst{39-36} = R1;
381 let Inst{35-32} = R2;
382 let Inst{31} = !if(I3Or{7}, 1, I3{7});
383 let Inst{30} = !if(I3Or{6}, 1, I3{6});
384 let Inst{29} = !if(I3Or{5}, 1, I3{5});
385 let Inst{28} = !if(I3Or{4}, 1, I3{4});
386 let Inst{27} = !if(I3Or{3}, 1, I3{3});
387 let Inst{26} = !if(I3Or{2}, 1, I3{2});
388 let Inst{25} = !if(I3Or{1}, 1, I3{1});
389 let Inst{24} = !if(I3Or{0}, 1, I3{0});
390 let Inst{23} = !if(I4Or{7}, 1, I4{7});
391 let Inst{22} = !if(I4Or{6}, 1, I4{6});
392 let Inst{21} = !if(I4Or{5}, 1, I4{5});
393 let Inst{20} = !if(I4Or{4}, 1, I4{4});
394 let Inst{19} = !if(I4Or{3}, 1, I4{3});
395 let Inst{18} = !if(I4Or{2}, 1, I4{2});
396 let Inst{17} = !if(I4Or{1}, 1, I4{1});
397 let Inst{16} = !if(I4Or{0}, 1, I4{0});
399 let Inst{7-0} = op{7-0};
402 class InstRIEg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
403 : InstSystemZ<6, outs, ins, asmstr, pattern> {
405 field bits<48> SoftFail = 0;
411 let Inst{47-40} = op{15-8};
412 let Inst{39-36} = R1;
413 let Inst{35-32} = M3;
414 let Inst{31-16} = I2;
416 let Inst{7-0} = op{7-0};
419 class InstRILa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
420 : InstSystemZ<6, outs, ins, asmstr, pattern> {
422 field bits<48> SoftFail = 0;
427 let Inst{47-40} = op{11-4};
428 let Inst{39-36} = R1;
429 let Inst{35-32} = op{3-0};
433 class InstRILb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
434 : InstSystemZ<6, outs, ins, asmstr, pattern> {
436 field bits<48> SoftFail = 0;
441 let Inst{47-40} = op{11-4};
442 let Inst{39-36} = R1;
443 let Inst{35-32} = op{3-0};
444 let Inst{31-0} = RI2;
447 class InstRILc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
448 : InstSystemZ<6, outs, ins, asmstr, pattern> {
450 field bits<48> SoftFail = 0;
455 let Inst{47-40} = op{11-4};
456 let Inst{39-36} = M1;
457 let Inst{35-32} = op{3-0};
458 let Inst{31-0} = RI2;
461 class InstRIS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
462 : InstSystemZ<6, outs, ins, asmstr, pattern> {
464 field bits<48> SoftFail = 0;
472 let Inst{47-40} = op{15-8};
473 let Inst{39-36} = R1;
474 let Inst{35-32} = M3;
475 let Inst{31-28} = B4;
476 let Inst{27-16} = D4;
478 let Inst{7-0} = op{7-0};
481 class InstRR<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
482 : InstSystemZ<2, outs, ins, asmstr, pattern> {
484 field bits<16> SoftFail = 0;
494 class InstRRD<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
495 : InstSystemZ<4, outs, ins, asmstr, pattern> {
497 field bits<32> SoftFail = 0;
503 let Inst{31-16} = op;
504 let Inst{15-12} = R1;
510 class InstRRE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
511 : InstSystemZ<4, outs, ins, asmstr, pattern> {
513 field bits<32> SoftFail = 0;
518 let Inst{31-16} = op;
524 class InstRRFa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
525 : InstSystemZ<4, outs, ins, asmstr, pattern> {
527 field bits<32> SoftFail = 0;
534 let Inst{31-16} = op;
535 let Inst{15-12} = R3;
541 class InstRRFb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
542 : InstSystemZ<4, outs, ins, asmstr, pattern> {
544 field bits<32> SoftFail = 0;
551 let Inst{31-16} = op;
552 let Inst{15-12} = R3;
558 class InstRRFc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
559 : InstSystemZ<4, outs, ins, asmstr, pattern> {
561 field bits<32> SoftFail = 0;
567 let Inst{31-16} = op;
568 let Inst{15-12} = M3;
574 class InstRRFd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
575 : InstSystemZ<4, outs, ins, asmstr, pattern> {
577 field bits<32> SoftFail = 0;
583 let Inst{31-16} = op;
590 class InstRRFe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
591 : InstSystemZ<4, outs, ins, asmstr, pattern> {
593 field bits<32> SoftFail = 0;
600 let Inst{31-16} = op;
601 let Inst{15-12} = M3;
607 class InstRRS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
608 : InstSystemZ<6, outs, ins, asmstr, pattern> {
610 field bits<48> SoftFail = 0;
618 let Inst{47-40} = op{15-8};
619 let Inst{39-36} = R1;
620 let Inst{35-32} = R2;
621 let Inst{31-28} = B4;
622 let Inst{27-16} = D4;
623 let Inst{15-12} = M3;
625 let Inst{7-0} = op{7-0};
628 class InstRXa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
629 : InstSystemZ<4, outs, ins, asmstr, pattern> {
631 field bits<32> SoftFail = 0;
638 let Inst{31-24} = op;
639 let Inst{23-20} = R1;
640 let Inst{19-16} = X2;
641 let Inst{15-12} = B2;
647 class InstRXb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
648 : InstSystemZ<4, outs, ins, asmstr, pattern> {
650 field bits<32> SoftFail = 0;
657 let Inst{31-24} = op;
658 let Inst{23-20} = M1;
659 let Inst{19-16} = X2;
660 let Inst{15-12} = B2;
666 class InstRXE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
667 : InstSystemZ<6, outs, ins, asmstr, pattern> {
669 field bits<48> SoftFail = 0;
677 let Inst{47-40} = op{15-8};
678 let Inst{39-36} = R1;
679 let Inst{35-32} = X2;
680 let Inst{31-28} = B2;
681 let Inst{27-16} = D2;
682 let Inst{15-12} = M3;
684 let Inst{7-0} = op{7-0};
689 class InstRXF<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
690 : InstSystemZ<6, outs, ins, asmstr, pattern> {
692 field bits<48> SoftFail = 0;
700 let Inst{47-40} = op{15-8};
701 let Inst{39-36} = R3;
702 let Inst{35-32} = X2;
703 let Inst{31-28} = B2;
704 let Inst{27-16} = D2;
705 let Inst{15-12} = R1;
707 let Inst{7-0} = op{7-0};
712 class InstRXYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
713 : InstSystemZ<6, outs, ins, asmstr, pattern> {
715 field bits<48> SoftFail = 0;
722 let Inst{47-40} = op{15-8};
723 let Inst{39-36} = R1;
724 let Inst{35-32} = X2;
725 let Inst{31-28} = B2;
726 let Inst{27-16} = D2{11-0};
727 let Inst{15-8} = D2{19-12};
728 let Inst{7-0} = op{7-0};
730 let Has20BitOffset = 1;
734 class InstRXYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
735 : InstSystemZ<6, outs, ins, asmstr, pattern> {
737 field bits<48> SoftFail = 0;
744 let Inst{47-40} = op{15-8};
745 let Inst{39-36} = M1;
746 let Inst{35-32} = X2;
747 let Inst{31-28} = B2;
748 let Inst{27-16} = D2{11-0};
749 let Inst{15-8} = D2{19-12};
750 let Inst{7-0} = op{7-0};
752 let Has20BitOffset = 1;
756 class InstRSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
757 : InstSystemZ<4, outs, ins, asmstr, pattern> {
759 field bits<32> SoftFail = 0;
766 let Inst{31-24} = op;
767 let Inst{23-20} = R1;
768 let Inst{19-16} = R3;
769 let Inst{15-12} = B2;
773 class InstRSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
774 : InstSystemZ<4, outs, ins, asmstr, pattern> {
776 field bits<32> SoftFail = 0;
783 let Inst{31-24} = op;
784 let Inst{23-20} = R1;
785 let Inst{19-16} = M3;
786 let Inst{15-12} = B2;
790 class InstRSEa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
791 : InstSystemZ<6, outs, ins, asmstr, pattern> {
793 field bits<48> SoftFail = 0;
800 let Inst{47-40} = op{15-8};
801 let Inst{39-36} = R1;
802 let Inst{35-32} = R3;
803 let Inst{31-28} = B2;
804 let Inst{27-16} = D2;
806 let Inst{7-0} = op{7-0};
809 class InstRSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
810 : InstSystemZ<4, outs, ins, asmstr, pattern> {
812 field bits<32> SoftFail = 0;
818 let Inst{31-24} = op;
819 let Inst{23-20} = R1;
820 let Inst{19-16} = R3;
821 let Inst{15-0} = RI2;
824 class InstRSLa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
825 : InstSystemZ<6, outs, ins, asmstr, pattern> {
827 field bits<48> SoftFail = 0;
833 let Inst{47-40} = op{15-8};
834 let Inst{39-36} = L1;
836 let Inst{31-28} = B1;
837 let Inst{27-16} = D1;
839 let Inst{7-0} = op{7-0};
842 class InstRSLb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
843 : InstSystemZ<6, outs, ins, asmstr, pattern> {
845 field bits<48> SoftFail = 0;
853 let Inst{47-40} = op{15-8};
854 let Inst{39-32} = L2;
855 let Inst{31-28} = B2;
856 let Inst{27-16} = D2;
857 let Inst{15-12} = R1;
859 let Inst{7-0} = op{7-0};
862 class InstRSYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
863 : InstSystemZ<6, outs, ins, asmstr, pattern> {
865 field bits<48> SoftFail = 0;
872 let Inst{47-40} = op{15-8};
873 let Inst{39-36} = R1;
874 let Inst{35-32} = R3;
875 let Inst{31-28} = B2;
876 let Inst{27-16} = D2{11-0};
877 let Inst{15-8} = D2{19-12};
878 let Inst{7-0} = op{7-0};
880 let Has20BitOffset = 1;
883 class InstRSYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
884 : InstSystemZ<6, outs, ins, asmstr, pattern> {
886 field bits<48> SoftFail = 0;
893 let Inst{47-40} = op{15-8};
894 let Inst{39-36} = R1;
895 let Inst{35-32} = M3;
896 let Inst{31-28} = B2;
897 let Inst{27-16} = D2{11-0};
898 let Inst{15-8} = D2{19-12};
899 let Inst{7-0} = op{7-0};
901 let Has20BitOffset = 1;
904 class InstSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
905 : InstSystemZ<4, outs, ins, asmstr, pattern> {
907 field bits<32> SoftFail = 0;
913 let Inst{31-24} = op;
914 let Inst{23-16} = I2;
915 let Inst{15-12} = B1;
919 class InstSIL<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
920 : InstSystemZ<6, outs, ins, asmstr, pattern> {
922 field bits<48> SoftFail = 0;
928 let Inst{47-32} = op;
929 let Inst{31-28} = B1;
930 let Inst{27-16} = D1;
934 class InstSIY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
935 : InstSystemZ<6, outs, ins, asmstr, pattern> {
937 field bits<48> SoftFail = 0;
943 let Inst{47-40} = op{15-8};
944 let Inst{39-32} = I2;
945 let Inst{31-28} = B1;
946 let Inst{27-16} = D1{11-0};
947 let Inst{15-8} = D1{19-12};
948 let Inst{7-0} = op{7-0};
950 let Has20BitOffset = 1;
953 class InstSMI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
954 : InstSystemZ<6, outs, ins, asmstr, pattern> {
956 field bits<48> SoftFail = 0;
963 let Inst{47-40} = op;
964 let Inst{39-36} = M1;
966 let Inst{31-28} = B3;
967 let Inst{27-16} = D3;
968 let Inst{15-0} = RI2;
971 class InstSSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
972 : InstSystemZ<6, outs, ins, asmstr, pattern> {
974 field bits<48> SoftFail = 0;
982 let Inst{47-40} = op;
983 let Inst{39-32} = L1;
984 let Inst{31-28} = B1;
985 let Inst{27-16} = D1;
986 let Inst{15-12} = B2;
990 class InstSSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
991 : InstSystemZ<6, outs, ins, asmstr, pattern> {
993 field bits<48> SoftFail = 0;
1002 let Inst{47-40} = op;
1003 let Inst{39-36} = L1;
1004 let Inst{35-32} = L2;
1005 let Inst{31-28} = B1;
1006 let Inst{27-16} = D1;
1007 let Inst{15-12} = B2;
1008 let Inst{11-0} = D2;
1011 class InstSSc<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1012 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1013 field bits<48> Inst;
1014 field bits<48> SoftFail = 0;
1023 let Inst{47-40} = op;
1024 let Inst{39-36} = L1;
1025 let Inst{35-32} = I3;
1026 let Inst{31-28} = B1;
1027 let Inst{27-16} = D1;
1028 let Inst{15-12} = B2;
1029 let Inst{11-0} = D2;
1032 class InstSSd<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1033 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1034 field bits<48> Inst;
1035 field bits<48> SoftFail = 0;
1044 let Inst{47-40} = op;
1045 let Inst{39-36} = R1;
1046 let Inst{35-32} = R3;
1047 let Inst{31-28} = B1;
1048 let Inst{27-16} = D1;
1049 let Inst{15-12} = B2;
1050 let Inst{11-0} = D2;
1053 class InstSSe<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1054 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1055 field bits<48> Inst;
1056 field bits<48> SoftFail = 0;
1065 let Inst{47-40} = op;
1066 let Inst{39-36} = R1;
1067 let Inst{35-32} = R3;
1068 let Inst{31-28} = B2;
1069 let Inst{27-16} = D2;
1070 let Inst{15-12} = B4;
1071 let Inst{11-0} = D4;
1074 class InstSSf<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1075 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1076 field bits<48> Inst;
1077 field bits<48> SoftFail = 0;
1085 let Inst{47-40} = op;
1086 let Inst{39-32} = L2;
1087 let Inst{31-28} = B1;
1088 let Inst{27-16} = D1;
1089 let Inst{15-12} = B2;
1090 let Inst{11-0} = D2;
1093 class InstSSE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1094 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1095 field bits<48> Inst;
1096 field bits<48> SoftFail = 0;
1103 let Inst{47-32} = op;
1104 let Inst{31-28} = B1;
1105 let Inst{27-16} = D1;
1106 let Inst{15-12} = B2;
1107 let Inst{11-0} = D2;
1110 class InstSSF<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1111 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1112 field bits<48> Inst;
1113 field bits<48> SoftFail = 0;
1121 let Inst{47-40} = op{11-4};
1122 let Inst{39-36} = R3;
1123 let Inst{35-32} = op{3-0};
1124 let Inst{31-28} = B1;
1125 let Inst{27-16} = D1;
1126 let Inst{15-12} = B2;
1127 let Inst{11-0} = D2;
1130 class InstS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1131 : InstSystemZ<4, outs, ins, asmstr, pattern> {
1132 field bits<32> Inst;
1133 field bits<32> SoftFail = 0;
1138 let Inst{31-16} = op;
1139 let Inst{15-12} = B2;
1140 let Inst{11-0} = D2;
1143 class InstVRIa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1144 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1145 field bits<48> Inst;
1146 field bits<48> SoftFail = 0;
1152 let Inst{47-40} = op{15-8};
1153 let Inst{39-36} = V1{3-0};
1154 let Inst{35-32} = 0;
1155 let Inst{31-16} = I2;
1156 let Inst{15-12} = M3;
1157 let Inst{11} = V1{4};
1159 let Inst{7-0} = op{7-0};
1162 class InstVRIb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1163 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1164 field bits<48> Inst;
1165 field bits<48> SoftFail = 0;
1172 let Inst{47-40} = op{15-8};
1173 let Inst{39-36} = V1{3-0};
1174 let Inst{35-32} = 0;
1175 let Inst{31-24} = I2;
1176 let Inst{23-16} = I3;
1177 let Inst{15-12} = M4;
1178 let Inst{11} = V1{4};
1180 let Inst{7-0} = op{7-0};
1183 class InstVRIc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1184 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1185 field bits<48> Inst;
1186 field bits<48> SoftFail = 0;
1193 let Inst{47-40} = op{15-8};
1194 let Inst{39-36} = V1{3-0};
1195 let Inst{35-32} = V3{3-0};
1196 let Inst{31-16} = I2;
1197 let Inst{15-12} = M4;
1198 let Inst{11} = V1{4};
1199 let Inst{10} = V3{4};
1201 let Inst{7-0} = op{7-0};
1204 class InstVRId<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1205 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1206 field bits<48> Inst;
1207 field bits<48> SoftFail = 0;
1215 let Inst{47-40} = op{15-8};
1216 let Inst{39-36} = V1{3-0};
1217 let Inst{35-32} = V2{3-0};
1218 let Inst{31-28} = V3{3-0};
1219 let Inst{27-24} = 0;
1220 let Inst{23-16} = I4;
1221 let Inst{15-12} = M5;
1222 let Inst{11} = V1{4};
1223 let Inst{10} = V2{4};
1224 let Inst{9} = V3{4};
1226 let Inst{7-0} = op{7-0};
1229 class InstVRIe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1230 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1231 field bits<48> Inst;
1232 field bits<48> SoftFail = 0;
1240 let Inst{47-40} = op{15-8};
1241 let Inst{39-36} = V1{3-0};
1242 let Inst{35-32} = V2{3-0};
1243 let Inst{31-20} = I3;
1244 let Inst{19-16} = M5;
1245 let Inst{15-12} = M4;
1246 let Inst{11} = V1{4};
1247 let Inst{10} = V2{4};
1249 let Inst{7-0} = op{7-0};
1252 class InstVRIf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1253 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1254 field bits<48> Inst;
1255 field bits<48> SoftFail = 0;
1263 let Inst{47-40} = op{15-8};
1264 let Inst{39-36} = V1{3-0};
1265 let Inst{35-32} = V2{3-0};
1266 let Inst{31-28} = V3{3-0};
1267 let Inst{27-24} = 0;
1268 let Inst{23-20} = M5;
1269 let Inst{19-12} = I4;
1270 let Inst{11} = V1{4};
1271 let Inst{10} = V2{4};
1272 let Inst{9} = V3{4};
1274 let Inst{7-0} = op{7-0};
1277 class InstVRIg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1278 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1279 field bits<48> Inst;
1280 field bits<48> SoftFail = 0;
1288 let Inst{47-40} = op{15-8};
1289 let Inst{39-36} = V1{3-0};
1290 let Inst{35-32} = V2{3-0};
1291 let Inst{31-24} = I4;
1292 let Inst{23-20} = M5;
1293 let Inst{19-12} = I3;
1294 let Inst{11} = V1{4};
1295 let Inst{10} = V2{4};
1297 let Inst{7-0} = op{7-0};
1300 class InstVRIh<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1301 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1302 field bits<48> Inst;
1303 field bits<48> SoftFail = 0;
1309 let Inst{47-40} = op{15-8};
1310 let Inst{39-36} = V1{3-0};
1311 let Inst{35-32} = 0;
1312 let Inst{31-16} = I2;
1313 let Inst{15-12} = I3;
1314 let Inst{11} = V1{4};
1316 let Inst{7-0} = op{7-0};
1319 class InstVRIi<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1320 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1321 field bits<48> Inst;
1322 field bits<48> SoftFail = 0;
1329 let Inst{47-40} = op{15-8};
1330 let Inst{39-36} = V1{3-0};
1331 let Inst{35-32} = R2;
1332 let Inst{31-24} = 0;
1333 let Inst{23-20} = M4;
1334 let Inst{19-12} = I3;
1335 let Inst{11} = V1{4};
1337 let Inst{7-0} = op{7-0};
1340 // Depending on the instruction mnemonic, certain bits may be or-ed into
1341 // the M4 value provided as explicit operand. These are passed as m4or.
1342 class InstVRRa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1344 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1345 field bits<48> Inst;
1346 field bits<48> SoftFail = 0;
1354 let Inst{47-40} = op{15-8};
1355 let Inst{39-36} = V1{3-0};
1356 let Inst{35-32} = V2{3-0};
1357 let Inst{31-24} = 0;
1358 let Inst{23-20} = M5;
1359 let Inst{19} = !if (!eq (m4or{3}, 1), 1, M4{3});
1360 let Inst{18} = !if (!eq (m4or{2}, 1), 1, M4{2});
1361 let Inst{17} = !if (!eq (m4or{1}, 1), 1, M4{1});
1362 let Inst{16} = !if (!eq (m4or{0}, 1), 1, M4{0});
1363 let Inst{15-12} = M3;
1364 let Inst{11} = V1{4};
1365 let Inst{10} = V2{4};
1367 let Inst{7-0} = op{7-0};
1370 // Depending on the instruction mnemonic, certain bits may be or-ed into
1371 // the M5 value provided as explicit operand. These are passed as m5or.
1372 class InstVRRb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1374 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1375 field bits<48> Inst;
1376 field bits<48> SoftFail = 0;
1384 let Inst{47-40} = op{15-8};
1385 let Inst{39-36} = V1{3-0};
1386 let Inst{35-32} = V2{3-0};
1387 let Inst{31-28} = V3{3-0};
1388 let Inst{27-24} = 0;
1389 let Inst{23} = !if (!eq (m5or{3}, 1), 1, M5{3});
1390 let Inst{22} = !if (!eq (m5or{2}, 1), 1, M5{2});
1391 let Inst{21} = !if (!eq (m5or{1}, 1), 1, M5{1});
1392 let Inst{20} = !if (!eq (m5or{0}, 1), 1, M5{0});
1393 let Inst{19-16} = 0;
1394 let Inst{15-12} = M4;
1395 let Inst{11} = V1{4};
1396 let Inst{10} = V2{4};
1397 let Inst{9} = V3{4};
1399 let Inst{7-0} = op{7-0};
1402 class InstVRRc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1403 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1404 field bits<48> Inst;
1405 field bits<48> SoftFail = 0;
1414 let Inst{47-40} = op{15-8};
1415 let Inst{39-36} = V1{3-0};
1416 let Inst{35-32} = V2{3-0};
1417 let Inst{31-28} = V3{3-0};
1418 let Inst{27-24} = 0;
1419 let Inst{23-20} = M6;
1420 let Inst{19-16} = M5;
1421 let Inst{15-12} = M4;
1422 let Inst{11} = V1{4};
1423 let Inst{10} = V2{4};
1424 let Inst{9} = V3{4};
1426 let Inst{7-0} = op{7-0};
1429 // Depending on the instruction mnemonic, certain bits may be or-ed into
1430 // the M6 value provided as explicit operand. These are passed as m6or.
1431 class InstVRRd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern,
1433 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1434 field bits<48> Inst;
1435 field bits<48> SoftFail = 0;
1444 let Inst{47-40} = op{15-8};
1445 let Inst{39-36} = V1{3-0};
1446 let Inst{35-32} = V2{3-0};
1447 let Inst{31-28} = V3{3-0};
1448 let Inst{27-24} = M5;
1449 let Inst{23} = !if (!eq (m6or{3}, 1), 1, M6{3});
1450 let Inst{22} = !if (!eq (m6or{2}, 1), 1, M6{2});
1451 let Inst{21} = !if (!eq (m6or{1}, 1), 1, M6{1});
1452 let Inst{20} = !if (!eq (m6or{0}, 1), 1, M6{0});
1453 let Inst{19-16} = 0;
1454 let Inst{15-12} = V4{3-0};
1455 let Inst{11} = V1{4};
1456 let Inst{10} = V2{4};
1457 let Inst{9} = V3{4};
1458 let Inst{8} = V4{4};
1459 let Inst{7-0} = op{7-0};
1462 class InstVRRe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1463 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1464 field bits<48> Inst;
1465 field bits<48> SoftFail = 0;
1474 let Inst{47-40} = op{15-8};
1475 let Inst{39-36} = V1{3-0};
1476 let Inst{35-32} = V2{3-0};
1477 let Inst{31-28} = V3{3-0};
1478 let Inst{27-24} = M6;
1479 let Inst{23-20} = 0;
1480 let Inst{19-16} = M5;
1481 let Inst{15-12} = V4{3-0};
1482 let Inst{11} = V1{4};
1483 let Inst{10} = V2{4};
1484 let Inst{9} = V3{4};
1485 let Inst{8} = V4{4};
1486 let Inst{7-0} = op{7-0};
1489 class InstVRRf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1490 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1491 field bits<48> Inst;
1492 field bits<48> SoftFail = 0;
1498 let Inst{47-40} = op{15-8};
1499 let Inst{39-36} = V1{3-0};
1500 let Inst{35-32} = R2;
1501 let Inst{31-28} = R3;
1502 let Inst{27-12} = 0;
1503 let Inst{11} = V1{4};
1505 let Inst{7-0} = op{7-0};
1508 class InstVRRg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1509 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1510 field bits<48> Inst;
1511 field bits<48> SoftFail = 0;
1515 let Inst{47-40} = op{15-8};
1516 let Inst{39-36} = 0;
1517 let Inst{35-32} = V1{3-0};
1518 let Inst{31-12} = 0;
1520 let Inst{10} = V1{4};
1522 let Inst{7-0} = op{7-0};
1525 class InstVRRh<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1526 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1527 field bits<48> Inst;
1528 field bits<48> SoftFail = 0;
1534 let Inst{47-40} = op{15-8};
1535 let Inst{39-36} = 0;
1536 let Inst{35-32} = V1{3-0};
1537 let Inst{31-28} = V2{3-0};
1538 let Inst{27-24} = 0;
1539 let Inst{23-20} = M3;
1540 let Inst{19-12} = 0;
1542 let Inst{10} = V1{4};
1543 let Inst{9} = V2{4};
1545 let Inst{7-0} = op{7-0};
1548 class InstVRRi<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1549 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1550 field bits<48> Inst;
1551 field bits<48> SoftFail = 0;
1558 let Inst{47-40} = op{15-8};
1559 let Inst{39-36} = R1;
1560 let Inst{35-32} = V2{3-0};
1561 let Inst{31-24} = 0;
1562 let Inst{23-20} = M3;
1563 let Inst{19-16} = M4;
1564 let Inst{15-12} = 0;
1566 let Inst{10} = V2{4};
1568 let Inst{7-0} = op{7-0};
1571 class InstVRRj<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1572 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1573 field bits<48> Inst;
1574 field bits<48> SoftFail = 0;
1581 let Inst{47-40} = op{15-8};
1582 let Inst{39-36} = V1{3-0};
1583 let Inst{35-32} = V2{3-0};
1584 let Inst{31-28} = V3{3-0};
1585 let Inst{27-24} = 0;
1586 let Inst{23-20} = M4;
1587 let Inst{19-16} = 0;
1588 let Inst{15-12} = 0;
1589 let Inst{11} = V1{4};
1590 let Inst{10} = V2{4};
1591 let Inst{9} = V3{4};
1593 let Inst{7-0} = op{7-0};
1596 class InstVRRk<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1597 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1598 field bits<48> Inst;
1599 field bits<48> SoftFail = 0;
1605 let Inst{47-40} = op{15-8};
1606 let Inst{39-36} = V1{3-0};
1607 let Inst{35-32} = V2{3-0};
1608 let Inst{31-28} = 0;
1609 let Inst{27-24} = 0;
1610 let Inst{23-20} = M3;
1611 let Inst{19-16} = 0;
1612 let Inst{15-12} = 0;
1613 let Inst{11} = V1{4};
1614 let Inst{10} = V2{4};
1617 let Inst{7-0} = op{7-0};
1620 class InstVRSa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1621 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1622 field bits<48> Inst;
1623 field bits<48> SoftFail = 0;
1631 let Inst{47-40} = op{15-8};
1632 let Inst{39-36} = V1{3-0};
1633 let Inst{35-32} = V3{3-0};
1634 let Inst{31-28} = B2;
1635 let Inst{27-16} = D2;
1636 let Inst{15-12} = M4;
1637 let Inst{11} = V1{4};
1638 let Inst{10} = V3{4};
1640 let Inst{7-0} = op{7-0};
1643 class InstVRSb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1644 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1645 field bits<48> Inst;
1646 field bits<48> SoftFail = 0;
1654 let Inst{47-40} = op{15-8};
1655 let Inst{39-36} = V1{3-0};
1656 let Inst{35-32} = R3;
1657 let Inst{31-28} = B2;
1658 let Inst{27-16} = D2;
1659 let Inst{15-12} = M4;
1660 let Inst{11} = V1{4};
1662 let Inst{7-0} = op{7-0};
1665 class InstVRSc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1666 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1667 field bits<48> Inst;
1668 field bits<48> SoftFail = 0;
1676 let Inst{47-40} = op{15-8};
1677 let Inst{39-36} = R1;
1678 let Inst{35-32} = V3{3-0};
1679 let Inst{31-28} = B2;
1680 let Inst{27-16} = D2;
1681 let Inst{15-12} = M4;
1683 let Inst{10} = V3{4};
1685 let Inst{7-0} = op{7-0};
1688 class InstVRSd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1689 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1690 field bits<48> Inst;
1691 field bits<48> SoftFail = 0;
1698 let Inst{47-40} = op{15-8};
1699 let Inst{39-36} = 0;
1700 let Inst{35-32} = R3;
1701 let Inst{31-28} = B2;
1702 let Inst{27-16} = D2;
1703 let Inst{15-12} = V1{3-0};
1705 let Inst{8} = V1{4};
1706 let Inst{7-0} = op{7-0};
1709 class InstVRV<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1710 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1711 field bits<48> Inst;
1712 field bits<48> SoftFail = 0;
1720 let Inst{47-40} = op{15-8};
1721 let Inst{39-36} = V1{3-0};
1722 let Inst{35-32} = V2{3-0};
1723 let Inst{31-28} = B2;
1724 let Inst{27-16} = D2;
1725 let Inst{15-12} = M3;
1726 let Inst{11} = V1{4};
1727 let Inst{10} = V2{4};
1729 let Inst{7-0} = op{7-0};
1732 class InstVRX<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1733 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1734 field bits<48> Inst;
1735 field bits<48> SoftFail = 0;
1743 let Inst{47-40} = op{15-8};
1744 let Inst{39-36} = V1{3-0};
1745 let Inst{35-32} = X2;
1746 let Inst{31-28} = B2;
1747 let Inst{27-16} = D2;
1748 let Inst{15-12} = M3;
1749 let Inst{11} = V1{4};
1751 let Inst{7-0} = op{7-0};
1754 class InstVSI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
1755 : InstSystemZ<6, outs, ins, asmstr, pattern> {
1756 field bits<48> Inst;
1757 field bits<48> SoftFail = 0;
1764 let Inst{47-40} = op{15-8};
1765 let Inst{39-32} = I3;
1766 let Inst{31-28} = B2;
1767 let Inst{27-16} = D2;
1768 let Inst{15-12} = V1{3-0};
1770 let Inst{8} = V1{4};
1771 let Inst{7-0} = op{7-0};
1774 //===----------------------------------------------------------------------===//
1775 // Instruction classes for .insn directives
1776 //===----------------------------------------------------------------------===//
1778 class DirectiveInsnE<dag outs, dag ins, string asmstr, list<dag> pattern>
1779 : InstE<0, outs, ins, asmstr, pattern> {
1785 class DirectiveInsnRI<dag outs, dag ins, string asmstr, list<dag> pattern>
1786 : InstRIa<0, outs, ins, asmstr, pattern> {
1789 let Inst{31-24} = enc{31-24};
1790 let Inst{19-16} = enc{19-16};
1793 class DirectiveInsnRIE<dag outs, dag ins, string asmstr, list<dag> pattern>
1794 : InstRIEd<0, outs, ins, asmstr, pattern> {
1797 let Inst{47-40} = enc{47-40};
1798 let Inst{7-0} = enc{7-0};
1801 class DirectiveInsnRIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1802 : InstRILa<0, outs, ins, asmstr, pattern> {
1806 let Inst{47-40} = enc{47-40};
1807 let Inst{35-32} = enc{35-32};
1810 class DirectiveInsnRIS<dag outs, dag ins, string asmstr, list<dag> pattern>
1811 : InstRIS<0, outs, ins, asmstr, pattern> {
1814 let Inst{47-40} = enc{47-40};
1815 let Inst{7-0} = enc{7-0};
1818 class DirectiveInsnRR<dag outs, dag ins, string asmstr, list<dag> pattern>
1819 : InstRR<0, outs, ins, asmstr, pattern> {
1822 let Inst{15-8} = enc{15-8};
1825 class DirectiveInsnRRE<dag outs, dag ins, string asmstr, list<dag> pattern>
1826 : InstRRE<0, outs, ins, asmstr, pattern> {
1829 let Inst{31-16} = enc{31-16};
1832 class DirectiveInsnRRF<dag outs, dag ins, string asmstr, list<dag> pattern>
1833 : InstRRFa<0, outs, ins, asmstr, pattern> {
1836 let Inst{31-16} = enc{31-16};
1839 class DirectiveInsnRRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1840 : InstRRS<0, outs, ins, asmstr, pattern> {
1843 let Inst{47-40} = enc{47-40};
1844 let Inst{7-0} = enc{7-0};
1847 class DirectiveInsnRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1848 : InstRSa<0, outs, ins, asmstr, pattern> {
1851 let Inst{31-24} = enc{31-24};
1854 class DirectiveInsnRSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1855 : InstRSEa<6, outs, ins, asmstr, pattern> {
1858 let Inst{47-40} = enc{47-40};
1859 let Inst{7-0} = enc{7-0};
1862 class DirectiveInsnRSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1863 : InstRSI<0, outs, ins, asmstr, pattern> {
1866 let Inst{31-24} = enc{31-24};
1869 class DirectiveInsnRSY<dag outs, dag ins, string asmstr, list<dag> pattern>
1870 : InstRSYa<0, outs, ins, asmstr, pattern> {
1873 let Inst{47-40} = enc{47-40};
1874 let Inst{7-0} = enc{7-0};
1877 class DirectiveInsnRX<dag outs, dag ins, string asmstr, list<dag> pattern>
1878 : InstRXa<0, outs, ins, asmstr, pattern> {
1881 let Inst{31-24} = enc{31-24};
1884 class DirectiveInsnRXE<dag outs, dag ins, string asmstr, list<dag> pattern>
1885 : InstRXE<0, outs, ins, asmstr, pattern> {
1890 let Inst{47-40} = enc{47-40};
1891 let Inst{7-0} = enc{7-0};
1894 class DirectiveInsnRXF<dag outs, dag ins, string asmstr, list<dag> pattern>
1895 : InstRXF<0, outs, ins, asmstr, pattern> {
1898 let Inst{47-40} = enc{47-40};
1899 let Inst{7-0} = enc{7-0};
1902 class DirectiveInsnRXY<dag outs, dag ins, string asmstr, list<dag> pattern>
1903 : InstRXYa<0, outs, ins, asmstr, pattern> {
1906 let Inst{47-40} = enc{47-40};
1907 let Inst{7-0} = enc{7-0};
1910 class DirectiveInsnS<dag outs, dag ins, string asmstr, list<dag> pattern>
1911 : InstS<0, outs, ins, asmstr, pattern> {
1914 let Inst{31-16} = enc{31-16};
1917 class DirectiveInsnSI<dag outs, dag ins, string asmstr, list<dag> pattern>
1918 : InstSI<0, outs, ins, asmstr, pattern> {
1921 let Inst{31-24} = enc{31-24};
1924 class DirectiveInsnSIY<dag outs, dag ins, string asmstr, list<dag> pattern>
1925 : InstSIY<0, outs, ins, asmstr, pattern> {
1928 let Inst{47-40} = enc{47-40};
1929 let Inst{7-0} = enc{7-0};
1932 class DirectiveInsnSIL<dag outs, dag ins, string asmstr, list<dag> pattern>
1933 : InstSIL<0, outs, ins, asmstr, pattern> {
1936 let Inst{47-32} = enc{47-32};
1939 class DirectiveInsnSS<dag outs, dag ins, string asmstr, list<dag> pattern>
1940 : InstSSd<0, outs, ins, asmstr, pattern> {
1943 let Inst{47-40} = enc{47-40};
1946 class DirectiveInsnSSE<dag outs, dag ins, string asmstr, list<dag> pattern>
1947 : InstSSE<0, outs, ins, asmstr, pattern> {
1950 let Inst{47-32} = enc{47-32};
1953 class DirectiveInsnSSF<dag outs, dag ins, string asmstr, list<dag> pattern>
1954 : InstSSF<0, outs, ins, asmstr, pattern> {
1957 let Inst{47-40} = enc{47-40};
1958 let Inst{35-32} = enc{35-32};
1961 class DirectiveInsnVRI<dag outs, dag ins, string asmstr, list<dag> pattern>
1962 : InstVRIe<0, outs, ins, asmstr, pattern> {
1965 let Inst{47-40} = enc{47-40};
1966 let Inst{7-0} = enc{7-0};
1969 class DirectiveInsnVRR<dag outs, dag ins, string asmstr, list<dag> pattern>
1970 : InstVRRc<0, outs, ins, asmstr, pattern> {
1973 let Inst{47-40} = enc{47-40};
1974 let Inst{7-0} = enc{7-0};
1977 class DirectiveInsnVRS<dag outs, dag ins, string asmstr, list<dag> pattern>
1978 : InstVRSc<0, outs, ins, asmstr, pattern> {
1981 let Inst{47-40} = enc{47-40};
1982 let Inst{7-0} = enc{7-0};
1985 class DirectiveInsnVRV<dag outs, dag ins, string asmstr, list<dag> pattern>
1986 : InstVRV<0, outs, ins, asmstr, pattern> {
1989 let Inst{47-40} = enc{47-40};
1990 let Inst{7-0} = enc{7-0};
1993 class DirectiveInsnVRX<dag outs, dag ins, string asmstr, list<dag> pattern>
1994 : InstVRX<0, outs, ins, asmstr, pattern> {
1997 let Inst{47-40} = enc{47-40};
1998 let Inst{7-0} = enc{7-0};
2001 class DirectiveInsnVSI<dag outs, dag ins, string asmstr, list<dag> pattern>
2002 : InstVSI<0, outs, ins, asmstr, pattern> {
2005 let Inst{47-40} = enc{47-40};
2006 let Inst{7-0} = enc{7-0};
2010 //===----------------------------------------------------------------------===//
2011 // Variants of instructions with condition mask
2012 //===----------------------------------------------------------------------===//
2014 // For instructions using a condition mask (e.g. conditional branches,
2015 // compare-and-branch instructions, or conditional move instructions),
2016 // we generally need to create multiple instruction patterns:
2018 // - One used for code generation, which encodes the condition mask as an
2019 // MI operand, but writes out an extended mnemonic for better readability.
2020 // - One pattern for the base form of the instruction with an explicit
2021 // condition mask (encoded as a plain integer MI operand).
2022 // - Specific patterns for each extended mnemonic, where the condition mask
2023 // is implied by the pattern name and not otherwise encoded at all.
2025 // We need the latter primarily for the assembler and disassembler, since the
2026 // assembler parser is not able to decode part of an instruction mnemonic
2027 // into an operand. Thus we provide separate patterns for each mnemonic.
2029 // Note that in some cases there are two different mnemonics for the same
2030 // condition mask. In this case we cannot have both instructions available
2031 // to the disassembler at the same time since the encodings are not distinct.
2032 // Therefore the alternate forms are marked isAsmParserOnly.
2034 // We don't make one of the two names an alias of the other because
2035 // we need the custom parsing routines to select the correct register class.
2037 // This section provides helpers for generating the specific forms.
2039 //===----------------------------------------------------------------------===//
2041 // A class to describe a variant of an instruction with condition mask.
2042 class CondVariant<bits<4> ccmaskin, string suffixin, bit alternatein,
2043 string asmvariantin = ""> {
2044 // The fixed condition mask to use.
2045 bits<4> ccmask = ccmaskin;
2047 // The suffix to use for the extended assembler mnemonic.
2048 string suffix = suffixin;
2050 // Whether this is an alternate that needs to be marked isAsmParserOnly.
2051 bit alternate = alternatein;
2053 // Whether this needs be to restricted to a specific dialect.
2054 // Valid values are "gnu" and "hlasm", which when passed in
2055 // will set AsmVariantName.
2056 string asmvariant = asmvariantin;
2059 // Condition mask 15 means "always true", which is used to define
2060 // unconditional branches as a variant of conditional branches.
2061 def CondAlways : CondVariant<15, "", 0>;
2063 // Condition masks for general instructions that can set all 4 bits.
2064 def CondVariantO : CondVariant<1, "o", 0>;
2065 def CondVariantH : CondVariant<2, "h", 0>;
2066 def CondVariantP : CondVariant<2, "p", 1>;
2067 def CondVariantNLE : CondVariant<3, "nle", 0, "gnu">;
2068 def CondVariantL : CondVariant<4, "l", 0>;
2069 def CondVariantM : CondVariant<4, "m", 1>;
2070 def CondVariantNHE : CondVariant<5, "nhe", 0, "gnu">;
2071 def CondVariantLH : CondVariant<6, "lh", 0, "gnu">;
2072 def CondVariantNE : CondVariant<7, "ne", 0>;
2073 def CondVariantNZ : CondVariant<7, "nz", 1>;
2074 def CondVariantE : CondVariant<8, "e", 0>;
2075 def CondVariantZ : CondVariant<8, "z", 1>;
2076 def CondVariantNLH : CondVariant<9, "nlh", 0, "gnu">;
2077 def CondVariantHE : CondVariant<10, "he", 0, "gnu">;
2078 def CondVariantNL : CondVariant<11, "nl", 0>;
2079 def CondVariantNM : CondVariant<11, "nm", 1>;
2080 def CondVariantLE : CondVariant<12, "le", 0, "gnu">;
2081 def CondVariantNH : CondVariant<13, "nh", 0>;
2082 def CondVariantNP : CondVariant<13, "np", 1>;
2083 def CondVariantNO : CondVariant<14, "no", 0>;
2085 // A helper class to look up one of the above by name.
2086 class CV<string name>
2087 : CondVariant<!cast<CondVariant>("CondVariant"#name).ccmask,
2088 !cast<CondVariant>("CondVariant"#name).suffix,
2089 !cast<CondVariant>("CondVariant"#name).alternate,
2090 !cast<CondVariant>("CondVariant"#name).asmvariant>;
2092 // Condition masks for integer instructions (e.g. compare-and-branch).
2093 // This is like the list above, except that condition 3 is not possible
2094 // and that the low bit of the mask is therefore always 0. This means
2095 // that each condition has two names. Conditions "o" and "no" are not used.
2096 def IntCondVariantH : CondVariant<2, "h", 0>;
2097 def IntCondVariantNLE : CondVariant<2, "nle", 1, "gnu">;
2098 def IntCondVariantL : CondVariant<4, "l", 0>;
2099 def IntCondVariantNHE : CondVariant<4, "nhe", 1, "gnu">;
2100 def IntCondVariantLH : CondVariant<6, "lh", 0, "gnu">;
2101 def IntCondVariantNE : CondVariant<6, "ne", 1>;
2102 def IntCondVariantE : CondVariant<8, "e", 0>;
2103 def IntCondVariantNLH : CondVariant<8, "nlh", 1, "gnu">;
2104 def IntCondVariantHE : CondVariant<10, "he", 0, "gnu">;
2105 def IntCondVariantNL : CondVariant<10, "nl", 1>;
2106 def IntCondVariantLE : CondVariant<12, "le", 0, "gnu">;
2107 def IntCondVariantNH : CondVariant<12, "nh", 1>;
2109 // A helper class to look up one of the above by name.
2110 class ICV<string name>
2111 : CondVariant<!cast<CondVariant>("IntCondVariant"#name).ccmask,
2112 !cast<CondVariant>("IntCondVariant"#name).suffix,
2113 !cast<CondVariant>("IntCondVariant"#name).alternate,
2114 !cast<CondVariant>("IntCondVariant"#name).asmvariant>;
2116 // Defines a class that makes it easier to define
2117 // a MnemonicAlias when CondVariant's are involved.
2118 multiclass MnemonicCondBranchAlias<CondVariant V, string from, string to,
2119 string asmvariant = V.asmvariant> {
2120 if !or(!eq(V.asmvariant, ""), !eq(V.asmvariant, asmvariant)) then
2121 def "" : MnemonicAlias<!subst("#", V.suffix, from),
2122 !subst("#", V.suffix, to),
2126 //===----------------------------------------------------------------------===//
2127 // Instruction definitions with semantics
2128 //===----------------------------------------------------------------------===//
2130 // These classes have the form [Cond]<Category><Format>, where <Format> is one
2131 // of the formats defined above and where <Category> describes the inputs
2132 // and outputs. "Cond" is used if the instruction is conditional,
2133 // in which case the 4-bit condition-code mask is added as a final operand.
2134 // <Category> can be one of:
2137 // One register output operand and no input operands.
2140 // Two register output operands and no input operands.
2143 // One address operand. The instruction stores to the address.
2145 // SideEffectInherent:
2146 // No input or output operands, but causes some side effect.
2149 // One branch target. The instruction branches to the target.
2152 // One output operand and one branch target. The instruction stores
2153 // the return address to the output operand and branches to the target.
2156 // Two input operands and one optional branch target. The instruction
2157 // compares the two input operands and branches or traps on the result.
2160 // One register output operand, one register input operand and one branch
2161 // target. The instructions stores a modified form of the source register
2162 // in the destination register and branches on the result.
2165 // One register output operand, two register input operands and one branch
2166 // target. The instructions stores a modified form of one of the source
2167 // registers in the destination register and branches on the result.
2170 // One address input operand and two explicit output operands.
2171 // The instruction loads a range of registers from the address,
2172 // with the explicit operands giving the first and last register
2173 // to load. Other loaded registers are added as implicit definitions.
2176 // Two explicit input register operands and an address operand.
2177 // The instruction stores a range of registers to the address,
2178 // with the explicit operands giving the first and last register
2179 // to store. Other stored registers are added as implicit uses.
2182 // One value operand, one length operand and one address operand.
2183 // The instruction stores the value operand to the address but
2184 // doesn't write more than the number of bytes specified by the
2188 // One register output operand and one address operand.
2190 // SideEffectAddress:
2191 // One address operand. No output operands, but causes some side effect.
2194 // One register output operand and one input operand.
2197 // One address operand and one other input operand. The instruction
2198 // stores to the address.
2201 // One input operand. No output operands, but causes some side effect.
2204 // One register output operand and two input operands.
2207 // One address operand and two other input operands. The instruction
2208 // stores to the address.
2210 // SideEffectBinary:
2211 // Two input operands. No output operands, but causes some side effect.
2214 // Two input operands and an implicit CC output operand.
2217 // One or two input operands and an implicit CC output operand. If
2218 // present, the second input operand is an "address" operand used as
2219 // a test class mask.
2222 // One register output operand and three input operands.
2224 // SideEffectTernary:
2225 // Three input operands. No output operands, but causes some side effect.
2228 // One register output operand and four input operands.
2231 // One output operand and two input operands, one of which is an address.
2232 // The instruction both reads from and writes to the address.
2235 // One output operand and three input operands, one of which is an address.
2236 // The instruction both reads from and writes to the address.
2239 // One output operand and five input operands. The first two operands
2240 // are registers and the other three are immediates.
2243 // One 4-bit immediate operand and one address operand. The immediate
2244 // operand is 1 for a load prefetch and 2 for a store prefetch.
2247 // One 4-bit immediate operand and two address operands.
2249 // The format determines which input operands are tied to output operands,
2250 // and also determines the shape of any address operand.
2252 // Multiclasses of the form <Category><Format>Pair define two instructions,
2253 // one with <Category><Format> and one with <Category><Format>Y. The name
2254 // of the first instruction has no suffix, the name of the second has
2257 //===----------------------------------------------------------------------===//
2259 class InherentRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
2260 SDPatternOperator operator>
2261 : InstRRE<opcode, (outs cls:$R1), (ins),
2263 [(set cls:$R1, (operator))]> {
2267 class InherentDualRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2268 : InstRRE<opcode, (outs cls:$R1, cls:$R2), (ins),
2269 mnemonic#"\t$R1, $R2", []>;
2271 class InherentVRIa<string mnemonic, bits<16> opcode, bits<16> value>
2272 : InstVRIa<opcode, (outs VR128:$V1), (ins), mnemonic#"\t$V1", []> {
2277 class StoreInherentS<string mnemonic, bits<16> opcode,
2278 SDPatternOperator operator, bits<5> bytes>
2279 : InstS<opcode, (outs), (ins (bdaddr12only $B2, $D2):$BD2),
2280 mnemonic#"\t$BD2", [(operator bdaddr12only:$BD2)]> {
2282 let AccessBytes = bytes;
2285 class SideEffectInherentE<string mnemonic, bits<16>opcode>
2286 : InstE<opcode, (outs), (ins), mnemonic, []>;
2288 class SideEffectInherentS<string mnemonic, bits<16> opcode,
2289 SDPatternOperator operator>
2290 : InstS<opcode, (outs), (ins), mnemonic, [(operator)]> {
2295 class SideEffectInherentRRE<string mnemonic, bits<16> opcode>
2296 : InstRRE<opcode, (outs), (ins), mnemonic, []> {
2301 // Allow an optional TLS marker symbol to generate TLS call relocations.
2302 class CallRI<string mnemonic, bits<12> opcode>
2303 : InstRIb<opcode, (outs), (ins GR64:$R1, brtarget16tls:$RI2),
2304 mnemonic#"\t$R1, $RI2", []>;
2306 // Allow an optional TLS marker symbol to generate TLS call relocations.
2307 class CallRIL<string mnemonic, bits<12> opcode>
2308 : InstRILb<opcode, (outs), (ins GR64:$R1, brtarget32tls:$RI2),
2309 mnemonic#"\t$R1, $RI2", []>;
2311 class CallRR<string mnemonic, bits<8> opcode>
2312 : InstRR<opcode, (outs), (ins GR64:$R1, ADDR64:$R2),
2313 mnemonic#"\t$R1, $R2", []>;
2315 class CallRX<string mnemonic, bits<8> opcode>
2316 : InstRXa<opcode, (outs), (ins GR64:$R1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2317 mnemonic#"\t$R1, $XBD2", []>;
2319 class CondBranchRI<string mnemonic, bits<12> opcode,
2320 SDPatternOperator operator = null_frag>
2321 : InstRIc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget16:$RI2),
2322 !subst("#", "${M1}", mnemonic)#"\t$RI2",
2323 [(operator cond4:$valid, cond4:$M1, bb:$RI2)]> {
2324 let CCMaskFirst = 1;
2327 class AsmCondBranchRI<string mnemonic, bits<12> opcode>
2328 : InstRIc<opcode, (outs), (ins imm32zx4:$M1, brtarget16:$RI2),
2329 mnemonic#"\t$M1, $RI2", []>;
2331 class NeverCondBranchRI<string mnemonic, bits<12> opcode>
2332 : InstRIc<opcode, (outs), (ins brtarget16:$RI2),
2333 mnemonic#"\t$RI2", []> {
2337 class FixedCondBranchRI<CondVariant V, string mnemonic, bits<12> opcode,
2338 SDPatternOperator operator = null_frag>
2339 : InstRIc<opcode, (outs), (ins brtarget16:$RI2),
2340 !subst("#", V.suffix, mnemonic)#"\t$RI2", [(operator bb:$RI2)]> {
2341 let isAsmParserOnly = V.alternate;
2342 let AsmVariantName = V.asmvariant;
2346 class CondBranchRIL<string mnemonic, bits<12> opcode>
2347 : InstRILc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget32:$RI2),
2348 !subst("#", "${M1}", mnemonic)#"\t$RI2", []> {
2349 let CCMaskFirst = 1;
2352 class AsmCondBranchRIL<string mnemonic, bits<12> opcode>
2353 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, brtarget32:$RI2),
2354 mnemonic#"\t$M1, $RI2", []>;
2356 class NeverCondBranchRIL<string mnemonic, bits<12> opcode>
2357 : InstRILc<opcode, (outs), (ins brtarget32:$RI2),
2358 mnemonic#"\t$RI2", []> {
2362 class FixedCondBranchRIL<CondVariant V, string mnemonic, bits<12> opcode>
2363 : InstRILc<opcode, (outs), (ins brtarget32:$RI2),
2364 !subst("#", V.suffix, mnemonic)#"\t$RI2", []> {
2365 let isAsmParserOnly = V.alternate;
2366 let AsmVariantName = V.asmvariant;
2370 class CondBranchRR<string mnemonic, bits<8> opcode>
2371 : InstRR<opcode, (outs), (ins cond4:$valid, cond4:$R1, GR64:$R2),
2372 !subst("#", "${R1}", mnemonic)#"\t$R2", []> {
2373 let CCMaskFirst = 1;
2376 class AsmCondBranchRR<string mnemonic, bits<8> opcode>
2377 : InstRR<opcode, (outs), (ins imm32zx4:$R1, GR64:$R2),
2378 mnemonic#"\t$R1, $R2", []>;
2380 multiclass NeverCondBranchRR<string mnemonic, bits<8> opcode> {
2381 // For the no-op (always false) branch, the target is optional.
2382 def "" : InstRR<opcode, (outs), (ins GR64:$R2),
2383 mnemonic#"\t$R2", []> {
2386 def Opt : InstRR<opcode, (outs), (ins), mnemonic, []> {
2392 class FixedCondBranchRR<CondVariant V, string mnemonic, bits<8> opcode,
2393 SDPatternOperator operator = null_frag>
2394 : InstRR<opcode, (outs), (ins ADDR64:$R2),
2395 !subst("#", V.suffix, mnemonic)#"\t$R2", [(operator ADDR64:$R2)]> {
2396 let isAsmParserOnly = V.alternate;
2397 let AsmVariantName = V.asmvariant;
2401 class CondBranchRX<string mnemonic, bits<8> opcode>
2402 : InstRXb<opcode, (outs),
2403 (ins cond4:$valid, cond4:$M1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2404 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
2405 let CCMaskFirst = 1;
2408 class AsmCondBranchRX<string mnemonic, bits<8> opcode>
2409 : InstRXb<opcode, (outs),
2410 (ins imm32zx4:$M1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2411 mnemonic#"\t$M1, $XBD2", []>;
2413 multiclass NeverCondBranchRX<string mnemonic, bits<8> opcode> {
2414 // For the no-op (always false) branch, the target is optional.
2415 def "" : InstRXb<opcode, (outs),
2416 (ins (bdxaddr12only $B2, $D2, $X2):$XBD2),
2417 mnemonic#"\t$XBD2", []> {
2420 def Opt : InstRXb<opcode, (outs), (ins), mnemonic, []> {
2428 class FixedCondBranchRX<CondVariant V, string mnemonic, bits<8> opcode>
2429 : InstRXb<opcode, (outs), (ins (bdxaddr12only $B2, $D2, $X2):$XBD2),
2430 !subst("#", V.suffix, mnemonic)#"\t$XBD2", []> {
2431 let isAsmParserOnly = V.alternate;
2432 let AsmVariantName = V.asmvariant;
2436 class CondBranchRXY<string mnemonic, bits<16> opcode>
2437 : InstRXYb<opcode, (outs), (ins cond4:$valid, cond4:$M1,
2438 (bdxaddr20only $B2, $D2, $X2):$XBD2),
2439 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> {
2440 let CCMaskFirst = 1;
2444 class AsmCondBranchRXY<string mnemonic, bits<16> opcode>
2445 : InstRXYb<opcode, (outs),
2446 (ins imm32zx4:$M1, (bdxaddr20only $B2, $D2, $X2):$XBD2),
2447 mnemonic#"\t$M1, $XBD2", []> {
2451 class FixedCondBranchRXY<CondVariant V, string mnemonic, bits<16> opcode,
2452 SDPatternOperator operator = null_frag>
2453 : InstRXYb<opcode, (outs), (ins (bdxaddr20only $B2, $D2, $X2):$XBD2),
2454 !subst("#", V.suffix, mnemonic)#"\t$XBD2",
2455 [(operator (load bdxaddr20only:$XBD2))]> {
2456 let isAsmParserOnly = V.alternate;
2457 let AsmVariantName = V.asmvariant;
2462 class CmpBranchRIEa<string mnemonic, bits<16> opcode,
2463 RegisterOperand cls, ImmOpWithPattern imm>
2464 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, cond4:$M3),
2465 mnemonic#"$M3\t$R1, $I2", []>;
2467 class AsmCmpBranchRIEa<string mnemonic, bits<16> opcode,
2468 RegisterOperand cls, ImmOpWithPattern imm>
2469 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, imm32zx4:$M3),
2470 mnemonic#"\t$R1, $I2, $M3", []>;
2472 class FixedCmpBranchRIEa<CondVariant V, string mnemonic, bits<16> opcode,
2473 RegisterOperand cls, ImmOpWithPattern imm>
2474 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2),
2475 mnemonic#V.suffix#"\t$R1, $I2", []> {
2476 let isAsmParserOnly = V.alternate;
2477 let AsmVariantName = V.asmvariant;
2481 multiclass CmpBranchRIEaPair<string mnemonic, bits<16> opcode,
2482 RegisterOperand cls, ImmOpWithPattern imm> {
2483 let isCodeGenOnly = 1 in
2484 def "" : CmpBranchRIEa<mnemonic, opcode, cls, imm>;
2485 def Asm : AsmCmpBranchRIEa<mnemonic, opcode, cls, imm>;
2488 class CmpBranchRIEb<string mnemonic, bits<16> opcode,
2489 RegisterOperand cls>
2490 : InstRIEb<opcode, (outs),
2491 (ins cls:$R1, cls:$R2, cond4:$M3, brtarget16:$RI4),
2492 mnemonic#"$M3\t$R1, $R2, $RI4", []>;
2494 class AsmCmpBranchRIEb<string mnemonic, bits<16> opcode,
2495 RegisterOperand cls>
2496 : InstRIEb<opcode, (outs),
2497 (ins cls:$R1, cls:$R2, imm32zx4:$M3, brtarget16:$RI4),
2498 mnemonic#"\t$R1, $R2, $M3, $RI4", []>;
2500 class FixedCmpBranchRIEb<CondVariant V, string mnemonic, bits<16> opcode,
2501 RegisterOperand cls>
2502 : InstRIEb<opcode, (outs), (ins cls:$R1, cls:$R2, brtarget16:$RI4),
2503 mnemonic#V.suffix#"\t$R1, $R2, $RI4", []> {
2504 let isAsmParserOnly = V.alternate;
2505 let AsmVariantName = V.asmvariant;
2509 multiclass CmpBranchRIEbPair<string mnemonic, bits<16> opcode,
2510 RegisterOperand cls> {
2511 let isCodeGenOnly = 1 in
2512 def "" : CmpBranchRIEb<mnemonic, opcode, cls>;
2513 def Asm : AsmCmpBranchRIEb<mnemonic, opcode, cls>;
2516 class CmpBranchRIEc<string mnemonic, bits<16> opcode,
2517 RegisterOperand cls, ImmOpWithPattern imm>
2518 : InstRIEc<opcode, (outs),
2519 (ins cls:$R1, imm:$I2, cond4:$M3, brtarget16:$RI4),
2520 mnemonic#"$M3\t$R1, $I2, $RI4", []>;
2522 class AsmCmpBranchRIEc<string mnemonic, bits<16> opcode,
2523 RegisterOperand cls, ImmOpWithPattern imm>
2524 : InstRIEc<opcode, (outs),
2525 (ins cls:$R1, imm:$I2, imm32zx4:$M3, brtarget16:$RI4),
2526 mnemonic#"\t$R1, $I2, $M3, $RI4", []>;
2528 class FixedCmpBranchRIEc<CondVariant V, string mnemonic, bits<16> opcode,
2529 RegisterOperand cls, ImmOpWithPattern imm>
2530 : InstRIEc<opcode, (outs), (ins cls:$R1, imm:$I2, brtarget16:$RI4),
2531 mnemonic#V.suffix#"\t$R1, $I2, $RI4", []> {
2532 let isAsmParserOnly = V.alternate;
2533 let AsmVariantName = V.asmvariant;
2537 multiclass CmpBranchRIEcPair<string mnemonic, bits<16> opcode,
2538 RegisterOperand cls, ImmOpWithPattern imm> {
2539 let isCodeGenOnly = 1 in
2540 def "" : CmpBranchRIEc<mnemonic, opcode, cls, imm>;
2541 def Asm : AsmCmpBranchRIEc<mnemonic, opcode, cls, imm>;
2544 class CmpBranchRRFc<string mnemonic, bits<16> opcode,
2545 RegisterOperand cls>
2546 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, cond4:$M3),
2547 mnemonic#"$M3\t$R1, $R2", []>;
2549 class AsmCmpBranchRRFc<string mnemonic, bits<16> opcode,
2550 RegisterOperand cls>
2551 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, imm32zx4:$M3),
2552 mnemonic#"\t$R1, $R2, $M3", []>;
2554 multiclass CmpBranchRRFcPair<string mnemonic, bits<16> opcode,
2555 RegisterOperand cls> {
2556 let isCodeGenOnly = 1 in
2557 def "" : CmpBranchRRFc<mnemonic, opcode, cls>;
2558 def Asm : AsmCmpBranchRRFc<mnemonic, opcode, cls>;
2561 class FixedCmpBranchRRFc<CondVariant V, string mnemonic, bits<16> opcode,
2562 RegisterOperand cls>
2563 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2),
2564 mnemonic#V.suffix#"\t$R1, $R2", []> {
2565 let isAsmParserOnly = V.alternate;
2566 let AsmVariantName = V.asmvariant;
2570 class CmpBranchRRS<string mnemonic, bits<16> opcode,
2571 RegisterOperand cls>
2572 : InstRRS<opcode, (outs),
2573 (ins cls:$R1, cls:$R2, cond4:$M3, (bdaddr12only $B4, $D4):$BD4),
2574 mnemonic#"$M3\t$R1, $R2, $BD4", []>;
2576 class AsmCmpBranchRRS<string mnemonic, bits<16> opcode,
2577 RegisterOperand cls>
2578 : InstRRS<opcode, (outs),
2579 (ins cls:$R1, cls:$R2, imm32zx4:$M3, (bdaddr12only $B4, $D4):$BD4),
2580 mnemonic#"\t$R1, $R2, $M3, $BD4", []>;
2582 class FixedCmpBranchRRS<CondVariant V, string mnemonic, bits<16> opcode,
2583 RegisterOperand cls>
2584 : InstRRS<opcode, (outs),
2585 (ins cls:$R1, cls:$R2, (bdaddr12only $B4, $D4):$BD4),
2586 mnemonic#V.suffix#"\t$R1, $R2, $BD4", []> {
2587 let isAsmParserOnly = V.alternate;
2588 let AsmVariantName = V.asmvariant;
2592 multiclass CmpBranchRRSPair<string mnemonic, bits<16> opcode,
2593 RegisterOperand cls> {
2594 let isCodeGenOnly = 1 in
2595 def "" : CmpBranchRRS<mnemonic, opcode, cls>;
2596 def Asm : AsmCmpBranchRRS<mnemonic, opcode, cls>;
2599 class CmpBranchRIS<string mnemonic, bits<16> opcode,
2600 RegisterOperand cls, ImmOpWithPattern imm>
2601 : InstRIS<opcode, (outs),
2602 (ins cls:$R1, imm:$I2, cond4:$M3, (bdaddr12only $B4, $D4):$BD4),
2603 mnemonic#"$M3\t$R1, $I2, $BD4", []>;
2605 class AsmCmpBranchRIS<string mnemonic, bits<16> opcode,
2606 RegisterOperand cls, ImmOpWithPattern imm>
2607 : InstRIS<opcode, (outs),
2608 (ins cls:$R1, imm:$I2, imm32zx4:$M3, (bdaddr12only $B4, $D4):$BD4),
2609 mnemonic#"\t$R1, $I2, $M3, $BD4", []>;
2611 class FixedCmpBranchRIS<CondVariant V, string mnemonic, bits<16> opcode,
2612 RegisterOperand cls, ImmOpWithPattern imm>
2613 : InstRIS<opcode, (outs),
2614 (ins cls:$R1, imm:$I2, (bdaddr12only $B4, $D4):$BD4),
2615 mnemonic#V.suffix#"\t$R1, $I2, $BD4", []> {
2616 let isAsmParserOnly = V.alternate;
2617 let AsmVariantName = V.asmvariant;
2621 multiclass CmpBranchRISPair<string mnemonic, bits<16> opcode,
2622 RegisterOperand cls, ImmOpWithPattern imm> {
2623 let isCodeGenOnly = 1 in
2624 def "" : CmpBranchRIS<mnemonic, opcode, cls, imm>;
2625 def Asm : AsmCmpBranchRIS<mnemonic, opcode, cls, imm>;
2628 class CmpBranchRSYb<string mnemonic, bits<16> opcode,
2629 RegisterOperand cls>
2630 : InstRSYb<opcode, (outs),
2631 (ins cls:$R1, (bdaddr20only $B2, $D2):$BD2, cond4:$M3),
2632 mnemonic#"$M3\t$R1, $BD2", []>;
2634 class AsmCmpBranchRSYb<string mnemonic, bits<16> opcode,
2635 RegisterOperand cls>
2636 : InstRSYb<opcode, (outs),
2637 (ins cls:$R1, (bdaddr20only $B2, $D2):$BD2, imm32zx4:$M3),
2638 mnemonic#"\t$R1, $M3, $BD2", []>;
2640 multiclass CmpBranchRSYbPair<string mnemonic, bits<16> opcode,
2641 RegisterOperand cls> {
2642 let isCodeGenOnly = 1 in
2643 def "" : CmpBranchRSYb<mnemonic, opcode, cls>;
2644 def Asm : AsmCmpBranchRSYb<mnemonic, opcode, cls>;
2647 class FixedCmpBranchRSYb<CondVariant V, string mnemonic, bits<16> opcode,
2648 RegisterOperand cls>
2649 : InstRSYb<opcode, (outs), (ins cls:$R1, (bdaddr20only $B2, $D2):$BD2),
2650 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2651 let isAsmParserOnly = V.alternate;
2652 let AsmVariantName = V.asmvariant;
2656 class BranchUnaryRI<string mnemonic, bits<12> opcode, RegisterOperand cls>
2657 : InstRIb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget16:$RI2),
2658 mnemonic#"\t$R1, $RI2", []> {
2659 let Constraints = "$R1 = $R1src";
2660 let DisableEncoding = "$R1src";
2663 class BranchUnaryRIL<string mnemonic, bits<12> opcode, RegisterOperand cls>
2664 : InstRILb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget32:$RI2),
2665 mnemonic#"\t$R1, $RI2", []> {
2666 let Constraints = "$R1 = $R1src";
2667 let DisableEncoding = "$R1src";
2670 class BranchUnaryRR<string mnemonic, bits<8> opcode, RegisterOperand cls>
2671 : InstRR<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2672 mnemonic#"\t$R1, $R2", []> {
2673 let Constraints = "$R1 = $R1src";
2674 let DisableEncoding = "$R1src";
2677 class BranchUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
2678 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2),
2679 mnemonic#"\t$R1, $R2", []> {
2680 let Constraints = "$R1 = $R1src";
2681 let DisableEncoding = "$R1src";
2684 class BranchUnaryRX<string mnemonic, bits<8> opcode, RegisterOperand cls>
2685 : InstRXa<opcode, (outs cls:$R1),
2686 (ins cls:$R1src, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2687 mnemonic#"\t$R1, $XBD2", []> {
2688 let Constraints = "$R1 = $R1src";
2689 let DisableEncoding = "$R1src";
2692 class BranchUnaryRXY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2693 : InstRXYa<opcode, (outs cls:$R1),
2694 (ins cls:$R1src, (bdxaddr20only $B2, $D2, $X2):$XBD2),
2695 mnemonic#"\t$R1, $XBD2", []> {
2696 let Constraints = "$R1 = $R1src";
2697 let DisableEncoding = "$R1src";
2700 class BranchBinaryRSI<string mnemonic, bits<8> opcode, RegisterOperand cls>
2701 : InstRSI<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2702 mnemonic#"\t$R1, $R3, $RI2", []> {
2703 let Constraints = "$R1 = $R1src";
2704 let DisableEncoding = "$R1src";
2707 class BranchBinaryRIEe<string mnemonic, bits<16> opcode, RegisterOperand cls>
2708 : InstRIEe<opcode, (outs cls:$R1),
2709 (ins cls:$R1src, cls:$R3, brtarget16:$RI2),
2710 mnemonic#"\t$R1, $R3, $RI2", []> {
2711 let Constraints = "$R1 = $R1src";
2712 let DisableEncoding = "$R1src";
2715 class BranchBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls>
2716 : InstRSa<opcode, (outs cls:$R1),
2717 (ins cls:$R1src, cls:$R3, (bdaddr12only $B2, $D2):$BD2),
2718 mnemonic#"\t$R1, $R3, $BD2", []> {
2719 let Constraints = "$R1 = $R1src";
2720 let DisableEncoding = "$R1src";
2723 class BranchBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls>
2726 (ins cls:$R1src, cls:$R3, (bdaddr20only $B2, $D2):$BD2),
2727 mnemonic#"\t$R1, $R3, $BD2", []> {
2728 let Constraints = "$R1 = $R1src";
2729 let DisableEncoding = "$R1src";
2732 class LoadMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2733 AddressingMode mode = bdaddr12only>
2734 : InstRSa<opcode, (outs cls:$R1, cls:$R3), (ins (mode $B2, $D2):$BD2),
2735 mnemonic#"\t$R1, $R3, $BD2", []> {
2739 class LoadMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2740 AddressingMode mode = bdaddr20only>
2741 : InstRSYa<opcode, (outs cls:$R1, cls:$R3), (ins (mode $B2, $D2):$BD2),
2742 mnemonic#"\t$R1, $R3, $BD2", []> {
2746 multiclass LoadMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2747 bits<16> rsyOpcode, RegisterOperand cls> {
2748 let DispKey = mnemonic # cls in {
2749 let DispSize = "12" in
2750 def "" : LoadMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2751 let DispSize = "20" in
2752 def Y : LoadMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2756 class LoadMultipleSSe<string mnemonic, bits<8> opcode, RegisterOperand cls>
2757 : InstSSe<opcode, (outs cls:$R1, cls:$R3),
2758 (ins (bdaddr12only $B2, $D2):$BD2, (bdaddr12only $B4, $D4):$BD4),
2759 mnemonic#"\t$R1, $R3, $BD2, $BD4", []> {
2763 multiclass LoadMultipleVRSaAlign<string mnemonic, bits<16> opcode> {
2764 let mayLoad = 1 in {
2765 def Align : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3),
2766 (ins (bdaddr12only $B2, $D2):$BD2, imm32zx4:$M4),
2767 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
2769 def "" : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3),
2770 (ins (bdaddr12only $B2, $D2):$BD2),
2771 mnemonic#"\t$V1, $V3, $BD2", []>;
2775 class StoreRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
2776 RegisterOperand cls>
2777 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
2778 mnemonic#"\t$R1, $RI2",
2779 [(operator cls:$R1, pcrel32:$RI2)]> {
2781 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
2782 // However, BDXs have two extra operands and are therefore 6 units more
2784 let AddedComplexity = 7;
2787 class StoreRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2788 RegisterOperand cls, bits<5> bytes,
2789 AddressingMode mode = bdxaddr12only>
2790 : InstRXa<opcode, (outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
2791 mnemonic#"\t$R1, $XBD2",
2792 [(operator cls:$R1, mode:$XBD2)]> {
2793 let OpKey = mnemonic#"r"#cls;
2796 let AccessBytes = bytes;
2799 class StoreRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2800 RegisterOperand cls, bits<5> bytes,
2801 AddressingMode mode = bdxaddr20only>
2802 : InstRXYa<opcode, (outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
2803 mnemonic#"\t$R1, $XBD2",
2804 [(operator cls:$R1, mode:$XBD2)]> {
2805 let OpKey = mnemonic#"r"#cls;
2808 let AccessBytes = bytes;
2811 multiclass StoreRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
2812 SDPatternOperator operator, RegisterOperand cls,
2814 let DispKey = mnemonic # cls in {
2815 let DispSize = "12" in
2816 def "" : StoreRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
2817 let DispSize = "20" in
2818 def Y : StoreRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
2823 class StoreVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2824 TypedReg tr, bits<5> bytes, bits<4> type = 0>
2825 : InstVRX<opcode, (outs),
2826 (ins tr.op:$V1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2827 mnemonic#"\t$V1, $XBD2",
2828 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2)]> {
2831 let AccessBytes = bytes;
2834 class StoreVRXGeneric<string mnemonic, bits<16> opcode>
2835 : InstVRX<opcode, (outs),
2836 (ins VR128:$V1, (bdxaddr12only $B2, $D2, $X2):$XBD2, imm32zx4:$M3),
2837 mnemonic#"\t$V1, $XBD2, $M3", []> {
2841 multiclass StoreVRXAlign<string mnemonic, bits<16> opcode> {
2842 let mayStore = 1, AccessBytes = 16 in {
2843 def Align : InstVRX<opcode, (outs),
2844 (ins VR128:$V1, (bdxaddr12only $B2, $D2, $X2):$XBD2,
2846 mnemonic#"\t$V1, $XBD2, $M3", []>;
2848 def "" : InstVRX<opcode, (outs),
2849 (ins VR128:$V1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
2850 mnemonic#"\t$V1, $XBD2", []>;
2854 class StoreLengthVRSb<string mnemonic, bits<16> opcode,
2855 SDPatternOperator operator, bits<5> bytes>
2856 : InstVRSb<opcode, (outs),
2857 (ins VR128:$V1, GR32:$R3, (bdaddr12only $B2, $D2):$BD2),
2858 mnemonic#"\t$V1, $R3, $BD2",
2859 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2862 let AccessBytes = bytes;
2865 class StoreLengthVRSd<string mnemonic, bits<16> opcode,
2866 SDPatternOperator operator, bits<5> bytes>
2867 : InstVRSd<opcode, (outs),
2868 (ins VR128:$V1, GR32:$R3, (bdaddr12only $B2, $D2):$BD2),
2869 mnemonic#"\t$V1, $R3, $BD2",
2870 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> {
2872 let AccessBytes = bytes;
2875 class StoreLengthVSI<string mnemonic, bits<16> opcode,
2876 SDPatternOperator operator, bits<5> bytes>
2877 : InstVSI<opcode, (outs),
2878 (ins VR128:$V1, (bdaddr12only $B2, $D2):$BD2, imm32zx8:$I3),
2879 mnemonic#"\t$V1, $BD2, $I3",
2880 [(operator VR128:$V1, imm32zx8:$I3, bdaddr12only:$BD2)]> {
2882 let AccessBytes = bytes;
2885 class StoreMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
2886 AddressingMode mode = bdaddr12only>
2887 : InstRSa<opcode, (outs), (ins cls:$R1, cls:$R3, (mode $B2, $D2):$BD2),
2888 mnemonic#"\t$R1, $R3, $BD2", []> {
2892 class StoreMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
2893 AddressingMode mode = bdaddr20only>
2894 : InstRSYa<opcode, (outs), (ins cls:$R1, cls:$R3, (mode $B2, $D2):$BD2),
2895 mnemonic#"\t$R1, $R3, $BD2", []> {
2899 multiclass StoreMultipleRSPair<string mnemonic, bits<8> rsOpcode,
2900 bits<16> rsyOpcode, RegisterOperand cls> {
2901 let DispKey = mnemonic # cls in {
2902 let DispSize = "12" in
2903 def "" : StoreMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>;
2904 let DispSize = "20" in
2905 def Y : StoreMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>;
2909 multiclass StoreMultipleVRSaAlign<string mnemonic, bits<16> opcode> {
2910 let mayStore = 1 in {
2911 def Align : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3,
2912 (bdaddr12only $B2, $D2):$BD2,
2914 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
2916 def "" : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3,
2917 (bdaddr12only $B2, $D2):$BD2),
2918 mnemonic#"\t$V1, $V3, $BD2", []>;
2922 // StoreSI* instructions are used to store an integer to memory, but the
2923 // addresses are more restricted than for normal stores. If we are in the
2924 // situation of having to force either the address into a register or the
2925 // constant into a register, it's usually better to do the latter.
2926 // We therefore match the address in the same way as a normal store and
2927 // only use the StoreSI* instruction if the matched address is suitable.
2928 class StoreSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
2929 ImmOpWithPattern imm>
2930 : InstSI<opcode, (outs), (ins (mviaddr12pair $B1, $D1):$BD1, imm:$I2),
2931 mnemonic#"\t$BD1, $I2",
2932 [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2936 class StoreSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2937 ImmOpWithPattern imm>
2938 : InstSIY<opcode, (outs), (ins (mviaddr20pair $B1, $D1):$BD1, imm:$I2),
2939 mnemonic#"\t$BD1, $I2",
2940 [(operator imm:$I2, mviaddr20pair:$BD1)]> {
2944 class StoreSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
2945 ImmOpWithPattern imm>
2946 : InstSIL<opcode, (outs), (ins (mviaddr12pair $B1, $D1):$BD1, imm:$I2),
2947 mnemonic#"\t$BD1, $I2",
2948 [(operator imm:$I2, mviaddr12pair:$BD1)]> {
2952 multiclass StoreSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
2953 SDPatternOperator operator, ImmOpWithPattern imm> {
2954 let DispKey = mnemonic in {
2955 let DispSize = "12" in
2956 def "" : StoreSI<mnemonic, siOpcode, operator, imm>;
2957 let DispSize = "20" in
2958 def Y : StoreSIY<mnemonic#"y", siyOpcode, operator, imm>;
2962 class StoreSSE<string mnemonic, bits<16> opcode>
2963 : InstSSE<opcode, (outs),
2964 (ins (bdaddr12only $B1, $D1):$BD1, (bdaddr12only $B2, $D2):$BD2),
2965 mnemonic#"\t$BD1, $BD2", []> {
2969 class CondStoreRSY<string mnemonic, bits<16> opcode,
2970 RegisterOperand cls, bits<5> bytes,
2971 AddressingMode mode = bdaddr20only>
2972 : InstRSYb<opcode, (outs),
2973 (ins cls:$R1, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$M3),
2974 mnemonic#"$M3\t$R1, $BD2", []> {
2976 let AccessBytes = bytes;
2980 // Like CondStoreRSY, but used for the raw assembly form. The condition-code
2981 // mask is the third operand rather than being part of the mnemonic.
2982 class AsmCondStoreRSY<string mnemonic, bits<16> opcode,
2983 RegisterOperand cls, bits<5> bytes,
2984 AddressingMode mode = bdaddr20only>
2985 : InstRSYb<opcode, (outs), (ins cls:$R1, (mode $B2, $D2):$BD2, imm32zx4:$M3),
2986 mnemonic#"\t$R1, $BD2, $M3", []> {
2988 let AccessBytes = bytes;
2991 // Like CondStoreRSY, but with a fixed CC mask.
2992 class FixedCondStoreRSY<CondVariant V, string mnemonic, bits<16> opcode,
2993 RegisterOperand cls, bits<5> bytes,
2994 AddressingMode mode = bdaddr20only>
2995 : InstRSYb<opcode, (outs), (ins cls:$R1, (mode $B2, $D2):$BD2),
2996 mnemonic#V.suffix#"\t$R1, $BD2", []> {
2998 let AccessBytes = bytes;
2999 let isAsmParserOnly = V.alternate;
3000 let AsmVariantName = V.asmvariant;
3004 multiclass CondStoreRSYPair<string mnemonic, bits<16> opcode,
3005 RegisterOperand cls, bits<5> bytes,
3006 AddressingMode mode = bdaddr20only> {
3007 let isCodeGenOnly = 1 in
3008 def "" : CondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
3009 def Asm : AsmCondStoreRSY<mnemonic, opcode, cls, bytes, mode>;
3012 class SideEffectUnaryI<string mnemonic, bits<8> opcode, ImmOpWithPattern imm>
3013 : InstI<opcode, (outs), (ins imm:$I1),
3014 mnemonic#"\t$I1", []>;
3016 class SideEffectUnaryRR<string mnemonic, bits<8>opcode, RegisterOperand cls>
3017 : InstRR<opcode, (outs), (ins cls:$R1),
3018 mnemonic#"\t$R1", []> {
3022 class SideEffectUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3023 SDPatternOperator operator>
3024 : InstRRE<opcode, (outs), (ins cls:$R1),
3025 mnemonic#"\t$R1", [(operator cls:$R1)]> {
3029 class SideEffectUnaryS<string mnemonic, bits<16> opcode,
3030 SDPatternOperator operator, bits<5> bytes,
3031 AddressingMode mode = bdaddr12only>
3032 : InstS<opcode, (outs), (ins (mode $B2, $D2):$BD2),
3033 mnemonic#"\t$BD2", [(operator mode:$BD2)]> {
3035 let AccessBytes = bytes;
3038 class SideEffectUnarySIY<string mnemonic, bits<16> opcode,
3040 AddressingMode mode = bdaddr20only>
3041 : InstSIY<opcode, (outs), (ins (mode $B1, $D1):$BD1),
3042 mnemonic#"\t$BD1", []> {
3044 let AccessBytes = bytes;
3048 class SideEffectAddressS<string mnemonic, bits<16> opcode,
3049 SDPatternOperator operator,
3050 AddressingMode mode = bdaddr12only>
3051 : InstS<opcode, (outs), (ins (mode $B2, $D2):$BD2),
3052 mnemonic#"\t$BD2", [(operator mode:$BD2)]>;
3054 class LoadAddressRX<string mnemonic, bits<8> opcode,
3055 SDPatternOperator operator, AddressingMode mode>
3056 : InstRXa<opcode, (outs GR64:$R1), (ins (mode $B2, $D2, $X2):$XBD2),
3057 mnemonic#"\t$R1, $XBD2",
3058 [(set GR64:$R1, (operator mode:$XBD2))]>;
3060 class LoadAddressRXY<string mnemonic, bits<16> opcode,
3061 SDPatternOperator operator, AddressingMode mode>
3062 : InstRXYa<opcode, (outs GR64:$R1), (ins (mode $B2, $D2, $X2):$XBD2),
3063 mnemonic#"\t$R1, $XBD2",
3064 [(set GR64:$R1, (operator mode:$XBD2))]>;
3066 multiclass LoadAddressRXPair<string mnemonic, bits<8> rxOpcode,
3067 bits<16> rxyOpcode, SDPatternOperator operator> {
3068 let DispKey = mnemonic in {
3069 let DispSize = "12" in
3070 def "" : LoadAddressRX<mnemonic, rxOpcode, operator, laaddr12pair>;
3071 let DispSize = "20" in
3072 def Y : LoadAddressRXY<mnemonic#"y", rxyOpcode, operator, laaddr20pair>;
3076 class LoadAddressRIL<string mnemonic, bits<12> opcode,
3077 SDPatternOperator operator>
3078 : InstRILb<opcode, (outs GR64:$R1), (ins pcrel32:$RI2),
3079 mnemonic#"\t$R1, $RI2",
3080 [(set GR64:$R1, (operator pcrel32:$RI2))]>;
3082 class UnaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3083 RegisterOperand cls1, RegisterOperand cls2>
3084 : InstRR<opcode, (outs cls1:$R1), (ins cls2:$R2),
3085 mnemonic#"\t$R1, $R2",
3086 [(set cls1:$R1, (operator cls2:$R2))]> {
3087 let OpKey = mnemonic#cls1;
3091 class UnaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3092 RegisterOperand cls1, RegisterOperand cls2>
3093 : InstRRE<opcode, (outs cls1:$R1), (ins cls2:$R2),
3094 mnemonic#"\t$R1, $R2",
3095 [(set cls1:$R1, (operator cls2:$R2))]> {
3096 let OpKey = mnemonic#cls1;
3100 class UnaryTiedRRE<string mnemonic, bits<16> opcode, RegisterOperand cls>
3101 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src),
3102 mnemonic#"\t$R1", []> {
3103 let Constraints = "$R1 = $R1src";
3104 let DisableEncoding = "$R1src";
3108 class UnaryMemRRFc<string mnemonic, bits<16> opcode,
3109 RegisterOperand cls1, RegisterOperand cls2>
3110 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src),
3111 mnemonic#"\t$R1, $R2", []> {
3112 let Constraints = "$R1 = $R1src";
3113 let DisableEncoding = "$R1src";
3117 class UnaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3118 RegisterOperand cls, ImmOpWithPattern imm>
3119 : InstRIa<opcode, (outs cls:$R1), (ins imm:$I2),
3120 mnemonic#"\t$R1, $I2",
3121 [(set cls:$R1, (operator imm:$I2))]>;
3123 class UnaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3124 RegisterOperand cls, ImmOpWithPattern imm>
3125 : InstRILa<opcode, (outs cls:$R1), (ins imm:$I2),
3126 mnemonic#"\t$R1, $I2",
3127 [(set cls:$R1, (operator imm:$I2))]>;
3129 class UnaryRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3130 RegisterOperand cls>
3131 : InstRILb<opcode, (outs cls:$R1), (ins pcrel32:$RI2),
3132 mnemonic#"\t$R1, $RI2",
3133 [(set cls:$R1, (operator pcrel32:$RI2))]> {
3135 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
3136 // However, BDXs have two extra operands and are therefore 6 units more
3138 let AddedComplexity = 7;
3141 class CondUnaryRSY<string mnemonic, bits<16> opcode,
3142 SDPatternOperator operator, RegisterOperand cls,
3143 bits<5> bytes, AddressingMode mode = bdaddr20only>
3144 : InstRSYb<opcode, (outs cls:$R1),
3145 (ins cls:$R1src, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$M3),
3146 mnemonic#"$M3\t$R1, $BD2",
3148 (z_select_ccmask (operator bdaddr20only:$BD2), cls:$R1src,
3149 cond4:$valid, cond4:$M3))]> {
3150 let Constraints = "$R1 = $R1src";
3151 let DisableEncoding = "$R1src";
3153 let AccessBytes = bytes;
3155 let OpKey = mnemonic#"r"#cls;
3157 let MemKey = mnemonic#cls;
3158 let MemType = "target";
3161 // Like CondUnaryRSY, but used for the raw assembly form. The condition-code
3162 // mask is the third operand rather than being part of the mnemonic.
3163 class AsmCondUnaryRSY<string mnemonic, bits<16> opcode,
3164 RegisterOperand cls, bits<5> bytes,
3165 AddressingMode mode = bdaddr20only>
3166 : InstRSYb<opcode, (outs cls:$R1),
3167 (ins cls:$R1src, (mode $B2, $D2):$BD2, imm32zx4:$M3),
3168 mnemonic#"\t$R1, $BD2, $M3", []> {
3170 let AccessBytes = bytes;
3171 let Constraints = "$R1 = $R1src";
3172 let DisableEncoding = "$R1src";
3175 // Like CondUnaryRSY, but with a fixed CC mask.
3176 class FixedCondUnaryRSY<CondVariant V, string mnemonic, bits<16> opcode,
3177 RegisterOperand cls, bits<5> bytes,
3178 AddressingMode mode = bdaddr20only>
3179 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, (mode $B2, $D2):$BD2),
3180 mnemonic#V.suffix#"\t$R1, $BD2", []> {
3181 let Constraints = "$R1 = $R1src";
3182 let DisableEncoding = "$R1src";
3184 let AccessBytes = bytes;
3185 let isAsmParserOnly = V.alternate;
3186 let AsmVariantName = V.asmvariant;
3190 multiclass CondUnaryRSYPair<string mnemonic, bits<16> opcode,
3191 SDPatternOperator operator,
3192 RegisterOperand cls, bits<5> bytes,
3193 AddressingMode mode = bdaddr20only> {
3194 let isCodeGenOnly = 1 in
3195 def "" : CondUnaryRSY<mnemonic, opcode, operator, cls, bytes, mode>;
3196 def Asm : AsmCondUnaryRSY<mnemonic, opcode, cls, bytes, mode>;
3199 class UnaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3200 RegisterOperand cls, bits<5> bytes,
3201 AddressingMode mode = bdxaddr12only>
3202 : InstRXa<opcode, (outs cls:$R1), (ins (mode $B2, $D2, $X2):$XBD2),
3203 mnemonic#"\t$R1, $XBD2",
3204 [(set cls:$R1, (operator mode:$XBD2))]> {
3205 let OpKey = mnemonic#"r"#cls;
3208 let AccessBytes = bytes;
3211 class UnaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3212 RegisterOperand cls, bits<5> bytes>
3213 : InstRXE<opcode, (outs cls:$R1), (ins (bdxaddr12only $B2, $D2, $X2):$XBD2),
3214 mnemonic#"\t$R1, $XBD2",
3215 [(set cls:$R1, (operator bdxaddr12only:$XBD2))]> {
3216 let OpKey = mnemonic#"r"#cls;
3219 let AccessBytes = bytes;
3223 class UnaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3224 RegisterOperand cls, bits<5> bytes,
3225 AddressingMode mode = bdxaddr20only>
3226 : InstRXYa<opcode, (outs cls:$R1), (ins (mode $B2, $D2, $X2):$XBD2),
3227 mnemonic#"\t$R1, $XBD2",
3228 [(set cls:$R1, (operator mode:$XBD2))]> {
3229 let OpKey = mnemonic#"r"#cls;
3232 let AccessBytes = bytes;
3235 multiclass UnaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3236 SDPatternOperator operator, RegisterOperand cls,
3238 let DispKey = mnemonic # cls in {
3239 let DispSize = "12" in
3240 def "" : UnaryRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>;
3241 let DispSize = "20" in
3242 def Y : UnaryRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes,
3247 class UnaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3248 TypedReg tr, ImmOpWithPattern imm, bits<4> type = 0>
3249 : InstVRIa<opcode, (outs tr.op:$V1), (ins imm:$I2),
3250 mnemonic#"\t$V1, $I2",
3251 [(set (tr.vt tr.op:$V1), (operator (i32 timm:$I2)))]> {
3255 class UnaryVRIaGeneric<string mnemonic, bits<16> opcode, ImmOpWithPattern imm>
3256 : InstVRIa<opcode, (outs VR128:$V1), (ins imm:$I2, imm32zx4:$M3),
3257 mnemonic#"\t$V1, $I2, $M3", []>;
3259 class UnaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3260 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0,
3261 bits<4> m5 = 0, string fp_mnemonic = "">
3262 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2),
3263 mnemonic#"\t$V1, $V2",
3264 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]> {
3268 let OpKey = fp_mnemonic#!subst("VR", "FP", !cast<string>(tr1.op));
3272 class UnaryVRRaGeneric<string mnemonic, bits<16> opcode, bits<4> m4 = 0,
3274 : InstVRRa<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3),
3275 mnemonic#"\t$V1, $V2, $M3", []> {
3280 class UnaryVRRaFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0>
3281 : InstVRRa<opcode, (outs VR128:$V1),
3282 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4),
3283 mnemonic#"\t$V1, $V2, $M3, $M4", []> {
3287 // Declare a pair of instructions, one which sets CC and one which doesn't.
3288 // The CC-setting form ends with "S" and sets the low bit of M5.
3289 // The form that does not set CC has an extra operand to optionally allow
3290 // specifying arbitrary M5 values in assembler.
3291 multiclass UnaryExtraVRRaSPair<string mnemonic, bits<16> opcode,
3292 SDPatternOperator operator,
3293 SDPatternOperator operator_cc,
3294 TypedReg tr1, TypedReg tr2, bits<4> type> {
3295 let M3 = type, M4 = 0 in
3296 def "" : InstVRRa<opcode, (outs tr1.op:$V1),
3297 (ins tr2.op:$V2, imm32zx4:$M5),
3298 mnemonic#"\t$V1, $V2, $M5", []>;
3299 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2))),
3300 (!cast<Instruction>(NAME) tr2.op:$V2, 0)>;
3301 def : InstAlias<mnemonic#"\t$V1, $V2",
3302 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 0)>;
3304 def S : UnaryVRRa<mnemonic#"s", opcode, operator_cc, tr1, tr2,
3308 multiclass UnaryExtraVRRaSPairGeneric<string mnemonic, bits<16> opcode> {
3309 let M4 = 0, Defs = [CC] in
3310 def "" : InstVRRa<opcode, (outs VR128:$V1),
3311 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M5),
3312 mnemonic#"\t$V1, $V2, $M3, $M5", []>;
3313 def : InstAlias<mnemonic#"\t$V1, $V2, $M3",
3314 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2,
3318 class UnaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3319 TypedReg tr, bits<5> bytes, bits<4> type = 0>
3320 : InstVRX<opcode, (outs tr.op:$V1), (ins (bdxaddr12only $B2, $D2, $X2):$XBD2),
3321 mnemonic#"\t$V1, $XBD2",
3322 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2))]> {
3325 let AccessBytes = bytes;
3328 class UnaryVRXGeneric<string mnemonic, bits<16> opcode>
3329 : InstVRX<opcode, (outs VR128:$V1),
3330 (ins (bdxaddr12only $B2, $D2, $X2):$XBD2, imm32zx4:$M3),
3331 mnemonic#"\t$V1, $XBD2, $M3", []> {
3335 multiclass UnaryVRXAlign<string mnemonic, bits<16> opcode> {
3336 let mayLoad = 1, AccessBytes = 16 in {
3337 def Align : InstVRX<opcode, (outs VR128:$V1),
3338 (ins (bdxaddr12only $B2, $D2, $X2):$XBD2, imm32zx4:$M3),
3339 mnemonic#"\t$V1, $XBD2, $M3", []>;
3341 def "" : InstVRX<opcode, (outs VR128:$V1),
3342 (ins (bdxaddr12only $B2, $D2, $X2):$XBD2),
3343 mnemonic#"\t$V1, $XBD2", []>;
3347 class SideEffectBinaryRX<string mnemonic, bits<8> opcode,
3348 RegisterOperand cls>
3349 : InstRXa<opcode, (outs), (ins cls:$R1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
3350 mnemonic#"\t$R1, $XBD2", []>;
3352 class SideEffectBinaryRXY<string mnemonic, bits<16> opcode,
3353 RegisterOperand cls>
3354 : InstRXYa<opcode, (outs), (ins cls:$R1, (bdxaddr20only $B2, $D2, $X2):$XBD2),
3355 mnemonic#"\t$R1, $XBD2", []>;
3357 class SideEffectBinaryRILPC<string mnemonic, bits<12> opcode,
3358 RegisterOperand cls>
3359 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
3360 mnemonic#"\t$R1, $RI2", []> {
3361 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
3362 // However, BDXs have two extra operands and are therefore 6 units more
3364 let AddedComplexity = 7;
3367 class SideEffectBinaryRRE<string mnemonic, bits<16> opcode,
3368 RegisterOperand cls1, RegisterOperand cls2>
3369 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3370 mnemonic#"\t$R1, $R2", []>;
3372 class SideEffectBinaryRRFa<string mnemonic, bits<16> opcode,
3373 RegisterOperand cls1, RegisterOperand cls2>
3374 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3375 mnemonic#"\t$R1, $R2", []> {
3380 class SideEffectBinaryRRFc<string mnemonic, bits<16> opcode,
3381 RegisterOperand cls1, RegisterOperand cls2>
3382 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2),
3383 mnemonic#"\t$R1, $R2", []> {
3387 class SideEffectBinaryIE<string mnemonic, bits<16> opcode,
3388 ImmOpWithPattern imm1, ImmOpWithPattern imm2>
3389 : InstIE<opcode, (outs), (ins imm1:$I1, imm2:$I2),
3390 mnemonic#"\t$I1, $I2", []>;
3392 class SideEffectBinarySI<string mnemonic, bits<8> opcode, Operand imm>
3393 : InstSI<opcode, (outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2),
3394 mnemonic#"\t$BD1, $I2", []>;
3396 class SideEffectBinarySIL<string mnemonic, bits<16> opcode,
3397 SDPatternOperator operator, ImmOpWithPattern imm>
3398 : InstSIL<opcode, (outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2),
3399 mnemonic#"\t$BD1, $I2", [(operator bdaddr12only:$BD1, imm:$I2)]>;
3401 class SideEffectBinarySSa<string mnemonic, bits<8> opcode>
3402 : InstSSa<opcode, (outs), (ins (bdladdr12onlylen8 $B1, $D1, $L1):$BDL1,
3403 (bdaddr12only $B2, $D2):$BD2),
3404 mnemonic#"\t$BDL1, $BD2", []>;
3406 class SideEffectBinarySSb<string mnemonic, bits<8> opcode>
3408 (outs), (ins (bdladdr12onlylen4 $B1, $D1, $L1):$BDL1,
3409 (bdladdr12onlylen4 $B2, $D2, $L2):$BDL2),
3410 mnemonic#"\t$BDL1, $BDL2", []>;
3412 class SideEffectBinarySSf<string mnemonic, bits<8> opcode>
3413 : InstSSf<opcode, (outs), (ins (bdaddr12only $B1, $D1):$BD1,
3414 (bdladdr12onlylen8 $B2, $D2, $L2):$BDL2),
3415 mnemonic#"\t$BD1, $BDL2", []>;
3417 class SideEffectBinarySSE<string mnemonic, bits<16> opcode>
3418 : InstSSE<opcode, (outs),
3419 (ins (bdaddr12only $B1, $D1):$BD1, (bdaddr12only $B2, $D2):$BD2),
3420 mnemonic#"\t$BD1, $BD2", []>;
3422 class SideEffectBinaryMemMemRR<string mnemonic, bits<8> opcode,
3423 RegisterOperand cls1, RegisterOperand cls2>
3424 : InstRR<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3425 mnemonic#"\t$R1, $R2", []> {
3426 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3427 let DisableEncoding = "$R1src, $R2src";
3430 class SideEffectBinaryMemRRE<string mnemonic, bits<16> opcode,
3431 RegisterOperand cls1, RegisterOperand cls2>
3432 : InstRRE<opcode, (outs cls2:$R2), (ins cls1:$R1, cls2:$R2src),
3433 mnemonic#"\t$R1, $R2", []> {
3434 let Constraints = "$R2 = $R2src";
3435 let DisableEncoding = "$R2src";
3438 class SideEffectBinaryMemMemRRE<string mnemonic, bits<16> opcode,
3439 RegisterOperand cls1, RegisterOperand cls2>
3440 : InstRRE<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3441 mnemonic#"\t$R1, $R2", []> {
3442 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3443 let DisableEncoding = "$R1src, $R2src";
3446 class SideEffectBinaryMemMemRRFc<string mnemonic, bits<16> opcode,
3447 RegisterOperand cls1, RegisterOperand cls2>
3448 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src),
3449 mnemonic#"\t$R1, $R2", []> {
3450 let Constraints = "$R1 = $R1src, $R2 = $R2src";
3451 let DisableEncoding = "$R1src, $R2src";
3455 class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3456 RegisterOperand cls1, RegisterOperand cls2>
3457 : InstRR<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3458 mnemonic#"\t$R1, $R2",
3459 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
3460 let OpKey = mnemonic#cls1;
3462 let Constraints = "$R1 = $R1src";
3463 let DisableEncoding = "$R1src";
3466 class BinaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3467 RegisterOperand cls1, RegisterOperand cls2>
3468 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3469 mnemonic#"\t$R1, $R2",
3470 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
3471 let OpKey = mnemonic#cls1;
3473 let Constraints = "$R1 = $R1src";
3474 let DisableEncoding = "$R1src";
3477 class BinaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3478 RegisterOperand cls1, RegisterOperand cls2>
3479 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R3, cls2:$R2),
3480 mnemonic#"\t$R1, $R3, $R2",
3481 [(set cls1:$R1, (operator cls2:$R3, cls2:$R2))]> {
3482 let OpKey = mnemonic#cls;
3486 class BinaryRRFa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3487 RegisterOperand cls1, RegisterOperand cls2,
3488 RegisterOperand cls3>
3489 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
3490 mnemonic#"\t$R1, $R2, $R3",
3491 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
3493 let OpKey = mnemonic#cls1;
3498 class UnaryRRFa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3499 RegisterOperand cls1, RegisterOperand cls2>
3500 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls2:$R3),
3501 mnemonic#"\t$R1, $R2",
3502 [(set cls1:$R1, (operator cls2:$R2, cls2:$R3))]> {
3505 let OpKey = mnemonic#cls1;
3510 multiclass BinaryRRAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
3511 SDPatternOperator operator, RegisterOperand cls1,
3512 RegisterOperand cls2> {
3513 let NumOpsKey = mnemonic in {
3514 let NumOpsValue = "3" in
3515 def K : BinaryRRFa<mnemonic#"k", opcode2, operator, cls1, cls1, cls2>,
3516 Requires<[FeatureDistinctOps]>;
3517 let NumOpsValue = "2" in
3518 def "" : BinaryRR<mnemonic, opcode1, operator, cls1, cls2>;
3522 multiclass BinaryRREAndK<string mnemonic, bits<16> opcode1, bits<16> opcode2,
3523 SDPatternOperator operator, RegisterOperand cls1,
3524 RegisterOperand cls2> {
3525 let NumOpsKey = mnemonic in {
3526 let NumOpsValue = "3" in
3527 def K : BinaryRRFa<mnemonic#"k", opcode2, operator, cls1, cls1, cls2>,
3528 Requires<[FeatureDistinctOps]>;
3529 let NumOpsValue = "2" in
3530 def "" : BinaryRRE<mnemonic, opcode1, operator, cls1, cls2>;
3534 class BinaryRRFb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3535 RegisterOperand cls1, RegisterOperand cls2,
3536 RegisterOperand cls3>
3537 : InstRRFb<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3),
3538 mnemonic#"\t$R1, $R3, $R2",
3539 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> {
3543 class BinaryRRFc<string mnemonic, bits<16> opcode,
3544 RegisterOperand cls1, RegisterOperand cls2>
3545 : InstRRFc<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M3),
3546 mnemonic#"\t$R1, $R2, $M3", []>;
3548 class BinaryMemRRFc<string mnemonic, bits<16> opcode,
3549 RegisterOperand cls1, RegisterOperand cls2, ImmOpWithPattern imm>
3550 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src, imm:$M3),
3551 mnemonic#"\t$R1, $R2, $M3", []> {
3552 let Constraints = "$R1 = $R1src";
3553 let DisableEncoding = "$R1src";
3556 multiclass BinaryMemRRFcOpt<string mnemonic, bits<16> opcode,
3557 RegisterOperand cls1, RegisterOperand cls2> {
3558 def "" : BinaryMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
3559 def Opt : UnaryMemRRFc<mnemonic, opcode, cls1, cls2>;
3562 class BinaryRRFd<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3563 RegisterOperand cls2>
3564 : InstRRFd<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M4),
3565 mnemonic#"\t$R1, $R2, $M4", []>;
3567 class BinaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3568 RegisterOperand cls2>
3569 : InstRRFe<opcode, (outs cls1:$R1), (ins imm32zx4:$M3, cls2:$R2),
3570 mnemonic#"\t$R1, $M3, $R2", []> {
3574 class CondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3575 RegisterOperand cls2>
3576 : InstRRFc<opcode, (outs cls1:$R1),
3577 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
3578 mnemonic#"$M3\t$R1, $R2",
3579 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src,
3580 cond4:$valid, cond4:$M3))]> {
3581 let Constraints = "$R1 = $R1src";
3582 let DisableEncoding = "$R1src";
3584 let NumOpsKey = !subst("loc", "sel", mnemonic);
3585 let NumOpsValue = "2";
3586 let OpKey = mnemonic#cls1;
3590 // Like CondBinaryRRF, but used for the raw assembly form. The condition-code
3591 // mask is the third operand rather than being part of the mnemonic.
3592 class AsmCondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3593 RegisterOperand cls2>
3594 : InstRRFc<opcode, (outs cls1:$R1),
3595 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M3),
3596 mnemonic#"\t$R1, $R2, $M3", []> {
3597 let Constraints = "$R1 = $R1src";
3598 let DisableEncoding = "$R1src";
3601 // Like CondBinaryRRF, but with a fixed CC mask.
3602 class FixedCondBinaryRRF<CondVariant V, string mnemonic, bits<16> opcode,
3603 RegisterOperand cls1, RegisterOperand cls2>
3604 : InstRRFc<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
3605 mnemonic#V.suffix#"\t$R1, $R2", []> {
3606 let Constraints = "$R1 = $R1src";
3607 let DisableEncoding = "$R1src";
3608 let isAsmParserOnly = V.alternate;
3609 let AsmVariantName = V.asmvariant;
3613 multiclass CondBinaryRRFPair<string mnemonic, bits<16> opcode,
3614 RegisterOperand cls1, RegisterOperand cls2> {
3615 let isCodeGenOnly = 1 in
3616 def "" : CondBinaryRRF<mnemonic, opcode, cls1, cls2>;
3617 def Asm : AsmCondBinaryRRF<mnemonic, opcode, cls1, cls2>;
3620 class CondBinaryRRFa<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3621 RegisterOperand cls2, RegisterOperand cls3>
3622 : InstRRFa<opcode, (outs cls1:$R1),
3623 (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4),
3624 mnemonic#"$M4\t$R1, $R2, $R3",
3625 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3,
3626 cond4:$valid, cond4:$M4))]> {
3628 let NumOpsKey = mnemonic;
3629 let NumOpsValue = "3";
3630 let OpKey = mnemonic#cls1;
3634 // Like CondBinaryRRFa, but used for the raw assembly form. The condition-code
3635 // mask is the third operand rather than being part of the mnemonic.
3636 class AsmCondBinaryRRFa<string mnemonic, bits<16> opcode, RegisterOperand cls1,
3637 RegisterOperand cls2, RegisterOperand cls3>
3638 : InstRRFa<opcode, (outs cls1:$R1), (ins cls3:$R3, cls2:$R2, imm32zx4:$M4),
3639 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
3641 // Like CondBinaryRRFa, but with a fixed CC mask.
3642 class FixedCondBinaryRRFa<CondVariant V, string mnemonic, bits<16> opcode,
3643 RegisterOperand cls1, RegisterOperand cls2,
3644 RegisterOperand cls3>
3645 : InstRRFa<opcode, (outs cls1:$R1), (ins cls3:$R3, cls2:$R2),
3646 mnemonic#V.suffix#"\t$R1, $R2, $R3", []> {
3647 let isAsmParserOnly = V.alternate;
3648 let AsmVariantName = V.asmvariant;
3652 multiclass CondBinaryRRFaPair<string mnemonic, bits<16> opcode,
3653 RegisterOperand cls1, RegisterOperand cls2,
3654 RegisterOperand cls3> {
3655 let isCodeGenOnly = 1 in
3656 def "" : CondBinaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
3657 def Asm : AsmCondBinaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
3660 class BinaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3661 RegisterOperand cls, ImmOpWithPattern imm>
3662 : InstRIa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3663 mnemonic#"\t$R1, $I2",
3664 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
3665 let Constraints = "$R1 = $R1src";
3666 let DisableEncoding = "$R1src";
3669 class BinaryRIE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3670 RegisterOperand cls, ImmOpWithPattern imm>
3671 : InstRIEd<opcode, (outs cls:$R1), (ins cls:$R3, imm:$I2),
3672 mnemonic#"\t$R1, $R3, $I2",
3673 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
3675 multiclass BinaryRIAndK<string mnemonic, bits<12> opcode1, bits<16> opcode2,
3676 SDPatternOperator operator, RegisterOperand cls,
3677 ImmOpWithPattern imm> {
3678 let NumOpsKey = mnemonic in {
3679 let NumOpsValue = "3" in
3680 def K : BinaryRIE<mnemonic#"k", opcode2, operator, cls, imm>,
3681 Requires<[FeatureDistinctOps]>;
3682 let NumOpsValue = "2" in
3683 def "" : BinaryRI<mnemonic, opcode1, operator, cls, imm>;
3687 class CondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3688 ImmOpWithPattern imm>
3689 : InstRIEg<opcode, (outs cls:$R1),
3690 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
3691 mnemonic#"$M3\t$R1, $I2",
3692 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
3693 cond4:$valid, cond4:$M3))]> {
3694 let Constraints = "$R1 = $R1src";
3695 let DisableEncoding = "$R1src";
3699 // Like CondBinaryRIE, but used for the raw assembly form. The condition-code
3700 // mask is the third operand rather than being part of the mnemonic.
3701 class AsmCondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls,
3702 ImmOpWithPattern imm>
3703 : InstRIEg<opcode, (outs cls:$R1),
3704 (ins cls:$R1src, imm:$I2, imm32zx4:$M3),
3705 mnemonic#"\t$R1, $I2, $M3", []> {
3706 let Constraints = "$R1 = $R1src";
3707 let DisableEncoding = "$R1src";
3710 // Like CondBinaryRIE, but with a fixed CC mask.
3711 class FixedCondBinaryRIE<CondVariant V, string mnemonic, bits<16> opcode,
3712 RegisterOperand cls, ImmOpWithPattern imm>
3713 : InstRIEg<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3714 mnemonic#V.suffix#"\t$R1, $I2", []> {
3715 let Constraints = "$R1 = $R1src";
3716 let DisableEncoding = "$R1src";
3717 let isAsmParserOnly = V.alternate;
3718 let AsmVariantName = V.asmvariant;
3722 multiclass CondBinaryRIEPair<string mnemonic, bits<16> opcode,
3723 RegisterOperand cls, ImmOpWithPattern imm> {
3724 let isCodeGenOnly = 1 in
3725 def "" : CondBinaryRIE<mnemonic, opcode, cls, imm>;
3726 def Asm : AsmCondBinaryRIE<mnemonic, opcode, cls, imm>;
3729 class BinaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
3730 RegisterOperand cls, ImmOpWithPattern imm>
3731 : InstRILa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
3732 mnemonic#"\t$R1, $I2",
3733 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
3734 let Constraints = "$R1 = $R1src";
3735 let DisableEncoding = "$R1src";
3738 class BinaryRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3739 RegisterOperand cls>
3740 : InstRSa<opcode, (outs cls:$R1),
3741 (ins cls:$R1src, (shift12only $B2, $D2):$BD2),
3742 mnemonic#"\t$R1, $BD2",
3743 [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> {
3745 let Constraints = "$R1 = $R1src";
3746 let DisableEncoding = "$R1src";
3749 class BinaryRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3750 RegisterOperand cls>
3751 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, (shift20only $B2, $D2):$BD2),
3752 mnemonic#"\t$R1, $R3, $BD2",
3753 [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>;
3755 multiclass BinaryRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
3756 SDPatternOperator operator, RegisterOperand cls> {
3757 let NumOpsKey = mnemonic in {
3758 let NumOpsValue = "3" in
3759 def K : BinaryRSY<mnemonic#"k", opcode2, operator, cls>,
3760 Requires<[FeatureDistinctOps]>;
3761 let NumOpsValue = "2" in
3762 def "" : BinaryRS<mnemonic, opcode1, operator, cls>;
3766 class BinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
3767 : InstRSLb<opcode, (outs cls:$R1),
3768 (ins (bdladdr12onlylen8 $B2, $D2, $L2):$BDL2, imm32zx4:$M3),
3769 mnemonic#"\t$R1, $BDL2, $M3", []> {
3773 class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3774 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3775 AddressingMode mode = bdxaddr12only>
3776 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, (mode $B2, $D2, $X2):$XBD2),
3777 mnemonic#"\t$R1, $XBD2",
3778 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3779 let OpKey = mnemonic#"r"#cls;
3781 let Constraints = "$R1 = $R1src";
3782 let DisableEncoding = "$R1src";
3784 let AccessBytes = bytes;
3787 class BinaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3788 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
3789 : InstRXE<opcode, (outs cls:$R1),
3790 (ins cls:$R1src, (bdxaddr12only $B2, $D2, $X2):$XBD2),
3791 mnemonic#"\t$R1, $XBD2",
3792 [(set cls:$R1, (operator cls:$R1src,
3793 (load bdxaddr12only:$XBD2)))]> {
3794 let OpKey = mnemonic#"r"#cls;
3796 let Constraints = "$R1 = $R1src";
3797 let DisableEncoding = "$R1src";
3799 let AccessBytes = bytes;
3803 class BinaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3804 RegisterOperand cls1, RegisterOperand cls2,
3805 SDPatternOperator load, bits<5> bytes>
3806 : InstRXF<opcode, (outs cls1:$R1),
3807 (ins cls2:$R3, (bdxaddr12only $B2, $D2, $X2):$XBD2),
3808 mnemonic#"\t$R1, $R3, $XBD2",
3809 [(set cls1:$R1, (operator cls2:$R3, (load bdxaddr12only:$XBD2)))]> {
3810 let OpKey = mnemonic#"r"#cls;
3813 let AccessBytes = bytes;
3816 class BinaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3817 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
3818 AddressingMode mode = bdxaddr20only>
3819 : InstRXYa<opcode, (outs cls:$R1),
3820 (ins cls:$R1src, (mode $B2, $D2, $X2):$XBD2),
3821 mnemonic#"\t$R1, $XBD2",
3822 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
3823 let OpKey = mnemonic#"r"#cls;
3825 let Constraints = "$R1 = $R1src";
3826 let DisableEncoding = "$R1src";
3828 let AccessBytes = bytes;
3831 multiclass BinaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
3832 SDPatternOperator operator, RegisterOperand cls,
3833 SDPatternOperator load, bits<5> bytes> {
3834 let DispKey = mnemonic # cls in {
3835 let DispSize = "12" in
3836 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes,
3838 let DispSize = "20" in
3839 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load, bytes,
3844 class BinarySI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
3845 Operand imm, AddressingMode mode = bdaddr12only>
3846 : InstSI<opcode, (outs), (ins (mode $B1, $D1):$BD1, imm:$I2),
3847 mnemonic#"\t$BD1, $I2",
3848 [(store (operator (z_load mode:$BD1), imm:$I2), mode:$BD1)]> {
3853 class BinarySIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3854 Operand imm, AddressingMode mode = bdaddr20only>
3855 : InstSIY<opcode, (outs), (ins (mode $B1, $D1):$BD1, imm:$I2),
3856 mnemonic#"\t$BD1, $I2",
3857 [(store (operator (z_load mode:$BD1), imm:$I2), mode:$BD1)]> {
3862 multiclass BinarySIPair<string mnemonic, bits<8> siOpcode,
3863 bits<16> siyOpcode, SDPatternOperator operator,
3865 let DispKey = mnemonic # cls in {
3866 let DispSize = "12" in
3867 def "" : BinarySI<mnemonic, siOpcode, operator, imm, bdaddr12pair>;
3868 let DispSize = "20" in
3869 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>;
3873 class BinarySSF<string mnemonic, bits<12> opcode, RegisterOperand cls>
3874 : InstSSF<opcode, (outs cls:$R3),
3875 (ins (bdaddr12pair $B1, $D1):$BD1, (bdaddr12pair $B2, $D2):$BD2),
3876 mnemonic#"\t$R3, $BD1, $BD2", []> {
3880 class BinaryVRIb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3881 TypedReg tr, bits<4> type>
3882 : InstVRIb<opcode, (outs tr.op:$V1), (ins imm32zx8:$I2, imm32zx8:$I3),
3883 mnemonic#"\t$V1, $I2, $I3",
3884 [(set (tr.vt tr.op:$V1), (operator imm32zx8_timm:$I2, imm32zx8_timm:$I3))]> {
3888 class BinaryVRIbGeneric<string mnemonic, bits<16> opcode>
3889 : InstVRIb<opcode, (outs VR128:$V1),
3890 (ins imm32zx8:$I2, imm32zx8:$I3, imm32zx4:$M4),
3891 mnemonic#"\t$V1, $I2, $I3, $M4", []>;
3893 class BinaryVRIc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3894 TypedReg tr1, TypedReg tr2, bits<4> type>
3895 : InstVRIc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, imm32zx16:$I2),
3896 mnemonic#"\t$V1, $V3, $I2",
3897 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3),
3898 imm32zx16_timm:$I2))]> {
3902 class BinaryVRIcGeneric<string mnemonic, bits<16> opcode>
3903 : InstVRIc<opcode, (outs VR128:$V1),
3904 (ins VR128:$V3, imm32zx16:$I2, imm32zx4:$M4),
3905 mnemonic#"\t$V1, $V3, $I2, $M4", []>;
3907 class BinaryVRIe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3908 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5>
3909 : InstVRIe<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx12:$I3),
3910 mnemonic#"\t$V1, $V2, $I3",
3911 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3912 imm32zx12_timm:$I3))]> {
3917 class BinaryVRIeFloatGeneric<string mnemonic, bits<16> opcode>
3918 : InstVRIe<opcode, (outs VR128:$V1),
3919 (ins VR128:$V2, imm32zx12:$I3, imm32zx4:$M4, imm32zx4:$M5),
3920 mnemonic#"\t$V1, $V2, $I3, $M4, $M5", []>;
3922 class BinaryVRIh<string mnemonic, bits<16> opcode>
3923 : InstVRIh<opcode, (outs VR128:$V1),
3924 (ins imm32zx16:$I2, imm32zx4:$I3),
3925 mnemonic#"\t$V1, $I2, $I3", []>;
3927 class BinaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3928 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0>
3929 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx4:$M5),
3930 mnemonic#"\t$V1, $V2, $M5",
3931 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3937 class BinaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
3938 : InstVRRa<opcode, (outs VR128:$V1),
3939 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
3940 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
3942 class BinaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
3943 TypedReg tr1, TypedReg tr2, bits<4> type = 0,
3944 bits<4> modifier = 0>
3945 : InstVRRb<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
3946 mnemonic#"\t$V1, $V2, $V3",
3947 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
3948 (tr2.vt tr2.op:$V3)))]> {
3953 class BinaryExtraVRRb<string mnemonic, bits<16> opcode, bits<4> type = 0>
3954 : InstVRRb<opcode, (outs VR128:$V1), (ins VR128:$V2, VR128:$V3, imm32zx4:$M5),
3955 mnemonic#"\t$V1, $V2, $V3, $M5", []> {
3959 class BinaryExtraVRRbGeneric<string mnemonic, bits<16> opcode>
3960 : InstVRRb<opcode, (outs VR128:$V1),
3961 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3962 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
3964 // Declare a pair of instructions, one which sets CC and one which doesn't.
3965 // The CC-setting form ends with "S" and sets the low bit of M5.
3966 multiclass BinaryVRRbSPair<string mnemonic, bits<16> opcode,
3967 SDPatternOperator operator,
3968 SDPatternOperator operator_cc, TypedReg tr1,
3969 TypedReg tr2, bits<4> type, bits<4> modifier = 0> {
3970 def "" : BinaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
3971 !and (modifier, 14)>;
3973 def S : BinaryVRRb<mnemonic#"s", opcode, operator_cc, tr1, tr2, type,
3974 !add (!and (modifier, 14), 1)>;
3977 class BinaryVRRbSPairGeneric<string mnemonic, bits<16> opcode>
3978 : InstVRRb<opcode, (outs VR128:$V1),
3979 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
3980 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> {
3984 // Declare a pair of instructions, one which sets CC and one which doesn't.
3985 // The CC-setting form ends with "S" and sets the low bit of M5.
3986 // The form that does not set CC has an extra operand to optionally allow
3987 // specifying arbitrary M5 values in assembler.
3988 multiclass BinaryExtraVRRbSPair<string mnemonic, bits<16> opcode,
3989 SDPatternOperator operator,
3990 SDPatternOperator operator_cc,
3991 TypedReg tr1, TypedReg tr2, bits<4> type> {
3993 def "" : InstVRRb<opcode, (outs tr1.op:$V1),
3994 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M5),
3995 mnemonic#"\t$V1, $V2, $V3, $M5", []>;
3996 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3))),
3997 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, 0)>;
3998 def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
3999 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4002 def S : BinaryVRRb<mnemonic#"s", opcode, operator_cc, tr1, tr2, type, 1>;
4005 multiclass BinaryExtraVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
4007 def "" : InstVRRb<opcode, (outs VR128:$V1),
4008 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
4009 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
4010 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
4011 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4015 class BinaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4016 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0,
4017 bits<4> m6 = 0, string fp_mnemonic = "">
4018 : InstVRRc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3),
4019 mnemonic#"\t$V1, $V2, $V3",
4020 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4021 (tr2.vt tr2.op:$V3)))]> {
4025 let OpKey = fp_mnemonic#"MemFold"#!subst("VR", "FP", !cast<string>(tr1.op));
4029 class BinaryVRRcGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0,
4031 : InstVRRc<opcode, (outs VR128:$V1),
4032 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4),
4033 mnemonic#"\t$V1, $V2, $V3, $M4", []> {
4038 class BinaryVRRcFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m6 = 0>
4039 : InstVRRc<opcode, (outs VR128:$V1),
4040 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
4041 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> {
4045 // Declare a pair of instructions, one which sets CC and one which doesn't.
4046 // The CC-setting form ends with "S" and sets the low bit of M5.
4047 multiclass BinaryVRRcSPair<string mnemonic, bits<16> opcode,
4048 SDPatternOperator operator,
4049 SDPatternOperator operator_cc, TypedReg tr1,
4050 TypedReg tr2, bits<4> type, bits<4> m5,
4051 bits<4> modifier = 0> {
4052 def "" : BinaryVRRc<mnemonic, opcode, operator, tr1, tr2, type,
4053 m5, !and (modifier, 14)>;
4055 def S : BinaryVRRc<mnemonic#"s", opcode, operator_cc, tr1, tr2, type,
4056 m5, !add (!and (modifier, 14), 1)>;
4059 class BinaryVRRcSPairFloatGeneric<string mnemonic, bits<16> opcode>
4060 : InstVRRc<opcode, (outs VR128:$V1),
4061 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
4063 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
4065 class BinaryVRRf<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4067 : InstVRRf<opcode, (outs tr.op:$V1), (ins GR64:$R2, GR64:$R3),
4068 mnemonic#"\t$V1, $R2, $R3",
4069 [(set (tr.vt tr.op:$V1), (operator GR64:$R2, GR64:$R3))]>;
4071 class BinaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4072 : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2, imm32zx4:$M3),
4073 mnemonic#"\t$R1, $V2, $M3", []> {
4077 class BinaryVRRk<string mnemonic, bits<16> opcode>
4078 : InstVRRk<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3),
4079 mnemonic#"\t$V1, $V2, $M3", []>;
4081 class BinaryVRSa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4082 TypedReg tr1, TypedReg tr2, bits<4> type>
4083 : InstVRSa<opcode, (outs tr1.op:$V1),
4084 (ins tr2.op:$V3, (shift12only $B2, $D2):$BD2),
4085 mnemonic#"\t$V1, $V3, $BD2",
4086 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3),
4087 shift12only:$BD2))]> {
4091 class BinaryVRSaGeneric<string mnemonic, bits<16> opcode>
4092 : InstVRSa<opcode, (outs VR128:$V1),
4093 (ins VR128:$V3, (shift12only $B2, $D2):$BD2, imm32zx4:$M4),
4094 mnemonic#"\t$V1, $V3, $BD2, $M4", []>;
4096 class BinaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4098 : InstVRSb<opcode, (outs VR128:$V1),
4099 (ins GR32:$R3, (bdaddr12only $B2, $D2):$BD2),
4100 mnemonic#"\t$V1, $R3, $BD2",
4101 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
4104 let AccessBytes = bytes;
4107 class BinaryVRSc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4108 TypedReg tr, bits<4> type>
4109 : InstVRSc<opcode, (outs GR64:$R1),
4110 (ins tr.op:$V3, (shift12only $B2, $D2):$BD2),
4111 mnemonic#"\t$R1, $V3, $BD2",
4112 [(set GR64:$R1, (operator (tr.vt tr.op:$V3), shift12only:$BD2))]> {
4116 class BinaryVRScGeneric<string mnemonic, bits<16> opcode>
4117 : InstVRSc<opcode, (outs GR64:$R1),
4118 (ins VR128:$V3, (shift12only $B2, $D2):$BD2, imm32zx4: $M4),
4119 mnemonic#"\t$R1, $V3, $BD2, $M4", []>;
4121 class BinaryVRSd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4123 : InstVRSd<opcode, (outs VR128:$V1),
4124 (ins GR32:$R3, (bdaddr12only $B2, $D2):$BD2),
4125 mnemonic#"\t$V1, $R3, $BD2",
4126 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> {
4128 let AccessBytes = bytes;
4131 class BinaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4132 TypedReg tr, bits<5> bytes>
4133 : InstVRX<opcode, (outs VR128:$V1),
4134 (ins (bdxaddr12only $B2, $D2, $X2):$XBD2, imm32zx4:$M3),
4135 mnemonic#"\t$V1, $XBD2, $M3",
4136 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2,
4137 imm32zx4_timm:$M3))]> {
4139 let AccessBytes = bytes;
4142 class StoreBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
4143 bits<5> bytes, AddressingMode mode = bdaddr12only>
4144 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4145 mnemonic#"\t$R1, $M3, $BD2", []> {
4147 let AccessBytes = bytes;
4150 class StoreBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
4151 bits<5> bytes, AddressingMode mode = bdaddr20only>
4152 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4153 mnemonic#"\t$R1, $M3, $BD2", []> {
4155 let AccessBytes = bytes;
4158 multiclass StoreBinaryRSPair<string mnemonic, bits<8> rsOpcode,
4159 bits<16> rsyOpcode, RegisterOperand cls,
4161 let DispKey = mnemonic # cls in {
4162 let DispSize = "12" in
4163 def "" : StoreBinaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
4164 let DispSize = "20" in
4165 def Y : StoreBinaryRSY<mnemonic#"y", rsyOpcode, cls, bytes,
4170 class StoreBinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls>
4171 : InstRSLb<opcode, (outs),
4172 (ins cls:$R1, (bdladdr12onlylen8 $B2, $D2, $L2):$BDL2,
4174 mnemonic#"\t$R1, $BDL2, $M3", []> {
4178 class BinaryVSI<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4180 : InstVSI<opcode, (outs VR128:$V1),
4181 (ins (bdaddr12only $B2, $D2):$BD2, imm32zx8:$I3),
4182 mnemonic#"\t$V1, $BD2, $I3",
4183 [(set VR128:$V1, (operator imm32zx8:$I3, bdaddr12only:$BD2))]> {
4185 let AccessBytes = bytes;
4188 class StoreBinaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
4189 ImmOpWithPattern index>
4190 : InstVRV<opcode, (outs),
4191 (ins VR128:$V1, (bdvaddr12only $B2, $D2, $V2):$VBD2, index:$M3),
4192 mnemonic#"\t$V1, $VBD2, $M3", []> {
4194 let AccessBytes = bytes;
4197 class StoreBinaryVRX<string mnemonic, bits<16> opcode,
4198 SDPatternOperator operator, TypedReg tr, bits<5> bytes,
4199 ImmOpWithPattern index>
4200 : InstVRX<opcode, (outs),
4201 (ins tr.op:$V1, (bdxaddr12only $B2, $D2, $X2):$XBD2, index:$M3),
4202 mnemonic#"\t$V1, $XBD2, $M3",
4203 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2, index:$M3)]> {
4205 let AccessBytes = bytes;
4208 class MemoryBinarySSd<string mnemonic, bits<8> opcode,
4209 RegisterOperand cls>
4210 : InstSSd<opcode, (outs),
4211 (ins (bdraddr12only $B1, $D1, $R1):$RBD1,
4212 (bdaddr12only $B2, $D2):$BD2, cls:$R3),
4213 mnemonic#"\t$RBD1, $BD2, $R3", []>;
4215 class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4216 RegisterOperand cls1, RegisterOperand cls2>
4217 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2),
4218 mnemonic#"\t$R1, $R2",
4219 [(set CC, (operator cls1:$R1, cls2:$R2))]> {
4220 let OpKey = mnemonic#cls1;
4225 class CompareRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4226 RegisterOperand cls1, RegisterOperand cls2>
4227 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
4228 mnemonic#"\t$R1, $R2",
4229 [(set CC, (operator cls1:$R1, cls2:$R2))]> {
4230 let OpKey = mnemonic#cls1;
4235 class CompareRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
4236 RegisterOperand cls, ImmOpWithPattern imm>
4237 : InstRIa<opcode, (outs), (ins cls:$R1, imm:$I2),
4238 mnemonic#"\t$R1, $I2",
4239 [(set CC, (operator cls:$R1, imm:$I2))]> {
4243 class CompareRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
4244 RegisterOperand cls, ImmOpWithPattern imm>
4245 : InstRILa<opcode, (outs), (ins cls:$R1, imm:$I2),
4246 mnemonic#"\t$R1, $I2",
4247 [(set CC, (operator cls:$R1, imm:$I2))]> {
4251 class CompareRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
4252 RegisterOperand cls, SDPatternOperator load>
4253 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
4254 mnemonic#"\t$R1, $RI2",
4255 [(set CC, (operator cls:$R1, (load pcrel32:$RI2)))]> {
4258 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
4259 // However, BDXs have two extra operands and are therefore 6 units more
4261 let AddedComplexity = 7;
4264 class CompareRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4265 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
4266 AddressingMode mode = bdxaddr12only>
4267 : InstRXa<opcode, (outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
4268 mnemonic#"\t$R1, $XBD2",
4269 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
4270 let OpKey = mnemonic#"r"#cls;
4274 let AccessBytes = bytes;
4277 class CompareRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4278 RegisterOperand cls, SDPatternOperator load, bits<5> bytes>
4279 : InstRXE<opcode, (outs), (ins cls:$R1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
4280 mnemonic#"\t$R1, $XBD2",
4281 [(set CC, (operator cls:$R1, (load bdxaddr12only:$XBD2)))]> {
4282 let OpKey = mnemonic#"r"#cls;
4286 let AccessBytes = bytes;
4290 class CompareRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4291 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
4292 AddressingMode mode = bdxaddr20only>
4293 : InstRXYa<opcode, (outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
4294 mnemonic#"\t$R1, $XBD2",
4295 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
4296 let OpKey = mnemonic#"r"#cls;
4300 let AccessBytes = bytes;
4303 multiclass CompareRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
4304 SDPatternOperator operator, RegisterOperand cls,
4305 SDPatternOperator load, bits<5> bytes> {
4306 let DispKey = mnemonic # cls in {
4307 let DispSize = "12" in
4308 def "" : CompareRX<mnemonic, rxOpcode, operator, cls,
4309 load, bytes, bdxaddr12pair>;
4310 let DispSize = "20" in
4311 def Y : CompareRXY<mnemonic#"y", rxyOpcode, operator, cls,
4312 load, bytes, bdxaddr20pair>;
4316 class CompareRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
4317 bits<5> bytes, AddressingMode mode = bdaddr12only>
4318 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4319 mnemonic#"\t$R1, $M3, $BD2", []> {
4321 let AccessBytes = bytes;
4324 class CompareRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
4325 bits<5> bytes, AddressingMode mode = bdaddr20only>
4326 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4327 mnemonic#"\t$R1, $M3, $BD2", []> {
4329 let AccessBytes = bytes;
4332 multiclass CompareRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4333 RegisterOperand cls, bits<5> bytes> {
4334 let DispKey = mnemonic # cls in {
4335 let DispSize = "12" in
4336 def "" : CompareRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
4337 let DispSize = "20" in
4338 def Y : CompareRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
4342 class CompareSSb<string mnemonic, bits<8> opcode>
4344 (outs), (ins (bdladdr12onlylen4 $B1, $D1, $L1):$BDL1,
4345 (bdladdr12onlylen4 $B2, $D2, $L2):$BDL2),
4346 mnemonic#"\t$BDL1, $BDL2", []> {
4351 class CompareSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
4352 SDPatternOperator load, ImmOpWithPattern imm,
4353 AddressingMode mode = bdaddr12only>
4354 : InstSI<opcode, (outs), (ins (mode $B1, $D1):$BD1, imm:$I2),
4355 mnemonic#"\t$BD1, $I2",
4356 [(set CC, (operator (load mode:$BD1), imm:$I2))]> {
4361 class CompareSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4362 SDPatternOperator load, ImmOpWithPattern imm>
4363 : InstSIL<opcode, (outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2),
4364 mnemonic#"\t$BD1, $I2",
4365 [(set CC, (operator (load bdaddr12only:$BD1), imm:$I2))]> {
4370 class CompareSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4371 SDPatternOperator load, ImmOpWithPattern imm,
4372 AddressingMode mode = bdaddr20only>
4373 : InstSIY<opcode, (outs), (ins (mode $B1, $D1):$BD1, imm:$I2),
4374 mnemonic#"\t$BD1, $I2",
4375 [(set CC, (operator (load mode:$BD1), imm:$I2))]> {
4380 multiclass CompareSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
4381 SDPatternOperator operator, SDPatternOperator load,
4382 ImmOpWithPattern imm> {
4383 let DispKey = mnemonic in {
4384 let DispSize = "12" in
4385 def "" : CompareSI<mnemonic, siOpcode, operator, load, imm, bdaddr12pair>;
4386 let DispSize = "20" in
4387 def Y : CompareSIY<mnemonic#"y", siyOpcode, operator, load, imm,
4392 class CompareVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4393 TypedReg tr, bits<4> type, string fp_mnemonic = "">
4394 : InstVRRa<opcode, (outs), (ins tr.op:$V1, tr.op:$V2),
4395 mnemonic#"\t$V1, $V2",
4396 [(set CC, (operator (tr.vt tr.op:$V1), (tr.vt tr.op:$V2)))]> {
4401 let OpKey = fp_mnemonic#!subst("VR", "FP", !cast<string>(tr.op));
4405 class CompareVRRaGeneric<string mnemonic, bits<16> opcode>
4406 : InstVRRa<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
4407 mnemonic#"\t$V1, $V2, $M3", []> {
4413 class CompareVRRaFloatGeneric<string mnemonic, bits<16> opcode>
4414 : InstVRRa<opcode, (outs),
4415 (ins VR64:$V1, VR64:$V2, imm32zx4:$M3, imm32zx4:$M4),
4416 mnemonic#"\t$V1, $V2, $M3, $M4", []> {
4421 class CompareVRRh<string mnemonic, bits<16> opcode>
4422 : InstVRRh<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3),
4423 mnemonic#"\t$V1, $V2, $M3", []> {
4427 class TestInherentS<string mnemonic, bits<16> opcode,
4428 SDPatternOperator operator>
4429 : InstS<opcode, (outs), (ins), mnemonic, [(set CC, (operator))]> {
4434 class TestRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4435 RegisterOperand cls>
4436 : InstRXE<opcode, (outs), (ins cls:$R1, (bdxaddr12only $B2, $D2, $X2):$XBD2),
4437 mnemonic#"\t$R1, $XBD2",
4438 [(set CC, (operator cls:$R1, bdxaddr12only:$XBD2))]> {
4442 class TestBinarySIL<string mnemonic, bits<16> opcode,
4443 SDPatternOperator operator, ImmOpWithPattern imm>
4444 : InstSIL<opcode, (outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2),
4445 mnemonic#"\t$BD1, $I2",
4446 [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>;
4448 class TestRSL<string mnemonic, bits<16> opcode>
4449 : InstRSLa<opcode, (outs), (ins (bdladdr12onlylen4 $B1, $D1, $L1):$BDL1),
4450 mnemonic#"\t$BDL1", []> {
4454 class TestVRRg<string mnemonic, bits<16> opcode>
4455 : InstVRRg<opcode, (outs), (ins VR128:$V1),
4456 mnemonic#"\t$V1", []>;
4458 class SideEffectTernarySSc<string mnemonic, bits<8> opcode>
4459 : InstSSc<opcode, (outs), (ins (bdladdr12onlylen4 $B1, $D1, $L1):$BDL1,
4460 (shift12only $B2, $D2):$BD2, imm32zx4:$I3),
4461 mnemonic#"\t$BDL1, $BD2, $I3", []>;
4463 class SideEffectTernaryRRFa<string mnemonic, bits<16> opcode,
4464 RegisterOperand cls1, RegisterOperand cls2,
4465 RegisterOperand cls3>
4466 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3),
4467 mnemonic#"\t$R1, $R2, $R3", []> {
4471 class SideEffectTernaryMemMemRRFa<string mnemonic, bits<16> opcode,
4472 RegisterOperand cls1, RegisterOperand cls2,
4473 RegisterOperand cls3>
4474 : InstRRFa<opcode, (outs cls1:$R1, cls2:$R2),
4475 (ins cls1:$R1src, cls2:$R2src, cls3:$R3),
4476 mnemonic#"\t$R1, $R2, $R3", []> {
4477 let Constraints = "$R1 = $R1src, $R2 = $R2src";
4478 let DisableEncoding = "$R1src, $R2src";
4482 class SideEffectTernaryRRFb<string mnemonic, bits<16> opcode,
4483 RegisterOperand cls1, RegisterOperand cls2,
4484 RegisterOperand cls3>
4485 : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3),
4486 mnemonic#"\t$R1, $R3, $R2", []> {
4490 class SideEffectTernaryMemMemMemRRFb<string mnemonic, bits<16> opcode,
4491 RegisterOperand cls1,
4492 RegisterOperand cls2,
4493 RegisterOperand cls3>
4494 : InstRRFb<opcode, (outs cls1:$R1, cls2:$R2, cls3:$R3),
4495 (ins cls1:$R1src, cls2:$R2src, cls3:$R3src),
4496 mnemonic#"\t$R1, $R3, $R2", []> {
4497 let Constraints = "$R1 = $R1src, $R2 = $R2src, $R3 = $R3src";
4498 let DisableEncoding = "$R1src, $R2src, $R3src";
4502 class SideEffectTernaryRRFc<string mnemonic, bits<16> opcode,
4503 RegisterOperand cls1, RegisterOperand cls2,
4504 ImmOpWithPattern imm>
4505 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2, imm:$M3),
4506 mnemonic#"\t$R1, $R2, $M3", []>;
4508 multiclass SideEffectTernaryRRFcOpt<string mnemonic, bits<16> opcode,
4509 RegisterOperand cls1,
4510 RegisterOperand cls2> {
4511 def "" : SideEffectTernaryRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
4512 def Opt : SideEffectBinaryRRFc<mnemonic, opcode, cls1, cls2>;
4515 class SideEffectTernaryMemMemRRFc<string mnemonic, bits<16> opcode,
4516 RegisterOperand cls1, RegisterOperand cls2,
4517 ImmOpWithPattern imm>
4518 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2),
4519 (ins cls1:$R1src, cls2:$R2src, imm:$M3),
4520 mnemonic#"\t$R1, $R2, $M3", []> {
4521 let Constraints = "$R1 = $R1src, $R2 = $R2src";
4522 let DisableEncoding = "$R1src, $R2src";
4525 multiclass SideEffectTernaryMemMemRRFcOpt<string mnemonic, bits<16> opcode,
4526 RegisterOperand cls1,
4527 RegisterOperand cls2> {
4528 def "" : SideEffectTernaryMemMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>;
4529 def Opt : SideEffectBinaryMemMemRRFc<mnemonic, opcode, cls1, cls2>;
4532 class SideEffectTernarySSF<string mnemonic, bits<12> opcode,
4533 RegisterOperand cls>
4534 : InstSSF<opcode, (outs),
4535 (ins (bdaddr12only $B1, $D1):$BD1,
4536 (bdaddr12only $B2, $D2):$BD2, cls:$R3),
4537 mnemonic#"\t$BD1, $BD2, $R3", []>;
4539 class TernaryRRFa<string mnemonic, bits<16> opcode,
4540 RegisterOperand cls1, RegisterOperand cls2,
4541 RegisterOperand cls3>
4542 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3, imm32zx4:$M4),
4543 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
4545 class TernaryRRFb<string mnemonic, bits<16> opcode,
4546 RegisterOperand cls1, RegisterOperand cls2,
4547 RegisterOperand cls3>
4548 : InstRRFb<opcode, (outs cls1:$R1, cls3:$R3),
4549 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M4),
4550 mnemonic#"\t$R1, $R3, $R2, $M4", []> {
4551 let Constraints = "$R1 = $R1src";
4552 let DisableEncoding = "$R1src";
4555 class TernaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
4556 RegisterOperand cls2>
4557 : InstRRFe<opcode, (outs cls1:$R1),
4558 (ins imm32zx4:$M3, cls2:$R2, imm32zx4:$M4),
4559 mnemonic#"\t$R1, $M3, $R2, $M4", []>;
4561 class TernaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4562 RegisterOperand cls1, RegisterOperand cls2>
4563 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R1src, cls2:$R3, cls2:$R2),
4564 mnemonic#"\t$R1, $R3, $R2",
4565 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3, cls2:$R2))]> {
4566 let OpKey = mnemonic#cls;
4568 let Constraints = "$R1 = $R1src";
4569 let DisableEncoding = "$R1src";
4572 class TernaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls,
4573 bits<5> bytes, AddressingMode mode = bdaddr12only>
4574 : InstRSb<opcode, (outs cls:$R1),
4575 (ins cls:$R1src, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4576 mnemonic#"\t$R1, $M3, $BD2", []> {
4578 let Constraints = "$R1 = $R1src";
4579 let DisableEncoding = "$R1src";
4581 let AccessBytes = bytes;
4584 class TernaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls,
4585 bits<5> bytes, AddressingMode mode = bdaddr20only>
4586 : InstRSYb<opcode, (outs cls:$R1),
4587 (ins cls:$R1src, imm32zx4:$M3, (mode $B2, $D2):$BD2),
4588 mnemonic#"\t$R1, $M3, $BD2", []> {
4590 let Constraints = "$R1 = $R1src";
4591 let DisableEncoding = "$R1src";
4593 let AccessBytes = bytes;
4596 multiclass TernaryRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
4597 RegisterOperand cls, bits<5> bytes> {
4598 let DispKey = mnemonic # cls in {
4599 let DispSize = "12" in
4600 def "" : TernaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>;
4601 let DispSize = "20" in
4602 def Y : TernaryRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>;
4606 class SideEffectTernaryRS<string mnemonic, bits<8> opcode,
4607 RegisterOperand cls1, RegisterOperand cls2>
4608 : InstRSa<opcode, (outs),
4609 (ins cls1:$R1, cls2:$R3, (bdaddr12only $B2, $D2):$BD2),
4610 mnemonic#"\t$R1, $R3, $BD2", []>;
4612 class SideEffectTernaryRSY<string mnemonic, bits<16> opcode,
4613 RegisterOperand cls1, RegisterOperand cls2>
4614 : InstRSYa<opcode, (outs),
4615 (ins cls1:$R1, cls2:$R3, (bdaddr20only $B2, $D2):$BD2),
4616 mnemonic#"\t$R1, $R3, $BD2", []>;
4618 class SideEffectTernaryMemMemRS<string mnemonic, bits<8> opcode,
4619 RegisterOperand cls1, RegisterOperand cls2>
4620 : InstRSa<opcode, (outs cls1:$R1, cls2:$R3),
4621 (ins cls1:$R1src, cls2:$R3src, (shift12only $B2, $D2):$BD2),
4622 mnemonic#"\t$R1, $R3, $BD2", []> {
4623 let Constraints = "$R1 = $R1src, $R3 = $R3src";
4624 let DisableEncoding = "$R1src, $R3src";
4627 class SideEffectTernaryMemMemRSY<string mnemonic, bits<16> opcode,
4628 RegisterOperand cls1, RegisterOperand cls2>
4629 : InstRSYa<opcode, (outs cls1:$R1, cls2:$R3),
4630 (ins cls1:$R1src, cls2:$R3src, (shift20only $B2, $D2):$BD2),
4631 mnemonic#"\t$R1, $R3, $BD2", []> {
4632 let Constraints = "$R1 = $R1src, $R3 = $R3src";
4633 let DisableEncoding = "$R1src, $R3src";
4636 class TernaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4637 RegisterOperand cls1, RegisterOperand cls2,
4638 SDPatternOperator load, bits<5> bytes>
4639 : InstRXF<opcode, (outs cls1:$R1),
4640 (ins cls2:$R1src, cls2:$R3, (bdxaddr12only $B2, $D2, $X2):$XBD2),
4641 mnemonic#"\t$R1, $R3, $XBD2",
4642 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3,
4643 (load bdxaddr12only:$XBD2)))]> {
4644 let OpKey = mnemonic#"r"#cls;
4646 let Constraints = "$R1 = $R1src";
4647 let DisableEncoding = "$R1src";
4649 let AccessBytes = bytes;
4652 class TernaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4653 TypedReg tr1, TypedReg tr2, ImmOpWithPattern imm, ImmOpWithPattern index>
4654 : InstVRIa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V1src, imm:$I2, index:$M3),
4655 mnemonic#"\t$V1, $I2, $M3",
4656 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4657 imm:$I2, index:$M3))]> {
4658 let Constraints = "$V1 = $V1src";
4659 let DisableEncoding = "$V1src";
4662 class TernaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4663 TypedReg tr1, TypedReg tr2, bits<4> type>
4664 : InstVRId<opcode, (outs tr1.op:$V1),
4665 (ins tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
4666 mnemonic#"\t$V1, $V2, $V3, $I4",
4667 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4668 (tr2.vt tr2.op:$V3),
4669 imm32zx8_timm:$I4))]> {
4673 class TernaryVRIi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4674 : InstVRIi<opcode, (outs VR128:$V1),
4675 (ins cls:$R2, imm32zx8:$I3, imm32zx4:$M4),
4676 mnemonic#"\t$V1, $R2, $I3, $M4", []>;
4678 class TernaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4679 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m4or>
4680 : InstVRRa<opcode, (outs tr1.op:$V1),
4681 (ins tr2.op:$V2, imm32zx4:$M4, imm32zx4:$M5),
4682 mnemonic#"\t$V1, $V2, $M4, $M5",
4683 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4685 imm32zx4_timm:$M5))],
4690 class TernaryVRRaFloatGeneric<string mnemonic, bits<16> opcode>
4691 : InstVRRa<opcode, (outs VR128:$V1),
4692 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5),
4693 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>;
4695 class TernaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4696 TypedReg tr1, TypedReg tr2, bits<4> type,
4697 SDPatternOperator m5mask, bits<4> m5or>
4698 : InstVRRb<opcode, (outs tr1.op:$V1),
4699 (ins tr2.op:$V2, tr2.op:$V3, m5mask:$M5),
4700 mnemonic#"\t$V1, $V2, $V3, $M5",
4701 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4702 (tr2.vt tr2.op:$V3),
4708 // Declare a pair of instructions, one which sets CC and one which doesn't.
4709 // The CC-setting form ends with "S" and sets the low bit of M5.
4710 // Also create aliases to make use of M5 operand optional in assembler.
4711 multiclass TernaryOptVRRbSPair<string mnemonic, bits<16> opcode,
4712 SDPatternOperator operator,
4713 SDPatternOperator operator_cc,
4714 TypedReg tr1, TypedReg tr2, bits<4> type,
4715 bits<4> modifier = 0> {
4716 def "" : TernaryVRRb<mnemonic, opcode, operator, tr1, tr2, type,
4717 imm32zx4even_timm, !and (modifier, 14)>;
4718 def : InstAlias<mnemonic#"\t$V1, $V2, $V3",
4719 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4722 def S : TernaryVRRb<mnemonic#"s", opcode, operator_cc, tr1, tr2, type,
4723 imm32zx4even_timm, !add(!and (modifier, 14), 1)>;
4724 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3",
4725 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
4729 multiclass TernaryOptVRRbSPairGeneric<string mnemonic, bits<16> opcode> {
4731 def "" : InstVRRb<opcode, (outs VR128:$V1),
4732 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5),
4733 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>;
4734 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4",
4735 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4739 class TernaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4740 TypedReg tr1, TypedReg tr2>
4741 : InstVRRc<opcode, (outs tr1.op:$V1),
4742 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M4),
4743 mnemonic#"\t$V1, $V2, $V3, $M4",
4744 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4745 (tr2.vt tr2.op:$V3),
4746 imm32zx4_timm:$M4))]> {
4751 class TernaryVRRcFloat<string mnemonic, bits<16> opcode,
4752 SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
4753 bits<4> type = 0, bits<4> m5 = 0>
4754 : InstVRRc<opcode, (outs tr1.op:$V1),
4755 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M6),
4756 mnemonic#"\t$V1, $V2, $V3, $M6",
4757 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4758 (tr2.vt tr2.op:$V3),
4759 imm32zx4_timm:$M6))]> {
4764 class TernaryVRRcFloatGeneric<string mnemonic, bits<16> opcode>
4765 : InstVRRc<opcode, (outs VR128:$V1),
4766 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5,
4768 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>;
4770 class TernaryVRRd<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4771 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m6 = 0>
4772 : InstVRRd<opcode, (outs tr1.op:$V1),
4773 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
4774 mnemonic#"\t$V1, $V2, $V3, $V4",
4775 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4776 (tr2.vt tr2.op:$V3),
4777 (tr1.vt tr1.op:$V4)))]> {
4782 class TernaryVRRdGeneric<string mnemonic, bits<16> opcode>
4783 : InstVRRd<opcode, (outs VR128:$V1),
4784 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5),
4785 mnemonic#"\t$V1, $V2, $V3, $V4, $M5", []> {
4789 // Ternary operation where the assembler mnemonic has an extra operand to
4790 // optionally allow specifying arbitrary M6 values.
4791 multiclass TernaryExtraVRRd<string mnemonic, bits<16> opcode,
4792 SDPatternOperator operator,
4793 TypedReg tr1, TypedReg tr2, bits<4> type> {
4794 let M5 = type, Defs = [CC] in
4795 def "" : InstVRRd<opcode, (outs tr1.op:$V1),
4796 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, imm32zx4:$M6),
4797 mnemonic#"\t$V1, $V2, $V3, $V4, $M6", []>;
4798 def : Pat<(operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3),
4799 (tr1.vt tr1.op:$V4)),
4800 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, 0)>;
4801 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4",
4802 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4803 tr2.op:$V3, tr1.op:$V4, 0)>;
4806 multiclass TernaryExtraVRRdGeneric<string mnemonic, bits<16> opcode> {
4808 def "" : InstVRRd<opcode, (outs VR128:$V1),
4809 (ins VR128:$V2, VR128:$V3, VR128:$V4,
4810 imm32zx4:$M5, imm32zx4:$M6),
4811 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4812 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5",
4813 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4814 VR128:$V4, imm32zx4:$M5, 0)>;
4817 class TernaryVRRe<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4818 TypedReg tr1, TypedReg tr2, bits<4> m5 = 0, bits<4> type = 0,
4819 string fp_mnemonic = "">
4820 : InstVRRe<opcode, (outs tr1.op:$V1),
4821 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4),
4822 mnemonic#"\t$V1, $V2, $V3, $V4",
4823 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4824 (tr2.vt tr2.op:$V3),
4825 (tr1.vt tr1.op:$V4)))]> {
4828 let OpKey = fp_mnemonic#"MemFold"#!subst("VR", "FP", !cast<string>(tr1.op));
4832 class TernaryVRReFloatGeneric<string mnemonic, bits<16> opcode>
4833 : InstVRRe<opcode, (outs VR128:$V1),
4834 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
4835 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4837 class TernaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4838 TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type>
4839 : InstVRSb<opcode, (outs tr1.op:$V1),
4840 (ins tr2.op:$V1src, cls:$R3, (shift12only $B2, $D2):$BD2),
4841 mnemonic#"\t$V1, $R3, $BD2",
4842 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4844 shift12only:$BD2))]> {
4845 let Constraints = "$V1 = $V1src";
4846 let DisableEncoding = "$V1src";
4850 class TernaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls>
4851 : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2,
4852 imm32zx4:$M3, imm32zx4:$M4),
4853 mnemonic#"\t$R1, $V2, $M3, $M4", []>;
4855 class TernaryVRRj<string mnemonic, bits<16> opcode>
4856 : InstVRRj<opcode, (outs VR128:$V1), (ins VR128:$V2,
4857 VR128:$V3, imm32zx4:$M4),
4858 mnemonic#"\t$V1, $V2, $V3, $M4", []>;
4860 class TernaryVRSbGeneric<string mnemonic, bits<16> opcode>
4861 : InstVRSb<opcode, (outs VR128:$V1),
4862 (ins VR128:$V1src, GR64:$R3, (shift12only $B2, $D2):$BD2,
4864 mnemonic#"\t$V1, $R3, $BD2, $M4", []> {
4865 let Constraints = "$V1 = $V1src";
4866 let DisableEncoding = "$V1src";
4869 class TernaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes,
4870 ImmOpWithPattern index>
4871 : InstVRV<opcode, (outs VR128:$V1),
4872 (ins VR128:$V1src, (bdvaddr12only $B2, $D2, $V2):$VBD2, index:$M3),
4873 mnemonic#"\t$V1, $VBD2, $M3", []> {
4874 let Constraints = "$V1 = $V1src";
4875 let DisableEncoding = "$V1src";
4877 let AccessBytes = bytes;
4880 class TernaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4881 TypedReg tr1, TypedReg tr2, bits<5> bytes, ImmOpWithPattern index>
4882 : InstVRX<opcode, (outs tr1.op:$V1),
4883 (ins tr2.op:$V1src, (bdxaddr12only $B2, $D2, $X2):$XBD2, index:$M3),
4884 mnemonic#"\t$V1, $XBD2, $M3",
4885 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4886 bdxaddr12only:$XBD2,
4888 let Constraints = "$V1 = $V1src";
4889 let DisableEncoding = "$V1src";
4891 let AccessBytes = bytes;
4894 class QuaternaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator,
4895 TypedReg tr1, TypedReg tr2, bits<4> type>
4896 : InstVRId<opcode, (outs tr1.op:$V1),
4897 (ins tr2.op:$V1src, tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4),
4898 mnemonic#"\t$V1, $V2, $V3, $I4",
4899 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src),
4900 (tr2.vt tr2.op:$V2),
4901 (tr2.vt tr2.op:$V3),
4902 imm32zx8_timm:$I4))]> {
4903 let Constraints = "$V1 = $V1src";
4904 let DisableEncoding = "$V1src";
4908 class QuaternaryVRIdGeneric<string mnemonic, bits<16> opcode>
4909 : InstVRId<opcode, (outs VR128:$V1),
4910 (ins VR128:$V1src, VR128:$V2, VR128:$V3,
4911 imm32zx8:$I4, imm32zx4:$M5),
4912 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []> {
4913 let Constraints = "$V1 = $V1src";
4914 let DisableEncoding = "$V1src";
4917 class QuaternaryVRIf<string mnemonic, bits<16> opcode>
4918 : InstVRIf<opcode, (outs VR128:$V1),
4919 (ins VR128:$V2, VR128:$V3,
4920 imm32zx8:$I4, imm32zx4:$M5),
4921 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []>;
4923 class QuaternaryVRIg<string mnemonic, bits<16> opcode>
4924 : InstVRIg<opcode, (outs VR128:$V1),
4925 (ins VR128:$V2, imm32zx8:$I3,
4926 imm32zx8:$I4, imm32zx4:$M5),
4927 mnemonic#"\t$V1, $V2, $I3, $I4, $M5", []>;
4929 class QuaternaryVRRd<string mnemonic, bits<16> opcode,
4930 SDPatternOperator operator, TypedReg tr1, TypedReg tr2,
4931 TypedReg tr3, TypedReg tr4, bits<4> type,
4932 SDPatternOperator m6mask = imm32zx4_timm, bits<4> m6or = 0>
4933 : InstVRRd<opcode, (outs tr1.op:$V1),
4934 (ins tr2.op:$V2, tr3.op:$V3, tr4.op:$V4, m6mask:$M6),
4935 mnemonic#"\t$V1, $V2, $V3, $V4, $M6",
4936 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2),
4937 (tr3.vt tr3.op:$V3),
4938 (tr4.vt tr4.op:$V4),
4944 class QuaternaryVRRdGeneric<string mnemonic, bits<16> opcode>
4945 : InstVRRd<opcode, (outs VR128:$V1),
4946 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6),
4947 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>;
4949 // Declare a pair of instructions, one which sets CC and one which doesn't.
4950 // The CC-setting form ends with "S" and sets the low bit of M6.
4951 // Also create aliases to make use of M6 operand optional in assembler.
4952 multiclass QuaternaryOptVRRdSPair<string mnemonic, bits<16> opcode,
4953 SDPatternOperator operator,
4954 SDPatternOperator operator_cc,
4955 TypedReg tr1, TypedReg tr2, bits<4> type,
4956 bits<4> modifier = 0> {
4957 def "" : QuaternaryVRRd<mnemonic, opcode, operator,
4958 tr1, tr2, tr2, tr2, type,
4959 imm32zx4even_timm, !and (modifier, 14)>;
4960 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4",
4961 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2,
4962 tr2.op:$V3, tr2.op:$V4, 0)>;
4964 def S : QuaternaryVRRd<mnemonic#"s", opcode, operator_cc,
4965 tr1, tr2, tr2, tr2, type,
4966 imm32zx4even_timm, !add (!and (modifier, 14), 1)>;
4967 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3, $V4",
4968 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2,
4969 tr2.op:$V3, tr2.op:$V4, 0)>;
4972 multiclass QuaternaryOptVRRdSPairGeneric<string mnemonic, bits<16> opcode> {
4974 def "" : QuaternaryVRRdGeneric<mnemonic, opcode>;
4975 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5",
4976 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3,
4977 VR128:$V4, imm32zx4_timm:$M5, 0)>;
4980 class SideEffectQuaternaryRRFa<string mnemonic, bits<16> opcode,
4981 RegisterOperand cls1, RegisterOperand cls2,
4982 RegisterOperand cls3>
4983 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4),
4984 mnemonic#"\t$R1, $R2, $R3, $M4", []>;
4986 multiclass SideEffectQuaternaryRRFaOptOpt<string mnemonic, bits<16> opcode,
4987 RegisterOperand cls1,
4988 RegisterOperand cls2,
4989 RegisterOperand cls3> {
4990 def "" : SideEffectQuaternaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
4991 def Opt : SideEffectTernaryRRFa<mnemonic, opcode, cls1, cls2, cls3>;
4992 def OptOpt : SideEffectBinaryRRFa<mnemonic, opcode, cls1, cls2>;
4995 class SideEffectQuaternaryRRFb<string mnemonic, bits<16> opcode,
4996 RegisterOperand cls1, RegisterOperand cls2,
4997 RegisterOperand cls3>
4998 : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4),
4999 mnemonic#"\t$R1, $R3, $R2, $M4", []>;
5001 multiclass SideEffectQuaternaryRRFbOpt<string mnemonic, bits<16> opcode,
5002 RegisterOperand cls1,
5003 RegisterOperand cls2,
5004 RegisterOperand cls3> {
5005 def "" : SideEffectQuaternaryRRFb<mnemonic, opcode, cls1, cls2, cls3>;
5006 def Opt : SideEffectTernaryRRFb<mnemonic, opcode, cls1, cls2, cls3>;
5009 class SideEffectQuaternarySSe<string mnemonic, bits<8> opcode,
5010 RegisterOperand cls>
5011 : InstSSe<opcode, (outs),
5012 (ins cls:$R1, (bdaddr12only $B2, $D2):$BD2, cls:$R3,
5013 (bdaddr12only $B4, $D4):$BD4),
5014 mnemonic#"\t$R1, $BD2, $R3, $BD4", []>;
5016 class LoadAndOpRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
5017 RegisterOperand cls, AddressingMode mode = bdaddr20only>
5018 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, (mode $B2, $D2):$BD2),
5019 mnemonic#"\t$R1, $R3, $BD2",
5020 [(set cls:$R1, (operator mode:$BD2, cls:$R3))]> {
5025 class CmpSwapRRE<string mnemonic, bits<16> opcode,
5026 RegisterOperand cls1, RegisterOperand cls2>
5027 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
5028 mnemonic#"\t$R1, $R2", []> {
5029 let Constraints = "$R1 = $R1src";
5030 let DisableEncoding = "$R1src";
5035 class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
5036 RegisterOperand cls, AddressingMode mode = bdaddr12only>
5037 : InstRSa<opcode, (outs cls:$R1),
5038 (ins cls:$R1src, cls:$R3, (mode $B2, $D2):$BD2),
5039 mnemonic#"\t$R1, $R3, $BD2",
5040 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
5041 let Constraints = "$R1 = $R1src";
5042 let DisableEncoding = "$R1src";
5047 class CmpSwapRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
5048 RegisterOperand cls, AddressingMode mode = bdaddr20only>
5049 : InstRSYa<opcode, (outs cls:$R1),
5050 (ins cls:$R1src, cls:$R3, (mode $B2, $D2):$BD2),
5051 mnemonic#"\t$R1, $R3, $BD2",
5052 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
5053 let Constraints = "$R1 = $R1src";
5054 let DisableEncoding = "$R1src";
5059 multiclass CmpSwapRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
5060 SDPatternOperator operator, RegisterOperand cls> {
5061 let DispKey = mnemonic # cls in {
5062 let DispSize = "12" in
5063 def "" : CmpSwapRS<mnemonic, rsOpcode, operator, cls, bdaddr12pair>;
5064 let DispSize = "20" in
5065 def Y : CmpSwapRSY<mnemonic#"y", rsyOpcode, operator, cls, bdaddr20pair>;
5069 class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1,
5070 RegisterOperand cls2, bits<8> I3Or = 0, bits<8> I4Or = 0>
5071 : InstRIEf<opcode, (outs cls1:$R1),
5072 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
5074 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", [], I3Or, I4Or> {
5075 let Constraints = "$R1 = $R1src";
5076 let DisableEncoding = "$R1src";
5079 class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator>
5080 : InstRXYb<opcode, (outs),
5081 (ins imm32zx4:$M1, (bdxaddr20only $B2, $D2, $X2):$XBD2),
5082 mnemonic#"\t$M1, $XBD2",
5083 [(operator imm32zx4_timm:$M1, bdxaddr20only:$XBD2)]>;
5085 class PrefetchRILPC<string mnemonic, bits<12> opcode,
5086 SDPatternOperator operator>
5087 : InstRILc<opcode, (outs), (ins imm32zx4_timm:$M1, pcrel32:$RI2),
5088 mnemonic#"\t$M1, $RI2",
5089 [(operator imm32zx4_timm:$M1, pcrel32:$RI2)]> {
5090 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
5091 // However, BDXs have two extra operands and are therefore 6 units more
5093 let AddedComplexity = 7;
5096 class BranchPreloadSMI<string mnemonic, bits<8> opcode>
5097 : InstSMI<opcode, (outs),
5098 (ins imm32zx4:$M1, brtarget16bpp:$RI2,
5099 (bdaddr12only $B3, $D3):$BD3),
5100 mnemonic#"\t$M1, $RI2, $BD3", []>;
5102 class BranchPreloadMII<string mnemonic, bits<8> opcode>
5103 : InstMII<opcode, (outs),
5104 (ins imm32zx4:$M1, brtarget12bpp:$RI2, brtarget24bpp:$RI3),
5105 mnemonic#"\t$M1, $RI2, $RI3", []>;
5107 //===----------------------------------------------------------------------===//
5108 // Pseudo instructions
5109 //===----------------------------------------------------------------------===//
5111 // Convenience instructions that get lowered to real instructions
5112 // by either SystemZTargetLowering::EmitInstrWithCustomInserter()
5113 // or SystemZInstrInfo::expandPostRAPseudo().
5115 //===----------------------------------------------------------------------===//
5117 class Pseudo<dag outs, dag ins, list<dag> pattern>
5118 : InstSystemZ<0, outs, ins, "", pattern> {
5120 let isCodeGenOnly = 1;
5123 // Like UnaryRI, but expanded after RA depending on the choice of register.
5124 class UnaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
5125 ImmOpWithPattern imm>
5126 : Pseudo<(outs cls:$R1), (ins imm:$I2),
5127 [(set cls:$R1, (operator imm:$I2))]>;
5129 // Like UnaryRXY, but expanded after RA depending on the choice of register.
5130 class UnaryRXYPseudo<string key, SDPatternOperator operator,
5131 RegisterOperand cls, bits<5> bytes,
5132 AddressingMode mode = bdxaddr20only>
5133 : Pseudo<(outs cls:$R1), (ins (mode $B2, $D2, $X2):$XBD2),
5134 [(set cls:$R1, (operator mode:$XBD2))]> {
5135 let OpKey = key#"r"#cls;
5138 let Has20BitOffset = 1;
5140 let AccessBytes = bytes;
5143 // Like UnaryRR, but expanded after RA depending on the choice of registers.
5144 class UnaryRRPseudo<string key, SDPatternOperator operator,
5145 RegisterOperand cls1, RegisterOperand cls2>
5146 : Pseudo<(outs cls1:$R1), (ins cls2:$R2),
5147 [(set cls1:$R1, (operator cls2:$R2))]> {
5148 let OpKey = key#cls1;
5152 // Like BinaryRI, but expanded after RA depending on the choice of register.
5153 class BinaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,
5154 ImmOpWithPattern imm>
5155 : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2),
5156 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
5157 let Constraints = "$R1 = $R1src";
5160 // Like BinaryRIE, but expanded after RA depending on the choice of register.
5161 class BinaryRIEPseudo<SDPatternOperator operator, RegisterOperand cls,
5162 ImmOpWithPattern imm>
5163 : Pseudo<(outs cls:$R1), (ins cls:$R3, imm:$I2),
5164 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>;
5166 // Like BinaryRIAndK, but expanded after RA depending on the choice of register.
5167 multiclass BinaryRIAndKPseudo<string key, SDPatternOperator operator,
5168 RegisterOperand cls, ImmOpWithPattern imm> {
5169 let NumOpsKey = key in {
5170 let NumOpsValue = "3" in
5171 def K : BinaryRIEPseudo<operator, cls, imm>,
5172 Requires<[FeatureHighWord, FeatureDistinctOps]>;
5173 let NumOpsValue = "2" in
5174 def "" : BinaryRIPseudo<operator, cls, imm>,
5175 Requires<[FeatureHighWord]>;
5179 // A pseudo that is used during register allocation when folding a memory
5180 // operand. The 3-address register instruction with a spilled source cannot
5181 // be converted directly to a target 2-address reg/mem instruction.
5182 // Mapping: <INSN>R -> MemFoldPseudo -> <INSN>
5183 class MemFoldPseudo<string mnemonic, RegisterOperand cls, bits<5> bytes,
5184 AddressingMode mode>
5185 : Pseudo<(outs cls:$R1), (ins cls:$R2, (mode $B2, $D2, $X2):$XBD2), []> {
5186 let OpKey = !subst("mscrk", "msrkc",
5187 !subst("msgcrk", "msgrkc",
5188 mnemonic#"rk"#cls));
5190 let MemKey = mnemonic#cls;
5191 let MemType = "pseudo";
5193 let AccessBytes = bytes;
5195 let hasNoSchedulingInfo = 1;
5198 // Same as MemFoldPseudo but for mapping a W... vector instruction
5199 class MemFoldPseudo_FP<string mnemonic, RegisterOperand cls, bits<5> bytes,
5200 AddressingMode mode>
5201 : MemFoldPseudo<mnemonic, cls, bytes, mode> {
5202 let OpKey = mnemonic#"r"#"MemFold"#cls;
5205 class MemFoldPseudo_FPTern<string mnemonic, RegisterOperand cls, bits<5> bytes,
5206 AddressingMode mode>
5207 : Pseudo<(outs cls:$R1),
5208 (ins cls:$R2, cls:$R3, (mode $B2, $D2, $X2):$XBD2), []> {
5209 let OpKey = mnemonic#"r"#"MemFold"#cls;
5211 let MemKey = mnemonic#cls;
5212 let MemType = "pseudo";
5214 let AccessBytes = bytes;
5216 let hasNoSchedulingInfo = 1;
5219 // Same as MemFoldPseudo but for Load On Condition with CC operands.
5220 class MemFoldPseudo_CondMove<string mnemonic, RegisterOperand cls, bits<5> bytes,
5221 AddressingMode mode>
5222 : Pseudo<(outs cls:$R1),
5223 (ins cls:$R2, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$M3), []> {
5224 let OpKey = !subst("loc", "sel", mnemonic)#"r"#cls;
5226 let MemKey = mnemonic#cls;
5227 let MemType = "pseudo";
5229 let AccessBytes = bytes;
5230 let hasNoSchedulingInfo = 1;
5233 // Like CompareRI, but expanded after RA depending on the choice of register.
5234 class CompareRIPseudo<SDPatternOperator operator, RegisterOperand cls,
5235 ImmOpWithPattern imm>
5236 : Pseudo<(outs), (ins cls:$R1, imm:$I2),
5237 [(set CC, (operator cls:$R1, imm:$I2))]> {
5241 // Like CompareRXY, but expanded after RA depending on the choice of register.
5242 class CompareRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
5243 SDPatternOperator load, bits<5> bytes,
5244 AddressingMode mode = bdxaddr20only>
5245 : Pseudo<(outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
5246 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> {
5248 let Has20BitOffset = 1;
5250 let AccessBytes = bytes;
5253 // Like TestBinarySIL, but expanded later.
5254 class TestBinarySILPseudo<SDPatternOperator operator, ImmOpWithPattern imm>
5255 : Pseudo<(outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2),
5256 [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>;
5258 // Like CondBinaryRRF, but expanded after RA depending on the choice of
5260 class CondBinaryRRFPseudo<string mnemonic, RegisterOperand cls1,
5261 RegisterOperand cls2>
5262 : Pseudo<(outs cls1:$R1),
5263 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3),
5264 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src,
5265 cond4:$valid, cond4:$M3))]> {
5266 let Constraints = "$R1 = $R1src";
5267 let DisableEncoding = "$R1src";
5269 let NumOpsKey = !subst("loc", "sel", mnemonic);
5270 let NumOpsValue = "2";
5271 let OpKey = mnemonic#cls1;
5275 // Like CondBinaryRRFa, but expanded after RA depending on the choice of
5277 class CondBinaryRRFaPseudo<string mnemonic, RegisterOperand cls1,
5278 RegisterOperand cls2, RegisterOperand cls3>
5279 : Pseudo<(outs cls1:$R1),
5280 (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4),
5281 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3,
5282 cond4:$valid, cond4:$M4))]> {
5284 let NumOpsKey = mnemonic;
5285 let NumOpsValue = "3";
5286 let OpKey = mnemonic#cls1;
5290 // Like CondBinaryRIE, but expanded after RA depending on the choice of
5292 class CondBinaryRIEPseudo<RegisterOperand cls, ImmOpWithPattern imm>
5293 : Pseudo<(outs cls:$R1),
5294 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3),
5295 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src,
5296 cond4:$valid, cond4:$M3))]> {
5297 let Constraints = "$R1 = $R1src";
5298 let DisableEncoding = "$R1src";
5302 // Like CondUnaryRSY, but expanded after RA depending on the choice of
5304 class CondUnaryRSYPseudo<string mnemonic, SDPatternOperator operator,
5305 RegisterOperand cls, bits<5> bytes,
5306 AddressingMode mode = bdaddr20only>
5307 : Pseudo<(outs cls:$R1),
5308 (ins cls:$R1src, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$R3),
5310 (z_select_ccmask (operator mode:$BD2), cls:$R1src,
5311 cond4:$valid, cond4:$R3))]> {
5312 let Constraints = "$R1 = $R1src";
5313 let DisableEncoding = "$R1src";
5315 let AccessBytes = bytes;
5317 let OpKey = mnemonic#"r"#cls;
5319 let MemKey = mnemonic#cls;
5320 let MemType = "target";
5323 // Like CondStoreRSY, but expanded after RA depending on the choice of
5325 class CondStoreRSYPseudo<RegisterOperand cls, bits<5> bytes,
5326 AddressingMode mode = bdaddr20only>
5328 (ins cls:$R1, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$R3), []> {
5330 let AccessBytes = bytes;
5334 // Like StoreRXY, but expanded after RA depending on the choice of register.
5335 class StoreRXYPseudo<SDPatternOperator operator, RegisterOperand cls,
5336 bits<5> bytes, AddressingMode mode = bdxaddr20only>
5337 : Pseudo<(outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2),
5338 [(operator cls:$R1, mode:$XBD2)]> {
5340 let Has20BitOffset = 1;
5342 let AccessBytes = bytes;
5345 // Like RotateSelectRIEf, but expanded after RA depending on the choice
5347 class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2>
5348 : Pseudo<(outs cls1:$R1),
5349 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
5352 let Constraints = "$R1 = $R1src";
5353 let DisableEncoding = "$R1src";
5356 // Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is
5357 // the value of the PSW's 2-bit condition code field.
5358 class SelectWrapper<ValueType vt, RegisterOperand cls>
5359 : Pseudo<(outs cls:$dst),
5360 (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc),
5361 [(set (vt cls:$dst), (z_select_ccmask cls:$src1, cls:$src2,
5362 imm32zx4_timm:$valid, imm32zx4_timm:$cc))]> {
5363 let usesCustomInserter = 1;
5364 let hasNoSchedulingInfo = 1;
5368 // Stores $new to $addr if $cc is true ("" case) or false (Inv case).
5369 multiclass CondStores<RegisterOperand cls, SDPatternOperator store,
5370 SDPatternOperator load, AddressingMode mode> {
5371 let Uses = [CC], usesCustomInserter = 1, hasNoSchedulingInfo = 1,
5372 mayLoad = 1, mayStore = 1 in {
5373 def "" : Pseudo<(outs),
5374 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
5375 [(store (z_select_ccmask cls:$new, (load mode:$addr),
5376 imm32zx4_timm:$valid, imm32zx4_timm:$cc),
5378 def Inv : Pseudo<(outs),
5379 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
5380 [(store (z_select_ccmask (load mode:$addr), cls:$new,
5381 imm32zx4_timm:$valid, imm32zx4_timm:$cc),
5386 // OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation. PAT and OPERAND
5387 // describe the second (non-memory) operand.
5388 class AtomicLoadWBinary<SDPatternOperator operator, dag pat,
5390 : Pseudo<(outs GR32:$dst),
5391 (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift,
5392 ADDR32:$negbitshift, uimm32:$bitsize),
5393 [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift,
5394 ADDR32:$negbitshift, uimm32:$bitsize))]> {
5396 let Has20BitOffset = 1;
5399 let usesCustomInserter = 1;
5400 let hasNoSchedulingInfo = 1;
5403 // Specializations of AtomicLoadWBinary.
5404 class AtomicLoadWBinaryReg<SDPatternOperator operator>
5405 : AtomicLoadWBinary<operator, (i32 GR32:$src2), GR32>;
5406 class AtomicLoadWBinaryImm<SDPatternOperator operator, ImmOpWithPattern imm>
5407 : AtomicLoadWBinary<operator, (i32 imm:$src2), imm>;
5409 // A pseudo instruction that is a direct alias of a real instruction.
5410 // These aliases are used in cases where a particular register operand is
5411 // fixed or where the same instruction is used with different register sizes.
5412 // The size parameter is the size in bytes of the associated real instruction.
5413 class Alias<int size, dag outs, dag ins, list<dag> pattern>
5414 : InstSystemZ<size, outs, ins, "", pattern> {
5416 let isCodeGenOnly = 1;
5419 class UnaryAliasVRS<RegisterOperand cls1, RegisterOperand cls2>
5420 : Alias<6, (outs cls1:$src1), (ins cls2:$src2), []>;
5422 // An alias of a UnaryVRR*, but with different register sizes.
5423 class UnaryAliasVRR<SDPatternOperator operator, TypedReg tr1, TypedReg tr2>
5424 : Alias<6, (outs tr1.op:$V1), (ins tr2.op:$V2),
5425 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]>;
5427 // An alias of a UnaryVRX, but with different register sizes.
5428 class UnaryAliasVRX<SDPatternOperator operator, TypedReg tr,
5429 AddressingMode mode = bdxaddr12only>
5430 : Alias<6, (outs tr.op:$V1), (ins (mode $B2, $D2, $X2):$XBD2),
5431 [(set (tr.vt tr.op:$V1), (operator mode:$XBD2))]>;
5433 // An alias of a StoreVRX, but with different register sizes.
5434 class StoreAliasVRX<SDPatternOperator operator, TypedReg tr,
5435 AddressingMode mode = bdxaddr12only>
5436 : Alias<6, (outs), (ins tr.op:$V1, (mode $B2, $D2, $X2):$XBD2),
5437 [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>;
5439 // An alias of a BinaryRI, but with different register sizes.
5440 class BinaryAliasRI<SDPatternOperator operator, RegisterOperand cls,
5441 ImmOpWithPattern imm>
5442 : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
5443 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
5444 let Constraints = "$R1 = $R1src";
5447 // An alias of a BinaryRIL, but with different register sizes.
5448 class BinaryAliasRIL<SDPatternOperator operator, RegisterOperand cls,
5449 ImmOpWithPattern imm>
5450 : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
5451 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
5452 let Constraints = "$R1 = $R1src";
5455 // An alias of a BinaryVRRf, but with different register sizes.
5456 class BinaryAliasVRRf<RegisterOperand cls>
5457 : Alias<6, (outs VR128:$V1), (ins cls:$R2, cls:$R3), []>;
5459 // An alias of a CompareRI, but with different register sizes.
5460 class CompareAliasRI<SDPatternOperator operator, RegisterOperand cls,
5461 ImmOpWithPattern imm>
5462 : Alias<4, (outs), (ins cls:$R1, imm:$I2),
5463 [(set CC, (operator cls:$R1, imm:$I2))]> {
5467 // An alias of a RotateSelectRIEf, but with different register sizes.
5468 class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2>
5469 : Alias<6, (outs cls1:$R1),
5470 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
5471 imm32zx8:$I5), []> {
5472 let Constraints = "$R1 = $R1src";
5475 class MemsetPseudo<DAGOperand lenop, DAGOperand byteop>
5476 : Pseudo<(outs), (ins bdaddr12only:$dest, lenop:$length, byteop:$B),
5477 [(z_memset_mvc bdaddr12only:$dest, lenop:$length, byteop:$B)]> {
5481 let usesCustomInserter = 1;
5482 let hasNoSchedulingInfo = 1;
5485 //===----------------------------------------------------------------------===//
5486 // Multiclasses that emit both real and pseudo instructions
5487 //===----------------------------------------------------------------------===//
5489 multiclass BinaryRXYAndPseudo<string mnemonic, bits<16> opcode,
5490 SDPatternOperator operator, RegisterOperand cls,
5491 SDPatternOperator load, bits<5> bytes,
5492 AddressingMode mode = bdxaddr20only> {
5493 def "" : BinaryRXY<mnemonic, opcode, operator, cls, load, bytes, mode> {
5494 let MemKey = mnemonic#cls;
5495 let MemType = "target";
5497 let Has20BitOffset = 1 in
5498 def _MemFoldPseudo : MemFoldPseudo<mnemonic, cls, bytes, mode>;
5501 multiclass BinaryRXPairAndPseudo<string mnemonic, bits<8> rxOpcode,
5502 bits<16> rxyOpcode, SDPatternOperator operator,
5503 RegisterOperand cls,
5504 SDPatternOperator load, bits<5> bytes> {
5505 let DispKey = mnemonic # cls in {
5506 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes,
5508 let DispSize = "12";
5509 let MemKey = mnemonic#cls;
5510 let MemType = "target";
5512 let DispSize = "20" in
5513 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load,
5514 bytes, bdxaddr20pair>;
5516 def _MemFoldPseudo : MemFoldPseudo<mnemonic, cls, bytes, bdxaddr12pair>;
5519 multiclass BinaryRXEAndPseudo<string mnemonic, bits<16> opcode,
5520 SDPatternOperator operator, RegisterOperand cls,
5521 SDPatternOperator load, bits<5> bytes> {
5522 def "" : BinaryRXE<mnemonic, opcode, operator, cls, load, bytes> {
5523 let MemKey = mnemonic#cls;
5524 let MemType = "target";
5526 def _MemFoldPseudo : MemFoldPseudo_FP<mnemonic, cls, bytes, bdxaddr12pair>;
5529 multiclass TernaryRXFAndPseudo<string mnemonic, bits<16> opcode,
5530 SDPatternOperator operator, RegisterOperand cls1,
5531 RegisterOperand cls2, SDPatternOperator load,
5533 def "" : TernaryRXF<mnemonic, opcode, operator, cls1, cls2, load, bytes> {
5534 let MemKey = mnemonic#cls1;
5535 let MemType = "target";
5537 def _MemFoldPseudo : MemFoldPseudo_FPTern<mnemonic, cls1, bytes, bdxaddr12pair>;
5540 multiclass CondUnaryRSYPairAndMemFold<string mnemonic, bits<16> opcode,
5541 SDPatternOperator operator,
5542 RegisterOperand cls, bits<5> bytes,
5543 AddressingMode mode = bdaddr20only> {
5544 defm "" : CondUnaryRSYPair<mnemonic, opcode, operator, cls, bytes, mode>;
5545 def _MemFoldPseudo : MemFoldPseudo_CondMove<mnemonic, cls, bytes, mode>;
5548 multiclass CondUnaryRSYPseudoAndMemFold<string mnemonic,
5549 SDPatternOperator operator,
5550 RegisterOperand cls, bits<5> bytes,
5551 AddressingMode mode = bdaddr20only> {
5552 def "" : CondUnaryRSYPseudo<mnemonic, operator, cls, bytes, mode>;
5553 def _MemFoldPseudo : MemFoldPseudo_CondMove<mnemonic, cls, bytes, mode>;
5556 // Define an instruction that operates on two fixed-length blocks of memory,
5557 // and associated pseudo instructions for operating on blocks of any size.
5558 // There are two pseudos for the different cases of when the length is
5559 // constant or variable. The length operand of a pseudo is actually one less
5560 // than the intended number of bytes, since the register case needs to use an
5561 // EXRL with a target instruction that adds one to the length always.
5562 multiclass MemorySS<string mnemonic, bits<8> opcode, SDPatternOperator memop> {
5563 def "" : SideEffectBinarySSa<mnemonic, opcode>;
5564 let usesCustomInserter = 1, hasNoSchedulingInfo = 1, Defs = [CC] in {
5565 def Imm : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5567 [(memop bdaddr12only:$dest, bdaddr12only:$src,
5569 def Reg : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5571 [(memop bdaddr12only:$dest, bdaddr12only:$src,
5576 // The same, but setting a CC result as comparison operator.
5577 multiclass CompareMemorySS<string mnemonic, bits<8> opcode,
5578 SDPatternOperator memop> {
5579 def "" : SideEffectBinarySSa<mnemonic, opcode>;
5580 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in {
5581 def Imm : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5583 [(set CC, (memop bdaddr12only:$dest, bdaddr12only:$src,
5585 def Reg : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src,
5587 [(set CC, (memop bdaddr12only:$dest, bdaddr12only:$src,
5592 // Define an instruction that operates on two strings, both terminated
5593 // by the character in R0. The instruction processes a CPU-determinated
5594 // number of bytes at a time and sets CC to 3 if the instruction needs
5595 // to be repeated. Also define a pseudo instruction that represents
5596 // the full loop (the main instruction plus the branch on CC==3).
5597 multiclass StringRRE<string mnemonic, bits<16> opcode,
5598 SDPatternOperator operator> {
5600 def "" : SideEffectBinaryMemMemRRE<mnemonic, opcode, GR64, GR64>;
5601 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in
5602 def Loop : Pseudo<(outs GR64:$end),
5603 (ins GR64:$start1, GR64:$start2, GR32:$char),
5604 [(set GR64:$end, (operator GR64:$start1, GR64:$start2,