//==- SystemZInstrFormats.td - SystemZ Instruction Formats --*- tablegen -*-==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // Basic SystemZ instruction definition //===----------------------------------------------------------------------===// class InstSystemZ pattern> : Instruction { let Namespace = "SystemZ"; dag OutOperandList = outs; dag InOperandList = ins; let Size = size; let Pattern = pattern; let AsmString = asmstr; let hasSideEffects = 0; let mayLoad = 0; let mayStore = 0; // Some instructions come in pairs, one having a 12-bit displacement // and the other having a 20-bit displacement. Both instructions in // the pair have the same DispKey and their DispSizes are "12" and "20" // respectively. string DispKey = ""; string DispSize = "none"; // Many register-based R instructions have a memory-based // counterpart. OpKey uniquely identifies R, while OpType is // "reg" for R and "mem" for . string OpKey = ""; string OpType = "none"; // MemKey identifies a targe reg-mem opcode, while MemType can be either // "pseudo" or "target". This is used to map a pseduo memory instruction to // its corresponding target opcode. See comment at MemFoldPseudo. string MemKey = ""; string MemType = "none"; // Many distinct-operands instructions have older 2-operand equivalents. // NumOpsKey uniquely identifies one of these 2-operand and 3-operand pairs, // with NumOpsValue being "2" or "3" as appropriate. string NumOpsKey = ""; string NumOpsValue = "none"; // True if this instruction is a simple D(X,B) load of a register // (with no sign or zero extension). bit SimpleBDXLoad = 0; // True if this instruction is a simple D(X,B) store of a register // (with no truncation). bit SimpleBDXStore = 0; // True if this instruction has a 20-bit displacement field. bit Has20BitOffset = 0; // True if addresses in this instruction have an index register. bit HasIndex = 0; // True if this is a 128-bit pseudo instruction that combines two 64-bit // operations. bit Is128Bit = 0; // The access size of all memory operands in bytes, or 0 if not known. bits<5> AccessBytes = 0; // If the instruction sets CC to a useful value, this gives the mask // of all possible CC results. The mask has the same form as // SystemZ::CCMASK_*. bits<4> CCValues = 0; // The subset of CCValues that have the same meaning as they would after a // comparison of the first operand against zero. "Logical" instructions // leave this blank as they set CC in a different way. bits<4> CompareZeroCCMask = 0; // True if the instruction is conditional and if the CC mask operand // comes first (as for BRC, etc.). bit CCMaskFirst = 0; // Similar, but true if the CC mask operand comes last (as for LOC, etc.). bit CCMaskLast = 0; // True if the instruction is the "logical" rather than "arithmetic" form, // in cases where a distinction exists. Except for logical compares, if the // instruction sets this flag along with a non-zero CCValues field, it is // assumed to set CC to either CCMASK_LOGICAL_ZERO or // CCMASK_LOGICAL_NONZERO. bit IsLogical = 0; // True if the (add or sub) instruction sets CC like a compare of the // result against zero, but only if the 'nsw' flag is set. bit CCIfNoSignedWrap = 0; let TSFlags{0} = SimpleBDXLoad; let TSFlags{1} = SimpleBDXStore; let TSFlags{2} = Has20BitOffset; let TSFlags{3} = HasIndex; let TSFlags{4} = Is128Bit; let TSFlags{9-5} = AccessBytes; let TSFlags{13-10} = CCValues; let TSFlags{17-14} = CompareZeroCCMask; let TSFlags{18} = CCMaskFirst; let TSFlags{19} = CCMaskLast; let TSFlags{20} = IsLogical; let TSFlags{21} = CCIfNoSignedWrap; } //===----------------------------------------------------------------------===// // Mappings between instructions //===----------------------------------------------------------------------===// // Return the version of an instruction that has an unsigned 12-bit // displacement. def getDisp12Opcode : InstrMapping { let FilterClass = "InstSystemZ"; let RowFields = ["DispKey"]; let ColFields = ["DispSize"]; let KeyCol = ["20"]; let ValueCols = [["12"]]; } // Return the version of an instruction that has a signed 20-bit displacement. def getDisp20Opcode : InstrMapping { let FilterClass = "InstSystemZ"; let RowFields = ["DispKey"]; let ColFields = ["DispSize"]; let KeyCol = ["12"]; let ValueCols = [["20"]]; } // Return the memory form of a register instruction. Note that this may // return a MemFoldPseudo instruction (see below). def getMemOpcode : InstrMapping { let FilterClass = "InstSystemZ"; let RowFields = ["OpKey"]; let ColFields = ["OpType"]; let KeyCol = ["reg"]; let ValueCols = [["mem"]]; } // Return the target memory instruction for a MemFoldPseudo. def getTargetMemOpcode : InstrMapping { let FilterClass = "InstSystemZ"; let RowFields = ["MemKey"]; let ColFields = ["MemType"]; let KeyCol = ["pseudo"]; let ValueCols = [["target"]]; } // Return the 2-operand form of a 3-operand instruction. def getTwoOperandOpcode : InstrMapping { let FilterClass = "InstSystemZ"; let RowFields = ["NumOpsKey"]; let ColFields = ["NumOpsValue"]; let KeyCol = ["3"]; let ValueCols = [["2"]]; } //===----------------------------------------------------------------------===// // Instruction formats //===----------------------------------------------------------------------===// // // Formats are specified using operand field declarations of the form: // // bits<4> Rn : register input or output for operand n // bits<5> Vn : vector register input or output for operand n // bits In : immediate value of width m for operand n // bits<4> Bn : base register for address operand n // bits Dn : displacement for address operand n // bits<5> Vn : vector index for address operand n // bits<4> Xn : index register for address operand n // bits<4> Mn : mode value for operand n // // The operand numbers ("n" in the list above) follow the architecture manual. // Assembly operands sometimes have a different order; in particular, R3 often // is often written between operands 1 and 2. // //===----------------------------------------------------------------------===// class InstE op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<2, outs, ins, asmstr, pattern> { field bits<16> Inst; field bits<16> SoftFail = 0; let Inst = op; } class InstI op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<2, outs, ins, asmstr, pattern> { field bits<16> Inst; field bits<16> SoftFail = 0; bits<8> I1; let Inst{15-8} = op; let Inst{7-0} = I1; } class InstIE op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> I1; bits<4> I2; let Inst{31-16} = op; let Inst{15-8} = 0; let Inst{7-4} = I1; let Inst{3-0} = I2; } class InstMII op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> M1; bits<12> RI2; bits<24> RI3; let Inst{47-40} = op; let Inst{39-36} = M1; let Inst{35-24} = RI2; let Inst{23-0} = RI3; } class InstRIa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<16> I2; let Inst{31-24} = op{11-4}; let Inst{23-20} = R1; let Inst{19-16} = op{3-0}; let Inst{15-0} = I2; } class InstRIb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<16> RI2; let Inst{31-24} = op{11-4}; let Inst{23-20} = R1; let Inst{19-16} = op{3-0}; let Inst{15-0} = RI2; } class InstRIc op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> M1; bits<16> RI2; let Inst{31-24} = op{11-4}; let Inst{23-20} = M1; let Inst{19-16} = op{3-0}; let Inst{15-0} = RI2; } class InstRIEa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<16> I2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = 0; let Inst{31-16} = I2; let Inst{15-12} = M3; let Inst{11-8} = 0; let Inst{7-0} = op{7-0}; } class InstRIEb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> R2; bits<4> M3; bits<16> RI4; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = R2; let Inst{31-16} = RI4; let Inst{15-12} = M3; let Inst{11-8} = 0; let Inst{7-0} = op{7-0}; } class InstRIEc op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<8> I2; bits<4> M3; bits<16> RI4; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = M3; let Inst{31-16} = RI4; let Inst{15-8} = I2; let Inst{7-0} = op{7-0}; } class InstRIEd op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> R3; bits<16> I2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = R3; let Inst{31-16} = I2; let Inst{15-8} = 0; let Inst{7-0} = op{7-0}; } class InstRIEe op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> R3; bits<16> RI2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = R3; let Inst{31-16} = RI2; let Inst{15-8} = 0; let Inst{7-0} = op{7-0}; } class InstRIEf op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> R2; bits<8> I3; bits<8> I4; bits<8> I5; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = R2; let Inst{31-24} = I3; let Inst{23-16} = I4; let Inst{15-8} = I5; let Inst{7-0} = op{7-0}; } class InstRIEg op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> M3; bits<16> I2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = M3; let Inst{31-16} = I2; let Inst{15-8} = 0; let Inst{7-0} = op{7-0}; } class InstRILa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<32> I2; let Inst{47-40} = op{11-4}; let Inst{39-36} = R1; let Inst{35-32} = op{3-0}; let Inst{31-0} = I2; } class InstRILb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<32> RI2; let Inst{47-40} = op{11-4}; let Inst{39-36} = R1; let Inst{35-32} = op{3-0}; let Inst{31-0} = RI2; } class InstRILc op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> M1; bits<32> RI2; let Inst{47-40} = op{11-4}; let Inst{39-36} = M1; let Inst{35-32} = op{3-0}; let Inst{31-0} = RI2; } class InstRIS op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<8> I2; bits<4> M3; bits<4> B4; bits<12> D4; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = M3; let Inst{31-28} = B4; let Inst{27-16} = D4; let Inst{15-8} = I2; let Inst{7-0} = op{7-0}; } class InstRR op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<2, outs, ins, asmstr, pattern> { field bits<16> Inst; field bits<16> SoftFail = 0; bits<4> R1; bits<4> R2; let Inst{15-8} = op; let Inst{7-4} = R1; let Inst{3-0} = R2; } class InstRRD op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> R3; bits<4> R2; let Inst{31-16} = op; let Inst{15-12} = R1; let Inst{11-8} = 0; let Inst{7-4} = R3; let Inst{3-0} = R2; } class InstRRE op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> R2; let Inst{31-16} = op; let Inst{15-8} = 0; let Inst{7-4} = R1; let Inst{3-0} = R2; } class InstRRFa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> R2; bits<4> R3; bits<4> M4; let Inst{31-16} = op; let Inst{15-12} = R3; let Inst{11-8} = M4; let Inst{7-4} = R1; let Inst{3-0} = R2; } class InstRRFb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> R2; bits<4> R3; bits<4> M4; let Inst{31-16} = op; let Inst{15-12} = R3; let Inst{11-8} = M4; let Inst{7-4} = R1; let Inst{3-0} = R2; } class InstRRFc op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> R2; bits<4> M3; let Inst{31-16} = op; let Inst{15-12} = M3; let Inst{11-8} = 0; let Inst{7-4} = R1; let Inst{3-0} = R2; } class InstRRFd op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> R2; bits<4> M4; let Inst{31-16} = op; let Inst{15-12} = 0; let Inst{11-8} = M4; let Inst{7-4} = R1; let Inst{3-0} = R2; } class InstRRFe op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> R2; bits<4> M3; bits<4> M4; let Inst{31-16} = op; let Inst{15-12} = M3; let Inst{11-8} = M4; let Inst{7-4} = R1; let Inst{3-0} = R2; } class InstRRS op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> R2; bits<4> M3; bits<4> B4; bits<12> D4; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = R2; let Inst{31-28} = B4; let Inst{27-16} = D4; let Inst{15-12} = M3; let Inst{11-8} = 0; let Inst{7-0} = op{7-0}; } class InstRXa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> X2; bits<4> B2; bits<12> D2; let Inst{31-24} = op; let Inst{23-20} = R1; let Inst{19-16} = X2; let Inst{15-12} = B2; let Inst{11-0} = D2; let HasIndex = 1; } class InstRXb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> M1; bits<4> X2; bits<4> B2; bits<12> D2; let Inst{31-24} = op; let Inst{23-20} = M1; let Inst{19-16} = X2; let Inst{15-12} = B2; let Inst{11-0} = D2; let HasIndex = 1; } class InstRXE op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> X2; bits<4> B2; bits<12> D2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = X2; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = M3; let Inst{11-8} = 0; let Inst{7-0} = op{7-0}; let HasIndex = 1; } class InstRXF op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> R3; bits<4> X2; bits<4> B2; bits<12> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R3; let Inst{35-32} = X2; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = R1; let Inst{11-8} = 0; let Inst{7-0} = op{7-0}; let HasIndex = 1; } class InstRXYa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> X2; bits<4> B2; bits<20> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = X2; let Inst{31-28} = B2; let Inst{27-16} = D2{11-0}; let Inst{15-8} = D2{19-12}; let Inst{7-0} = op{7-0}; let Has20BitOffset = 1; let HasIndex = 1; } class InstRXYb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> M1; bits<4> X2; bits<4> B2; bits<20> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = M1; let Inst{35-32} = X2; let Inst{31-28} = B2; let Inst{27-16} = D2{11-0}; let Inst{15-8} = D2{19-12}; let Inst{7-0} = op{7-0}; let Has20BitOffset = 1; let HasIndex = 1; } class InstRSa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> R3; bits<4> B2; bits<12> D2; let Inst{31-24} = op; let Inst{23-20} = R1; let Inst{19-16} = R3; let Inst{15-12} = B2; let Inst{11-0} = D2; } class InstRSb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> M3; bits<4> B2; bits<12> D2; let Inst{31-24} = op; let Inst{23-20} = R1; let Inst{19-16} = M3; let Inst{15-12} = B2; let Inst{11-0} = D2; } class InstRSEa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> R3; bits<4> B2; bits<12> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = R3; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-8} = 0; let Inst{7-0} = op{7-0}; } class InstRSI op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> R1; bits<4> R3; bits<16> RI2; let Inst{31-24} = op; let Inst{23-20} = R1; let Inst{19-16} = R3; let Inst{15-0} = RI2; } class InstRSLa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> B1; bits<12> D1; bits<4> L1; let Inst{47-40} = op{15-8}; let Inst{39-36} = L1; let Inst{35-32} = 0; let Inst{31-28} = B1; let Inst{27-16} = D1; let Inst{15-8} = 0; let Inst{7-0} = op{7-0}; } class InstRSLb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> B2; bits<12> D2; bits<8> L2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-32} = L2; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = R1; let Inst{11-8} = M3; let Inst{7-0} = op{7-0}; } class InstRSYa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> R3; bits<4> B2; bits<20> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = R3; let Inst{31-28} = B2; let Inst{27-16} = D2{11-0}; let Inst{15-8} = D2{19-12}; let Inst{7-0} = op{7-0}; let Has20BitOffset = 1; } class InstRSYb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> M3; bits<4> B2; bits<20> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = M3; let Inst{31-28} = B2; let Inst{27-16} = D2{11-0}; let Inst{15-8} = D2{19-12}; let Inst{7-0} = op{7-0}; let Has20BitOffset = 1; } class InstSI op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> B1; bits<12> D1; bits<8> I2; let Inst{31-24} = op; let Inst{23-16} = I2; let Inst{15-12} = B1; let Inst{11-0} = D1; } class InstSIL op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> B1; bits<12> D1; bits<16> I2; let Inst{47-32} = op; let Inst{31-28} = B1; let Inst{27-16} = D1; let Inst{15-0} = I2; } class InstSIY op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> B1; bits<20> D1; bits<8> I2; let Inst{47-40} = op{15-8}; let Inst{39-32} = I2; let Inst{31-28} = B1; let Inst{27-16} = D1{11-0}; let Inst{15-8} = D1{19-12}; let Inst{7-0} = op{7-0}; let Has20BitOffset = 1; } class InstSMI op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> M1; bits<16> RI2; bits<4> B3; bits<12> D3; let Inst{47-40} = op; let Inst{39-36} = M1; let Inst{35-32} = 0; let Inst{31-28} = B3; let Inst{27-16} = D3; let Inst{15-0} = RI2; } class InstSSa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> B1; bits<12> D1; bits<8> L1; bits<4> B2; bits<12> D2; let Inst{47-40} = op; let Inst{39-32} = L1; let Inst{31-28} = B1; let Inst{27-16} = D1; let Inst{15-12} = B2; let Inst{11-0} = D2; } class InstSSb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> B1; bits<12> D1; bits<4> L1; bits<4> B2; bits<12> D2; bits<4> L2; let Inst{47-40} = op; let Inst{39-36} = L1; let Inst{35-32} = L2; let Inst{31-28} = B1; let Inst{27-16} = D1; let Inst{15-12} = B2; let Inst{11-0} = D2; } class InstSSc op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> B1; bits<12> D1; bits<4> L1; bits<4> B2; bits<12> D2; bits<4> I3; let Inst{47-40} = op; let Inst{39-36} = L1; let Inst{35-32} = I3; let Inst{31-28} = B1; let Inst{27-16} = D1; let Inst{15-12} = B2; let Inst{11-0} = D2; } class InstSSd op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> B1; bits<12> D1; bits<4> B2; bits<12> D2; bits<4> R3; let Inst{47-40} = op; let Inst{39-36} = R1; let Inst{35-32} = R3; let Inst{31-28} = B1; let Inst{27-16} = D1; let Inst{15-12} = B2; let Inst{11-0} = D2; } class InstSSe op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> B2; bits<12> D2; bits<4> R3; bits<4> B4; bits<12> D4; let Inst{47-40} = op; let Inst{39-36} = R1; let Inst{35-32} = R3; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = B4; let Inst{11-0} = D4; } class InstSSf op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> B1; bits<12> D1; bits<4> B2; bits<12> D2; bits<8> L2; let Inst{47-40} = op; let Inst{39-32} = L2; let Inst{31-28} = B1; let Inst{27-16} = D1; let Inst{15-12} = B2; let Inst{11-0} = D2; } class InstSSE op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> B1; bits<12> D1; bits<4> B2; bits<12> D2; let Inst{47-32} = op; let Inst{31-28} = B1; let Inst{27-16} = D1; let Inst{15-12} = B2; let Inst{11-0} = D2; } class InstSSF op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> B1; bits<12> D1; bits<4> B2; bits<12> D2; bits<4> R3; let Inst{47-40} = op{11-4}; let Inst{39-36} = R3; let Inst{35-32} = op{3-0}; let Inst{31-28} = B1; let Inst{27-16} = D1; let Inst{15-12} = B2; let Inst{11-0} = D2; } class InstS op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; field bits<32> SoftFail = 0; bits<4> B2; bits<12> D2; let Inst{31-16} = op; let Inst{15-12} = B2; let Inst{11-0} = D2; } class InstVRIa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<16> I2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = 0; let Inst{31-16} = I2; let Inst{15-12} = M3; let Inst{11} = V1{4}; let Inst{10-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRIb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<8> I2; bits<8> I3; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = 0; let Inst{31-24} = I2; let Inst{23-16} = I3; let Inst{15-12} = M4; let Inst{11} = V1{4}; let Inst{10-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRIc op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V3; bits<16> I2; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V3{3-0}; let Inst{31-16} = I2; let Inst{15-12} = M4; let Inst{11} = V1{4}; let Inst{10} = V3{4}; let Inst{9-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRId op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<5> V3; bits<8> I4; bits<4> M5; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-28} = V3{3-0}; let Inst{27-24} = 0; let Inst{23-16} = I4; let Inst{15-12} = M5; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9} = V3{4}; let Inst{8} = 0; let Inst{7-0} = op{7-0}; } class InstVRIe op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<12> I3; bits<4> M4; bits<4> M5; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-20} = I3; let Inst{19-16} = M5; let Inst{15-12} = M4; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRIf op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<5> V3; bits<8> I4; bits<4> M5; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-28} = V3{3-0}; let Inst{27-24} = 0; let Inst{23-20} = M5; let Inst{19-12} = I4; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9} = V3{4}; let Inst{8} = 0; let Inst{7-0} = op{7-0}; } class InstVRIg op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<8> I3; bits<8> I4; bits<4> M5; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-24} = I4; let Inst{23-20} = M5; let Inst{19-12} = I3; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRIh op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<16> I2; bits<4> I3; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = 0; let Inst{31-16} = I2; let Inst{15-12} = I3; let Inst{11} = V1{4}; let Inst{10-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRIi op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<4> R2; bits<8> I3; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = R2; let Inst{31-24} = 0; let Inst{23-20} = M4; let Inst{19-12} = I3; let Inst{11} = V1{4}; let Inst{10-8} = 0; let Inst{7-0} = op{7-0}; } // Depending on the instruction mnemonic, certain bits may be or-ed into // the M4 value provided as explicit operand. These are passed as m4or. class InstVRRa op, dag outs, dag ins, string asmstr, list pattern, bits<4> m4or = 0> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<4> M3; bits<4> M4; bits<4> M5; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-24} = 0; let Inst{23-20} = M5; let Inst{19} = !if (!eq (m4or{3}, 1), 1, M4{3}); let Inst{18} = !if (!eq (m4or{2}, 1), 1, M4{2}); let Inst{17} = !if (!eq (m4or{1}, 1), 1, M4{1}); let Inst{16} = !if (!eq (m4or{0}, 1), 1, M4{0}); let Inst{15-12} = M3; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9-8} = 0; let Inst{7-0} = op{7-0}; } // Depending on the instruction mnemonic, certain bits may be or-ed into // the M5 value provided as explicit operand. These are passed as m5or. class InstVRRb op, dag outs, dag ins, string asmstr, list pattern, bits<4> m5or = 0> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<5> V3; bits<4> M4; bits<4> M5; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-28} = V3{3-0}; let Inst{27-24} = 0; let Inst{23} = !if (!eq (m5or{3}, 1), 1, M5{3}); let Inst{22} = !if (!eq (m5or{2}, 1), 1, M5{2}); let Inst{21} = !if (!eq (m5or{1}, 1), 1, M5{1}); let Inst{20} = !if (!eq (m5or{0}, 1), 1, M5{0}); let Inst{19-16} = 0; let Inst{15-12} = M4; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9} = V3{4}; let Inst{8} = 0; let Inst{7-0} = op{7-0}; } class InstVRRc op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<5> V3; bits<4> M4; bits<4> M5; bits<4> M6; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-28} = V3{3-0}; let Inst{27-24} = 0; let Inst{23-20} = M6; let Inst{19-16} = M5; let Inst{15-12} = M4; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9} = V3{4}; let Inst{8} = 0; let Inst{7-0} = op{7-0}; } // Depending on the instruction mnemonic, certain bits may be or-ed into // the M6 value provided as explicit operand. These are passed as m6or. class InstVRRd op, dag outs, dag ins, string asmstr, list pattern, bits<4> m6or = 0> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<5> V3; bits<5> V4; bits<4> M5; bits<4> M6; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-28} = V3{3-0}; let Inst{27-24} = M5; let Inst{23} = !if (!eq (m6or{3}, 1), 1, M6{3}); let Inst{22} = !if (!eq (m6or{2}, 1), 1, M6{2}); let Inst{21} = !if (!eq (m6or{1}, 1), 1, M6{1}); let Inst{20} = !if (!eq (m6or{0}, 1), 1, M6{0}); let Inst{19-16} = 0; let Inst{15-12} = V4{3-0}; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9} = V3{4}; let Inst{8} = V4{4}; let Inst{7-0} = op{7-0}; } class InstVRRe op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<5> V3; bits<5> V4; bits<4> M5; bits<4> M6; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-28} = V3{3-0}; let Inst{27-24} = M6; let Inst{23-20} = 0; let Inst{19-16} = M5; let Inst{15-12} = V4{3-0}; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9} = V3{4}; let Inst{8} = V4{4}; let Inst{7-0} = op{7-0}; } class InstVRRf op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<4> R2; bits<4> R3; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = R2; let Inst{31-28} = R3; let Inst{27-12} = 0; let Inst{11} = V1{4}; let Inst{10-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRRg op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; let Inst{47-40} = op{15-8}; let Inst{39-36} = 0; let Inst{35-32} = V1{3-0}; let Inst{31-12} = 0; let Inst{11} = 0; let Inst{10} = V1{4}; let Inst{9-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRRh op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-36} = 0; let Inst{35-32} = V1{3-0}; let Inst{31-28} = V2{3-0}; let Inst{27-24} = 0; let Inst{23-20} = M3; let Inst{19-12} = 0; let Inst{11} = 0; let Inst{10} = V1{4}; let Inst{9} = V2{4}; let Inst{8} = 0; let Inst{7-0} = op{7-0}; } class InstVRRi op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<5> V2; bits<4> M3; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = V2{3-0}; let Inst{31-24} = 0; let Inst{23-20} = M3; let Inst{19-16} = M4; let Inst{15-12} = 0; let Inst{11} = 0; let Inst{10} = V2{4}; let Inst{9-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRRj op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<5> V3; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-28} = V3{3-0}; let Inst{27-24} = 0; let Inst{23-20} = M4; let Inst{19-16} = 0; let Inst{15-12} = 0; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9} = V3{4}; let Inst{8} = 0; let Inst{7-0} = op{7-0}; } class InstVRRk op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-28} = 0; let Inst{27-24} = 0; let Inst{23-20} = M3; let Inst{19-16} = 0; let Inst{15-12} = 0; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9} = 0; let Inst{8} = 0; let Inst{7-0} = op{7-0}; } class InstVRSa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<4> B2; bits<12> D2; bits<5> V3; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V3{3-0}; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = M4; let Inst{11} = V1{4}; let Inst{10} = V3{4}; let Inst{9-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRSb op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<4> B2; bits<12> D2; bits<4> R3; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = R3; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = M4; let Inst{11} = V1{4}; let Inst{10-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRSc op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<4> R1; bits<4> B2; bits<12> D2; bits<5> V3; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = V3{3-0}; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = M4; let Inst{11} = 0; let Inst{10} = V3{4}; let Inst{9-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRSd op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<4> B2; bits<12> D2; bits<4> R3; let Inst{47-40} = op{15-8}; let Inst{39-36} = 0; let Inst{35-32} = R3; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = V1{3-0}; let Inst{11-9} = 0; let Inst{8} = V1{4}; let Inst{7-0} = op{7-0}; } class InstVRV op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<5> V2; bits<4> B2; bits<12> D2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V2{3-0}; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = M3; let Inst{11} = V1{4}; let Inst{10} = V2{4}; let Inst{9-8} = 0; let Inst{7-0} = op{7-0}; } class InstVRX op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<4> X2; bits<4> B2; bits<12> D2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = X2; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = M3; let Inst{11} = V1{4}; let Inst{10-8} = 0; let Inst{7-0} = op{7-0}; } class InstVSI op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<6, outs, ins, asmstr, pattern> { field bits<48> Inst; field bits<48> SoftFail = 0; bits<5> V1; bits<4> B2; bits<12> D2; bits<8> I3; let Inst{47-40} = op{15-8}; let Inst{39-32} = I3; let Inst{31-28} = B2; let Inst{27-16} = D2; let Inst{15-12} = V1{3-0}; let Inst{11-9} = 0; let Inst{8} = V1{4}; let Inst{7-0} = op{7-0}; } //===----------------------------------------------------------------------===// // Instruction classes for .insn directives //===----------------------------------------------------------------------===// class DirectiveInsnE pattern> : InstE<0, outs, ins, asmstr, pattern> { bits<16> enc; let Inst = enc; } class DirectiveInsnRI pattern> : InstRIa<0, outs, ins, asmstr, pattern> { bits<32> enc; let Inst{31-24} = enc{31-24}; let Inst{19-16} = enc{19-16}; } class DirectiveInsnRIE pattern> : InstRIEd<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnRIL pattern> : InstRILa<0, outs, ins, asmstr, pattern> { bits<48> enc; string type; let Inst{47-40} = enc{47-40}; let Inst{35-32} = enc{35-32}; } class DirectiveInsnRIS pattern> : InstRIS<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnRR pattern> : InstRR<0, outs, ins, asmstr, pattern> { bits<16> enc; let Inst{15-8} = enc{15-8}; } class DirectiveInsnRRE pattern> : InstRRE<0, outs, ins, asmstr, pattern> { bits<32> enc; let Inst{31-16} = enc{31-16}; } class DirectiveInsnRRF pattern> : InstRRFa<0, outs, ins, asmstr, pattern> { bits<32> enc; let Inst{31-16} = enc{31-16}; } class DirectiveInsnRRS pattern> : InstRRS<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnRS pattern> : InstRSa<0, outs, ins, asmstr, pattern> { bits<32> enc; let Inst{31-24} = enc{31-24}; } class DirectiveInsnRSE pattern> : InstRSEa<6, outs, ins, asmstr, pattern> { bits <48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnRSI pattern> : InstRSI<0, outs, ins, asmstr, pattern> { bits<32> enc; let Inst{31-24} = enc{31-24}; } class DirectiveInsnRSY pattern> : InstRSYa<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnRX pattern> : InstRXa<0, outs, ins, asmstr, pattern> { bits<32> enc; let Inst{31-24} = enc{31-24}; } class DirectiveInsnRXE pattern> : InstRXE<0, outs, ins, asmstr, pattern> { bits<48> enc; let M3 = 0; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnRXF pattern> : InstRXF<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnRXY pattern> : InstRXYa<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnS pattern> : InstS<0, outs, ins, asmstr, pattern> { bits<32> enc; let Inst{31-16} = enc{31-16}; } class DirectiveInsnSI pattern> : InstSI<0, outs, ins, asmstr, pattern> { bits<32> enc; let Inst{31-24} = enc{31-24}; } class DirectiveInsnSIY pattern> : InstSIY<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnSIL pattern> : InstSIL<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-32} = enc{47-32}; } class DirectiveInsnSS pattern> : InstSSd<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; } class DirectiveInsnSSE pattern> : InstSSE<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-32} = enc{47-32}; } class DirectiveInsnSSF pattern> : InstSSF<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{35-32} = enc{35-32}; } class DirectiveInsnVRI pattern> : InstVRIe<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnVRR pattern> : InstVRRc<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnVRS pattern> : InstVRSc<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnVRV pattern> : InstVRV<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnVRX pattern> : InstVRX<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } class DirectiveInsnVSI pattern> : InstVSI<0, outs, ins, asmstr, pattern> { bits<48> enc; let Inst{47-40} = enc{47-40}; let Inst{7-0} = enc{7-0}; } //===----------------------------------------------------------------------===// // Variants of instructions with condition mask //===----------------------------------------------------------------------===// // // For instructions using a condition mask (e.g. conditional branches, // compare-and-branch instructions, or conditional move instructions), // we generally need to create multiple instruction patterns: // // - One used for code generation, which encodes the condition mask as an // MI operand, but writes out an extended mnemonic for better readability. // - One pattern for the base form of the instruction with an explicit // condition mask (encoded as a plain integer MI operand). // - Specific patterns for each extended mnemonic, where the condition mask // is implied by the pattern name and not otherwise encoded at all. // // We need the latter primarily for the assembler and disassembler, since the // assembler parser is not able to decode part of an instruction mnemonic // into an operand. Thus we provide separate patterns for each mnemonic. // // Note that in some cases there are two different mnemonics for the same // condition mask. In this case we cannot have both instructions available // to the disassembler at the same time since the encodings are not distinct. // Therefore the alternate forms are marked isAsmParserOnly. // // We don't make one of the two names an alias of the other because // we need the custom parsing routines to select the correct register class. // // This section provides helpers for generating the specific forms. // //===----------------------------------------------------------------------===// // A class to describe a variant of an instruction with condition mask. class CondVariant ccmaskin, string suffixin, bit alternatein, string asmvariantin = ""> { // The fixed condition mask to use. bits<4> ccmask = ccmaskin; // The suffix to use for the extended assembler mnemonic. string suffix = suffixin; // Whether this is an alternate that needs to be marked isAsmParserOnly. bit alternate = alternatein; // Whether this needs be to restricted to a specific dialect. // Valid values are "att" and "hlasm", which when passed in // will set AsmVariantName. string asmvariant = asmvariantin; } // Condition mask 15 means "always true", which is used to define // unconditional branches as a variant of conditional branches. def CondAlways : CondVariant<15, "", 0>; // Condition masks for general instructions that can set all 4 bits. def CondVariantO : CondVariant<1, "o", 0>; def CondVariantH : CondVariant<2, "h", 0>; def CondVariantP : CondVariant<2, "p", 1>; def CondVariantNLE : CondVariant<3, "nle", 0, "att">; def CondVariantL : CondVariant<4, "l", 0>; def CondVariantM : CondVariant<4, "m", 1>; def CondVariantNHE : CondVariant<5, "nhe", 0, "att">; def CondVariantLH : CondVariant<6, "lh", 0, "att">; def CondVariantNE : CondVariant<7, "ne", 0>; def CondVariantNZ : CondVariant<7, "nz", 1>; def CondVariantE : CondVariant<8, "e", 0>; def CondVariantZ : CondVariant<8, "z", 1>; def CondVariantNLH : CondVariant<9, "nlh", 0, "att">; def CondVariantHE : CondVariant<10, "he", 0, "att">; def CondVariantNL : CondVariant<11, "nl", 0>; def CondVariantNM : CondVariant<11, "nm", 1>; def CondVariantLE : CondVariant<12, "le", 0, "att">; def CondVariantNH : CondVariant<13, "nh", 0>; def CondVariantNP : CondVariant<13, "np", 1>; def CondVariantNO : CondVariant<14, "no", 0>; // A helper class to look up one of the above by name. class CV : CondVariant("CondVariant"#name).ccmask, !cast("CondVariant"#name).suffix, !cast("CondVariant"#name).alternate, !cast("CondVariant"#name).asmvariant>; // Condition masks for integer instructions (e.g. compare-and-branch). // This is like the list above, except that condition 3 is not possible // and that the low bit of the mask is therefore always 0. This means // that each condition has two names. Conditions "o" and "no" are not used. def IntCondVariantH : CondVariant<2, "h", 0>; def IntCondVariantNLE : CondVariant<2, "nle", 1, "att">; def IntCondVariantL : CondVariant<4, "l", 0>; def IntCondVariantNHE : CondVariant<4, "nhe", 1, "att">; def IntCondVariantLH : CondVariant<6, "lh", 0, "att">; def IntCondVariantNE : CondVariant<6, "ne", 1>; def IntCondVariantE : CondVariant<8, "e", 0>; def IntCondVariantNLH : CondVariant<8, "nlh", 1, "att">; def IntCondVariantHE : CondVariant<10, "he", 0, "att">; def IntCondVariantNL : CondVariant<10, "nl", 1>; def IntCondVariantLE : CondVariant<12, "le", 0, "att">; def IntCondVariantNH : CondVariant<12, "nh", 1>; // A helper class to look up one of the above by name. class ICV : CondVariant("IntCondVariant"#name).ccmask, !cast("IntCondVariant"#name).suffix, !cast("IntCondVariant"#name).alternate, !cast("IntCondVariant"#name).asmvariant>; // Defines a class that makes it easier to define // a MnemonicAlias when CondVariant's are involved. multiclass MnemonicCondBranchAlias { if !or(!eq(V.asmvariant, ""), !eq(V.asmvariant, asmvariant)) then def "" : MnemonicAlias; } //===----------------------------------------------------------------------===// // Instruction definitions with semantics //===----------------------------------------------------------------------===// // // These classes have the form [Cond], where is one // of the formats defined above and where describes the inputs // and outputs. "Cond" is used if the instruction is conditional, // in which case the 4-bit condition-code mask is added as a final operand. // can be one of: // // Inherent: // One register output operand and no input operands. // // InherentDual: // Two register output operands and no input operands. // // StoreInherent: // One address operand. The instruction stores to the address. // // SideEffectInherent: // No input or output operands, but causes some side effect. // // Branch: // One branch target. The instruction branches to the target. // // Call: // One output operand and one branch target. The instruction stores // the return address to the output operand and branches to the target. // // CmpBranch: // Two input operands and one optional branch target. The instruction // compares the two input operands and branches or traps on the result. // // BranchUnary: // One register output operand, one register input operand and one branch // target. The instructions stores a modified form of the source register // in the destination register and branches on the result. // // BranchBinary: // One register output operand, two register input operands and one branch // target. The instructions stores a modified form of one of the source // registers in the destination register and branches on the result. // // LoadMultiple: // One address input operand and two explicit output operands. // The instruction loads a range of registers from the address, // with the explicit operands giving the first and last register // to load. Other loaded registers are added as implicit definitions. // // StoreMultiple: // Two explicit input register operands and an address operand. // The instruction stores a range of registers to the address, // with the explicit operands giving the first and last register // to store. Other stored registers are added as implicit uses. // // StoreLength: // One value operand, one length operand and one address operand. // The instruction stores the value operand to the address but // doesn't write more than the number of bytes specified by the // length operand. // // LoadAddress: // One register output operand and one address operand. // // SideEffectAddress: // One address operand. No output operands, but causes some side effect. // // Unary: // One register output operand and one input operand. // // Store: // One address operand and one other input operand. The instruction // stores to the address. // // SideEffectUnary: // One input operand. No output operands, but causes some side effect. // // Binary: // One register output operand and two input operands. // // StoreBinary: // One address operand and two other input operands. The instruction // stores to the address. // // SideEffectBinary: // Two input operands. No output operands, but causes some side effect. // // Compare: // Two input operands and an implicit CC output operand. // // Test: // One or two input operands and an implicit CC output operand. If // present, the second input operand is an "address" operand used as // a test class mask. // // Ternary: // One register output operand and three input operands. // // SideEffectTernary: // Three input operands. No output operands, but causes some side effect. // // Quaternary: // One register output operand and four input operands. // // LoadAndOp: // One output operand and two input operands, one of which is an address. // The instruction both reads from and writes to the address. // // CmpSwap: // One output operand and three input operands, one of which is an address. // The instruction both reads from and writes to the address. // // RotateSelect: // One output operand and five input operands. The first two operands // are registers and the other three are immediates. // // Prefetch: // One 4-bit immediate operand and one address operand. The immediate // operand is 1 for a load prefetch and 2 for a store prefetch. // // BranchPreload: // One 4-bit immediate operand and two address operands. // // The format determines which input operands are tied to output operands, // and also determines the shape of any address operand. // // Multiclasses of the form Pair define two instructions, // one with and one with Y. The name // of the first instruction has no suffix, the name of the second has // an extra "y". // //===----------------------------------------------------------------------===// class InherentRRE opcode, RegisterOperand cls, SDPatternOperator operator> : InstRRE { let R2 = 0; } class InherentDualRRE opcode, RegisterOperand cls> : InstRRE; class InherentVRIa opcode, bits<16> value> : InstVRIa { let I2 = value; let M3 = 0; } class StoreInherentS opcode, SDPatternOperator operator, bits<5> bytes> : InstS { let mayStore = 1; let AccessBytes = bytes; } class SideEffectInherentEopcode> : InstE; class SideEffectInherentS opcode, SDPatternOperator operator> : InstS { let B2 = 0; let D2 = 0; } class SideEffectInherentRRE opcode> : InstRRE { let R1 = 0; let R2 = 0; } // Allow an optional TLS marker symbol to generate TLS call relocations. class CallRI opcode> : InstRIb; // Allow an optional TLS marker symbol to generate TLS call relocations. class CallRIL opcode> : InstRILb; class CallRR opcode> : InstRR; class CallRX opcode> : InstRXa; class CondBranchRI opcode, SDPatternOperator operator = null_frag> : InstRIc { let CCMaskFirst = 1; } class AsmCondBranchRI opcode> : InstRIc; class FixedCondBranchRI opcode, SDPatternOperator operator = null_frag> : InstRIc { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M1 = V.ccmask; } class CondBranchRIL opcode> : InstRILc { let CCMaskFirst = 1; } class AsmCondBranchRIL opcode> : InstRILc; class FixedCondBranchRIL opcode> : InstRILc { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M1 = V.ccmask; } class CondBranchRR opcode> : InstRR { let CCMaskFirst = 1; } class AsmCondBranchRR opcode> : InstRR; class FixedCondBranchRR opcode, SDPatternOperator operator = null_frag> : InstRR { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let R1 = V.ccmask; } class CondBranchRX opcode> : InstRXb { let CCMaskFirst = 1; } class AsmCondBranchRX opcode> : InstRXb; class FixedCondBranchRX opcode> : InstRXb { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M1 = V.ccmask; } class CondBranchRXY opcode> : InstRXYb { let CCMaskFirst = 1; let mayLoad = 1; } class AsmCondBranchRXY opcode> : InstRXYb { let mayLoad = 1; } class FixedCondBranchRXY opcode, SDPatternOperator operator = null_frag> : InstRXYb { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M1 = V.ccmask; let mayLoad = 1; } class CmpBranchRIEa opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIEa; class AsmCmpBranchRIEa opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIEa; class FixedCmpBranchRIEa opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIEa { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } multiclass CmpBranchRIEaPair opcode, RegisterOperand cls, ImmOpWithPattern imm> { let isCodeGenOnly = 1 in def "" : CmpBranchRIEa; def Asm : AsmCmpBranchRIEa; } class CmpBranchRIEb opcode, RegisterOperand cls> : InstRIEb; class AsmCmpBranchRIEb opcode, RegisterOperand cls> : InstRIEb; class FixedCmpBranchRIEb opcode, RegisterOperand cls> : InstRIEb { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } multiclass CmpBranchRIEbPair opcode, RegisterOperand cls> { let isCodeGenOnly = 1 in def "" : CmpBranchRIEb; def Asm : AsmCmpBranchRIEb; } class CmpBranchRIEc opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIEc; class AsmCmpBranchRIEc opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIEc; class FixedCmpBranchRIEc opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIEc { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } multiclass CmpBranchRIEcPair opcode, RegisterOperand cls, ImmOpWithPattern imm> { let isCodeGenOnly = 1 in def "" : CmpBranchRIEc; def Asm : AsmCmpBranchRIEc; } class CmpBranchRRFc opcode, RegisterOperand cls> : InstRRFc; class AsmCmpBranchRRFc opcode, RegisterOperand cls> : InstRRFc; multiclass CmpBranchRRFcPair opcode, RegisterOperand cls> { let isCodeGenOnly = 1 in def "" : CmpBranchRRFc; def Asm : AsmCmpBranchRRFc; } class FixedCmpBranchRRFc opcode, RegisterOperand cls> : InstRRFc { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } class CmpBranchRRS opcode, RegisterOperand cls> : InstRRS; class AsmCmpBranchRRS opcode, RegisterOperand cls> : InstRRS; class FixedCmpBranchRRS opcode, RegisterOperand cls> : InstRRS { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } multiclass CmpBranchRRSPair opcode, RegisterOperand cls> { let isCodeGenOnly = 1 in def "" : CmpBranchRRS; def Asm : AsmCmpBranchRRS; } class CmpBranchRIS opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIS; class AsmCmpBranchRIS opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIS; class FixedCmpBranchRIS opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIS { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } multiclass CmpBranchRISPair opcode, RegisterOperand cls, ImmOpWithPattern imm> { let isCodeGenOnly = 1 in def "" : CmpBranchRIS; def Asm : AsmCmpBranchRIS; } class CmpBranchRSYb opcode, RegisterOperand cls> : InstRSYb; class AsmCmpBranchRSYb opcode, RegisterOperand cls> : InstRSYb; multiclass CmpBranchRSYbPair opcode, RegisterOperand cls> { let isCodeGenOnly = 1 in def "" : CmpBranchRSYb; def Asm : AsmCmpBranchRSYb; } class FixedCmpBranchRSYb opcode, RegisterOperand cls> : InstRSYb { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } class BranchUnaryRI opcode, RegisterOperand cls> : InstRIb { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BranchUnaryRIL opcode, RegisterOperand cls> : InstRILb { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BranchUnaryRR opcode, RegisterOperand cls> : InstRR { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BranchUnaryRRE opcode, RegisterOperand cls> : InstRRE { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BranchUnaryRX opcode, RegisterOperand cls> : InstRXa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BranchUnaryRXY opcode, RegisterOperand cls> : InstRXYa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BranchBinaryRSI opcode, RegisterOperand cls> : InstRSI { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BranchBinaryRIEe opcode, RegisterOperand cls> : InstRIEe { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BranchBinaryRS opcode, RegisterOperand cls> : InstRSa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BranchBinaryRSY opcode, RegisterOperand cls> : InstRSYa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class LoadMultipleRS opcode, RegisterOperand cls, AddressingMode mode = bdaddr12only> : InstRSa { let mayLoad = 1; } class LoadMultipleRSY opcode, RegisterOperand cls, AddressingMode mode = bdaddr20only> : InstRSYa { let mayLoad = 1; } multiclass LoadMultipleRSPair rsOpcode, bits<16> rsyOpcode, RegisterOperand cls> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : LoadMultipleRS; let DispSize = "20" in def Y : LoadMultipleRSY; } } class LoadMultipleSSe opcode, RegisterOperand cls> : InstSSe { let mayLoad = 1; } multiclass LoadMultipleVRSaAlign opcode> { let mayLoad = 1 in { def Align : InstVRSa; let M4 = 0 in def "" : InstVRSa; } } class StoreRILPC opcode, SDPatternOperator operator, RegisterOperand cls> : InstRILb { let mayStore = 1; // We want PC-relative addresses to be tried ahead of BD and BDX addresses. // However, BDXs have two extra operands and are therefore 6 units more // complex. let AddedComplexity = 7; } class StoreRX opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr12only> : InstRXa { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let mayStore = 1; let AccessBytes = bytes; } class StoreRXY opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr20only> : InstRXYa { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let mayStore = 1; let AccessBytes = bytes; } multiclass StoreRXPair rxOpcode, bits<16> rxyOpcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : StoreRX; let DispSize = "20" in def Y : StoreRXY; } } class StoreVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes, bits<4> type = 0> : InstVRX { let M3 = type; let mayStore = 1; let AccessBytes = bytes; } class StoreVRXGeneric opcode> : InstVRX { let mayStore = 1; } multiclass StoreVRXAlign opcode> { let mayStore = 1, AccessBytes = 16 in { def Align : InstVRX; let M3 = 0 in def "" : InstVRX; } } class StoreLengthVRSb opcode, SDPatternOperator operator, bits<5> bytes> : InstVRSb { let M4 = 0; let mayStore = 1; let AccessBytes = bytes; } class StoreLengthVRSd opcode, SDPatternOperator operator, bits<5> bytes> : InstVRSd { let mayStore = 1; let AccessBytes = bytes; } class StoreLengthVSI opcode, SDPatternOperator operator, bits<5> bytes> : InstVSI { let mayStore = 1; let AccessBytes = bytes; } class StoreMultipleRS opcode, RegisterOperand cls, AddressingMode mode = bdaddr12only> : InstRSa { let mayStore = 1; } class StoreMultipleRSY opcode, RegisterOperand cls, AddressingMode mode = bdaddr20only> : InstRSYa { let mayStore = 1; } multiclass StoreMultipleRSPair rsOpcode, bits<16> rsyOpcode, RegisterOperand cls> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : StoreMultipleRS; let DispSize = "20" in def Y : StoreMultipleRSY; } } multiclass StoreMultipleVRSaAlign opcode> { let mayStore = 1 in { def Align : InstVRSa; let M4 = 0 in def "" : InstVRSa; } } // StoreSI* instructions are used to store an integer to memory, but the // addresses are more restricted than for normal stores. If we are in the // situation of having to force either the address into a register or the // constant into a register, it's usually better to do the latter. // We therefore match the address in the same way as a normal store and // only use the StoreSI* instruction if the matched address is suitable. class StoreSI opcode, SDPatternOperator operator, ImmOpWithPattern imm> : InstSI { let mayStore = 1; } class StoreSIY opcode, SDPatternOperator operator, ImmOpWithPattern imm> : InstSIY { let mayStore = 1; } class StoreSIL opcode, SDPatternOperator operator, ImmOpWithPattern imm> : InstSIL { let mayStore = 1; } multiclass StoreSIPair siOpcode, bits<16> siyOpcode, SDPatternOperator operator, ImmOpWithPattern imm> { let DispKey = mnemonic in { let DispSize = "12" in def "" : StoreSI; let DispSize = "20" in def Y : StoreSIY; } } class StoreSSE opcode> : InstSSE { let mayStore = 1; } class CondStoreRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let mayStore = 1; let AccessBytes = bytes; let CCMaskLast = 1; } // Like CondStoreRSY, but used for the raw assembly form. The condition-code // mask is the third operand rather than being part of the mnemonic. class AsmCondStoreRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let mayStore = 1; let AccessBytes = bytes; } // Like CondStoreRSY, but with a fixed CC mask. class FixedCondStoreRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let mayStore = 1; let AccessBytes = bytes; let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } multiclass CondStoreRSYPair opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> { let isCodeGenOnly = 1 in def "" : CondStoreRSY; def Asm : AsmCondStoreRSY; } class SideEffectUnaryI opcode, ImmOpWithPattern imm> : InstI; class SideEffectUnaryRRopcode, RegisterOperand cls> : InstRR { let R2 = 0; } class SideEffectUnaryRRE opcode, RegisterOperand cls, SDPatternOperator operator> : InstRRE { let R2 = 0; } class SideEffectUnaryS opcode, SDPatternOperator operator, bits<5> bytes, AddressingMode mode = bdaddr12only> : InstS { let mayLoad = 1; let AccessBytes = bytes; } class SideEffectUnarySIY opcode, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstSIY { let mayLoad = 1; let AccessBytes = bytes; let I2 = 0; } class SideEffectAddressS opcode, SDPatternOperator operator, AddressingMode mode = bdaddr12only> : InstS; class LoadAddressRX opcode, SDPatternOperator operator, AddressingMode mode> : InstRXa; class LoadAddressRXY opcode, SDPatternOperator operator, AddressingMode mode> : InstRXYa; multiclass LoadAddressRXPair rxOpcode, bits<16> rxyOpcode, SDPatternOperator operator> { let DispKey = mnemonic in { let DispSize = "12" in def "" : LoadAddressRX; let DispSize = "20" in def Y : LoadAddressRXY; } } class LoadAddressRIL opcode, SDPatternOperator operator> : InstRILb; class UnaryRR opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2> : InstRR { let OpKey = mnemonic#cls1; let OpType = "reg"; } class UnaryRRE opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2> : InstRRE { let OpKey = mnemonic#cls1; let OpType = "reg"; } class UnaryTiedRRE opcode, RegisterOperand cls> : InstRRE { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let R2 = 0; } class UnaryMemRRFc opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFc { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let M3 = 0; } class UnaryRI opcode, SDPatternOperator operator, RegisterOperand cls, ImmOpWithPattern imm> : InstRIa; class UnaryRIL opcode, SDPatternOperator operator, RegisterOperand cls, ImmOpWithPattern imm> : InstRILa; class UnaryRILPC opcode, SDPatternOperator operator, RegisterOperand cls> : InstRILb { let mayLoad = 1; // We want PC-relative addresses to be tried ahead of BD and BDX addresses. // However, BDXs have two extra operands and are therefore 6 units more // complex. let AddedComplexity = 7; } class CondUnaryRSY opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let AccessBytes = bytes; let CCMaskLast = 1; let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let MemKey = mnemonic#cls; let MemType = "target"; } // Like CondUnaryRSY, but used for the raw assembly form. The condition-code // mask is the third operand rather than being part of the mnemonic. class AsmCondUnaryRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let mayLoad = 1; let AccessBytes = bytes; let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } // Like CondUnaryRSY, but with a fixed CC mask. class FixedCondUnaryRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let AccessBytes = bytes; let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } multiclass CondUnaryRSYPair opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> { let isCodeGenOnly = 1 in def "" : CondUnaryRSY; def Asm : AsmCondUnaryRSY; } class UnaryRX opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr12only> : InstRXa { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let mayLoad = 1; let AccessBytes = bytes; } class UnaryRXE opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes> : InstRXE { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let mayLoad = 1; let AccessBytes = bytes; let M3 = 0; } class UnaryRXY opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr20only> : InstRXYa { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let mayLoad = 1; let AccessBytes = bytes; } multiclass UnaryRXPair rxOpcode, bits<16> rxyOpcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : UnaryRX; let DispSize = "20" in def Y : UnaryRXY; } } class UnaryVRIa opcode, SDPatternOperator operator, TypedReg tr, ImmOpWithPattern imm, bits<4> type = 0> : InstVRIa { let M3 = type; } class UnaryVRIaGeneric opcode, ImmOpWithPattern imm> : InstVRIa; class UnaryVRRa opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0, bits<4> m5 = 0, string fp_mnemonic = ""> : InstVRRa { let M3 = type; let M4 = m4; let M5 = m5; let OpKey = fp_mnemonic#!subst("VR", "FP", !cast(tr1.op)); let OpType = "reg"; } class UnaryVRRaGeneric opcode, bits<4> m4 = 0, bits<4> m5 = 0> : InstVRRa { let M4 = m4; let M5 = m5; } class UnaryVRRaFloatGeneric opcode, bits<4> m5 = 0> : InstVRRa { let M5 = m5; } // Declare a pair of instructions, one which sets CC and one which doesn't. // The CC-setting form ends with "S" and sets the low bit of M5. // The form that does not set CC has an extra operand to optionally allow // specifying arbitrary M5 values in assembler. multiclass UnaryExtraVRRaSPair opcode, SDPatternOperator operator, SDPatternOperator operator_cc, TypedReg tr1, TypedReg tr2, bits<4> type> { let M3 = type, M4 = 0 in def "" : InstVRRa; def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2))), (!cast(NAME) tr2.op:$V2, 0)>; def : InstAlias(NAME) tr1.op:$V1, tr2.op:$V2, 0)>; let Defs = [CC] in def S : UnaryVRRa; } multiclass UnaryExtraVRRaSPairGeneric opcode> { let M4 = 0, Defs = [CC] in def "" : InstVRRa; def : InstAlias(NAME) VR128:$V1, VR128:$V2, imm32zx4:$M3, 0)>; } class UnaryVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes, bits<4> type = 0> : InstVRX { let M3 = type; let mayLoad = 1; let AccessBytes = bytes; } class UnaryVRXGeneric opcode> : InstVRX { let mayLoad = 1; } multiclass UnaryVRXAlign opcode> { let mayLoad = 1, AccessBytes = 16 in { def Align : InstVRX; let M3 = 0 in def "" : InstVRX; } } class SideEffectBinaryRX opcode, RegisterOperand cls> : InstRXa; class SideEffectBinaryRXY opcode, RegisterOperand cls> : InstRXYa; class SideEffectBinaryRILPC opcode, RegisterOperand cls> : InstRILb { // We want PC-relative addresses to be tried ahead of BD and BDX addresses. // However, BDXs have two extra operands and are therefore 6 units more // complex. let AddedComplexity = 7; } class SideEffectBinaryRRE opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRE; class SideEffectBinaryRRFa opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFa { let R3 = 0; let M4 = 0; } class SideEffectBinaryRRFc opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFc { let M3 = 0; } class SideEffectBinaryIE opcode, ImmOpWithPattern imm1, ImmOpWithPattern imm2> : InstIE; class SideEffectBinarySI opcode, Operand imm> : InstSI; class SideEffectBinarySIL opcode, SDPatternOperator operator, ImmOpWithPattern imm> : InstSIL; class SideEffectBinarySSa opcode> : InstSSa; class SideEffectBinarySSb opcode> : InstSSb; class SideEffectBinarySSf opcode> : InstSSf; class SideEffectBinarySSE opcode> : InstSSE; class SideEffectBinaryMemMemRR opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRR { let Constraints = "$R1 = $R1src, $R2 = $R2src"; let DisableEncoding = "$R1src, $R2src"; } class SideEffectBinaryMemRRE opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRE { let Constraints = "$R2 = $R2src"; let DisableEncoding = "$R2src"; } class SideEffectBinaryMemMemRRE opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRE { let Constraints = "$R1 = $R1src, $R2 = $R2src"; let DisableEncoding = "$R1src, $R2src"; } class SideEffectBinaryMemMemRRFc opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFc { let Constraints = "$R1 = $R1src, $R2 = $R2src"; let DisableEncoding = "$R1src, $R2src"; let M3 = 0; } class BinaryRR opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2> : InstRR { let OpKey = mnemonic#cls1; let OpType = "reg"; let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BinaryRRE opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2> : InstRRE { let OpKey = mnemonic#cls1; let OpType = "reg"; let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BinaryRRD opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2> : InstRRD { let OpKey = mnemonic#cls; let OpType = "reg"; } class BinaryRRFa opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFa { let M4 = 0; let OpKey = mnemonic#cls1; let OpType = "reg"; } multiclass BinaryRRAndK opcode1, bits<16> opcode2, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2> { let NumOpsKey = mnemonic in { let NumOpsValue = "3" in def K : BinaryRRFa, Requires<[FeatureDistinctOps]>; let NumOpsValue = "2" in def "" : BinaryRR; } } multiclass BinaryRREAndK opcode1, bits<16> opcode2, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2> { let NumOpsKey = mnemonic in { let NumOpsValue = "3" in def K : BinaryRRFa, Requires<[FeatureDistinctOps]>; let NumOpsValue = "2" in def "" : BinaryRRE; } } class BinaryRRFb opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFb { let M4 = 0; } class BinaryRRFc opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFc; class BinaryMemRRFc opcode, RegisterOperand cls1, RegisterOperand cls2, ImmOpWithPattern imm> : InstRRFc { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } multiclass BinaryMemRRFcOpt opcode, RegisterOperand cls1, RegisterOperand cls2> { def "" : BinaryMemRRFc; def Opt : UnaryMemRRFc; } class BinaryRRFd opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFd; class BinaryRRFe opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFe { let M4 = 0; } class CondBinaryRRF opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFc { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let CCMaskLast = 1; let NumOpsKey = !subst("loc", "sel", mnemonic); let NumOpsValue = "2"; let OpKey = mnemonic#cls1; let OpType = "reg"; } // Like CondBinaryRRF, but used for the raw assembly form. The condition-code // mask is the third operand rather than being part of the mnemonic. class AsmCondBinaryRRF opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFc { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } // Like CondBinaryRRF, but with a fixed CC mask. class FixedCondBinaryRRF opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFc { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } multiclass CondBinaryRRFPair opcode, RegisterOperand cls1, RegisterOperand cls2> { let isCodeGenOnly = 1 in def "" : CondBinaryRRF; def Asm : AsmCondBinaryRRF; } class CondBinaryRRFa opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFa { let CCMaskLast = 1; let NumOpsKey = mnemonic; let NumOpsValue = "3"; let OpKey = mnemonic#cls1; let OpType = "reg"; } // Like CondBinaryRRFa, but used for the raw assembly form. The condition-code // mask is the third operand rather than being part of the mnemonic. class AsmCondBinaryRRFa opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFa; // Like CondBinaryRRFa, but with a fixed CC mask. class FixedCondBinaryRRFa opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFa { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M4 = V.ccmask; } multiclass CondBinaryRRFaPair opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> { let isCodeGenOnly = 1 in def "" : CondBinaryRRFa; def Asm : AsmCondBinaryRRFa; } class BinaryRI opcode, SDPatternOperator operator, RegisterOperand cls, ImmOpWithPattern imm> : InstRIa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BinaryRIE opcode, SDPatternOperator operator, RegisterOperand cls, ImmOpWithPattern imm> : InstRIEd; multiclass BinaryRIAndK opcode1, bits<16> opcode2, SDPatternOperator operator, RegisterOperand cls, ImmOpWithPattern imm> { let NumOpsKey = mnemonic in { let NumOpsValue = "3" in def K : BinaryRIE, Requires<[FeatureDistinctOps]>; let NumOpsValue = "2" in def "" : BinaryRI; } } class CondBinaryRIE opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIEg { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let CCMaskLast = 1; } // Like CondBinaryRIE, but used for the raw assembly form. The condition-code // mask is the third operand rather than being part of the mnemonic. class AsmCondBinaryRIE opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIEg { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } // Like CondBinaryRIE, but with a fixed CC mask. class FixedCondBinaryRIE opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIEg { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let M3 = V.ccmask; } multiclass CondBinaryRIEPair opcode, RegisterOperand cls, ImmOpWithPattern imm> { let isCodeGenOnly = 1 in def "" : CondBinaryRIE; def Asm : AsmCondBinaryRIE; } class BinaryRIL opcode, SDPatternOperator operator, RegisterOperand cls, ImmOpWithPattern imm> : InstRILa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BinaryRS opcode, SDPatternOperator operator, RegisterOperand cls> : InstRSa { let R3 = 0; let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BinaryRSY opcode, SDPatternOperator operator, RegisterOperand cls> : InstRSYa; multiclass BinaryRSAndK opcode1, bits<16> opcode2, SDPatternOperator operator, RegisterOperand cls> { let NumOpsKey = mnemonic in { let NumOpsValue = "3" in def K : BinaryRSY, Requires<[FeatureDistinctOps]>; let NumOpsValue = "2" in def "" : BinaryRS; } } class BinaryRSL opcode, RegisterOperand cls> : InstRSLb { let mayLoad = 1; } class BinaryRX opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr12only> : InstRXa { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let AccessBytes = bytes; } class BinaryRXE opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes> : InstRXE { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let AccessBytes = bytes; let M3 = 0; } class BinaryRXF opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2, SDPatternOperator load, bits<5> bytes> : InstRXF { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let mayLoad = 1; let AccessBytes = bytes; } class BinaryRXY opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr20only> : InstRXYa { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let AccessBytes = bytes; } multiclass BinaryRXPair rxOpcode, bits<16> rxyOpcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : BinaryRX; let DispSize = "20" in def Y : BinaryRXY; } } class BinarySI opcode, SDPatternOperator operator, Operand imm, AddressingMode mode = bdaddr12only> : InstSI { let mayLoad = 1; let mayStore = 1; } class BinarySIY opcode, SDPatternOperator operator, Operand imm, AddressingMode mode = bdaddr20only> : InstSIY { let mayLoad = 1; let mayStore = 1; } multiclass BinarySIPair siOpcode, bits<16> siyOpcode, SDPatternOperator operator, Operand imm> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : BinarySI; let DispSize = "20" in def Y : BinarySIY; } } class BinarySSF opcode, RegisterOperand cls> : InstSSF { let mayLoad = 1; } class BinaryVRIb opcode, SDPatternOperator operator, TypedReg tr, bits<4> type> : InstVRIb { let M4 = type; } class BinaryVRIbGeneric opcode> : InstVRIb; class BinaryVRIc opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type> : InstVRIc { let M4 = type; } class BinaryVRIcGeneric opcode> : InstVRIc; class BinaryVRIe opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5> : InstVRIe { let M4 = type; let M5 = m5; } class BinaryVRIeFloatGeneric opcode> : InstVRIe; class BinaryVRIh opcode> : InstVRIh; class BinaryVRRa opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0> : InstVRRa { let M3 = type; let M4 = m4; } class BinaryVRRaFloatGeneric opcode> : InstVRRa; class BinaryVRRb opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> modifier = 0> : InstVRRb { let M4 = type; let M5 = modifier; } class BinaryExtraVRRb opcode, bits<4> type = 0> : InstVRRb { let M4 = type; } class BinaryExtraVRRbGeneric opcode> : InstVRRb; // Declare a pair of instructions, one which sets CC and one which doesn't. // The CC-setting form ends with "S" and sets the low bit of M5. multiclass BinaryVRRbSPair opcode, SDPatternOperator operator, SDPatternOperator operator_cc, TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> modifier = 0> { def "" : BinaryVRRb; let Defs = [CC] in def S : BinaryVRRb; } class BinaryVRRbSPairGeneric opcode> : InstVRRb { let Defs = [CC]; } // Declare a pair of instructions, one which sets CC and one which doesn't. // The CC-setting form ends with "S" and sets the low bit of M5. // The form that does not set CC has an extra operand to optionally allow // specifying arbitrary M5 values in assembler. multiclass BinaryExtraVRRbSPair opcode, SDPatternOperator operator, SDPatternOperator operator_cc, TypedReg tr1, TypedReg tr2, bits<4> type> { let M4 = type in def "" : InstVRRb; def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3))), (!cast(NAME) tr2.op:$V2, tr2.op:$V3, 0)>; def : InstAlias(NAME) tr1.op:$V1, tr2.op:$V2, tr2.op:$V3, 0)>; let Defs = [CC] in def S : BinaryVRRb; } multiclass BinaryExtraVRRbSPairGeneric opcode> { let Defs = [CC] in def "" : InstVRRb; def : InstAlias(NAME) VR128:$V1, VR128:$V2, VR128:$V3, imm32zx4:$M4, 0)>; } class BinaryVRRc opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0, bits<4> m6 = 0, string fp_mnemonic = ""> : InstVRRc { let M4 = type; let M5 = m5; let M6 = m6; let OpKey = fp_mnemonic#"MemFold"#!subst("VR", "FP", !cast(tr1.op)); let OpType = "reg"; } class BinaryVRRcGeneric opcode, bits<4> m5 = 0, bits<4> m6 = 0> : InstVRRc { let M5 = m5; let M6 = m6; } class BinaryVRRcFloatGeneric opcode, bits<4> m6 = 0> : InstVRRc { let M6 = m6; } // Declare a pair of instructions, one which sets CC and one which doesn't. // The CC-setting form ends with "S" and sets the low bit of M5. multiclass BinaryVRRcSPair opcode, SDPatternOperator operator, SDPatternOperator operator_cc, TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5, bits<4> modifier = 0> { def "" : BinaryVRRc; let Defs = [CC] in def S : BinaryVRRc; } class BinaryVRRcSPairFloatGeneric opcode> : InstVRRc; class BinaryVRRf opcode, SDPatternOperator operator, TypedReg tr> : InstVRRf; class BinaryVRRi opcode, RegisterOperand cls> : InstVRRi { let M4 = 0; } class BinaryVRRk opcode> : InstVRRk; class BinaryVRSa opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type> : InstVRSa { let M4 = type; } class BinaryVRSaGeneric opcode> : InstVRSa; class BinaryVRSb opcode, SDPatternOperator operator, bits<5> bytes> : InstVRSb { let M4 = 0; let mayLoad = 1; let AccessBytes = bytes; } class BinaryVRSc opcode, SDPatternOperator operator, TypedReg tr, bits<4> type> : InstVRSc { let M4 = type; } class BinaryVRScGeneric opcode> : InstVRSc; class BinaryVRSd opcode, SDPatternOperator operator, bits<5> bytes> : InstVRSd { let mayLoad = 1; let AccessBytes = bytes; } class BinaryVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes> : InstVRX { let mayLoad = 1; let AccessBytes = bytes; } class StoreBinaryRS opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr12only> : InstRSb { let mayStore = 1; let AccessBytes = bytes; } class StoreBinaryRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let mayStore = 1; let AccessBytes = bytes; } multiclass StoreBinaryRSPair rsOpcode, bits<16> rsyOpcode, RegisterOperand cls, bits<5> bytes> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : StoreBinaryRS; let DispSize = "20" in def Y : StoreBinaryRSY; } } class StoreBinaryRSL opcode, RegisterOperand cls> : InstRSLb { let mayStore = 1; } class BinaryVSI opcode, SDPatternOperator operator, bits<5> bytes> : InstVSI { let mayLoad = 1; let AccessBytes = bytes; } class StoreBinaryVRV opcode, bits<5> bytes, ImmOpWithPattern index> : InstVRV { let mayStore = 1; let AccessBytes = bytes; } class StoreBinaryVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes, ImmOpWithPattern index> : InstVRX { let mayStore = 1; let AccessBytes = bytes; } class MemoryBinarySSd opcode, RegisterOperand cls> : InstSSd; class CompareRR opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2> : InstRR { let OpKey = mnemonic#cls1; let OpType = "reg"; let isCompare = 1; } class CompareRRE opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2> : InstRRE { let OpKey = mnemonic#cls1; let OpType = "reg"; let isCompare = 1; } class CompareRI opcode, SDPatternOperator operator, RegisterOperand cls, ImmOpWithPattern imm> : InstRIa { let isCompare = 1; } class CompareRIL opcode, SDPatternOperator operator, RegisterOperand cls, ImmOpWithPattern imm> : InstRILa { let isCompare = 1; } class CompareRILPC opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load> : InstRILb { let isCompare = 1; let mayLoad = 1; // We want PC-relative addresses to be tried ahead of BD and BDX addresses. // However, BDXs have two extra operands and are therefore 6 units more // complex. let AddedComplexity = 7; } class CompareRX opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr12only> : InstRXa { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let isCompare = 1; let mayLoad = 1; let AccessBytes = bytes; } class CompareRXE opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes> : InstRXE { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let isCompare = 1; let mayLoad = 1; let AccessBytes = bytes; let M3 = 0; } class CompareRXY opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr20only> : InstRXYa { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let isCompare = 1; let mayLoad = 1; let AccessBytes = bytes; } multiclass CompareRXPair rxOpcode, bits<16> rxyOpcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : CompareRX; let DispSize = "20" in def Y : CompareRXY; } } class CompareRS opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr12only> : InstRSb { let mayLoad = 1; let AccessBytes = bytes; } class CompareRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let mayLoad = 1; let AccessBytes = bytes; } multiclass CompareRSPair rsOpcode, bits<16> rsyOpcode, RegisterOperand cls, bits<5> bytes> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : CompareRS; let DispSize = "20" in def Y : CompareRSY; } } class CompareSSb opcode> : InstSSb { let isCompare = 1; let mayLoad = 1; } class CompareSI opcode, SDPatternOperator operator, SDPatternOperator load, ImmOpWithPattern imm, AddressingMode mode = bdaddr12only> : InstSI { let isCompare = 1; let mayLoad = 1; } class CompareSIL opcode, SDPatternOperator operator, SDPatternOperator load, ImmOpWithPattern imm> : InstSIL { let isCompare = 1; let mayLoad = 1; } class CompareSIY opcode, SDPatternOperator operator, SDPatternOperator load, ImmOpWithPattern imm, AddressingMode mode = bdaddr20only> : InstSIY { let isCompare = 1; let mayLoad = 1; } multiclass CompareSIPair siOpcode, bits<16> siyOpcode, SDPatternOperator operator, SDPatternOperator load, ImmOpWithPattern imm> { let DispKey = mnemonic in { let DispSize = "12" in def "" : CompareSI; let DispSize = "20" in def Y : CompareSIY; } } class CompareVRRa opcode, SDPatternOperator operator, TypedReg tr, bits<4> type, string fp_mnemonic = ""> : InstVRRa { let isCompare = 1; let M3 = type; let M4 = 0; let M5 = 0; let OpKey = fp_mnemonic#!subst("VR", "FP", !cast(tr.op)); let OpType = "reg"; } class CompareVRRaGeneric opcode> : InstVRRa { let isCompare = 1; let M4 = 0; let M5 = 0; } class CompareVRRaFloatGeneric opcode> : InstVRRa { let isCompare = 1; let M5 = 0; } class CompareVRRh opcode> : InstVRRh { let isCompare = 1; } class TestInherentS opcode, SDPatternOperator operator> : InstS { let B2 = 0; let D2 = 0; } class TestRXE opcode, SDPatternOperator operator, RegisterOperand cls> : InstRXE { let M3 = 0; } class TestBinarySIL opcode, SDPatternOperator operator, ImmOpWithPattern imm> : InstSIL; class TestRSL opcode> : InstRSLa { let mayLoad = 1; } class TestVRRg opcode> : InstVRRg; class SideEffectTernarySSc opcode> : InstSSc; class SideEffectTernaryRRFa opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFa { let M4 = 0; } class SideEffectTernaryMemMemRRFa opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFa { let Constraints = "$R1 = $R1src, $R2 = $R2src"; let DisableEncoding = "$R1src, $R2src"; let M4 = 0; } class SideEffectTernaryRRFb opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFb { let M4 = 0; } class SideEffectTernaryMemMemMemRRFb opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFb { let Constraints = "$R1 = $R1src, $R2 = $R2src, $R3 = $R3src"; let DisableEncoding = "$R1src, $R2src, $R3src"; let M4 = 0; } class SideEffectTernaryRRFc opcode, RegisterOperand cls1, RegisterOperand cls2, ImmOpWithPattern imm> : InstRRFc; multiclass SideEffectTernaryRRFcOpt opcode, RegisterOperand cls1, RegisterOperand cls2> { def "" : SideEffectTernaryRRFc; def Opt : SideEffectBinaryRRFc; } class SideEffectTernaryMemMemRRFc opcode, RegisterOperand cls1, RegisterOperand cls2, ImmOpWithPattern imm> : InstRRFc { let Constraints = "$R1 = $R1src, $R2 = $R2src"; let DisableEncoding = "$R1src, $R2src"; } multiclass SideEffectTernaryMemMemRRFcOpt opcode, RegisterOperand cls1, RegisterOperand cls2> { def "" : SideEffectTernaryMemMemRRFc; def Opt : SideEffectBinaryMemMemRRFc; } class SideEffectTernarySSF opcode, RegisterOperand cls> : InstSSF; class TernaryRRFa opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFa; class TernaryRRFb opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFb { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class TernaryRRFe opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRFe; class TernaryRRD opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2> : InstRRD { let OpKey = mnemonic#cls; let OpType = "reg"; let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class TernaryRS opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr12only> : InstRSb { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let AccessBytes = bytes; } class TernaryRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let AccessBytes = bytes; } multiclass TernaryRSPair rsOpcode, bits<16> rsyOpcode, RegisterOperand cls, bits<5> bytes> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : TernaryRS; let DispSize = "20" in def Y : TernaryRSY; } } class SideEffectTernaryRS opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRSa; class SideEffectTernaryRSY opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRSYa; class SideEffectTernaryMemMemRS opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRSa { let Constraints = "$R1 = $R1src, $R3 = $R3src"; let DisableEncoding = "$R1src, $R3src"; } class SideEffectTernaryMemMemRSY opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRSYa { let Constraints = "$R1 = $R1src, $R3 = $R3src"; let DisableEncoding = "$R1src, $R3src"; } class TernaryRXF opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2, SDPatternOperator load, bits<5> bytes> : InstRXF { let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let AccessBytes = bytes; } class TernaryVRIa opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, ImmOpWithPattern imm, ImmOpWithPattern index> : InstVRIa { let Constraints = "$V1 = $V1src"; let DisableEncoding = "$V1src"; } class TernaryVRId opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type> : InstVRId { let M5 = type; } class TernaryVRIi opcode, RegisterOperand cls> : InstVRIi; class TernaryVRRa opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m4or> : InstVRRa { let M3 = type; } class TernaryVRRaFloatGeneric opcode> : InstVRRa; class TernaryVRRb opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type, SDPatternOperator m5mask, bits<4> m5or> : InstVRRb { let M4 = type; } // Declare a pair of instructions, one which sets CC and one which doesn't. // The CC-setting form ends with "S" and sets the low bit of M5. // Also create aliases to make use of M5 operand optional in assembler. multiclass TernaryOptVRRbSPair opcode, SDPatternOperator operator, SDPatternOperator operator_cc, TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> modifier = 0> { def "" : TernaryVRRb; def : InstAlias(NAME) tr1.op:$V1, tr2.op:$V2, tr2.op:$V3, 0)>; let Defs = [CC] in def S : TernaryVRRb; def : InstAlias(NAME#"S") tr1.op:$V1, tr2.op:$V2, tr2.op:$V3, 0)>; } multiclass TernaryOptVRRbSPairGeneric opcode> { let Defs = [CC] in def "" : InstVRRb; def : InstAlias(NAME) VR128:$V1, VR128:$V2, VR128:$V3, imm32zx4:$M4, 0)>; } class TernaryVRRc opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2> : InstVRRc { let M5 = 0; let M6 = 0; } class TernaryVRRcFloat opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0> : InstVRRc { let M4 = type; let M5 = m5; } class TernaryVRRcFloatGeneric opcode> : InstVRRc; class TernaryVRRd opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m6 = 0> : InstVRRd { let M5 = type; let M6 = m6; } class TernaryVRRdGeneric opcode> : InstVRRd { let M6 = 0; } // Ternary operation where the assembler mnemonic has an extra operand to // optionally allow specifying arbitrary M6 values. multiclass TernaryExtraVRRd opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type> { let M5 = type, Defs = [CC] in def "" : InstVRRd; def : Pat<(operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3), (tr1.vt tr1.op:$V4)), (!cast(NAME) tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, 0)>; def : InstAlias(NAME) tr1.op:$V1, tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, 0)>; } multiclass TernaryExtraVRRdGeneric opcode> { let Defs = [CC] in def "" : InstVRRd; def : InstAlias(NAME) VR128:$V1, VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, 0)>; } class TernaryVRRe opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> m5 = 0, bits<4> type = 0, string fp_mnemonic = ""> : InstVRRe { let M5 = m5; let M6 = type; let OpKey = fp_mnemonic#"MemFold"#!subst("VR", "FP", !cast(tr1.op)); let OpType = "reg"; } class TernaryVRReFloatGeneric opcode> : InstVRRe; class TernaryVRSb opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type> : InstVRSb { let Constraints = "$V1 = $V1src"; let DisableEncoding = "$V1src"; let M4 = type; } class TernaryVRRi opcode, RegisterOperand cls> : InstVRRi; class TernaryVRRj opcode> : InstVRRj; class TernaryVRSbGeneric opcode> : InstVRSb { let Constraints = "$V1 = $V1src"; let DisableEncoding = "$V1src"; } class TernaryVRV opcode, bits<5> bytes, ImmOpWithPattern index> : InstVRV { let Constraints = "$V1 = $V1src"; let DisableEncoding = "$V1src"; let mayLoad = 1; let AccessBytes = bytes; } class TernaryVRX opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<5> bytes, ImmOpWithPattern index> : InstVRX { let Constraints = "$V1 = $V1src"; let DisableEncoding = "$V1src"; let mayLoad = 1; let AccessBytes = bytes; } class QuaternaryVRId opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type> : InstVRId { let Constraints = "$V1 = $V1src"; let DisableEncoding = "$V1src"; let M5 = type; } class QuaternaryVRIdGeneric opcode> : InstVRId { let Constraints = "$V1 = $V1src"; let DisableEncoding = "$V1src"; } class QuaternaryVRIf opcode> : InstVRIf; class QuaternaryVRIg opcode> : InstVRIg; class QuaternaryVRRd opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, TypedReg tr3, TypedReg tr4, bits<4> type, SDPatternOperator m6mask = imm32zx4_timm, bits<4> m6or = 0> : InstVRRd { let M5 = type; } class QuaternaryVRRdGeneric opcode> : InstVRRd; // Declare a pair of instructions, one which sets CC and one which doesn't. // The CC-setting form ends with "S" and sets the low bit of M6. // Also create aliases to make use of M6 operand optional in assembler. multiclass QuaternaryOptVRRdSPair opcode, SDPatternOperator operator, SDPatternOperator operator_cc, TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> modifier = 0> { def "" : QuaternaryVRRd; def : InstAlias(NAME) tr1.op:$V1, tr2.op:$V2, tr2.op:$V3, tr2.op:$V4, 0)>; let Defs = [CC] in def S : QuaternaryVRRd; def : InstAlias(NAME#"S") tr1.op:$V1, tr2.op:$V2, tr2.op:$V3, tr2.op:$V4, 0)>; } multiclass QuaternaryOptVRRdSPairGeneric opcode> { let Defs = [CC] in def "" : QuaternaryVRRdGeneric; def : InstAlias(NAME) VR128:$V1, VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4_timm:$M5, 0)>; } class SideEffectQuaternaryRRFa opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFa; multiclass SideEffectQuaternaryRRFaOptOpt opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> { def "" : SideEffectQuaternaryRRFa; def Opt : SideEffectTernaryRRFa; def OptOpt : SideEffectBinaryRRFa; } class SideEffectQuaternaryRRFb opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> : InstRRFb; multiclass SideEffectQuaternaryRRFbOpt opcode, RegisterOperand cls1, RegisterOperand cls2, RegisterOperand cls3> { def "" : SideEffectQuaternaryRRFb; def Opt : SideEffectTernaryRRFb; } class SideEffectQuaternarySSe opcode, RegisterOperand cls> : InstSSe; class LoadAndOpRSY opcode, SDPatternOperator operator, RegisterOperand cls, AddressingMode mode = bdaddr20only> : InstRSYa { let mayLoad = 1; let mayStore = 1; } class CmpSwapRRE opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRRE { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let mayStore = 1; } class CmpSwapRS opcode, SDPatternOperator operator, RegisterOperand cls, AddressingMode mode = bdaddr12only> : InstRSa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let mayStore = 1; } class CmpSwapRSY opcode, SDPatternOperator operator, RegisterOperand cls, AddressingMode mode = bdaddr20only> : InstRSYa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let mayStore = 1; } multiclass CmpSwapRSPair rsOpcode, bits<16> rsyOpcode, SDPatternOperator operator, RegisterOperand cls> { let DispKey = mnemonic # cls in { let DispSize = "12" in def "" : CmpSwapRS; let DispSize = "20" in def Y : CmpSwapRSY; } } class RotateSelectRIEf opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRIEf { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class PrefetchRXY opcode, SDPatternOperator operator> : InstRXYb; class PrefetchRILPC opcode, SDPatternOperator operator> : InstRILc { // We want PC-relative addresses to be tried ahead of BD and BDX addresses. // However, BDXs have two extra operands and are therefore 6 units more // complex. let AddedComplexity = 7; } class BranchPreloadSMI opcode> : InstSMI; class BranchPreloadMII opcode> : InstMII; //===----------------------------------------------------------------------===// // Pseudo instructions //===----------------------------------------------------------------------===// // // Convenience instructions that get lowered to real instructions // by either SystemZTargetLowering::EmitInstrWithCustomInserter() // or SystemZInstrInfo::expandPostRAPseudo(). // //===----------------------------------------------------------------------===// class Pseudo pattern> : InstSystemZ<0, outs, ins, "", pattern> { let isPseudo = 1; let isCodeGenOnly = 1; } // Like UnaryRI, but expanded after RA depending on the choice of register. class UnaryRIPseudo : Pseudo<(outs cls:$R1), (ins imm:$I2), [(set cls:$R1, (operator imm:$I2))]>; // Like UnaryRXY, but expanded after RA depending on the choice of register. class UnaryRXYPseudo bytes, AddressingMode mode = bdxaddr20only> : Pseudo<(outs cls:$R1), (ins (mode $B2, $D2, $X2):$XBD2), [(set cls:$R1, (operator mode:$XBD2))]> { let OpKey = key#"r"#cls; let OpType = "mem"; let mayLoad = 1; let Has20BitOffset = 1; let HasIndex = 1; let AccessBytes = bytes; } // Like UnaryRR, but expanded after RA depending on the choice of registers. class UnaryRRPseudo : Pseudo<(outs cls1:$R1), (ins cls2:$R2), [(set cls1:$R1, (operator cls2:$R2))]> { let OpKey = key#cls1; let OpType = "reg"; } // Like BinaryRI, but expanded after RA depending on the choice of register. class BinaryRIPseudo : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2), [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { let Constraints = "$R1 = $R1src"; } // Like BinaryRIE, but expanded after RA depending on the choice of register. class BinaryRIEPseudo : Pseudo<(outs cls:$R1), (ins cls:$R3, imm:$I2), [(set cls:$R1, (operator cls:$R3, imm:$I2))]>; // Like BinaryRIAndK, but expanded after RA depending on the choice of register. multiclass BinaryRIAndKPseudo { let NumOpsKey = key in { let NumOpsValue = "3" in def K : BinaryRIEPseudo, Requires<[FeatureHighWord, FeatureDistinctOps]>; let NumOpsValue = "2" in def "" : BinaryRIPseudo, Requires<[FeatureHighWord]>; } } // A pseudo that is used during register allocation when folding a memory // operand. The 3-address register instruction with a spilled source cannot // be converted directly to a target 2-address reg/mem instruction. // Mapping: R -> MemFoldPseudo -> class MemFoldPseudo bytes, AddressingMode mode> : Pseudo<(outs cls:$R1), (ins cls:$R2, (mode $B2, $D2, $X2):$XBD2), []> { let OpKey = !subst("mscrk", "msrkc", !subst("msgcrk", "msgrkc", mnemonic#"rk"#cls)); let OpType = "mem"; let MemKey = mnemonic#cls; let MemType = "pseudo"; let mayLoad = 1; let AccessBytes = bytes; let HasIndex = 1; let hasNoSchedulingInfo = 1; } // Same as MemFoldPseudo but for mapping a W... vector instruction class MemFoldPseudo_FP bytes, AddressingMode mode> : MemFoldPseudo { let OpKey = mnemonic#"r"#"MemFold"#cls; } class MemFoldPseudo_FPTern bytes, AddressingMode mode> : Pseudo<(outs cls:$R1), (ins cls:$R2, cls:$R3, (mode $B2, $D2, $X2):$XBD2), []> { let OpKey = mnemonic#"r"#"MemFold"#cls; let OpType = "mem"; let MemKey = mnemonic#cls; let MemType = "pseudo"; let mayLoad = 1; let AccessBytes = bytes; let HasIndex = 1; let hasNoSchedulingInfo = 1; } // Same as MemFoldPseudo but for Load On Condition with CC operands. class MemFoldPseudo_CondMove bytes, AddressingMode mode> : Pseudo<(outs cls:$R1), (ins cls:$R2, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$M3), []> { let OpKey = !subst("loc", "sel", mnemonic)#"r"#cls; let OpType = "mem"; let MemKey = mnemonic#cls; let MemType = "pseudo"; let mayLoad = 1; let AccessBytes = bytes; let hasNoSchedulingInfo = 1; } // Like CompareRI, but expanded after RA depending on the choice of register. class CompareRIPseudo : Pseudo<(outs), (ins cls:$R1, imm:$I2), [(set CC, (operator cls:$R1, imm:$I2))]> { let isCompare = 1; } // Like CompareRXY, but expanded after RA depending on the choice of register. class CompareRXYPseudo bytes, AddressingMode mode = bdxaddr20only> : Pseudo<(outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2), [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> { let mayLoad = 1; let Has20BitOffset = 1; let HasIndex = 1; let AccessBytes = bytes; } // Like TestBinarySIL, but expanded later. class TestBinarySILPseudo : Pseudo<(outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2), [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>; // Like CondBinaryRRF, but expanded after RA depending on the choice of // register. class CondBinaryRRFPseudo : Pseudo<(outs cls1:$R1), (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3), [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src, cond4:$valid, cond4:$M3))]> { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let CCMaskLast = 1; let NumOpsKey = !subst("loc", "sel", mnemonic); let NumOpsValue = "2"; let OpKey = mnemonic#cls1; let OpType = "reg"; } // Like CondBinaryRRFa, but expanded after RA depending on the choice of // register. class CondBinaryRRFaPseudo : Pseudo<(outs cls1:$R1), (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4), [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3, cond4:$valid, cond4:$M4))]> { let CCMaskLast = 1; let NumOpsKey = mnemonic; let NumOpsValue = "3"; let OpKey = mnemonic#cls1; let OpType = "reg"; } // Like CondBinaryRIE, but expanded after RA depending on the choice of // register. class CondBinaryRIEPseudo : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3), [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src, cond4:$valid, cond4:$M3))]> { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let CCMaskLast = 1; } // Like CondUnaryRSY, but expanded after RA depending on the choice of // register. class CondUnaryRSYPseudo bytes, AddressingMode mode = bdaddr20only> : Pseudo<(outs cls:$R1), (ins cls:$R1src, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$R3), [(set cls:$R1, (z_select_ccmask (operator mode:$BD2), cls:$R1src, cond4:$valid, cond4:$R3))]> { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; let mayLoad = 1; let AccessBytes = bytes; let CCMaskLast = 1; let OpKey = mnemonic#"r"#cls; let OpType = "mem"; let MemKey = mnemonic#cls; let MemType = "target"; } // Like CondStoreRSY, but expanded after RA depending on the choice of // register. class CondStoreRSYPseudo bytes, AddressingMode mode = bdaddr20only> : Pseudo<(outs), (ins cls:$R1, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$R3), []> { let mayStore = 1; let AccessBytes = bytes; let CCMaskLast = 1; } // Like StoreRXY, but expanded after RA depending on the choice of register. class StoreRXYPseudo bytes, AddressingMode mode = bdxaddr20only> : Pseudo<(outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2), [(operator cls:$R1, mode:$XBD2)]> { let mayStore = 1; let Has20BitOffset = 1; let HasIndex = 1; let AccessBytes = bytes; } // Like RotateSelectRIEf, but expanded after RA depending on the choice // of registers. class RotateSelectRIEfPseudo : Pseudo<(outs cls1:$R1), (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, imm32zx8:$I5), []> { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } // Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is // the value of the PSW's 2-bit condition code field. class SelectWrapper : Pseudo<(outs cls:$dst), (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc), [(set (vt cls:$dst), (z_select_ccmask cls:$src1, cls:$src2, imm32zx4_timm:$valid, imm32zx4_timm:$cc))]> { let usesCustomInserter = 1; let hasNoSchedulingInfo = 1; let Uses = [CC]; } // Stores $new to $addr if $cc is true ("" case) or false (Inv case). multiclass CondStores { let Uses = [CC], usesCustomInserter = 1, hasNoSchedulingInfo = 1, mayLoad = 1, mayStore = 1 in { def "" : Pseudo<(outs), (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc), [(store (z_select_ccmask cls:$new, (load mode:$addr), imm32zx4_timm:$valid, imm32zx4_timm:$cc), mode:$addr)]>; def Inv : Pseudo<(outs), (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc), [(store (z_select_ccmask (load mode:$addr), cls:$new, imm32zx4_timm:$valid, imm32zx4_timm:$cc), mode:$addr)]>; } } // OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation. PAT and OPERAND // describe the second (non-memory) operand. class AtomicLoadWBinary : Pseudo<(outs GR32:$dst), (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift, ADDR32:$negbitshift, uimm32:$bitsize), [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift, ADDR32:$negbitshift, uimm32:$bitsize))]> { let Defs = [CC]; let Has20BitOffset = 1; let mayLoad = 1; let mayStore = 1; let usesCustomInserter = 1; let hasNoSchedulingInfo = 1; } // Specializations of AtomicLoadWBinary. class AtomicLoadWBinaryReg : AtomicLoadWBinary; class AtomicLoadWBinaryImm : AtomicLoadWBinary; // A pseudo instruction that is a direct alias of a real instruction. // These aliases are used in cases where a particular register operand is // fixed or where the same instruction is used with different register sizes. // The size parameter is the size in bytes of the associated real instruction. class Alias pattern> : InstSystemZ { let isPseudo = 1; let isCodeGenOnly = 1; } class UnaryAliasVRS : Alias<6, (outs cls1:$src1), (ins cls2:$src2), []>; // An alias of a UnaryVRR*, but with different register sizes. class UnaryAliasVRR : Alias<6, (outs tr1.op:$V1), (ins tr2.op:$V2), [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]>; // An alias of a UnaryVRX, but with different register sizes. class UnaryAliasVRX : Alias<6, (outs tr.op:$V1), (ins (mode $B2, $D2, $X2):$XBD2), [(set (tr.vt tr.op:$V1), (operator mode:$XBD2))]>; // An alias of a StoreVRX, but with different register sizes. class StoreAliasVRX : Alias<6, (outs), (ins tr.op:$V1, (mode $B2, $D2, $X2):$XBD2), [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>; // An alias of a BinaryRI, but with different register sizes. class BinaryAliasRI : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2), [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { let Constraints = "$R1 = $R1src"; } // An alias of a BinaryRIL, but with different register sizes. class BinaryAliasRIL : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2), [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { let Constraints = "$R1 = $R1src"; } // An alias of a BinaryVRRf, but with different register sizes. class BinaryAliasVRRf : Alias<6, (outs VR128:$V1), (ins cls:$R2, cls:$R3), []>; // An alias of a CompareRI, but with different register sizes. class CompareAliasRI : Alias<4, (outs), (ins cls:$R1, imm:$I2), [(set CC, (operator cls:$R1, imm:$I2))]> { let isCompare = 1; } // An alias of a RotateSelectRIEf, but with different register sizes. class RotateSelectAliasRIEf : Alias<6, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, imm32zx8:$I5), []> { let Constraints = "$R1 = $R1src"; } class MemsetPseudo : Pseudo<(outs), (ins bdaddr12only:$dest, lenop:$length, byteop:$B), [(z_memset_mvc bdaddr12only:$dest, lenop:$length, byteop:$B)]> { let Defs = [CC]; let mayLoad = 1; let mayStore = 1; let usesCustomInserter = 1; let hasNoSchedulingInfo = 1; } //===----------------------------------------------------------------------===// // Multiclasses that emit both real and pseudo instructions //===----------------------------------------------------------------------===// multiclass BinaryRXYAndPseudo opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr20only> { def "" : BinaryRXY { let MemKey = mnemonic#cls; let MemType = "target"; } let Has20BitOffset = 1 in def _MemFoldPseudo : MemFoldPseudo; } multiclass BinaryRXPairAndPseudo rxOpcode, bits<16> rxyOpcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes> { let DispKey = mnemonic # cls in { def "" : BinaryRX { let DispSize = "12"; let MemKey = mnemonic#cls; let MemType = "target"; } let DispSize = "20" in def Y : BinaryRXY; } def _MemFoldPseudo : MemFoldPseudo; } multiclass BinaryRXEAndPseudo opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes> { def "" : BinaryRXE { let MemKey = mnemonic#cls; let MemType = "target"; } def _MemFoldPseudo : MemFoldPseudo_FP; } multiclass TernaryRXFAndPseudo opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2, SDPatternOperator load, bits<5> bytes> { def "" : TernaryRXF { let MemKey = mnemonic#cls1; let MemType = "target"; } def _MemFoldPseudo : MemFoldPseudo_FPTern; } multiclass CondUnaryRSYPairAndMemFold opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> { defm "" : CondUnaryRSYPair; def _MemFoldPseudo : MemFoldPseudo_CondMove; } multiclass CondUnaryRSYPseudoAndMemFold bytes, AddressingMode mode = bdaddr20only> { def "" : CondUnaryRSYPseudo; def _MemFoldPseudo : MemFoldPseudo_CondMove; } // Define an instruction that operates on two fixed-length blocks of memory, // and associated pseudo instructions for operating on blocks of any size. // There are two pseudos for the different cases of when the length is // constant or variable. The length operand of a pseudo is actually one less // than the intended number of bytes, since the register case needs to use an // EXRL with a target instruction that adds one to the length always. multiclass MemorySS opcode, SDPatternOperator memop> { def "" : SideEffectBinarySSa; let usesCustomInserter = 1, hasNoSchedulingInfo = 1, Defs = [CC] in { def Imm : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, imm64:$length), [(memop bdaddr12only:$dest, bdaddr12only:$src, imm64:$length)]>; def Reg : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, ADDR64:$length), [(memop bdaddr12only:$dest, bdaddr12only:$src, ADDR64:$length)]>; } } // The same, but setting a CC result as comparison operator. multiclass CompareMemorySS opcode, SDPatternOperator memop> { def "" : SideEffectBinarySSa; let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in { def Imm : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, imm64:$length), [(set CC, (memop bdaddr12only:$dest, bdaddr12only:$src, imm64:$length))]>; def Reg : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, ADDR64:$length), [(set CC, (memop bdaddr12only:$dest, bdaddr12only:$src, ADDR64:$length))]>; } } // Define an instruction that operates on two strings, both terminated // by the character in R0. The instruction processes a CPU-determinated // number of bytes at a time and sets CC to 3 if the instruction needs // to be repeated. Also define a pseudo instruction that represents // the full loop (the main instruction plus the branch on CC==3). multiclass StringRRE opcode, SDPatternOperator operator> { let Uses = [R0L] in def "" : SideEffectBinaryMemMemRRE; let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in def Loop : Pseudo<(outs GR64:$end), (ins GR64:$start1, GR64:$start2, GR32:$char), [(set GR64:$end, (operator GR64:$start1, GR64:$start2, GR32:$char))]>; }