2012-05-09 03:08:58 +08:00
|
|
|
//===- Mips16InstrFormats.td - Mips Instruction Formats ----*- tablegen -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Describe MIPS instructions format
|
|
|
|
//
|
|
|
|
// CPU INSTRUCTION FORMATS
|
|
|
|
//
|
|
|
|
// funct or f Function field
|
|
|
|
//
|
2012-07-18 06:55:34 +08:00
|
|
|
// immediate 4-,5-,8- or 11-bit immediate, branch displacement, or
|
2012-05-09 03:08:58 +08:00
|
|
|
// or imm address displacement
|
|
|
|
//
|
2012-06-13 10:42:47 +08:00
|
|
|
// op 5-bit major operation code
|
2012-05-09 03:08:58 +08:00
|
|
|
//
|
|
|
|
// rx 3-bit source or destination register
|
|
|
|
//
|
|
|
|
// ry 3-bit source or destination register
|
|
|
|
//
|
|
|
|
// rz 3-bit source or destination register
|
|
|
|
//
|
|
|
|
// sa 3- or 5-bit shift amount
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
// Base class for Mips 16 Format
|
|
|
|
// This class does not depend on the instruction size
|
|
|
|
//
|
|
|
|
class MipsInst16_Base<dag outs, dag ins, string asmstr, list<dag> pattern,
|
2013-02-14 11:05:25 +08:00
|
|
|
InstrItinClass itin>: Instruction
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
let Namespace = "Mips";
|
|
|
|
|
|
|
|
let OutOperandList = outs;
|
|
|
|
let InOperandList = ins;
|
|
|
|
|
|
|
|
let AsmString = asmstr;
|
|
|
|
let Pattern = pattern;
|
|
|
|
let Itinerary = itin;
|
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
let Predicates = [InMips16Mode];
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
2012-05-31 10:59:44 +08:00
|
|
|
// Generic Mips 16 Format
|
2012-05-09 03:08:58 +08:00
|
|
|
//
|
2012-05-31 10:59:44 +08:00
|
|
|
class MipsInst16<dag outs, dag ins, string asmstr, list<dag> pattern,
|
2013-02-14 11:05:25 +08:00
|
|
|
InstrItinClass itin>:
|
|
|
|
MipsInst16_Base<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
2012-05-31 10:59:44 +08:00
|
|
|
field bits<16> Inst;
|
2012-05-09 03:08:58 +08:00
|
|
|
bits<5> Opcode = 0;
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
// Top 5 bits are the 'opcode' field
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{15-11} = Opcode;
|
2013-05-17 04:08:49 +08:00
|
|
|
|
2013-02-14 11:05:25 +08:00
|
|
|
let Size=2;
|
|
|
|
field bits<16> SoftFail = 0;
|
2012-05-31 10:59:44 +08:00
|
|
|
}
|
2012-05-09 03:08:58 +08:00
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
//
|
|
|
|
// For 32 bit extended instruction forms.
|
|
|
|
//
|
|
|
|
class MipsInst16_32<dag outs, dag ins, string asmstr, list<dag> pattern,
|
2013-02-14 11:05:25 +08:00
|
|
|
InstrItinClass itin>:
|
|
|
|
MipsInst16_Base<outs, ins, asmstr, pattern, itin>
|
2012-05-31 10:59:44 +08:00
|
|
|
{
|
|
|
|
field bits<32> Inst;
|
2013-05-17 04:08:49 +08:00
|
|
|
|
2013-02-14 11:05:25 +08:00
|
|
|
let Size=4;
|
|
|
|
field bits<32> SoftFail = 0;
|
2012-05-31 10:59:44 +08:00
|
|
|
}
|
2012-05-09 03:08:58 +08:00
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
class MipsInst16_EXTEND<dag outs, dag ins, string asmstr, list<dag> pattern,
|
2013-02-14 11:05:25 +08:00
|
|
|
InstrItinClass itin>:
|
|
|
|
MipsInst16_32<outs, ins, asmstr, pattern, itin>
|
2012-05-31 10:59:44 +08:00
|
|
|
{
|
|
|
|
let Inst{31-27} = 0b11110;
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Mips Pseudo Instructions Format
|
|
|
|
class MipsPseudo16<dag outs, dag ins, string asmstr, list<dag> pattern>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, IIPseudo> {
|
2012-05-09 03:08:58 +08:00
|
|
|
let isCodeGenOnly = 1;
|
|
|
|
let isPseudo = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:37:54 +08:00
|
|
|
// Format I instruction class in Mips : <|opcode|imm11|>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class FI16<bits<5> op, dag outs, dag ins, string asmstr, list<dag> pattern,
|
2012-07-18 06:55:34 +08:00
|
|
|
InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<11> imm11;
|
|
|
|
|
|
|
|
let Opcode = op;
|
|
|
|
|
|
|
|
let Inst{10-0} = imm11;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:37:54 +08:00
|
|
|
// Format RI instruction class in Mips : <|opcode|rx|imm8|>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class FRI16<bits<5> op, dag outs, dag ins, string asmstr,
|
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<3> rx;
|
|
|
|
bits<8> imm8;
|
|
|
|
|
|
|
|
let Opcode = op;
|
|
|
|
|
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-0} = imm8;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Format RR instruction class in Mips : <|opcode|rx|ry|funct|>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-05-25 02:32:33 +08:00
|
|
|
class FRR16<bits<5> _funct, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<3> rx;
|
|
|
|
bits<3> ry;
|
|
|
|
bits<5> funct;
|
|
|
|
|
2012-05-25 02:32:33 +08:00
|
|
|
let Opcode = 0b11101;
|
2012-05-09 03:08:58 +08:00
|
|
|
let funct = _funct;
|
|
|
|
|
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-5} = ry;
|
|
|
|
let Inst{4-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-08-07 12:00:26 +08:00
|
|
|
class FRRBreak16<dag outs, dag ins, string asmstr,
|
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
|
|
|
{
|
|
|
|
bits<6> Code;
|
|
|
|
bits<5> funct;
|
|
|
|
|
|
|
|
let Opcode = 0b11101;
|
|
|
|
let funct = 0b00101;
|
|
|
|
|
|
|
|
let Inst{10-5} = Code;
|
|
|
|
let Inst{4-0} = funct;
|
|
|
|
}
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
//
|
|
|
|
// For conversion functions.
|
|
|
|
//
|
|
|
|
class FRR_SF16<bits<5> _funct, bits<3> _subfunct, dag outs, dag ins,
|
|
|
|
string asmstr, list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-07-18 06:55:34 +08:00
|
|
|
{
|
|
|
|
bits<3> rx;
|
|
|
|
bits<3> subfunct;
|
|
|
|
bits<5> funct;
|
|
|
|
|
|
|
|
let Opcode = 0b11101; // RR
|
|
|
|
let funct = _funct;
|
|
|
|
let subfunct = _subfunct;
|
|
|
|
|
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-5} = subfunct;
|
|
|
|
let Inst{4-0} = funct;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// just used for breakpoint (hardware and software) instructions.
|
|
|
|
//
|
|
|
|
class FC16<bits<5> _funct, dag outs, dag ins, string asmstr,
|
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-07-18 06:55:34 +08:00
|
|
|
{
|
|
|
|
bits<6> _code; // code is a keyword in tablegen
|
|
|
|
bits<5> funct;
|
|
|
|
|
|
|
|
let Opcode = 0b11101; // RR
|
|
|
|
let funct = _funct;
|
|
|
|
|
|
|
|
let Inst{10-5} = _code;
|
|
|
|
let Inst{4-0} = funct;
|
|
|
|
}
|
2012-05-31 10:59:44 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// J(AL)R(C) subformat
|
|
|
|
//
|
2012-07-18 06:55:34 +08:00
|
|
|
class FRR16_JALRC<bits<1> _nd, bits<1> _l, bits<1> r_a,
|
|
|
|
dag outs, dag ins, string asmstr,
|
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-31 10:59:44 +08:00
|
|
|
{
|
|
|
|
bits<3> rx;
|
|
|
|
bits<1> nd;
|
|
|
|
bits<1> l;
|
|
|
|
bits<1> ra;
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let nd = _nd;
|
|
|
|
let l = _l;
|
|
|
|
let ra = r_a;
|
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
let Opcode = 0b11101;
|
|
|
|
|
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7} = nd;
|
|
|
|
let Inst{6} = l;
|
|
|
|
let Inst{5} = ra;
|
|
|
|
let Inst{4-0} = 0;
|
|
|
|
}
|
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:37:54 +08:00
|
|
|
// Format RRI instruction class in Mips : <|opcode|rx|ry|imm5|>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class FRRI16<bits<5> op, dag outs, dag ins, string asmstr,
|
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<3> rx;
|
|
|
|
bits<3> ry;
|
|
|
|
bits<5> imm5;
|
|
|
|
|
|
|
|
let Opcode = op;
|
|
|
|
|
|
|
|
|
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-5} = ry;
|
|
|
|
let Inst{4-0} = imm5;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Format RRR instruction class in Mips : <|opcode|rx|ry|rz|f|>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FRRR16<bits<2> _f, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<3> rx;
|
|
|
|
bits<3> ry;
|
|
|
|
bits<3> rz;
|
|
|
|
bits<2> f;
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let Opcode = 0b11100;
|
2012-05-09 03:08:58 +08:00
|
|
|
let f = _f;
|
|
|
|
|
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-5} = ry;
|
|
|
|
let Inst{4-2} = rz;
|
|
|
|
let Inst{1-0} = f;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:37:54 +08:00
|
|
|
// Format RRI-A instruction class in Mips : <|opcode|rx|ry|f|imm4|>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FRRI_A16<bits<1> _f, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<3> rx;
|
|
|
|
bits<3> ry;
|
|
|
|
bits<1> f;
|
|
|
|
bits<4> imm4;
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let Opcode = 0b01000;
|
2012-05-09 03:08:58 +08:00
|
|
|
let f = _f;
|
|
|
|
|
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-5} = ry;
|
|
|
|
let Inst{4} = f;
|
|
|
|
let Inst{3-0} = imm4;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Format Shift instruction class in Mips : <|opcode|rx|ry|sa|f|>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FSHIFT16<bits<2> _f, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<3> rx;
|
|
|
|
bits<3> ry;
|
|
|
|
bits<3> sa;
|
|
|
|
bits<2> f;
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let Opcode = 0b00110;
|
2012-05-09 03:08:58 +08:00
|
|
|
let f = _f;
|
|
|
|
|
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-5} = ry;
|
|
|
|
let Inst{4-2} = sa;
|
|
|
|
let Inst{1-0} = f;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:37:54 +08:00
|
|
|
// Format i8 instruction class in Mips : <|opcode|funct|imm8>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FI816<bits<3> _func, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<3> func;
|
2012-06-13 10:37:54 +08:00
|
|
|
bits<8> imm8;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let Opcode = 0b01100;
|
2012-05-09 03:08:58 +08:00
|
|
|
let func = _func;
|
|
|
|
|
|
|
|
let Inst{10-8} = func;
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{7-0} = imm8;
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Format i8_MOVR32 instruction class in Mips : <|opcode|func|ry|r32>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FI8_MOVR3216<dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
bits<4> ry;
|
|
|
|
bits<4> r32;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let Opcode = 0b01100;
|
2012-05-09 03:08:58 +08:00
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let Inst{10-8} = 0b111;
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{7-4} = ry;
|
|
|
|
let Inst{3-0} = r32;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-07-18 06:55:34 +08:00
|
|
|
// Format i8_MOV32R instruction class in Mips : <|opcode|func|r32|rz>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FI8_MOV32R16<dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
bits<3> func;
|
|
|
|
bits<5> r32;
|
|
|
|
bits<3> rz;
|
|
|
|
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let Opcode = 0b01100;
|
2012-05-09 03:08:58 +08:00
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let Inst{10-8} = 0b101;
|
2012-06-13 10:42:47 +08:00
|
|
|
let Inst{7-5} = r32{2-0};
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{4-3} = r32{4-3};
|
|
|
|
let Inst{2-0} = rz;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:42:47 +08:00
|
|
|
// Format i8_SVRS instruction class in Mips :
|
2012-05-09 03:08:58 +08:00
|
|
|
// <|opcode|svrs|s|ra|s0|s1|framesize>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FI8_SVRS16<bits<1> _s, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<1> s;
|
2012-07-18 06:55:34 +08:00
|
|
|
bits<1> ra = 0;
|
|
|
|
bits<1> s0 = 0;
|
|
|
|
bits<1> s1 = 0;
|
|
|
|
bits<4> framesize = 0;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let s =_s;
|
|
|
|
let Opcode = 0b01100;
|
2012-05-09 03:08:58 +08:00
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let Inst{10-8} = 0b100;
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{7} = s;
|
|
|
|
let Inst{6} = ra;
|
|
|
|
let Inst{5} = s0;
|
|
|
|
let Inst{4} = s1;
|
|
|
|
let Inst{3-0} = framesize;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:42:47 +08:00
|
|
|
// Format JAL instruction class in Mips16 :
|
2012-05-09 03:08:58 +08:00
|
|
|
// <|opcode|svrs|s|ra|s0|s1|framesize>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FJAL16<bits<1> _X, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16_32<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<1> X;
|
2012-06-13 10:37:54 +08:00
|
|
|
bits<26> imm26;
|
2012-05-09 03:08:58 +08:00
|
|
|
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
let X = _X;
|
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
let Inst{31-27} = 0b00011;
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{26} = X;
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{25-21} = imm26{20-16};
|
|
|
|
let Inst{20-16} = imm26{25-21};
|
|
|
|
let Inst{15-0} = imm26{15-0};
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:42:47 +08:00
|
|
|
// Format EXT-I instruction class in Mips16 :
|
2012-06-13 10:37:54 +08:00
|
|
|
// <|EXTEND|imm10:5|imm15:11|op|0|0|0|0|0|0|imm4:0>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
class FEXT_I16<bits<5> _eop, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
2012-06-13 10:37:54 +08:00
|
|
|
bits<16> imm16;
|
2012-05-09 03:08:58 +08:00
|
|
|
bits<5> eop;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
let eop = _eop;
|
|
|
|
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{26-21} = imm16{10-5};
|
|
|
|
let Inst{20-16} = imm16{15-11};
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{15-11} = eop;
|
|
|
|
let Inst{10-5} = 0;
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{4-0} = imm16{4-0};
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:42:47 +08:00
|
|
|
// Format ASMACRO instruction class in Mips16 :
|
2012-05-09 03:08:58 +08:00
|
|
|
// <EXTEND|select|p4|p3|RRR|p2|p1|p0>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FASMACRO16<dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<3> select;
|
|
|
|
bits<3> p4;
|
|
|
|
bits<5> p3;
|
2012-07-18 06:55:34 +08:00
|
|
|
bits<5> RRR = 0b11100;
|
2012-05-09 03:08:58 +08:00
|
|
|
bits<3> p2;
|
|
|
|
bits<3> p1;
|
|
|
|
bits<5> p0;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
|
|
|
|
let Inst{26-24} = select;
|
|
|
|
let Inst{23-21} = p4;
|
|
|
|
let Inst{20-16} = p3;
|
|
|
|
let Inst{15-11} = RRR;
|
|
|
|
let Inst{10-8} = p2;
|
|
|
|
let Inst{7-5} = p1;
|
2012-06-13 10:42:47 +08:00
|
|
|
let Inst{4-0} = p0;
|
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:42:47 +08:00
|
|
|
// Format EXT-RI instruction class in Mips16 :
|
2012-06-13 10:37:54 +08:00
|
|
|
// <|EXTEND|imm10:5|imm15:11|op|rx|0|0|0|imm4:0>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
class FEXT_RI16<bits<5> _op, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
2012-06-13 10:37:54 +08:00
|
|
|
bits<16> imm16;
|
2012-05-31 10:59:44 +08:00
|
|
|
bits<5> op;
|
2012-05-09 03:08:58 +08:00
|
|
|
bits<3> rx;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
let op = _op;
|
2012-05-09 03:08:58 +08:00
|
|
|
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{26-21} = imm16{10-5};
|
|
|
|
let Inst{20-16} = imm16{15-11};
|
2012-05-31 10:59:44 +08:00
|
|
|
let Inst{15-11} = op;
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-5} = 0;
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{4-0} = imm16{4-0};
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Format EXT-RRI instruction class in Mips16 :
|
2012-06-13 10:37:54 +08:00
|
|
|
// <|EXTEND|imm10:5|imm15:11|op|rx|ry|imm4:0>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
class FEXT_RRI16<bits<5> _op, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
2012-07-24 07:45:54 +08:00
|
|
|
bits<5> op;
|
2012-06-13 10:37:54 +08:00
|
|
|
bits<16> imm16;
|
2012-05-09 03:08:58 +08:00
|
|
|
bits<3> rx;
|
|
|
|
bits<3> ry;
|
2012-05-31 10:59:44 +08:00
|
|
|
|
2012-07-24 07:45:54 +08:00
|
|
|
let op=_op;
|
2012-07-21 10:20:33 +08:00
|
|
|
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{26-21} = imm16{10-5};
|
|
|
|
let Inst{20-16} = imm16{15-11};
|
2012-07-24 07:45:54 +08:00
|
|
|
let Inst{15-11} = op;
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-5} = ry;
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{4-0} = imm16{4-0};
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:42:47 +08:00
|
|
|
// Format EXT-RRI-A instruction class in Mips16 :
|
2012-06-13 10:37:54 +08:00
|
|
|
// <|EXTEND|imm10:4|imm14:11|RRI-A|rx|ry|f|imm3:0>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
class FEXT_RRI_A16<bits<1> _f, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
2012-06-13 10:37:54 +08:00
|
|
|
bits<15> imm15;
|
2012-05-09 03:08:58 +08:00
|
|
|
bits<3> rx;
|
|
|
|
bits<3> ry;
|
|
|
|
bits<1> f;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
let f = _f;
|
|
|
|
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{26-20} = imm15{10-4};
|
|
|
|
let Inst{19-16} = imm15{14-11};
|
2012-05-31 10:59:44 +08:00
|
|
|
let Inst{15-11} = 0b01000;
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-5} = ry;
|
|
|
|
let Inst{4} = f;
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{3-0} = imm15{3-0};
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:42:47 +08:00
|
|
|
// Format EXT-SHIFT instruction class in Mips16 :
|
2012-06-13 10:37:54 +08:00
|
|
|
// <|EXTEND|sa 4:0|s5|0|SHIFT|rx|ry|0|f>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FEXT_SHIFT16<bits<2> _f, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
|
|
|
bits<6> sa6;
|
|
|
|
bits<3> rx;
|
|
|
|
bits<3> ry;
|
|
|
|
bits<2> f;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
let f = _f;
|
|
|
|
|
|
|
|
let Inst{26-22} = sa6{4-0};
|
|
|
|
let Inst{21} = sa6{5};
|
|
|
|
let Inst{20-16} = 0;
|
2012-05-31 10:59:44 +08:00
|
|
|
let Inst{15-11} = 0b00110;
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{10-8} = rx;
|
|
|
|
let Inst{7-5} = ry;
|
|
|
|
let Inst{4-2} = 0;
|
2012-06-13 10:42:47 +08:00
|
|
|
let Inst{1-0} = f;
|
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:42:47 +08:00
|
|
|
// Format EXT-I8 instruction class in Mips16 :
|
2012-06-13 10:37:54 +08:00
|
|
|
// <|EXTEND|imm10:5|imm15:11|I8|funct|0|imm4:0>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-05-31 10:59:44 +08:00
|
|
|
class FEXT_I816<bits<3> _funct, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
2012-06-13 10:37:54 +08:00
|
|
|
bits<16> imm16;
|
2012-05-09 03:08:58 +08:00
|
|
|
bits<5> I8;
|
|
|
|
bits<3> funct;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
let funct = _funct;
|
2014-08-07 13:46:54 +08:00
|
|
|
let I8 = 0b00110;
|
2012-05-09 03:08:58 +08:00
|
|
|
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{26-21} = imm16{10-5};
|
|
|
|
let Inst{20-16} = imm16{15-11};
|
2012-05-09 03:08:58 +08:00
|
|
|
let Inst{15-11} = I8;
|
|
|
|
let Inst{10-8} = funct;
|
|
|
|
let Inst{7-5} = 0;
|
2012-06-13 10:37:54 +08:00
|
|
|
let Inst{4-0} = imm16{4-0};
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-13 10:42:47 +08:00
|
|
|
// Format EXT-I8_SVRS instruction class in Mips16 :
|
2012-06-13 10:37:54 +08:00
|
|
|
// <|EXTEND|xsregs|framesize7:4|aregs|I8|SVRS|s|ra|s0|s1|framesize3:0>
|
2012-05-09 03:08:58 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
class FEXT_I8_SVRS16<bits<1> s_, dag outs, dag ins, string asmstr,
|
2012-05-09 03:08:58 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2013-02-14 11:05:25 +08:00
|
|
|
MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin>
|
2012-05-09 03:08:58 +08:00
|
|
|
{
|
2012-07-18 06:55:34 +08:00
|
|
|
bits<3> xsregs =0;
|
|
|
|
bits<8> framesize =0;
|
|
|
|
bits<3> aregs =0;
|
|
|
|
bits<5> I8 = 0b01100;
|
|
|
|
bits<3> SVRS = 0b100;
|
2012-05-09 03:08:58 +08:00
|
|
|
bits<1> s;
|
2012-07-18 06:55:34 +08:00
|
|
|
bits<1> ra = 0;
|
|
|
|
bits<1> s0 = 0;
|
|
|
|
bits<1> s1 = 0;
|
2012-06-13 10:42:47 +08:00
|
|
|
|
2012-07-18 06:55:34 +08:00
|
|
|
let s= s_;
|
2012-05-09 03:08:58 +08:00
|
|
|
|
|
|
|
let Inst{26-24} = xsregs;
|
|
|
|
let Inst{23-20} = framesize{7-4};
|
|
|
|
let Inst{19} = 0;
|
|
|
|
let Inst{18-16} = aregs;
|
|
|
|
let Inst{15-11} = I8;
|
|
|
|
let Inst{10-8} = SVRS;
|
|
|
|
let Inst{7} = s;
|
|
|
|
let Inst{6} = ra;
|
|
|
|
let Inst{5} = s0;
|
|
|
|
let Inst{4} = s1;
|
|
|
|
let Inst{3-0} = framesize{3-0};
|
2012-06-13 10:42:47 +08:00
|
|
|
|
|
|
|
|
2012-05-09 03:08:58 +08:00
|
|
|
}
|
|
|
|
|