xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARC/ARCInstrFormats.td (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
10b57cec5SDimitry Andric//===- ARCInstrFormats.td - ARC Instruction Formats --------*- tablegen -*-===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric
90b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
100b57cec5SDimitry Andric// Instruction format superclass
110b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric
130b57cec5SDimitry Andricclass Encoding64 {
140b57cec5SDimitry Andric  field bits<64> Inst;
150b57cec5SDimitry Andric  field bits<64> SoftFail = 0;
160b57cec5SDimitry Andric}
170b57cec5SDimitry Andric
180b57cec5SDimitry Andric// Address operands
190b57cec5SDimitry Andric
200b57cec5SDimitry Andricclass immU<int BSz> : Operand<i32>, PatLeaf<(imm),
210b57cec5SDimitry Andric    "\n    return isUInt<"#BSz#">(N->getSExtValue());"> {
220b57cec5SDimitry Andric}
230b57cec5SDimitry Andric
240b57cec5SDimitry Andricdef immU6 : immU<6>;
250b57cec5SDimitry Andric
260b57cec5SDimitry Andricclass immS<int BSz> : Operand<i32>, PatLeaf<(imm),
270b57cec5SDimitry Andric    "\n    return isInt<"#BSz#">(N->getSExtValue());"> {
280b57cec5SDimitry Andric  let DecoderMethod = "DecodeSignedOperand<"#BSz#">";
290b57cec5SDimitry Andric}
300b57cec5SDimitry Andric
310b57cec5SDimitry Andric// e.g. s3 field may encode the signed integers values -1 .. 6
320b57cec5SDimitry Andric// using binary codes 111, 000, 001, 010, 011, 100, 101, and 110, respectively
330b57cec5SDimitry Andricclass immC<int BSz> : Operand<i32>, PatLeaf<(imm),
340b57cec5SDimitry Andric    "\n    return isInt<"#BSz#">(N->getSExtValue());"> {
350b57cec5SDimitry Andric  let DecoderMethod = "DecodeFromCyclicRange<"#BSz#">";
360b57cec5SDimitry Andric}
370b57cec5SDimitry Andric
380b57cec5SDimitry Andricdef MEMii : Operand<i32> {
390b57cec5SDimitry Andric  let MIOperandInfo = (ops i32imm, i32imm);
400b57cec5SDimitry Andric}
410b57cec5SDimitry Andric
420b57cec5SDimitry Andricdef MEMrs9 : Operand<iAny> {
430b57cec5SDimitry Andric  let MIOperandInfo = (ops GPR32:$B, immS<9>:$S9);
440b57cec5SDimitry Andric  let PrintMethod = "printMemOperandRI";
450b57cec5SDimitry Andric  let DecoderMethod = "DecodeMEMrs9";
460b57cec5SDimitry Andric}
470b57cec5SDimitry Andric
480b57cec5SDimitry Andricdef MEMrlimm : Operand<iAny> {
490b57cec5SDimitry Andric  let MIOperandInfo = (ops GPR32:$B, i32imm:$LImm);
500b57cec5SDimitry Andric  let PrintMethod = "printMemOperandRI";
510b57cec5SDimitry Andric  let DecoderMethod = "DecodeMEMrlimm";
520b57cec5SDimitry Andric}
530b57cec5SDimitry Andric
540b57cec5SDimitry Andricdef GPR32Reduced : Operand<iAny> {
550b57cec5SDimitry Andric  let DecoderMethod = "DecodeGBR32ShortRegister";
560b57cec5SDimitry Andric}
570b57cec5SDimitry Andric
580b57cec5SDimitry Andric// Helper classes for load/store instructions
590b57cec5SDimitry Andricclass DataSizeMode<bits<2> mode, string instSfx, string asmSfx> {
600b57cec5SDimitry Andric  bits<2> Value = mode;
610b57cec5SDimitry Andric  string  InstSuffix = instSfx;
620b57cec5SDimitry Andric  string  AsmSuffix  = asmSfx;
630b57cec5SDimitry Andric}
640b57cec5SDimitry Andricclass ExtMode<bit mode, string instSfx, string asmSfx> {
650b57cec5SDimitry Andric  bit     Value = mode;
660b57cec5SDimitry Andric  string  InstSuffix = instSfx;
670b57cec5SDimitry Andric  string  AsmSuffix  = asmSfx;
680b57cec5SDimitry Andric}
690b57cec5SDimitry Andric
700b57cec5SDimitry Andricclass AddrMode<bits<2> mode, string instSfx, string asmSfx> {
710b57cec5SDimitry Andric  bits<2> Value = mode;
720b57cec5SDimitry Andric  string  InstSuffix = instSfx;
730b57cec5SDimitry Andric  string  AsmSuffix  = asmSfx;
740b57cec5SDimitry Andric}
750b57cec5SDimitry Andric
760b57cec5SDimitry Andricclass CacheMode<bit mode, string instSfx, string asmSfx> {
770b57cec5SDimitry Andric  bit     Value = mode;
780b57cec5SDimitry Andric  string  InstSuffix = instSfx;
790b57cec5SDimitry Andric  string  AsmSuffix  = asmSfx;
800b57cec5SDimitry Andric}
810b57cec5SDimitry Andric
820b57cec5SDimitry Andricdef ByteSM : DataSizeMode<0b01, "B", "b">;
830b57cec5SDimitry Andricdef HalfSM : DataSizeMode<0b10, "H", "h">;
840b57cec5SDimitry Andricdef WordSM : DataSizeMode<0b00,  "",  "">;
850b57cec5SDimitry Andric
860b57cec5SDimitry Andricdef NoEM      : ExtMode<0,   "",   "">;
870b57cec5SDimitry Andricdef SignedEM  : ExtMode<1, "_X", ".x">;
880b57cec5SDimitry Andric
890b57cec5SDimitry Andricdef NoAM      : AddrMode<0b00, "", "">;
900b57cec5SDimitry Andricdef PreIncAM  : AddrMode<0b01, "_AW", ".aw">;
910b57cec5SDimitry Andricdef PostIncAM : AddrMode<0b10, "_AB", ".ab">;
920b57cec5SDimitry Andric
930b57cec5SDimitry Andricdef NoCC       : CacheMode<0b0,    "",    "">;
940b57cec5SDimitry Andricdef UncachedCC : CacheMode<0b1, "_DI", ".di">;
950b57cec5SDimitry Andric
960b57cec5SDimitry Andricclass InstARC<int sz, dag outs, dag ins, string asmstr, list<dag> pattern>
970b57cec5SDimitry Andric    : Instruction, Encoding64 {
980b57cec5SDimitry Andric
990b57cec5SDimitry Andric  let Namespace = "ARC";
1000b57cec5SDimitry Andric  dag OutOperandList = outs;
1010b57cec5SDimitry Andric  dag InOperandList = ins;
1020b57cec5SDimitry Andric  let AsmString = asmstr;
1030b57cec5SDimitry Andric  let Pattern = pattern;
1040b57cec5SDimitry Andric  let Size = sz;
1050b57cec5SDimitry Andric
1060b57cec5SDimitry Andric  // Load/Store instruction properties
1070b57cec5SDimitry Andric  DataSizeMode ZZ = WordSM;
1080b57cec5SDimitry Andric  ExtMode X = NoEM;
1090b57cec5SDimitry Andric  AddrMode AA = NoAM;
1100b57cec5SDimitry Andric  CacheMode DI = NoCC;
1110b57cec5SDimitry Andric
1120b57cec5SDimitry Andric  // Field used for relation models
1130b57cec5SDimitry Andric  string BaseOpcode = "";
1140b57cec5SDimitry Andric
1150b57cec5SDimitry Andric  //TSFlags
1160b57cec5SDimitry Andric  let TSFlags{1-0} = AA.Value;
1170b57cec5SDimitry Andric}
1180b57cec5SDimitry Andric
1190b57cec5SDimitry Andric// ARC pseudo instructions format
1200b57cec5SDimitry Andricclass PseudoInstARC<dag outs, dag ins, string asmstr, list<dag> pattern>
1210b57cec5SDimitry Andric   : InstARC<0, outs, ins, asmstr, pattern> {
1220b57cec5SDimitry Andric  let isPseudo = 1;
1230b57cec5SDimitry Andric}
1240b57cec5SDimitry Andric
1250b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
1260b57cec5SDimitry Andric// Instruction formats
1270b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
1280b57cec5SDimitry Andric
1290b57cec5SDimitry Andric// All 32-bit ARC instructions have a 5-bit "major" opcode class designator
1300b57cec5SDimitry Andric// in bits 27-31.
1310b57cec5SDimitry Andric//
1320b57cec5SDimitry Andric// Some general naming conventions:
1330b57cec5SDimitry Andric// N  - Delay Slot bit.  ARC v2 branch instructions have an optional delay slot
1340b57cec5SDimitry Andric//      which is encoded with this bit.  When set, a delay slot exists.
1350b57cec5SDimitry Andric// cc - Condition code.
1360b57cec5SDimitry Andric// SX - Signed X-bit immediate.
1370b57cec5SDimitry Andric// UX - Unsigned X-bit immediate.
1380b57cec5SDimitry Andric//
1390b57cec5SDimitry Andric// [ABC] - 32-bit register operand.  These are 6-bit fields.  This encodes the
1400b57cec5SDimitry Andric//         standard 32 general purpose registers, and allows use of additional
1410b57cec5SDimitry Andric//         (extension) registers.  This also encodes an instruction that uses
1420b57cec5SDimitry Andric//         a 32-bit Long Immediate (LImm), using 0x3e==62 as the field value.
1430b57cec5SDimitry Andric//         This makes 32-bit format instructions with Long Immediates
1440b57cec5SDimitry Andric//         64-bit instructions, with the Long Immediate in bits 32-63.
1450b57cec5SDimitry Andric// A - Inst[5-0] = A[5-0], when the format has A.  A is always a register.
1460b57cec5SDimitry Andric// B - Inst[14-12] = B[5-3], Inst[26-24] = B[2-0], when the format has B.
1470b57cec5SDimitry Andric//     B is always a register.
1480b57cec5SDimitry Andric// C - Inst[11-6] = C[5-0], when the format has C.  C can either be a register,
1490b57cec5SDimitry Andric//     or a 6-bit unsigned immediate (immU6), depending on the format.
1500b57cec5SDimitry Andric// F - Many instructions specify a flag bit. When set, the result of these
1510b57cec5SDimitry Andric//     instructions will set the ZNCV flags of the STATUS32 register
1520b57cec5SDimitry Andric//     (Zero/Negative/Carry/oVerflow).
1530b57cec5SDimitry Andric
1540b57cec5SDimitry Andric// Branch Instructions.
1550b57cec5SDimitry Andricclass F32_BR<bits<5> major, dag outs, dag ins, bit b16, string asmstr,
1560b57cec5SDimitry Andric             list<dag> pattern> :
1570b57cec5SDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
1580b57cec5SDimitry Andric  bit N;
1590b57cec5SDimitry Andric
1600b57cec5SDimitry Andric  let Inst{31-27} = major;
1610b57cec5SDimitry Andric  let Inst{16} = b16;
1620b57cec5SDimitry Andric  let Inst{5} = N;
1630b57cec5SDimitry Andric}
1640b57cec5SDimitry Andric
1650b57cec5SDimitry Andricclass F32_BR_COND<bits<5> major, dag outs, dag ins, bit b16, string asmstr,
1660b57cec5SDimitry Andric                  list<dag> pattern> :
1670b57cec5SDimitry Andric  F32_BR<major, outs, ins, b16, asmstr, pattern> {
1680b57cec5SDimitry Andric  bits<21> S21; // 2-byte aligned 21-bit byte-offset.
1690b57cec5SDimitry Andric  bits<5> cc;
1700b57cec5SDimitry Andric  let Inst{26-18} = S21{10-2};
1710b57cec5SDimitry Andric  let Inst{15-6} = S21{20-11};
1720b57cec5SDimitry Andric  let Inst{4-0} = cc;
1730b57cec5SDimitry Andric}
1740b57cec5SDimitry Andric
1750b57cec5SDimitry Andricclass F32_BR_UCOND_FAR<bits<5> major, dag outs, dag ins, bit b16, string asmstr,
1760b57cec5SDimitry Andric                       list<dag> pattern> :
1770b57cec5SDimitry Andric  F32_BR<major, outs, ins, b16, asmstr, pattern> {
1780b57cec5SDimitry Andric  bits<25> S25; // 2-byte aligned 25-bit byte-offset.
1790b57cec5SDimitry Andric  let Inst{26-18} = S25{10-2};
1800b57cec5SDimitry Andric  let Inst{15-6} = S25{20-11};
1810b57cec5SDimitry Andric  let Inst{4} = 0;
1820b57cec5SDimitry Andric  let Inst{3-0} = S25{24-21};
1830b57cec5SDimitry Andric}
1840b57cec5SDimitry Andric
1850b57cec5SDimitry Andricclass F32_BR0_COND<dag outs, dag ins, string asmstr, list<dag> pat> :
1860b57cec5SDimitry Andric  F32_BR_COND<0b00000, outs, ins, 0, asmstr, pat> {
1870b57cec5SDimitry Andric  let Inst{17} = S21{1};
1880b57cec5SDimitry Andric}
1890b57cec5SDimitry Andric
1900b57cec5SDimitry Andric// Branch targets are 2-byte aligned, so S25[0] is implied 0.
1910b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0   |
1920b57cec5SDimitry Andric// |S25[10-1]                    | 1|S25[20-11]               |N|0|S25[24-21]|
1930b57cec5SDimitry Andricclass F32_BR0_UCOND_FAR<dag outs, dag ins, string asmstr, list<dag> pat> :
1940b57cec5SDimitry Andric  F32_BR_UCOND_FAR<0b00000, outs, ins, 1, asmstr, pat> {
1950b57cec5SDimitry Andric  let Inst{17} = S25{1};
1960b57cec5SDimitry Andric}
1970b57cec5SDimitry Andric
1980b57cec5SDimitry Andric// BL targets (functions) are 4-byte aligned, so S25[1-0] = 0b00
1990b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0   |
2000b57cec5SDimitry Andric// |S25[10-2]                 | 1| 0|S25[20-11]               |N|0|S25[24-21]|
2010b57cec5SDimitry Andricclass F32_BR1_BL_UCOND_FAR<dag outs, dag ins, string asmstr, list<dag> pat> :
2020b57cec5SDimitry Andric  F32_BR_UCOND_FAR<0b00001, outs, ins, 0, asmstr, pat> {
2030b57cec5SDimitry Andric  let Inst{17} = 1;
2040b57cec5SDimitry Andric}
2050b57cec5SDimitry Andric
2060b57cec5SDimitry Andric// BLcc targets have 21 bit range, and are 4-byte aligned.
2070b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
2080b57cec5SDimitry Andric// |S25[10-2]                 | 0| 0|S25[20-11]               |N|0|cc     |
2090b57cec5SDimitry Andricclass F32_BR1_BL_COND<dag outs, dag ins, string asmstr, list<dag> pat> :
2100b57cec5SDimitry Andric  F32_BR_COND<0b00001, outs, ins, 0, asmstr, pat> {
2110b57cec5SDimitry Andric  let Inst{17} = 0;
2120b57cec5SDimitry Andric}
2130b57cec5SDimitry Andric
2140b57cec5SDimitry Andric// BRcc targets have limited 9-bit range.  These are for compare and branch
2150b57cec5SDimitry Andric// in single instruction.  Their targets are 2-byte aligned.  They also use
2160b57cec5SDimitry Andric// a different (3-bit) set of condition codes.
2170b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15   |14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
2180b57cec5SDimitry Andric// |B[2-0]  |S9[7-1]             | 1|S9[8]|B[5-3]  |C            |N|u|0|cc   |
2190b57cec5SDimitry Andricclass F32_BR1_BCC<dag outs, dag ins, string asmstr, bit IsU6,
2200b57cec5SDimitry Andric                  list<dag> pattern> :
2210b57cec5SDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
2220b57cec5SDimitry Andric
2230b57cec5SDimitry Andric  bits<3> cc;
2240b57cec5SDimitry Andric  bits<6> B;
2250b57cec5SDimitry Andric  bits<6> C;
2260b57cec5SDimitry Andric  bit N;
2270b57cec5SDimitry Andric  bits<9> S9; // 2-byte aligned 9-bit byte-offset.
2280b57cec5SDimitry Andric
2290b57cec5SDimitry Andric  let Inst{31-27} = 0b00001;
2300b57cec5SDimitry Andric  let Inst{26-24} = B{2-0};
2310b57cec5SDimitry Andric  let Inst{23-17} = S9{7-1};
2320b57cec5SDimitry Andric  let Inst{16} = 1;
2330b57cec5SDimitry Andric  let Inst{15} = S9{8};
2340b57cec5SDimitry Andric  let Inst{14-12} = B{5-3};
2350b57cec5SDimitry Andric  let Inst{11-6} = C;
2360b57cec5SDimitry Andric  let Inst{5} = N;
2370b57cec5SDimitry Andric  let Inst{4} = IsU6;
2380b57cec5SDimitry Andric  let Inst{3} = 0;
2390b57cec5SDimitry Andric  let Inst{2-0} = cc;
2400b57cec5SDimitry Andric}
2410b57cec5SDimitry Andric
2420b57cec5SDimitry Andric// General operations instructions.
2430b57cec5SDimitry Andric// Single Operand Instructions.  Inst[5-0] specifies the specific operation
2440b57cec5SDimitry Andric// for this format.
2450b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
2460b57cec5SDimitry Andric// |B[2-0]  | 0| 0| 1| 0| 1| 1| 1| 1| F|B[5-3]  |C            |subop      |
2470b57cec5SDimitry Andricclass F32_SOP_RR<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
2480b57cec5SDimitry Andric                 string asmstr, list<dag> pattern> :
2490b57cec5SDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
2500b57cec5SDimitry Andric
2510b57cec5SDimitry Andric  bits<6> C;
2520b57cec5SDimitry Andric  bits<6> B;
2530b57cec5SDimitry Andric
2540b57cec5SDimitry Andric  let Inst{31-27} = major;
2550b57cec5SDimitry Andric  let Inst{26-24} = B{2-0};
2560b57cec5SDimitry Andric  let Inst{23-22} = 0b00;
2570b57cec5SDimitry Andric  let Inst{21-16} = 0b101111;
2580b57cec5SDimitry Andric  let Inst{15} = F;
2590b57cec5SDimitry Andric  let Inst{14-12} = B{5-3};
2600b57cec5SDimitry Andric  let Inst{11-6} = C;
2610b57cec5SDimitry Andric  let Inst{5-0} = subop;
2620b57cec5SDimitry Andric}
2630b57cec5SDimitry Andric
2640b57cec5SDimitry Andric// Dual Operand Instructions.  Inst[21-16] specifies the specific operation
2650b57cec5SDimitry Andric// for this format.
2660b57cec5SDimitry Andric
2670b57cec5SDimitry Andric// 3-register Dual Operand instruction.
2680b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
2690b57cec5SDimitry Andric// |B[2-0]  | 0| 0|            subop| F|B[5-3]  |C            |A          |
2700b57cec5SDimitry Andricclass F32_DOP_RR<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
2710b57cec5SDimitry Andric                 string asmstr, list<dag> pattern> :
2720b57cec5SDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
2730b57cec5SDimitry Andric  bits<6> C;
2740b57cec5SDimitry Andric  bits<6> B;
2750b57cec5SDimitry Andric  bits<6> A;
2760b57cec5SDimitry Andric
2770b57cec5SDimitry Andric  let Inst{31-27} = major;
2780b57cec5SDimitry Andric  let Inst{26-24} = B{2-0};
2790b57cec5SDimitry Andric  let Inst{23-22} = 0b00;
2800b57cec5SDimitry Andric  let Inst{21-16} = subop;
2810b57cec5SDimitry Andric  let Inst{15} = F;
2820b57cec5SDimitry Andric  let Inst{14-12} = B{5-3};
2830b57cec5SDimitry Andric  let Inst{11-6} = C;
2840b57cec5SDimitry Andric  let Inst{5-0} = A;
2850b57cec5SDimitry Andric}
2860b57cec5SDimitry Andric
2870b57cec5SDimitry Andric// Conditional Dual Operand instruction.  This instruction uses B as the
2880b57cec5SDimitry Andric// first 2 operands (i.e, add.cc B, B, C).
2890b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
2900b57cec5SDimitry Andric// |B[2-0]  | 1| 1|            subop| F|B[5-3]  |C            |A          |
2910b57cec5SDimitry Andricclass F32_DOP_CC_RR<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
2920b57cec5SDimitry Andric                    string asmstr, list<dag> pattern> :
2930b57cec5SDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
2940b57cec5SDimitry Andric  bits<5> cc;
2950b57cec5SDimitry Andric  bits<6> C;
2960b57cec5SDimitry Andric  bits<6> B;
2970b57cec5SDimitry Andric
2980b57cec5SDimitry Andric  let Inst{31-27} = major;
2990b57cec5SDimitry Andric  let Inst{26-24} = B{2-0};
3000b57cec5SDimitry Andric  let Inst{23-22} = 0b11;
3010b57cec5SDimitry Andric  let Inst{21-16} = subop;
3020b57cec5SDimitry Andric  let Inst{15} = F;
3030b57cec5SDimitry Andric  let Inst{14-12} = B{5-3};
3040b57cec5SDimitry Andric  let Inst{11-6} = C;
3050b57cec5SDimitry Andric  let Inst{5} = 0;
3060b57cec5SDimitry Andric  let Inst{4-0} = cc;
3070b57cec5SDimitry Andric}
3080b57cec5SDimitry Andric
3090b57cec5SDimitry Andric
3100b57cec5SDimitry Andric// 2-register, unsigned 6-bit immediate Dual Operand instruction.
3110b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
3120b57cec5SDimitry Andric// |B[2-0]  | 0| 1|            subop| F|B[5-3]  |U6           |A          |
3130b57cec5SDimitry Andricclass F32_DOP_RU6<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
3140b57cec5SDimitry Andric                  string asmstr, list<dag> pattern> :
3150b57cec5SDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
3160b57cec5SDimitry Andric  bits<6> U6;
3170b57cec5SDimitry Andric  bits<6> B;
3180b57cec5SDimitry Andric  bits<6> A;
3190b57cec5SDimitry Andric
3200b57cec5SDimitry Andric  let Inst{31-27} = major;
3210b57cec5SDimitry Andric  let Inst{26-24} = B{2-0};
3220b57cec5SDimitry Andric  let Inst{23-22} = 0b01;
3230b57cec5SDimitry Andric  let Inst{21-16} = subop;
3240b57cec5SDimitry Andric  let Inst{15} = F;
3250b57cec5SDimitry Andric  let Inst{14-12} = B{5-3};
3260b57cec5SDimitry Andric  let Inst{11-6} = U6;
3270b57cec5SDimitry Andric  let Inst{5-0} = A;
3280b57cec5SDimitry Andric}
3290b57cec5SDimitry Andric
330*349cc55cSDimitry Andric// 1-register, unsigned 6-bit, immediate Dual Operand instruction with
331*349cc55cSDimitry Andric// condition code.
332*349cc55cSDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
333*349cc55cSDimitry Andric// |B[2-0]  | 1| 1|            subop| F|B[5-3]  |U6           |1|cc       |
334*349cc55cSDimitry Andricclass F32_DOP_CC_RU6<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
335*349cc55cSDimitry Andric                     string asmstr, list<dag> pattern> :
336*349cc55cSDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
337*349cc55cSDimitry Andric
338*349cc55cSDimitry Andric  bits<5> cc;
339*349cc55cSDimitry Andric  bits<6> U6;
340*349cc55cSDimitry Andric  bits<6> B;
341*349cc55cSDimitry Andric
342*349cc55cSDimitry Andric  let Inst{31-27} = major;
343*349cc55cSDimitry Andric  let Inst{26-24} = B{2-0};
344*349cc55cSDimitry Andric  let Inst{23-22} = 0b11;
345*349cc55cSDimitry Andric  let Inst{21-16} = subop;
346*349cc55cSDimitry Andric  let Inst{15} = F;
347*349cc55cSDimitry Andric  let Inst{14-12} = B{5-3};
348*349cc55cSDimitry Andric  let Inst{11-6} = U6;
349*349cc55cSDimitry Andric  let Inst{5} = 1;
350*349cc55cSDimitry Andric  let Inst{4-0} = cc;
351*349cc55cSDimitry Andric
352*349cc55cSDimitry Andric  let DecoderMethod = "DecodeCCRU6Instruction";
353*349cc55cSDimitry Andric}
354*349cc55cSDimitry Andric
355fe6060f1SDimitry Andric// 2-register, unsigned 6-bit immediate Dual Operand instruction with
356fe6060f1SDimitry Andric// condition code. This instruction uses B as the first 2 operands
357fe6060f1SDimitry Andric// (i.e, add.cc B, B, u6).
358fe6060f1SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
359fe6060f1SDimitry Andric// |B[2-0]  | 1| 1|            subop| F|B[5-3]  |U6           |1|cc       |
360fe6060f1SDimitry Andricclass F32_DOP_CC_RRU6<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
361fe6060f1SDimitry Andric                      string asmstr, list<dag> pattern> :
362fe6060f1SDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
363fe6060f1SDimitry Andric  bits<5> cc;
364fe6060f1SDimitry Andric  bits<6> U6;
365fe6060f1SDimitry Andric  bits<6> B;
366fe6060f1SDimitry Andric
367fe6060f1SDimitry Andric  let Inst{31-27} = major;
368fe6060f1SDimitry Andric  let Inst{26-24} = B{2-0};
369fe6060f1SDimitry Andric  let Inst{23-22} = 0b11;
370fe6060f1SDimitry Andric  let Inst{21-16} = subop;
371fe6060f1SDimitry Andric  let Inst{15} = F;
372fe6060f1SDimitry Andric  let Inst{14-12} = B{5-3};
373fe6060f1SDimitry Andric  let Inst{11-6} = U6;
374fe6060f1SDimitry Andric  let Inst{5} = 1;
375fe6060f1SDimitry Andric  let Inst{4-0} = cc;
376fe6060f1SDimitry Andric}
377fe6060f1SDimitry Andric
3780b57cec5SDimitry Andric// 2-register, signed 12-bit immediate Dual Operand instruction.
3790b57cec5SDimitry Andric// This instruction uses B as the first 2 operands (i.e., add B, B, -128).
3800b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
3810b57cec5SDimitry Andric// |B[2-0]  | 1| 0|            subop| F|B[5-3]  |S12[5-0]     |S12[11-6]  |
3820b57cec5SDimitry Andricclass F32_DOP_RS12<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
3830b57cec5SDimitry Andric                   string asmstr, list<dag> pattern> :
3840b57cec5SDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
3850b57cec5SDimitry Andric  bits<6> B;
3860b57cec5SDimitry Andric  bits<12> S12;
3870b57cec5SDimitry Andric
3880b57cec5SDimitry Andric  let Inst{31-27} = major;
3890b57cec5SDimitry Andric  let Inst{26-24} = B{2-0};
3900b57cec5SDimitry Andric  let Inst{23-22} = 0b10;
3910b57cec5SDimitry Andric  let Inst{21-16} = subop;
3920b57cec5SDimitry Andric  let Inst{15} = F;
3930b57cec5SDimitry Andric  let Inst{14-12} = B{5-3};
3940b57cec5SDimitry Andric  let Inst{11-6} = S12{5-0};
3950b57cec5SDimitry Andric  let Inst{5-0} = S12{11-6};
3960b57cec5SDimitry Andric}
3970b57cec5SDimitry Andric
398*349cc55cSDimitry Andric// 1-register, signed 12-bit immediate Dual Operand instruction.
399*349cc55cSDimitry Andric// This instruction uses B as the first operand (i.e., lr B, [%count0]).
400*349cc55cSDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
401*349cc55cSDimitry Andric// |B[2-0]  | 1| 0|            subop| F|B[5-3]  |S12[5-0]     |S12[11-6]  |
402*349cc55cSDimitry Andricclass F32_SOP_RS12<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
403*349cc55cSDimitry Andric                   string asmstr, list<dag> pattern> :
404*349cc55cSDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
405*349cc55cSDimitry Andric  bits<6> B;
406*349cc55cSDimitry Andric  bits<12> S12;
407*349cc55cSDimitry Andric
408*349cc55cSDimitry Andric  let Inst{31-27} = major;
409*349cc55cSDimitry Andric  let Inst{26-24} = B{2-0};
410*349cc55cSDimitry Andric  let Inst{23-22} = 0b10;
411*349cc55cSDimitry Andric  let Inst{21-16} = subop;
412*349cc55cSDimitry Andric  let Inst{15} = F;
413*349cc55cSDimitry Andric  let Inst{14-12} = B{5-3};
414*349cc55cSDimitry Andric  let Inst{11-6} = S12{5-0};
415*349cc55cSDimitry Andric  let Inst{5-0} = S12{11-6};
416*349cc55cSDimitry Andric
417*349cc55cSDimitry Andric  let DecoderMethod = "DecodeSOPwithRS12";
418*349cc55cSDimitry Andric}
419*349cc55cSDimitry Andric
420*349cc55cSDimitry Andric// 1-register, unsigned 6-bit immediate Dual Operand instruction.
421*349cc55cSDimitry Andric// This instruction uses B as the first operand.
422*349cc55cSDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
423*349cc55cSDimitry Andric// |B[2-0]  | 0| 1|            subop| F|B[5-3]  |U6           |0|0|0|0|0|0|
424*349cc55cSDimitry Andricclass F32_SOP_RU6<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
425*349cc55cSDimitry Andric                  string asmstr, list<dag> pattern> :
426*349cc55cSDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
427*349cc55cSDimitry Andric  bits<6> B;
428*349cc55cSDimitry Andric  bits<6> U6;
429*349cc55cSDimitry Andric
430*349cc55cSDimitry Andric  let Inst{31-27} = major;
431*349cc55cSDimitry Andric  let Inst{26-24} = B{2-0};
432*349cc55cSDimitry Andric  let Inst{23-22} = 0b01;
433*349cc55cSDimitry Andric  let Inst{21-16} = subop;
434*349cc55cSDimitry Andric  let Inst{15} = F;
435*349cc55cSDimitry Andric  let Inst{14-12} = B{5-3};
436*349cc55cSDimitry Andric  let Inst{11-6} = U6;
437*349cc55cSDimitry Andric  let Inst{5-0} = 0;
438*349cc55cSDimitry Andric
439*349cc55cSDimitry Andric  let DecoderMethod = "DecodeSOPwithRU6";
440*349cc55cSDimitry Andric}
441*349cc55cSDimitry Andric
4420b57cec5SDimitry Andric// 2-register, 32-bit immediate (LImm) Dual Operand instruction.
4430b57cec5SDimitry Andric// This instruction has the 32-bit immediate in bits 32-63, and
4440b57cec5SDimitry Andric// 62 in the C register operand slot, but is otherwise F32_DOP_RR.
4450b57cec5SDimitry Andricclass F32_DOP_RLIMM<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
4460b57cec5SDimitry Andric                    string asmstr, list<dag> pattern> :
4470b57cec5SDimitry Andric  InstARC<8, outs, ins, asmstr, pattern> {
4480b57cec5SDimitry Andric  bits<6> B;
4490b57cec5SDimitry Andric  bits<6> A;
4500b57cec5SDimitry Andric  bits<32> LImm;
4510b57cec5SDimitry Andric
4520b57cec5SDimitry Andric  let Inst{63-32} = LImm;
4530b57cec5SDimitry Andric  let Inst{31-27} = major;
4540b57cec5SDimitry Andric  let Inst{26-24} = B{2-0};
4550b57cec5SDimitry Andric  let Inst{23-22} = 0b00;
4560b57cec5SDimitry Andric  let Inst{21-16} = subop;
4570b57cec5SDimitry Andric  let Inst{15} = F;
4580b57cec5SDimitry Andric  let Inst{14-12} = B{5-3};
4590b57cec5SDimitry Andric  let Inst{11-6} = 0b111110;
4600b57cec5SDimitry Andric  let Inst{5-0} = A;
4610b57cec5SDimitry Andric}
4620b57cec5SDimitry Andric
4630b57cec5SDimitry Andric
4640b57cec5SDimitry Andric// Load and store instructions.
4650b57cec5SDimitry Andric// In addition to the previous naming conventions, load and store instructions
4660b57cec5SDimitry Andric// have:
4670b57cec5SDimitry Andric// di - Uncached bit.  When set, loads/stores bypass the cache and access
4680b57cec5SDimitry Andric//      memory directly.
4690b57cec5SDimitry Andric// aa - Incrementing mode.  Loads and stores can write-back address pre- or
4700b57cec5SDimitry Andric//      post- memory operation.
4710b57cec5SDimitry Andric// zz - Memory size (can be 8/16/32 bit load/store).
4720b57cec5SDimitry Andric//  x - Sign-extending.  When set, short loads can be sign-extended to 32-bits.
4730b57cec5SDimitry Andric// Loads and Stores support different memory addressing modes:
4740b57cec5SDimitry Andric// Base Register + Signed 9-bit Immediate: Both Load/Store.
4750b57cec5SDimitry Andric// LImm: Both Load/Store (Load/Store from a fixed 32-bit address).
4760b57cec5SDimitry Andric// Register + Register: Load Only.
4770b57cec5SDimitry Andric// Register + LImm: Load Only.
4780b57cec5SDimitry Andric
4790b57cec5SDimitry Andric// Register + S9 Load. (B + S9)
4800b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15   |14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
4810b57cec5SDimitry Andric// |B[2-0]  |S9[7-0]                |S9[8]|B[5-3]  |di|aa  |zz |x|A          |
4820b57cec5SDimitry Andricclass F32_LD_RS9<bit x, bits<2> aa, bit di, bits<2> zz, dag outs, dag ins,
4830b57cec5SDimitry Andric                 string asmstr, list<dag> pattern> :
4840b57cec5SDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
4850b57cec5SDimitry Andric  bits<6> B;
4860b57cec5SDimitry Andric  bits<6> A;
4870b57cec5SDimitry Andric  bits<9> S9;
4880b57cec5SDimitry Andric
4890b57cec5SDimitry Andric  let Inst{31-27} = 0b00010;
4900b57cec5SDimitry Andric  let Inst{26-24} = B{2-0};
4910b57cec5SDimitry Andric  let Inst{23-16} = S9{7-0};
4920b57cec5SDimitry Andric  let Inst{15} = S9{8};
4930b57cec5SDimitry Andric  let Inst{14-12} = B{5-3};
4940b57cec5SDimitry Andric  let Inst{11} = di;
4950b57cec5SDimitry Andric  let Inst{10-9} = aa;
4960b57cec5SDimitry Andric  let Inst{8-7} = zz;
4970b57cec5SDimitry Andric  let Inst{6} = x;
4980b57cec5SDimitry Andric  let Inst{5-0} = A;
4990b57cec5SDimitry Andric
5000b57cec5SDimitry Andric  let BaseOpcode = "ld_rs9";
5010b57cec5SDimitry Andric}
5020b57cec5SDimitry Andric
5030b57cec5SDimitry Andricclass F32_LD_ADDR<bit x, bits<2> aa, bit di, bits<2> zz, dag outs, dag ins,
5040b57cec5SDimitry Andric                  string asmstr, list<dag> pattern> :
5050b57cec5SDimitry Andric  F32_LD_RS9<x, aa, di, zz, outs, ins, asmstr, pattern> {
5060b57cec5SDimitry Andric  bits<15> addr;
5070b57cec5SDimitry Andric
5080b57cec5SDimitry Andric  let B = addr{14-9};
5090b57cec5SDimitry Andric  let S9 = addr{8-0};
5100b57cec5SDimitry Andric
5110b57cec5SDimitry Andric  let BaseOpcode = "ld_rs9";
5120b57cec5SDimitry Andric}
5130b57cec5SDimitry Andric
5140b57cec5SDimitry Andric
5150b57cec5SDimitry Andric// LImm Load.  The 32-bit immediate address is in Inst[63-32].
5160b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
5170b57cec5SDimitry Andric// | 1| 1| 0| 0                        | 1| 1| 1|di| 0|0|zz |x|A          |
5180b57cec5SDimitry Andricclass F32_LD_LIMM<bit x, bit di, bits<2> zz, dag outs, dag ins,
5190b57cec5SDimitry Andric                  string asmstr, list<dag> pattern> :
5200b57cec5SDimitry Andric  InstARC<8, outs, ins, asmstr, pattern> {
5210b57cec5SDimitry Andric  bits<6> LImmReg = 0b111110;
5220b57cec5SDimitry Andric  bits<6> A;
5230b57cec5SDimitry Andric  bits<32> LImm;
5240b57cec5SDimitry Andric
5250b57cec5SDimitry Andric  let Inst{63-32} = LImm;
5260b57cec5SDimitry Andric  let Inst{31-27} = 0b00010;
5270b57cec5SDimitry Andric  let Inst{26-24} = LImmReg{2-0};
5280b57cec5SDimitry Andric  let Inst{23-15} = 0;
5290b57cec5SDimitry Andric  let Inst{14-12} = LImmReg{5-3};
5300b57cec5SDimitry Andric  let Inst{11} = di;
5310b57cec5SDimitry Andric  let Inst{10-9} = 0;
5320b57cec5SDimitry Andric  let Inst{8-7} = zz;
5330b57cec5SDimitry Andric  let Inst{6} = x;
5340b57cec5SDimitry Andric  let Inst{5-0} = A;
5350b57cec5SDimitry Andric  let DecoderMethod = "DecodeLdLImmInstruction";
5360b57cec5SDimitry Andric
5370b57cec5SDimitry Andric  let BaseOpcode = "ld_limm";
5380b57cec5SDimitry Andric}
5390b57cec5SDimitry Andric
5400b57cec5SDimitry Andric// Register + LImm load.  The 32-bit immediate address is in Inst[63-32].
5410b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
5420b57cec5SDimitry Andric// |B[2-0]  |aa   | 1| 1| 0|zz   | x|di|B[5-3]  | 1| 1|1|1|1|0|A          |
5430b57cec5SDimitry Andricclass F32_LD_RLIMM<bit x, bits<2> aa, bit di, bits<2> zz, dag outs, dag ins,
5440b57cec5SDimitry Andric                   string asmstr, list<dag> pattern> :
5450b57cec5SDimitry Andric  InstARC<8, outs, ins, asmstr, pattern> {
5460b57cec5SDimitry Andric  bits<6> LImmReg = 0b111110;
5470b57cec5SDimitry Andric  bits<32> LImm;
5480b57cec5SDimitry Andric  bits<6> B;
5490b57cec5SDimitry Andric  bits<6> A;
5500b57cec5SDimitry Andric  bits<38> addr;
5510b57cec5SDimitry Andric  let B = addr{37-32};
5520b57cec5SDimitry Andric  let LImm = addr{31-0};
5530b57cec5SDimitry Andric
5540b57cec5SDimitry Andric  let Inst{63-32} = LImm;
5550b57cec5SDimitry Andric  let Inst{31-27} = 0b00100;
5560b57cec5SDimitry Andric  let Inst{26-24} = B{2-0};
5570b57cec5SDimitry Andric  let Inst{23-22} = aa;
5580b57cec5SDimitry Andric  let Inst{21-19} = 0b110;
5590b57cec5SDimitry Andric  let Inst{18-17} = zz;
5600b57cec5SDimitry Andric  let Inst{16} = x;
5610b57cec5SDimitry Andric  let Inst{15} = di;
5620b57cec5SDimitry Andric  let Inst{14-12} = B{5-3};
5630b57cec5SDimitry Andric  let Inst{11-6} = LImmReg;
5640b57cec5SDimitry Andric  let Inst{5-0} = A;
5650b57cec5SDimitry Andric  let DecoderMethod = "DecodeLdRLImmInstruction";
5660b57cec5SDimitry Andric
5670b57cec5SDimitry Andric  let BaseOpcode = "ld_rlimm";
5680b57cec5SDimitry Andric}
5690b57cec5SDimitry Andric
5700b57cec5SDimitry Andric// Register + S9 Store. (B + S9)
5710b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15   |14|13|12|11|10|9|8|7|6|5 |4|3|2|1|0|
5720b57cec5SDimitry Andric// |B[2-0]  |S9[7-0]                |S9[8]|B[5-3]  |C            |di|aa |zz |0|
5730b57cec5SDimitry Andricclass F32_ST_RS9<bits<2> aa, bit di, bits<2> zz, dag outs, dag ins,
5740b57cec5SDimitry Andric                 string asmstr, list<dag> pattern> :
5750b57cec5SDimitry Andric  InstARC<4, outs, ins, asmstr, pattern> {
5760b57cec5SDimitry Andric  bits<6> B;
5770b57cec5SDimitry Andric  bits<6> C;
5780b57cec5SDimitry Andric  bits<9> S9;
5790b57cec5SDimitry Andric
5800b57cec5SDimitry Andric  let Inst{31-27} = 0b00011;
5810b57cec5SDimitry Andric  let Inst{26-24} = B{2-0};
5820b57cec5SDimitry Andric  let Inst{23-16} = S9{7-0};
5830b57cec5SDimitry Andric  let Inst{15} = S9{8};
5840b57cec5SDimitry Andric  let Inst{14-12} = B{5-3};
5850b57cec5SDimitry Andric  let Inst{11-6} = C;
5860b57cec5SDimitry Andric  let Inst{5} = di;
5870b57cec5SDimitry Andric  let Inst{4-3} = aa;
5880b57cec5SDimitry Andric  let Inst{2-1} = zz;
5890b57cec5SDimitry Andric  let Inst{0} = 0;
5900b57cec5SDimitry Andric
5910b57cec5SDimitry Andric  let BaseOpcode = "st_rs9";
5920b57cec5SDimitry Andric}
5930b57cec5SDimitry Andric
5940b57cec5SDimitry Andricclass F32_ST_ADDR<bits<2> aa, bit di, bits<2> zz, dag outs, dag ins,
5950b57cec5SDimitry Andric                  string asmstr, list<dag> pattern> :
5960b57cec5SDimitry Andric  F32_ST_RS9<aa, di, zz, outs, ins, asmstr, pattern> {
5970b57cec5SDimitry Andric  bits<15> addr;
5980b57cec5SDimitry Andric
5990b57cec5SDimitry Andric  let B = addr{14-9};
6000b57cec5SDimitry Andric  let S9 = addr{8-0};
6010b57cec5SDimitry Andric
6020b57cec5SDimitry Andric  let BaseOpcode = "st_rs9";
6030b57cec5SDimitry Andric}
6040b57cec5SDimitry Andric
6050b57cec5SDimitry Andric// LImm Store.
6060b57cec5SDimitry Andric// |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5 |4|3|2|1|0|
6070b57cec5SDimitry Andric// | 1| 1| 0| 0                        | 1| 1| 1|C            |di|0|0|zz |0|
6080b57cec5SDimitry Andricclass F32_ST_LIMM<bit di, bits<2> zz, dag outs, dag ins,
6090b57cec5SDimitry Andric                  string asmstr, list<dag> pattern> :
6100b57cec5SDimitry Andric  InstARC<8, outs, ins, asmstr, pattern> {
6110b57cec5SDimitry Andric  bits<6> LImmReg = 0b111110;
6120b57cec5SDimitry Andric  bits<6> C;
6130b57cec5SDimitry Andric  bits<32> LImm;
6140b57cec5SDimitry Andric
6150b57cec5SDimitry Andric  let Inst{63-32} = LImm;
6160b57cec5SDimitry Andric  let Inst{31-27} = 0b00011;
6170b57cec5SDimitry Andric  let Inst{26-24} = LImmReg{2-0};
6180b57cec5SDimitry Andric  let Inst{23-15} = 0;
6190b57cec5SDimitry Andric  let Inst{14-12} = LImmReg{5-3};
6200b57cec5SDimitry Andric  let Inst{11-6} = C;
6210b57cec5SDimitry Andric  let Inst{5} = di;
6220b57cec5SDimitry Andric  let Inst{4-3} = 0;
6230b57cec5SDimitry Andric  let Inst{2-1} = zz;
6240b57cec5SDimitry Andric  let Inst{0} = 0;
6250b57cec5SDimitry Andric  let DecoderMethod = "DecodeStLImmInstruction";
6260b57cec5SDimitry Andric
6270b57cec5SDimitry Andric  let BaseOpcode = "st_limm";
6280b57cec5SDimitry Andric}
6290b57cec5SDimitry Andric
6300b57cec5SDimitry Andric// Compact Move/Load.
6310b57cec5SDimitry Andric// |10|9|8|7|6|5|4|3|2|1|0|
6320b57cec5SDimitry Andric// |      |h    |   |i|H  |
6330b57cec5SDimitry Andricclass F16_COMPACT<bits<1> i, dag outs, dag ins,
6340b57cec5SDimitry Andric                 string asmstr> :
6350b57cec5SDimitry Andric  InstARC<2, outs, ins, asmstr, []> {
6360b57cec5SDimitry Andric
6370b57cec5SDimitry Andric  bits<5> h;
6380b57cec5SDimitry Andric
6390b57cec5SDimitry Andric  let Inst{15-11} = 0b01000;
6400b57cec5SDimitry Andric  let Inst{7-5} = h{2-0};
6410b57cec5SDimitry Andric  let Inst{2} = i;
6420b57cec5SDimitry Andric  let Inst{1-0} = h{4-3};
6430b57cec5SDimitry Andric}
6440b57cec5SDimitry Andric
6450b57cec5SDimitry Andric// Compact Load/Add/Sub.
6460b57cec5SDimitry Andricclass F16_LD_ADD_SUB<dag outs, dag ins, string asmstr> :
6470b57cec5SDimitry Andric  InstARC<2, outs, ins, asmstr, []> {
6480b57cec5SDimitry Andric
6490b57cec5SDimitry Andric  bits<3> b;
6500b57cec5SDimitry Andric  let Inst{15-11} = 0b01001;
6510b57cec5SDimitry Andric  let Inst{10-8} = b;
6520b57cec5SDimitry Andric}
6530b57cec5SDimitry Andric
6540b57cec5SDimitry Andricclass F16_LD_SUB<bit i, string asmstr> :
6550b57cec5SDimitry Andric  F16_LD_ADD_SUB<(outs GPR32:$a), (ins GPR32:$b, GPR32:$c),
6560b57cec5SDimitry Andric  asmstr> {
6570b57cec5SDimitry Andric
6580b57cec5SDimitry Andric  bits<3> a;
6590b57cec5SDimitry Andric  bits<3> c;
6600b57cec5SDimitry Andric
6610b57cec5SDimitry Andric  let Inst{7-5} = c;
6620b57cec5SDimitry Andric  let Inst{4} = i;
6630b57cec5SDimitry Andric  let Inst{3} = 0;
6640b57cec5SDimitry Andric  let Inst{2-0} = a;
6650b57cec5SDimitry Andric}
6660b57cec5SDimitry Andric
6670b57cec5SDimitry Andricclass F16_ADD :
6680b57cec5SDimitry Andric  F16_LD_ADD_SUB<(outs GPR32:$r), (ins GPR32:$b, immU<6>:$u6),
6690b57cec5SDimitry Andric  "add_s\t$r, $b, $u6"> {
6700b57cec5SDimitry Andric
6710b57cec5SDimitry Andric  bit r;
6720b57cec5SDimitry Andric  bits<6> u6;
6730b57cec5SDimitry Andric
6740b57cec5SDimitry Andric  let Inst{7} = r;
6750b57cec5SDimitry Andric  let Inst{6-4} = u6{5-3};
6760b57cec5SDimitry Andric  let Inst{3} = 1;
6770b57cec5SDimitry Andric  let Inst{2-0} = u6{2-0};
6780b57cec5SDimitry Andric}
6790b57cec5SDimitry Andric
6800b57cec5SDimitry Andric// Compact Load/Store.
6810b57cec5SDimitry Andricclass F16_LD_ST_1<dag outs, dag ins, string asmstr> :
6820b57cec5SDimitry Andric  InstARC<2, outs, ins, asmstr, []> {
6830b57cec5SDimitry Andric
6840b57cec5SDimitry Andric  let Inst{15-11} = 0b01010;
6850b57cec5SDimitry Andric}
6860b57cec5SDimitry Andric
6870b57cec5SDimitry Andricclass F16_LD_ST_s11<bit i, string asmstr> :
6880b57cec5SDimitry Andric  F16_LD_ST_1<(outs), (ins immS<11>:$s11), asmstr> {
6890b57cec5SDimitry Andric
6900b57cec5SDimitry Andric  bits<11> s11;
6910b57cec5SDimitry Andric
6920b57cec5SDimitry Andric  let Inst{10-5} = s11{10-5};
6930b57cec5SDimitry Andric  let Inst{4} = i;
6940b57cec5SDimitry Andric  let Inst{3} = 0;
6950b57cec5SDimitry Andric  let Inst{2-0} = s11{4-2};
6960b57cec5SDimitry Andric  let s11{1-0} = 0b00;
6970b57cec5SDimitry Andric}
6980b57cec5SDimitry Andric
6990b57cec5SDimitry Andricclass F16_LDI_u7 :
7000b57cec5SDimitry Andric  F16_LD_ST_1<(outs GPR32:$b), (ins immU<7>:$u7),
7010b57cec5SDimitry Andric  "ldi_s\t$b, [$u7]"> {
7020b57cec5SDimitry Andric
7030b57cec5SDimitry Andric  bits<3> b;
7040b57cec5SDimitry Andric  bits<7> u7;
7050b57cec5SDimitry Andric
7060b57cec5SDimitry Andric  let Inst{10-8} = b;
7070b57cec5SDimitry Andric  let Inst{7-4} = u7{6-3};
7080b57cec5SDimitry Andric  let Inst{3} = 1;
7090b57cec5SDimitry Andric  let Inst{2-0} = u7{2-0};
7100b57cec5SDimitry Andric}
7110b57cec5SDimitry Andric
7120b57cec5SDimitry Andric// Indexed Jump or Execute.
7130b57cec5SDimitry Andricclass F16_JLI_EI<bit i, string asmstr> :
7140b57cec5SDimitry Andric  InstARC<2, (outs), (ins immU<10>:$u10),
7150b57cec5SDimitry Andric  !strconcat(asmstr, "\t$u10"), []> {
7160b57cec5SDimitry Andric
7170b57cec5SDimitry Andric  bits<10> u10;
7180b57cec5SDimitry Andric
7190b57cec5SDimitry Andric  let Inst{15-11} = 0b01011;
7200b57cec5SDimitry Andric  let Inst{10} = i;
7210b57cec5SDimitry Andric  let Inst{9-0} = u10;
7220b57cec5SDimitry Andric}
7230b57cec5SDimitry Andric
7240b57cec5SDimitry Andric// Load/Add Register-Register.
7250b57cec5SDimitry Andricclass F16_LD_ADD_RR<bits<2> i, string asmstr> :
7260b57cec5SDimitry Andric  InstARC<2, (outs GPR32:$a), (ins GPR32:$b, GPR32:$c),
7270b57cec5SDimitry Andric  asmstr, []> {
7280b57cec5SDimitry Andric
7290b57cec5SDimitry Andric  bits<3> a;
7300b57cec5SDimitry Andric  bits<3> b;
7310b57cec5SDimitry Andric  bits<3> c;
7320b57cec5SDimitry Andric
7330b57cec5SDimitry Andric  let Inst{15-11} = 0b01100;
7340b57cec5SDimitry Andric  let Inst{10-8} = b;
7350b57cec5SDimitry Andric  let Inst{7-5} = c;
7360b57cec5SDimitry Andric  let Inst{4-3} = i;
7370b57cec5SDimitry Andric  let Inst{2-0} = a;
7380b57cec5SDimitry Andric}
7390b57cec5SDimitry Andric
7400b57cec5SDimitry Andric// Load/Add GP-Relative.
7410b57cec5SDimitry Andricclass F16_GP_LD_ADD<bits<2> i, dag ins, string asmstr> :
7420b57cec5SDimitry Andric  InstARC<2, (outs), ins, asmstr, []> {
7430b57cec5SDimitry Andric
7440b57cec5SDimitry Andric  let Inst{15-11} = 0b11001;
7450b57cec5SDimitry Andric  let Inst{10-9} = i;
7460b57cec5SDimitry Andric}
7470b57cec5SDimitry Andric
7480b57cec5SDimitry Andric// Add/Sub/Shift Register-Immediate.
7490b57cec5SDimitry Andric// |10|9|8|7|6|5|4|3|2|1|0|
7500b57cec5SDimitry Andric// |b     |c    |i  |u    |
7510b57cec5SDimitry Andricclass F16_ADD_IMM<bits<2> i, string asmstr> :
7520b57cec5SDimitry Andric  InstARC<2, (outs GPR32:$c), (ins GPR32:$b, immU<3>:$u3),
7530b57cec5SDimitry Andric  !strconcat(asmstr, "\t$c, $b, $u3"), []> {
7540b57cec5SDimitry Andric
7550b57cec5SDimitry Andric  bits<3> b;
7560b57cec5SDimitry Andric  bits<3> c;
7570b57cec5SDimitry Andric  bits<3> u3;
7580b57cec5SDimitry Andric
7590b57cec5SDimitry Andric  let Inst{15-11} = 0b01101;
7600b57cec5SDimitry Andric  let Inst{10-8} = b;
7610b57cec5SDimitry Andric  let Inst{7-5} = c;
7620b57cec5SDimitry Andric  let Inst{4-3} = i;
7630b57cec5SDimitry Andric  let Inst{2-0} = u3;
7640b57cec5SDimitry Andric}
7650b57cec5SDimitry Andric
7660b57cec5SDimitry Andric// Dual Register Operations.
7670b57cec5SDimitry Andric// |10|9|8|7|6|5|4|3|2|1|0|
7680b57cec5SDimitry Andric// |b/s   |h    |i    |H  |
7690b57cec5SDimitry Andricclass F16_OP_HREG<bits<3> i, dag outs, dag ins, string asmstr> :
7700b57cec5SDimitry Andric  InstARC<2, outs, ins, asmstr, []> {
7710b57cec5SDimitry Andric
7720b57cec5SDimitry Andric  bits<3> b_s3;
7730b57cec5SDimitry Andric  bits<5> h;
7740b57cec5SDimitry Andric
7750b57cec5SDimitry Andric  let Inst{15-11} = 0b01110;
7760b57cec5SDimitry Andric  let Inst{10-8} = b_s3;
7770b57cec5SDimitry Andric  let Inst{7-5} = h{2-0};
7780b57cec5SDimitry Andric  let Inst{4-2} = i;
7790b57cec5SDimitry Andric  let Inst{1-0} = h{4-3};
7800b57cec5SDimitry Andric}
7810b57cec5SDimitry Andric
7820b57cec5SDimitry Andricclass F16_OP_HREG30<bits<3> i, dag outs, dag ins, string asmstr> :
7830b57cec5SDimitry Andric  F16_OP_HREG<i, outs, ins, asmstr> {
7840b57cec5SDimitry Andric
7850b57cec5SDimitry Andric  bits<5> LImmReg = 0b11110;
7860b57cec5SDimitry Andric  let Inst{7-5} = LImmReg{2-0};
7870b57cec5SDimitry Andric  let Inst{1-0} = LImmReg{4-3};
7880b57cec5SDimitry Andric}
7890b57cec5SDimitry Andric
7900b57cec5SDimitry Andricclass F16_OP_HREG_LIMM<bits<3> i, dag outs, dag ins, string asmstr> :
7910b57cec5SDimitry Andric  F16_OP_HREG30<i, outs, ins, asmstr> {
7920b57cec5SDimitry Andric
7930b57cec5SDimitry Andric  bits<32> LImm;
7940b57cec5SDimitry Andric  let Inst{47-16} = LImm;
7950b57cec5SDimitry Andric  let Size = 6;
7960b57cec5SDimitry Andric}
7970b57cec5SDimitry Andric
7980b57cec5SDimitry Andric// General compact DOP format.
7990b57cec5SDimitry Andricclass F16_GEN_DOP_BASE<bits<5> i, dag outs, dag ins, string asmstr> :
8000b57cec5SDimitry Andric  InstARC<2, outs, ins, asmstr, []> {
8010b57cec5SDimitry Andric
8020b57cec5SDimitry Andric  bits<3> b;
8030b57cec5SDimitry Andric  bits<3> c;
8040b57cec5SDimitry Andric  let Inst{15-11} = 0b01111;
8050b57cec5SDimitry Andric  let Inst{10-8} = b;
8060b57cec5SDimitry Andric  let Inst{7-5} = c;
8070b57cec5SDimitry Andric  let Inst{4-0} = i;
8080b57cec5SDimitry Andric}
8090b57cec5SDimitry Andric
8100b57cec5SDimitry Andricclass F16_GEN_DOP<bits<5> i, string asmstr> :
8110b57cec5SDimitry Andric  F16_GEN_DOP_BASE<i, (outs GPR32:$b), (ins GPR32:$c),
8120b57cec5SDimitry Andric  !strconcat(asmstr, "\t$b, $b, $c")>;
8130b57cec5SDimitry Andric
8140b57cec5SDimitry Andricclass F16_GEN_DOP_NODST<bits<5> i, string asmstr> :
8150b57cec5SDimitry Andric  F16_GEN_DOP_BASE<i, (outs), (ins GPR32:$b, GPR32:$c),
8160b57cec5SDimitry Andric  !strconcat(asmstr, "\t$b, $c")>;
8170b57cec5SDimitry Andric
8180b57cec5SDimitry Andricclass F16_GEN_DOP_SINGLESRC<bits<5> i, string asmstr> :
8190b57cec5SDimitry Andric  F16_GEN_DOP_BASE<i, (outs GPR32:$b), (ins GPR32:$c),
8200b57cec5SDimitry Andric  !strconcat(asmstr, "\t$b, $c")>;
8210b57cec5SDimitry Andric
8220b57cec5SDimitry Andricclass F16_GEN_SOP_BASE<bits<3> i, dag outs, dag ins, string asmstr> :
8230b57cec5SDimitry Andric  F16_GEN_DOP_BASE<0b00000, outs, ins, asmstr> {
8240b57cec5SDimitry Andric
8250b57cec5SDimitry Andric  let c = i;
8260b57cec5SDimitry Andric}
8270b57cec5SDimitry Andric
8280b57cec5SDimitry Andricclass F16_GEN_SOP<bits<3> i, string asmstr> :
8290b57cec5SDimitry Andric  F16_GEN_SOP_BASE<i, (outs), (ins GPR32:$b), asmstr>;
8300b57cec5SDimitry Andric
8310b57cec5SDimitry Andricclass F16_GEN_ZOP<bits<3> i, string asmstr> :
8320b57cec5SDimitry Andric  F16_GEN_SOP_BASE<0b111, (outs), (ins), asmstr> {
8330b57cec5SDimitry Andric
8340b57cec5SDimitry Andric  let b = i;
8350b57cec5SDimitry Andric}
8360b57cec5SDimitry Andric
8370b57cec5SDimitry Andric// Compact Load/Store with Offset Format.
8380b57cec5SDimitry Andricclass F16_LD_ST_OFF<bits<5> opc, dag outs, dag ins, string asmstr> :
8390b57cec5SDimitry Andric  InstARC<2, outs, ins, !strconcat(asmstr, "\t$c, [$b, $off]"), []> {
8400b57cec5SDimitry Andric
8410b57cec5SDimitry Andric  bits<3> b;
8420b57cec5SDimitry Andric  bits<3> c;
8430b57cec5SDimitry Andric  let Inst{15-11} = opc;
8440b57cec5SDimitry Andric  let Inst{10-8} = b;
8450b57cec5SDimitry Andric  let Inst{7-5} = c;
8460b57cec5SDimitry Andric}
8470b57cec5SDimitry Andric
8480b57cec5SDimitry Andricclass F16_LD_ST_WORD_OFF<bits<5> opc, dag outs, dag ins, string asmstr> :
8490b57cec5SDimitry Andric  F16_LD_ST_OFF<opc, outs, ins, asmstr> {
8500b57cec5SDimitry Andric
8510b57cec5SDimitry Andric  bits<7> off;
8520b57cec5SDimitry Andric  let Inst{4-0} = off{6-2};
8530b57cec5SDimitry Andric  let off{1-0} = 0b00;
8540b57cec5SDimitry Andric}
8550b57cec5SDimitry Andric
8560b57cec5SDimitry Andricclass F16_LD_ST_HALF_OFF<bits<5> opc, dag outs, dag ins, string asmstr> :
8570b57cec5SDimitry Andric  F16_LD_ST_OFF<opc, outs, ins, asmstr> {
8580b57cec5SDimitry Andric
8590b57cec5SDimitry Andric  bits<6> off;
8600b57cec5SDimitry Andric  let Inst{4-0} = off{5-1};
8610b57cec5SDimitry Andric  let off{0} = 0b0;
8620b57cec5SDimitry Andric}
8630b57cec5SDimitry Andric
8640b57cec5SDimitry Andricclass F16_LD_ST_BYTE_OFF<bits<5> opc, dag outs, dag ins, string asmstr> :
8650b57cec5SDimitry Andric  F16_LD_ST_OFF<opc, outs, ins, asmstr> {
8660b57cec5SDimitry Andric
8670b57cec5SDimitry Andric  bits<5> off;
8680b57cec5SDimitry Andric  let Inst{4-0} = off;
8690b57cec5SDimitry Andric}
8700b57cec5SDimitry Andric
8710b57cec5SDimitry Andric// Shift/Subtract/Bit Immediate.
8720b57cec5SDimitry Andric// |10|9|8|7|6|5|4|3|2|1|0|
8730b57cec5SDimitry Andric// |b     |i    |u        |
8740b57cec5SDimitry Andricclass F16_SH_SUB_BIT<bits<3> i, string asmstr> :
8750b57cec5SDimitry Andric  InstARC<2, (outs), (ins GPR32:$b, immU<5>:$u5), asmstr, []> {
8760b57cec5SDimitry Andric
8770b57cec5SDimitry Andric  bits<3> b;
8780b57cec5SDimitry Andric  bits<5> u5;
8790b57cec5SDimitry Andric
8800b57cec5SDimitry Andric  let Inst{15-11} = 0b10111;
8810b57cec5SDimitry Andric  let Inst{10-8} = b;
8820b57cec5SDimitry Andric  let Inst{7-5} = i;
8830b57cec5SDimitry Andric  let Inst{4-0} = u5;
8840b57cec5SDimitry Andric}
8850b57cec5SDimitry Andric
8860b57cec5SDimitry Andricclass F16_SH_SUB_BIT_DST<bits<3> i, string asmstr> :
8870b57cec5SDimitry Andric  F16_SH_SUB_BIT<i, !strconcat(asmstr, "\t$b, $b, $u5")>;
8880b57cec5SDimitry Andric
8890b57cec5SDimitry Andric// 16-bit stack-based operations.
8900b57cec5SDimitry Andric// |10|9|8|7|6|5|4|3|2|1|0|
8910b57cec5SDimitry Andric// |b     |i    |u        |
8920b57cec5SDimitry Andricclass F16_SP_OPS<bits<3> i,
8930b57cec5SDimitry Andric  dag outs, dag ins, string asmstr> :
8940b57cec5SDimitry Andric  InstARC<2, outs, ins, asmstr, []> {
8950b57cec5SDimitry Andric
8960b57cec5SDimitry Andric  bits<3> fieldB;
8970b57cec5SDimitry Andric  bits<5> fieldU;
8980b57cec5SDimitry Andric
8990b57cec5SDimitry Andric  let Inst{15-11} = 0b11000;
9000b57cec5SDimitry Andric  let Inst{10-8} = fieldB;
9010b57cec5SDimitry Andric  let Inst{7-5} = i;
9020b57cec5SDimitry Andric  let Inst{4-0} = fieldU;
9030b57cec5SDimitry Andric}
9040b57cec5SDimitry Andric
9050b57cec5SDimitry Andricclass F16_SP_OPS_u7_aligned<bits<3> i,
9060b57cec5SDimitry Andric  dag outs, dag ins, string asmstr> :
9070b57cec5SDimitry Andric  F16_SP_OPS<i, outs, ins, asmstr> {
9080b57cec5SDimitry Andric
9090b57cec5SDimitry Andric  bits<3> b3;
9100b57cec5SDimitry Andric  bits<7> u7;
9110b57cec5SDimitry Andric
9120b57cec5SDimitry Andric  let fieldB = b3;
9130b57cec5SDimitry Andric  let fieldU = u7{6-2};
9140b57cec5SDimitry Andric  let u7{1-0} = 0b00;
9150b57cec5SDimitry Andric}
9160b57cec5SDimitry Andric
9170b57cec5SDimitry Andricclass F16_SP_OPS_bconst<bits<3> b, string asmop> :
9180b57cec5SDimitry Andric  F16_SP_OPS_u7_aligned<0b101,
9190b57cec5SDimitry Andric  (outs), (ins immU<7>:$u7),
9200b57cec5SDimitry Andric  !strconcat(asmop, "\t%sp, %sp, $u7")> {
9210b57cec5SDimitry Andric
9220b57cec5SDimitry Andric  let fieldB = b;
9230b57cec5SDimitry Andric}
9240b57cec5SDimitry Andric
9250b57cec5SDimitry Andricclass F16_SP_OPS_uconst<bits<3> i,
9260b57cec5SDimitry Andric  dag outs, dag ins, string asmop> :
9270b57cec5SDimitry Andric  F16_SP_OPS_u7_aligned<i, outs, ins,
9280b57cec5SDimitry Andric  !strconcat(asmop, "\t$b3")> {
9290b57cec5SDimitry Andric
9300b57cec5SDimitry Andric  let fieldU = 0b00001;
9310b57cec5SDimitry Andric}
9320b57cec5SDimitry Andric
9330b57cec5SDimitry Andricclass F16_SP_OPS_buconst<bits<3> i, string asmop> :
9340b57cec5SDimitry Andric  F16_SP_OPS_u7_aligned<i, (outs), (ins),
9350b57cec5SDimitry Andric    !strconcat(asmop, "\t%blink")> {
9360b57cec5SDimitry Andric
9370b57cec5SDimitry Andric  let fieldB = 0x000;
9380b57cec5SDimitry Andric  let fieldU = 0b10001;
9390b57cec5SDimitry Andric}
9400b57cec5SDimitry Andric
9410b57cec5SDimitry Andricclass F16_SP_LD<bits<3> i, string asmop> : F16_SP_OPS_u7_aligned<i,
9420b57cec5SDimitry Andric                         (outs GPR32Reduced:$b3), (ins immU<7>:$u7),
9430b57cec5SDimitry Andric                         !strconcat(asmop, "\t$b3, [%sp, $u7]")>;
9440b57cec5SDimitry Andric
9450b57cec5SDimitry Andricclass F16_SP_ST<bits<3> i, string asmop> : F16_SP_OPS_u7_aligned<i,
9460b57cec5SDimitry Andric                         (outs), (ins GPR32Reduced:$b3, immU<7>:$u7),
9470b57cec5SDimitry Andric                         !strconcat(asmop, "\t$b3, [%sp, $u7]")>;
9480b57cec5SDimitry Andric
9490b57cec5SDimitry Andric// Compact MOV/ADD/CMP Immediate Format.
9500b57cec5SDimitry Andricclass F16_OP_IMM<bits<5> opc, dag outs, dag ins, string asmstr> :
9510b57cec5SDimitry Andric  InstARC<2, outs, ins, asmstr, []> {
9520b57cec5SDimitry Andric
9530b57cec5SDimitry Andric  bits<3> b;
9540b57cec5SDimitry Andric  let Inst{15-11} = opc;
9550b57cec5SDimitry Andric  let Inst{10-8} = b;
9560b57cec5SDimitry Andric}
9570b57cec5SDimitry Andric
9580b57cec5SDimitry Andricclass F16_OP_U7<bit i, string asmstr> :
9590b57cec5SDimitry Andric  F16_OP_IMM<0b11100, (outs GPR32:$b), (ins immU<7>:$u7), asmstr> {
9600b57cec5SDimitry Andric
9610b57cec5SDimitry Andric  bits<7> u7;
9620b57cec5SDimitry Andric  let Inst{7} = i;
9630b57cec5SDimitry Andric  let Inst{6-0} = u7;
9640b57cec5SDimitry Andric}
9650b57cec5SDimitry Andric
9660b57cec5SDimitry Andric// Special types for different instruction operands.
9670b57cec5SDimitry Andricdef ccond : Operand<i32> {
9680b57cec5SDimitry Andric  let MIOperandInfo = (ops i32imm);
9690b57cec5SDimitry Andric  let PrintMethod = "printPredicateOperand";
9700b57cec5SDimitry Andric}
9710b57cec5SDimitry Andric
9720b57cec5SDimitry Andricdef brccond : Operand<i32> {
9730b57cec5SDimitry Andric  let MIOperandInfo = (ops i32imm);
9740b57cec5SDimitry Andric  let PrintMethod = "printBRCCPredicateOperand";
9750b57cec5SDimitry Andric}
9760b57cec5SDimitry Andric
9770b57cec5SDimitry Andric// Branch/call targets of different offset sizes.
9780b57cec5SDimitry Andricclass BCTarget<ValueType vt> : Operand<vt> {
9790b57cec5SDimitry Andric  let OperandType = "OPERAND_PCREL";
9800b57cec5SDimitry Andric}
9810b57cec5SDimitry Andric
9820b57cec5SDimitry Andricdef btarget : BCTarget<OtherVT>;
9830b57cec5SDimitry Andric
9840b57cec5SDimitry Andricclass BCTargetSigned<ValueType vt, int BSz> : BCTarget<vt> {
9850b57cec5SDimitry Andric  let DecoderMethod = "DecodeBranchTargetS<"#BSz#">";
9860b57cec5SDimitry Andric}
9870b57cec5SDimitry Andric
9880b57cec5SDimitry Andricclass BranchTargetS<int BSz> : BCTargetSigned<OtherVT, BSz>;
9890b57cec5SDimitry Andricdef btargetS7 : BranchTargetS<7>;
9900b57cec5SDimitry Andricdef btargetS8 : BranchTargetS<8>;
9910b57cec5SDimitry Andricdef btargetS9 : BranchTargetS<9>;
9920b57cec5SDimitry Andricdef btargetS10 : BranchTargetS<10>;
9930b57cec5SDimitry Andricdef btargetS13 : BranchTargetS<13>;
9940b57cec5SDimitry Andricdef btargetS21 : BranchTargetS<21>;
9950b57cec5SDimitry Andricdef btargetS25 : BranchTargetS<25>;
9960b57cec5SDimitry Andric
9970b57cec5SDimitry Andricclass CallTargetS<int BSz> : BCTargetSigned<i32, BSz>;
9980b57cec5SDimitry Andricdef calltargetS25: CallTargetS<25>;
9990b57cec5SDimitry Andric
10000b57cec5SDimitry Andric// Compact Branch on Compare Register with Zero.
10010b57cec5SDimitry Andricclass F16_BCC_REG<bit i, string asmstr> :
10020b57cec5SDimitry Andric  InstARC<2, (outs), (ins GPR32:$b, btargetS8:$s8),
10030b57cec5SDimitry Andric  !strconcat(asmstr, "\t$b, 0, $s8"), []> {
10040b57cec5SDimitry Andric
10050b57cec5SDimitry Andric  bits<3> b;
10060b57cec5SDimitry Andric  bits<8> s8;
10070b57cec5SDimitry Andric
10080b57cec5SDimitry Andric  let Inst{15-11} = 0b11101;
10090b57cec5SDimitry Andric  let Inst{10-8} = b;
10100b57cec5SDimitry Andric  let Inst{7} = i;
10110b57cec5SDimitry Andric  let Inst{6-0} = s8{7-1};
10120b57cec5SDimitry Andric  let s8{0} = 0b0;
10130b57cec5SDimitry Andric}
10140b57cec5SDimitry Andric
10150b57cec5SDimitry Andric// Compact Branch Conditionally Format.
10160b57cec5SDimitry Andricclass F16_BCC<bits<2> i, dag ins, string asmstr> :
10170b57cec5SDimitry Andric  InstARC<2, (outs), ins, asmstr, []> {
10180b57cec5SDimitry Andric
10190b57cec5SDimitry Andric  let Inst{15-11} = 0b11110;
10200b57cec5SDimitry Andric  let Inst{10-9} = i;
10210b57cec5SDimitry Andric}
10220b57cec5SDimitry Andric
10230b57cec5SDimitry Andricclass F16_BCC_s10<bits<2> i, string asmstr> :
10240b57cec5SDimitry Andric  F16_BCC<i, (ins btargetS10:$s),
10250b57cec5SDimitry Andric  !strconcat(asmstr, "\t$s")> {
10260b57cec5SDimitry Andric
10270b57cec5SDimitry Andric  bits<10> s;
10280b57cec5SDimitry Andric  let Inst{8-0} = s{9-1};
10290b57cec5SDimitry Andric  let s{0} = 0b0;
10300b57cec5SDimitry Andric}
10310b57cec5SDimitry Andric
10320b57cec5SDimitry Andricclass F16_BCC_s7<bits<3> i, string asmstr> :
10330b57cec5SDimitry Andric  F16_BCC<0b11, (ins btargetS7:$s),
10340b57cec5SDimitry Andric  !strconcat(asmstr, "\t$s")> {
10350b57cec5SDimitry Andric
10360b57cec5SDimitry Andric  bits<7> s;
10370b57cec5SDimitry Andric  let Inst{8-6} = i;
10380b57cec5SDimitry Andric  let Inst{5-0} = s{6-1};
10390b57cec5SDimitry Andric  let s{0} = 0b0;
10400b57cec5SDimitry Andric}
1041