2014-05-12 23:12:45 +08:00
|
|
|
//=- Mips32r6InstrFormats.td - Mips32r6 Instruction Formats -*- tablegen -*-==//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes Mips32r6 instruction formats.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class MipsR6Inst : MipsInst<(outs), (ins), "", [], NoItinerary, FrmOther>,
|
|
|
|
PredicateControl {
|
|
|
|
let DecoderNamespace = "Mips32r6_64r6";
|
|
|
|
let EncodingPredicates = [HasStdEnc];
|
|
|
|
}
|
|
|
|
|
2014-05-14 23:29:44 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Field Values
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-05-15 18:27:19 +08:00
|
|
|
def OPGROUP_COP1 { bits<6> Value = 0b010001; }
|
|
|
|
def OPGROUP_AUI { bits<6> Value = 0b001111; }
|
|
|
|
def OPGROUP_DAUI { bits<6> Value = 0b011101; }
|
2014-05-15 18:45:58 +08:00
|
|
|
def OPGROUP_PCREL { bits<6> Value = 0b111011; }
|
2014-05-15 18:27:19 +08:00
|
|
|
def OPGROUP_REGIMM { bits<6> Value = 0b000001; }
|
2014-05-14 23:29:44 +08:00
|
|
|
def OPGROUP_SPECIAL { bits<6> Value = 0b000000; }
|
2014-05-15 20:06:36 +08:00
|
|
|
def OPGROUP_SPECIAL3 { bits<6> Value = 0b011111; }
|
2014-05-14 23:29:44 +08:00
|
|
|
|
2014-05-15 18:45:58 +08:00
|
|
|
class OPCODE2<bits<2> Val> {
|
|
|
|
bits<2> Value = Val;
|
|
|
|
}
|
|
|
|
def OPCODE2_ADDIUPC : OPCODE2<0b00>;
|
|
|
|
|
2014-05-15 18:27:19 +08:00
|
|
|
class OPCODE5<bits<5> Val> {
|
|
|
|
bits<5> Value = Val;
|
|
|
|
}
|
2014-05-15 18:45:58 +08:00
|
|
|
def OPCODE5_ALUIPC : OPCODE5<0b11111>;
|
|
|
|
def OPCODE5_AUIPC : OPCODE5<0b11110>;
|
2014-05-15 18:27:19 +08:00
|
|
|
def OPCODE5_DAHI : OPCODE5<0b00110>;
|
|
|
|
def OPCODE5_DATI : OPCODE5<0b11110>;
|
|
|
|
|
2014-05-15 20:06:36 +08:00
|
|
|
class OPCODE6<bits<6> Val> {
|
|
|
|
bits<6> Value = Val;
|
|
|
|
}
|
2014-05-15 20:18:23 +08:00
|
|
|
def OPCODE6_ALIGN : OPCODE6<0b100000>;
|
|
|
|
def OPCODE6_DALIGN : OPCODE6<0b100100>;
|
|
|
|
def OPCODE6_BITSWAP : OPCODE6<0b100000>;
|
|
|
|
def OPCODE6_DBITSWAP : OPCODE6<0b100100>;
|
2014-05-15 20:06:36 +08:00
|
|
|
|
2014-05-14 23:29:44 +08:00
|
|
|
class FIELD_FMT<bits<5> Val> {
|
|
|
|
bits<5> Value = Val;
|
|
|
|
}
|
|
|
|
def FIELD_FMT_S : FIELD_FMT<0b10000>;
|
|
|
|
def FIELD_FMT_D : FIELD_FMT<0b10001>;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Encoding Formats
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-05-15 18:27:19 +08:00
|
|
|
class AUI_FM : MipsR6Inst {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<16> imm;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = OPGROUP_AUI.Value;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = imm;
|
|
|
|
}
|
|
|
|
|
|
|
|
class DAUI_FM : AUI_FM {
|
|
|
|
let Inst{31-26} = OPGROUP_DAUI.Value;
|
|
|
|
}
|
|
|
|
|
2014-05-14 23:29:44 +08:00
|
|
|
class COP1_3R_FM<bits<6> funct, FIELD_FMT Format> : MipsR6Inst {
|
|
|
|
bits<5> ft;
|
|
|
|
bits<5> fs;
|
|
|
|
bits<5> fd;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = OPGROUP_COP1.Value;
|
|
|
|
let Inst{25-21} = Format.Value;
|
|
|
|
let Inst{20-16} = ft;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2014-05-15 18:45:58 +08:00
|
|
|
class PCREL16_FM<OPCODE5 Operation> : MipsR6Inst {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<16> imm;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = OPGROUP_PCREL.Value;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = Operation.Value;
|
|
|
|
let Inst{15-0} = imm;
|
|
|
|
}
|
|
|
|
|
|
|
|
class PCREL19_FM<OPCODE2 Operation> : MipsR6Inst {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<19> imm;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = OPGROUP_PCREL.Value;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-19} = Operation.Value;
|
|
|
|
let Inst{18-0} = imm;
|
|
|
|
}
|
|
|
|
|
2014-05-15 20:18:23 +08:00
|
|
|
class SPECIAL3_2R_FM<OPCODE6 Operation> : MipsR6Inst {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = OPGROUP_SPECIAL3.Value;
|
|
|
|
let Inst{25-21} = 0b00000;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0b00000;
|
|
|
|
let Inst{5-0} = Operation.Value;
|
|
|
|
}
|
|
|
|
|
2014-05-12 23:12:45 +08:00
|
|
|
class SPECIAL_3R_FM<bits<5> mulop, bits<6> funct> : MipsR6Inst {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
2014-05-14 23:29:44 +08:00
|
|
|
let Inst{31-26} = OPGROUP_SPECIAL.Value;
|
2014-05-12 23:12:45 +08:00
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = mulop;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
2014-05-15 18:27:19 +08:00
|
|
|
|
2014-05-15 20:06:36 +08:00
|
|
|
class SPECIAL3_ALIGN_FM<OPCODE6 Operation> : MipsR6Inst {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<2> bp;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = OPGROUP_SPECIAL3.Value;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-8} = 0b010;
|
|
|
|
let Inst{7-6} = bp;
|
|
|
|
let Inst{5-0} = Operation.Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
class SPECIAL3_DALIGN_FM<OPCODE6 Operation> : MipsR6Inst {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<3> bp;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = OPGROUP_SPECIAL3.Value;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-9} = 0b01;
|
|
|
|
let Inst{8-6} = bp;
|
|
|
|
let Inst{5-0} = Operation.Value;
|
|
|
|
}
|
|
|
|
|
2014-05-15 18:27:19 +08:00
|
|
|
class REGIMM_FM<OPCODE5 Operation> : MipsR6Inst {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<16> imm;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = OPGROUP_REGIMM.Value;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = Operation.Value;
|
|
|
|
let Inst{15-0} = imm;
|
|
|
|
}
|