2012-02-28 07:46:26 +00:00
|
|
|
//===-- MipsInstrFormats.td - Mips Instruction Formats -----*- tablegen -*-===//
|
2007-06-06 07:42:06 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-06-06 07:42:06 +00:00
|
|
|
//
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 07:42:06 +00:00
|
|
|
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 07:42:06 +00:00
|
|
|
// Describe MIPS instructions format
|
|
|
|
//
|
2008-06-08 01:39:36 +00:00
|
|
|
// CPU INSTRUCTION FORMATS
|
2007-06-06 07:42:06 +00:00
|
|
|
//
|
|
|
|
// opcode - operation code.
|
|
|
|
// rs - src reg.
|
|
|
|
// rt - dst reg (on a 2 regs instr) or src reg (on a 3 reg instr).
|
|
|
|
// rd - dst reg, only used on 3 regs instr.
|
|
|
|
// shamt - only used on shift instructions, contains the shift amount.
|
|
|
|
// funct - combined with opcode field give us an operation code.
|
|
|
|
//
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 07:42:06 +00:00
|
|
|
|
2011-10-18 17:50:36 +00:00
|
|
|
// Format specifies the encoding used by the instruction. This is part of the
|
|
|
|
// ad-hoc solution used to emit machine instruction encodings by our machine
|
|
|
|
// code emitter.
|
|
|
|
class Format<bits<4> val> {
|
|
|
|
bits<4> Value = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
def Pseudo : Format<0>;
|
|
|
|
def FrmR : Format<1>;
|
|
|
|
def FrmI : Format<2>;
|
|
|
|
def FrmJ : Format<3>;
|
|
|
|
def FrmFR : Format<4>;
|
|
|
|
def FrmFI : Format<5>;
|
|
|
|
def FrmOther : Format<6>; // Instruction w/ a custom format
|
|
|
|
|
2007-06-06 07:42:06 +00:00
|
|
|
// Generic Mips Format
|
2012-07-31 19:13:07 +00:00
|
|
|
class MipsInst<dag outs, dag ins, string asmstr, list<dag> pattern,
|
|
|
|
InstrItinClass itin, Format f>: Instruction
|
2007-06-06 07:42:06 +00:00
|
|
|
{
|
|
|
|
field bits<32> Inst;
|
2011-10-18 17:50:36 +00:00
|
|
|
Format Form = f;
|
2007-06-06 07:42:06 +00:00
|
|
|
|
|
|
|
let Namespace = "Mips";
|
|
|
|
|
2012-04-17 18:03:21 +00:00
|
|
|
let Size = 4;
|
|
|
|
|
2011-10-18 17:50:36 +00:00
|
|
|
bits<6> Opcode = 0;
|
2007-06-06 07:42:06 +00:00
|
|
|
|
2011-10-18 17:50:36 +00:00
|
|
|
// Top 6 bits are the 'opcode' field
|
|
|
|
let Inst{31-26} = Opcode;
|
2011-03-04 17:51:39 +00:00
|
|
|
|
2011-10-18 17:50:36 +00:00
|
|
|
let OutOperandList = outs;
|
|
|
|
let InOperandList = ins;
|
2007-08-18 02:01:28 +00:00
|
|
|
|
2007-06-06 07:42:06 +00:00
|
|
|
let AsmString = asmstr;
|
|
|
|
let Pattern = pattern;
|
2007-08-21 16:06:45 +00:00
|
|
|
let Itinerary = itin;
|
2011-10-18 17:50:36 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Attributes specific to Mips instructions...
|
|
|
|
//
|
|
|
|
bits<4> FormBits = Form.Value;
|
|
|
|
|
|
|
|
// TSFlags layout should be kept in sync with MipsInstrInfo.h.
|
|
|
|
let TSFlags{3-0} = FormBits;
|
2012-04-17 18:03:21 +00:00
|
|
|
|
|
|
|
let DecoderNamespace = "Mips";
|
|
|
|
|
|
|
|
field bits<32> SoftFail = 0;
|
2012-07-31 19:13:07 +00:00
|
|
|
}
|
2012-05-22 03:10:09 +00:00
|
|
|
|
2012-07-31 19:13:07 +00:00
|
|
|
// Mips32/64 Instruction Format
|
|
|
|
class InstSE<dag outs, dag ins, string asmstr, list<dag> pattern,
|
|
|
|
InstrItinClass itin, Format f>:
|
|
|
|
MipsInst<outs, ins, asmstr, pattern, itin, f> {
|
2012-12-07 03:06:09 +00:00
|
|
|
let Predicates = [HasStdEnc];
|
2007-06-06 07:42:06 +00:00
|
|
|
}
|
|
|
|
|
2007-10-09 02:55:31 +00:00
|
|
|
// Mips Pseudo Instructions Format
|
2012-12-20 04:20:09 +00:00
|
|
|
class MipsPseudo<dag outs, dag ins, list<dag> pattern,
|
|
|
|
InstrItinClass itin = IIPseudo> :
|
|
|
|
MipsInst<outs, ins, "", pattern, itin, Pseudo> {
|
2011-10-18 17:50:36 +00:00
|
|
|
let isCodeGenOnly = 1;
|
2011-09-27 04:57:54 +00:00
|
|
|
let isPseudo = 1;
|
|
|
|
}
|
2007-06-06 07:42:06 +00:00
|
|
|
|
2012-07-31 19:13:07 +00:00
|
|
|
// Mips32/64 Pseudo Instruction Format
|
2012-12-20 04:20:09 +00:00
|
|
|
class PseudoSE<dag outs, dag ins, list<dag> pattern,
|
|
|
|
InstrItinClass itin = IIPseudo>:
|
|
|
|
MipsPseudo<outs, ins, pattern, itin> {
|
2012-12-07 03:06:09 +00:00
|
|
|
let Predicates = [HasStdEnc];
|
2012-07-31 19:13:07 +00:00
|
|
|
}
|
|
|
|
|
Implement methods that enable expansion of load immediate
macro instruction (li) in the assembler.
We have identified three possible expansions depending on
the size of immediate operand:
1) for 0 ≤ j ≤ 65535.
li d,j =>
ori d,$zero,j
2) for −32768 ≤ j < 0.
li d,j =>
addiu d,$zero,j
3) for any other value of j that is representable as a 32-bit integer.
li d,j =>
lui d,hi16(j)
ori d,d,lo16(j)
All of the above have been implemented in ths patch.
Contributer: Vladimir Medic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165199 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-04 04:03:53 +00:00
|
|
|
// Pseudo-instructions for alternate assembly syntax (never used by codegen).
|
|
|
|
// These are aliases that require C++ handling to convert to the target
|
|
|
|
// instruction, while InstAliases can be handled directly by tblgen.
|
|
|
|
class MipsAsmPseudoInst<dag outs, dag ins, string asmstr>:
|
|
|
|
MipsInst<outs, ins, asmstr, [], IIPseudo, Pseudo> {
|
|
|
|
let isPseudo = 1;
|
|
|
|
let Pattern = [];
|
|
|
|
}
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 07:42:06 +00:00
|
|
|
// Format R instruction class in Mips : <|opcode|rs|rt|rd|shamt|funct|>
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 07:42:06 +00:00
|
|
|
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 01:14:50 +00:00
|
|
|
class FR<bits<6> op, bits<6> _funct, dag outs, dag ins, string asmstr,
|
2007-08-18 02:01:28 +00:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2012-07-31 18:55:01 +00:00
|
|
|
InstSE<outs, ins, asmstr, pattern, itin, FrmR>
|
2007-06-06 07:42:06 +00:00
|
|
|
{
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> shamt;
|
|
|
|
bits<6> funct;
|
|
|
|
|
2011-10-18 17:50:36 +00:00
|
|
|
let Opcode = op;
|
2007-06-06 07:42:06 +00:00
|
|
|
let funct = _funct;
|
|
|
|
|
|
|
|
let Inst{25-21} = rs;
|
2011-03-04 17:51:39 +00:00
|
|
|
let Inst{20-16} = rt;
|
2007-06-06 07:42:06 +00:00
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = shamt;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 07:42:06 +00:00
|
|
|
// Format I instruction class in Mips : <|opcode|rs|rt|immediate|>
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 07:42:06 +00:00
|
|
|
|
2007-08-18 02:01:28 +00:00
|
|
|
class FI<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern,
|
2012-07-31 18:55:01 +00:00
|
|
|
InstrItinClass itin>: InstSE<outs, ins, asmstr, pattern, itin, FrmI>
|
2007-06-06 07:42:06 +00:00
|
|
|
{
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
2011-10-18 17:50:36 +00:00
|
|
|
let Opcode = op;
|
2007-06-06 07:42:06 +00:00
|
|
|
|
|
|
|
let Inst{25-21} = rs;
|
2011-03-04 17:51:39 +00:00
|
|
|
let Inst{20-16} = rt;
|
2007-06-06 07:42:06 +00:00
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2011-12-06 03:34:48 +00:00
|
|
|
class BranchBase<bits<6> op, dag outs, dag ins, string asmstr,
|
2011-10-11 18:49:17 +00:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2012-07-31 18:55:01 +00:00
|
|
|
InstSE<outs, ins, asmstr, pattern, itin, FrmI>
|
2011-10-11 18:49:17 +00:00
|
|
|
{
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
2011-10-18 17:50:36 +00:00
|
|
|
let Opcode = op;
|
2011-10-11 18:49:17 +00:00
|
|
|
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 07:42:06 +00:00
|
|
|
// Format J instruction class in Mips : <|opcode|address|>
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 07:42:06 +00:00
|
|
|
|
2012-12-21 23:03:50 +00:00
|
|
|
class FJ<bits<6> op>
|
2007-06-06 07:42:06 +00:00
|
|
|
{
|
2012-12-21 23:03:50 +00:00
|
|
|
bits<26> target;
|
2007-06-06 07:42:06 +00:00
|
|
|
|
2012-12-21 23:03:50 +00:00
|
|
|
bits<32> Inst;
|
2011-03-04 17:51:39 +00:00
|
|
|
|
2012-12-21 23:03:50 +00:00
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-0} = target;
|
2007-06-06 07:42:06 +00:00
|
|
|
}
|
2007-10-09 02:55:31 +00:00
|
|
|
|
2013-01-04 19:38:05 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2012-10-06 01:17:37 +00:00
|
|
|
// MFC instruction class in Mips : <|op|mf|rt|rd|0000000|sel|>
|
|
|
|
//===----------------------------------------------------------------------===//
|
2013-01-04 19:13:49 +00:00
|
|
|
class MFC3OP_FM<bits<6> op, bits<5> mfmt>
|
2012-10-06 01:17:37 +00:00
|
|
|
{
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rd;
|
|
|
|
bits<3> sel;
|
|
|
|
|
2013-01-04 19:13:49 +00:00
|
|
|
bits<32> Inst;
|
2012-10-06 01:17:37 +00:00
|
|
|
|
2013-01-04 19:13:49 +00:00
|
|
|
let Inst{31-26} = op;
|
2012-10-06 01:17:37 +00:00
|
|
|
let Inst{25-21} = mfmt;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-3} = 0;
|
|
|
|
let Inst{2-0} = sel;
|
|
|
|
}
|
|
|
|
|
2012-12-20 03:34:05 +00:00
|
|
|
class ADD_FM<bits<6> op, bits<6> funct> {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2012-12-20 03:40:03 +00:00
|
|
|
class ADDI_FM<bits<6> op> {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2012-12-20 03:44:41 +00:00
|
|
|
class SRA_FM<bits<6> funct, bit rotate> {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> shamt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-22} = 0;
|
|
|
|
let Inst{21} = rotate;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = shamt;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2012-12-20 03:48:24 +00:00
|
|
|
class SRLV_FM<bits<6> funct, bit rotate> {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-7} = 0;
|
|
|
|
let Inst{6} = rotate;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2012-12-20 04:10:13 +00:00
|
|
|
class BEQ_FM<bits<6> op> {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
|
|
|
|
2012-12-20 04:13:23 +00:00
|
|
|
class BGEZ_FM<bits<6> op, bits<5> funct> {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = funct;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
|
|
|
|
2012-12-20 04:22:39 +00:00
|
|
|
class B_FM {
|
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 4;
|
|
|
|
let Inst{25-21} = 0;
|
|
|
|
let Inst{20-16} = 0;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
|
|
|
|
2012-12-20 04:27:52 +00:00
|
|
|
class SLTI_FM<bits<6> op> {
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2012-12-21 22:39:17 +00:00
|
|
|
class MFLO_FM<bits<6> funct> {
|
|
|
|
bits<5> rd;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-16} = 0;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MTLO_FM<bits<6> funct> {
|
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2012-12-21 23:21:32 +00:00
|
|
|
class SEB_FM<bits<5> funct, bits<6> funct2> {
|
2012-12-21 22:41:52 +00:00
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1f;
|
|
|
|
let Inst{25-21} = 0;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = funct;
|
2012-12-21 23:21:32 +00:00
|
|
|
let Inst{5-0} = funct2;
|
2012-12-21 22:41:52 +00:00
|
|
|
}
|
|
|
|
|
2012-12-21 22:43:58 +00:00
|
|
|
class CLO_FM<bits<6> funct> {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1c;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
let rt = rd;
|
|
|
|
}
|
|
|
|
|
2012-12-21 22:46:07 +00:00
|
|
|
class LUI_FM {
|
|
|
|
bits<5> rt;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0xf;
|
|
|
|
let Inst{25-21} = 0;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2012-12-21 23:03:50 +00:00
|
|
|
class JALR_FM {
|
2013-02-07 19:48:00 +00:00
|
|
|
bits<5> rd;
|
2012-12-21 23:03:50 +00:00
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = 0;
|
2013-02-07 19:48:00 +00:00
|
|
|
let Inst{15-11} = rd;
|
2012-12-21 23:03:50 +00:00
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = 9;
|
|
|
|
}
|
|
|
|
|
2012-12-21 23:15:59 +00:00
|
|
|
class BAL_FM {
|
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 1;
|
|
|
|
let Inst{25-21} = 0;
|
|
|
|
let Inst{20-16} = 0x11;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
class BGEZAL_FM<bits<5> funct> {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 1;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = funct;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
|
|
|
|
2012-12-21 23:17:36 +00:00
|
|
|
class SYNC_FM {
|
|
|
|
bits<5> stype;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{10-6} = stype;
|
|
|
|
let Inst{5-0} = 0xf;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MULT_FM<bits<6> op, bits<6> funct> {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2012-12-21 23:21:32 +00:00
|
|
|
class EXT_FM<bits<6> funct> {
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> pos;
|
|
|
|
bits<5> size;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1f;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = size;
|
|
|
|
let Inst{10-6} = pos;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
|
|
|
class RDHWR_FM {
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rd;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1f;
|
|
|
|
let Inst{25-21} = 0;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = 0x3b;
|
|
|
|
}
|
|
|
|
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-06-08 01:39:36 +00:00
|
|
|
//
|
2008-07-09 04:45:36 +00:00
|
|
|
// FLOATING POINT INSTRUCTION FORMATS
|
2008-06-08 01:39:36 +00:00
|
|
|
//
|
|
|
|
// opcode - operation code.
|
|
|
|
// fs - src reg.
|
|
|
|
// ft - dst reg (on a 2 regs instr) or src reg (on a 3 reg instr).
|
|
|
|
// fd - dst reg, only used on 3 regs instr.
|
|
|
|
// fmt - double or single precision.
|
|
|
|
// funct - combined with opcode field give us an operation code.
|
|
|
|
//
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-06-08 01:39:36 +00:00
|
|
|
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 19:05:21 +00:00
|
|
|
// Format FI instruction class in Mips : <|opcode|base|ft|immediate|>
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-06-08 01:39:36 +00:00
|
|
|
|
2011-03-04 17:51:39 +00:00
|
|
|
class FFI<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern>:
|
2012-07-31 18:55:01 +00:00
|
|
|
InstSE<outs, ins, asmstr, pattern, NoItinerary, FrmFI>
|
2008-06-08 01:39:36 +00:00
|
|
|
{
|
|
|
|
bits<5> ft;
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 19:05:21 +00:00
|
|
|
bits<5> base;
|
2008-06-08 01:39:36 +00:00
|
|
|
bits<16> imm16;
|
|
|
|
|
2011-10-18 17:50:36 +00:00
|
|
|
let Opcode = op;
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 19:05:21 +00:00
|
|
|
|
|
|
|
let Inst{25-21} = base;
|
2011-03-04 17:51:39 +00:00
|
|
|
let Inst{20-16} = ft;
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 19:05:21 +00:00
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2012-12-13 01:07:37 +00:00
|
|
|
class ADDS_FM<bits<6> funct, bits<5> fmt> {
|
|
|
|
bits<5> fd;
|
|
|
|
bits<5> fs;
|
|
|
|
bits<5> ft;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = fmt;
|
|
|
|
let Inst{20-16} = ft;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
2012-12-13 01:14:07 +00:00
|
|
|
|
|
|
|
class ABSS_FM<bits<6> funct, bits<5> fmt> {
|
|
|
|
bits<5> fd;
|
|
|
|
bits<5> fs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = fmt;
|
|
|
|
let Inst{20-16} = 0;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
2012-12-13 01:16:49 +00:00
|
|
|
|
|
|
|
class MFC1_FM<bits<5> funct> {
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> fs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = funct;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-0} = 0;
|
|
|
|
}
|
2012-12-13 01:24:00 +00:00
|
|
|
|
|
|
|
class LW_FM<bits<6> op> {
|
|
|
|
bits<5> rt;
|
|
|
|
bits<21> addr;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = addr{20-16};
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = addr{15-0};
|
|
|
|
}
|
2012-12-13 01:27:48 +00:00
|
|
|
|
|
|
|
class MADDS_FM<bits<3> funct, bits<3> fmt> {
|
|
|
|
bits<5> fd;
|
|
|
|
bits<5> fr;
|
|
|
|
bits<5> fs;
|
|
|
|
bits<5> ft;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x13;
|
|
|
|
let Inst{25-21} = fr;
|
|
|
|
let Inst{20-16} = ft;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-3} = funct;
|
|
|
|
let Inst{2-0} = fmt;
|
|
|
|
}
|
2012-12-13 01:30:49 +00:00
|
|
|
|
|
|
|
class LWXC1_FM<bits<6> funct> {
|
|
|
|
bits<5> fd;
|
|
|
|
bits<5> base;
|
|
|
|
bits<5> index;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x13;
|
|
|
|
let Inst{25-21} = base;
|
|
|
|
let Inst{20-16} = index;
|
|
|
|
let Inst{15-11} = 0;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
|
|
|
class SWXC1_FM<bits<6> funct> {
|
|
|
|
bits<5> fs;
|
|
|
|
bits<5> base;
|
|
|
|
bits<5> index;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x13;
|
|
|
|
let Inst{25-21} = base;
|
|
|
|
let Inst{20-16} = index;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
2012-12-13 01:32:36 +00:00
|
|
|
|
|
|
|
class BC1F_FM<bit nd, bit tf> {
|
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = 0x8;
|
|
|
|
let Inst{20-18} = 0; // cc
|
|
|
|
let Inst{17} = nd;
|
|
|
|
let Inst{16} = tf;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
2012-12-13 01:34:09 +00:00
|
|
|
|
|
|
|
class CEQS_FM<bits<5> fmt> {
|
|
|
|
bits<5> fs;
|
|
|
|
bits<5> ft;
|
|
|
|
bits<4> cond;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = fmt;
|
|
|
|
let Inst{20-16} = ft;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-8} = 0; // cc
|
|
|
|
let Inst{7-4} = 0x3;
|
|
|
|
let Inst{3-0} = cond;
|
|
|
|
}
|
2012-12-13 01:41:15 +00:00
|
|
|
|
|
|
|
class CMov_I_F_FM<bits<6> funct, bits<5> fmt> {
|
|
|
|
bits<5> fd;
|
|
|
|
bits<5> fs;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = fmt;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CMov_F_I_FM<bit tf> {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-18} = 0; // cc
|
|
|
|
let Inst{17} = 0;
|
|
|
|
let Inst{16} = tf;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CMov_F_F_FM<bits<5> fmt, bit tf> {
|
|
|
|
bits<5> fd;
|
|
|
|
bits<5> fs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = fmt;
|
|
|
|
let Inst{20-18} = 0; // cc
|
|
|
|
let Inst{17} = 0;
|
|
|
|
let Inst{16} = tf;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = 0x11;
|
|
|
|
}
|