319 lines
13 KiB
TableGen
319 lines
13 KiB
TableGen
class _FootInstructionA<string asm, string operands,
|
|
bits<4> opcode,
|
|
bits<2> dstmode, bits<1> repeat,
|
|
dag oops = (outs), dag iops = (ins)>
|
|
: Instruction<> {
|
|
let Namespace = "Foot";
|
|
let AsmString = !strconcat(asm, "\t", operands);
|
|
let OutOperandList = oops;
|
|
let InOperandList = iops;
|
|
|
|
bits<32> Inst;
|
|
bits<3> Condition;
|
|
bits<5> dst;
|
|
bits<16> imm;
|
|
|
|
let Inst{31-29} = Condition;
|
|
let Inst{28} = repeat;
|
|
let Inst{27-24} = opcode;
|
|
let Inst{23} = 0b0;
|
|
let Inst{22-21} = dstmode;
|
|
let Inst{20-16} = dst;
|
|
let Inst{15-0} = imm;
|
|
}
|
|
|
|
multiclass FootInstructionA<string asm, string operands,
|
|
bits<4> opcode, bits<2> dstmode,
|
|
dag oops = (outs), dag iops = (ins)> {
|
|
def _A : _FootInstructionA<asm, operands, opcode, dstmode, 0b0, oops, iops> {
|
|
let Condition = 0b000;
|
|
}
|
|
|
|
def _L : _FootInstructionA<!strconcat(asm, ".l"), operands, opcode, dstmode, 0b0, oops, iops> {
|
|
let Condition = 0b001;
|
|
}
|
|
|
|
def _LE : _FootInstructionA<!strconcat(asm, ".le"), operands, opcode, dstmode, 0b0, oops, iops> {
|
|
let Condition = 0b010;
|
|
}
|
|
|
|
def _E : _FootInstructionA<!strconcat(asm, ".e"), operands, opcode, dstmode, 0b0, oops, iops> {
|
|
let Condition = 0b011;
|
|
}
|
|
|
|
def _GE : _FootInstructionA<!strconcat(asm, ".ge"), operands, opcode, dstmode, 0b0, oops, iops> {
|
|
let Condition = 0b100;
|
|
}
|
|
|
|
def _G : _FootInstructionA<!strconcat(asm, ".g"), operands, opcode, dstmode, 0b0, oops, iops> {
|
|
let Condition = 0b101;
|
|
}
|
|
|
|
def _NE : _FootInstructionA<!strconcat(asm, ".ne"), operands, opcode, dstmode, 0b0, oops, iops> {
|
|
let Condition = 0b110;
|
|
}
|
|
|
|
def _A_R : _FootInstructionA<asm, operands, opcode, dstmode, 0b1, oops, iops> {
|
|
let Condition = 0b000;
|
|
}
|
|
|
|
def _L_R : _FootInstructionA<!strconcat(asm, ".l"), operands, opcode, dstmode, 0b1, oops, iops> {
|
|
let Condition = 0b001;
|
|
}
|
|
|
|
def _LE_R : _FootInstructionA<!strconcat(asm, ".le"), operands, opcode, dstmode, 0b1, oops, iops> {
|
|
let Condition = 0b010;
|
|
}
|
|
|
|
def _E_R : _FootInstructionA<!strconcat(asm, ".e"), operands, opcode, dstmode, 0b1, oops, iops> {
|
|
let Condition = 0b011;
|
|
}
|
|
|
|
def _GE_R : _FootInstructionA<!strconcat(asm, ".ge"), operands, opcode, dstmode, 0b1, oops, iops> {
|
|
let Condition = 0b100;
|
|
}
|
|
|
|
def _G_R : _FootInstructionA<!strconcat(asm, ".g"), operands, opcode, dstmode, 0b1, oops, iops> {
|
|
let Condition = 0b101;
|
|
}
|
|
|
|
def _NE_R : _FootInstructionA<!strconcat(asm, ".ne"), operands, opcode, dstmode, 0b1, oops, iops> {
|
|
let Condition = 0b110;
|
|
}
|
|
}
|
|
|
|
class _FootInstructionB<string asm, string operands,
|
|
bits<4> opcode,
|
|
bits<2> dstmode, bits<2> amode,
|
|
bits<8> opcode2, bits<1> repeat,
|
|
dag oops = (outs), dag iops = (ins)>
|
|
: Instruction<> {
|
|
let Namespace = "Foot";
|
|
let AsmString = !strconcat(asm, "\t", operands);
|
|
let OutOperandList = oops;
|
|
let InOperandList = iops;
|
|
|
|
bits<32> Inst;
|
|
bits<3> Condition;
|
|
bits<2> Vect;
|
|
bits<5> dst;
|
|
bits<5> a;
|
|
|
|
let Inst{31-29} = Condition;
|
|
let Inst{28} = repeat;
|
|
let Inst{27-24} = opcode;
|
|
let Inst{23} = Vect{1};
|
|
let Inst{22-21} = dstmode;
|
|
let Inst{20-16} = dst;
|
|
let Inst{15-8} = opcode2;
|
|
let Inst{7} = Vect{0};
|
|
let Inst{6-5} = amode;
|
|
let Inst{4-0} = a;
|
|
|
|
let Vect = 0b00;
|
|
}
|
|
|
|
multiclass _mFootInstructionB<string asm, string operands,
|
|
bits<4> opcode,
|
|
bits<2> dstmode, bits<2> amode,
|
|
bits<8> opcode2,
|
|
dag oops = (outs), dag iops = (ins)> {
|
|
def _A : _FootInstructionB<asm, operands, opcode, dstmode, amode, opcode2, 0b0, oops, iops> {
|
|
let Condition = 0b000;
|
|
}
|
|
|
|
def _L : _FootInstructionB<!strconcat(asm, ".l"), operands, opcode, dstmode, amode, opcode2, 0b0, oops, iops> {
|
|
let Condition = 0b001;
|
|
}
|
|
|
|
def _LE : _FootInstructionB<!strconcat(asm, ".le"), operands, opcode, dstmode, amode, opcode2, 0b0, oops, iops> {
|
|
let Condition = 0b010;
|
|
}
|
|
|
|
def _E : _FootInstructionB<!strconcat(asm, ".e"), operands, opcode, dstmode, amode, opcode2, 0b0, oops, iops> {
|
|
let Condition = 0b011;
|
|
}
|
|
|
|
def _GE : _FootInstructionB<!strconcat(asm, ".ge"), operands, opcode, dstmode, amode, opcode2, 0b0, oops, iops> {
|
|
let Condition = 0b100;
|
|
}
|
|
|
|
def _G : _FootInstructionB<!strconcat(asm, ".g"), operands, opcode, dstmode, amode, opcode2, 0b0, oops, iops> {
|
|
let Condition = 0b101;
|
|
}
|
|
|
|
def _NE : _FootInstructionB<!strconcat(asm, ".ne"), operands, opcode, dstmode, amode, opcode2, 0b0, oops, iops> {
|
|
let Condition = 0b110;
|
|
}
|
|
|
|
def _A_R : _FootInstructionB<asm, operands, opcode, dstmode, amode, opcode2, 0b1, oops, iops> {
|
|
let Condition = 0b000;
|
|
}
|
|
|
|
def _L_R : _FootInstructionB<!strconcat(asm, ".l"), operands, opcode, dstmode, amode, opcode2, 0b1, oops, iops> {
|
|
let Condition = 0b001;
|
|
}
|
|
|
|
def _LE_R : _FootInstructionB<!strconcat(asm, ".le"), operands, opcode, dstmode, amode, opcode2, 0b1, oops, iops> {
|
|
let Condition = 0b010;
|
|
}
|
|
|
|
def _E_R : _FootInstructionB<!strconcat(asm, ".e"), operands, opcode, dstmode, amode, opcode2, 0b1, oops, iops> {
|
|
let Condition = 0b011;
|
|
}
|
|
|
|
def _GE_R : _FootInstructionB<!strconcat(asm, ".ge"), operands, opcode, dstmode, amode, opcode2, 0b1, oops, iops> {
|
|
let Condition = 0b100;
|
|
}
|
|
|
|
def _G_R : _FootInstructionB<!strconcat(asm, ".g"), operands, opcode, dstmode, amode, opcode2, 0b1, oops, iops> {
|
|
let Condition = 0b101;
|
|
}
|
|
|
|
def _NE_R : _FootInstructionB<!strconcat(asm, ".ne"), operands, opcode, dstmode, amode, opcode2, 0b1, oops, iops> {
|
|
let Condition = 0b110;
|
|
}
|
|
}
|
|
|
|
multiclass FootInstructionB<string asm, bits<8> opcode2, dag oops, dag iops> {
|
|
defm _M_M : _mFootInstructionB<!strconcat(asm, ".m.m"), "$dst, $a", 0b0001, 0b00, 0b00, opcode2, oops, iops>;
|
|
defm _M_D : _mFootInstructionB<!strconcat(asm, ".m.d"), "$dst, $a", 0b0001, 0b00, 0b01, opcode2, oops, iops>;
|
|
defm _M_I : _mFootInstructionB<!strconcat(asm, ".m.i"), "$dst, $a", 0b0001, 0b00, 0b10, opcode2, oops, iops>;
|
|
defm _M_A : _mFootInstructionB<!strconcat(asm, ".m.a"), "$dst, $a", 0b0001, 0b00, 0b11, opcode2, oops, iops>;
|
|
defm _D_M : _mFootInstructionB<!strconcat(asm, ".d.m"), "$dst, $a", 0b0001, 0b01, 0b00, opcode2, oops, iops>;
|
|
defm _D_D : _mFootInstructionB<!strconcat(asm, ".d.d"), "$dst, $a", 0b0001, 0b01, 0b01, opcode2, oops, iops>;
|
|
defm _D_I : _mFootInstructionB<!strconcat(asm, ".d.m"), "$dst, $a", 0b0001, 0b01, 0b10, opcode2, oops, iops>;
|
|
defm _D_A : _mFootInstructionB<!strconcat(asm, ".d.m"), "$dst, $a", 0b0001, 0b01, 0b11, opcode2, oops, iops>;
|
|
defm _I_M : _mFootInstructionB<!strconcat(asm, ".i.m"), "$dst, $a", 0b0001, 0b10, 0b00, opcode2, oops, iops>;
|
|
defm _I_D : _mFootInstructionB<!strconcat(asm, ".i.d"), "$dst, $a", 0b0001, 0b10, 0b01, opcode2, oops, iops>;
|
|
defm _I_I : _mFootInstructionB<!strconcat(asm, ".i.m"), "$dst, $a", 0b0001, 0b10, 0b10, opcode2, oops, iops>;
|
|
defm _I_A : _mFootInstructionB<!strconcat(asm, ".i.m"), "$dst, $a", 0b0001, 0b10, 0b11, opcode2, oops, iops>;
|
|
defm _A_M : _mFootInstructionB<!strconcat(asm, ".a.m"), "$dst, $a", 0b0001, 0b11, 0b00, opcode2, oops, iops>;
|
|
defm _A_D : _mFootInstructionB<!strconcat(asm, ".a.d"), "$dst, $a", 0b0001, 0b11, 0b01, opcode2, oops, iops>;
|
|
defm _A_I : _mFootInstructionB<!strconcat(asm, ".a.m"), "$dst, $a", 0b0001, 0b11, 0b10, opcode2, oops, iops>;
|
|
defm _A_A : _mFootInstructionB<!strconcat(asm, ".a.m"), "$dst, $a", 0b0001, 0b11, 0b11, opcode2, oops, iops>;
|
|
}
|
|
|
|
class _FootInstructionC<string asm, string operands,
|
|
bits<4> opcode,
|
|
bits<2> dstmode, bits<2> amode,
|
|
bits<2> bmode, bits<1> repeat,
|
|
dag oops = (outs), dag iops = (ins)>
|
|
: Instruction<> {
|
|
let Namespace = "Foot";
|
|
let AsmString = !strconcat(asm, "\t", operands);
|
|
let OutOperandList = oops;
|
|
let InOperandList = iops;
|
|
|
|
bits<32> Inst;
|
|
bits<3> Condition;
|
|
bits<2> Vect;
|
|
bits<5> dst;
|
|
bits<5> a;
|
|
bits<5> b;
|
|
|
|
let Inst{31-29} = Condition;
|
|
let Inst{28} = repeat;
|
|
let Inst{27-24} = opcode;
|
|
let Inst{23} = Vect{1};
|
|
let Inst{22-21} = bmode;
|
|
let Inst{20-16} = dst;
|
|
let Inst{15} = 0b0;
|
|
let Inst{14-13} = dstmode;
|
|
let Inst{12-8} = b;
|
|
let Inst{7} = Vect{0};
|
|
let Inst{6-5} = amode;
|
|
let Inst{4-0} = a;
|
|
|
|
let Vect = 0b00;
|
|
}
|
|
|
|
multiclass _mmmFootInstructionC<string asm, string operands,
|
|
bits<4> opcode,
|
|
bits<2> dstmode, bits<2> amode,
|
|
bits<2> bmode,
|
|
dag oops, dag iops> {
|
|
def _A : _FootInstructionC<asm, operands, opcode, dstmode, amode, bmode, 0b0, oops, iops> {
|
|
let Condition = 0b000;
|
|
}
|
|
|
|
def _L : _FootInstructionC<!strconcat(asm, ".l"), operands, opcode, dstmode, amode, bmode, 0b0, oops, iops> {
|
|
let Condition = 0b001;
|
|
}
|
|
|
|
def _LE : _FootInstructionC<!strconcat(asm, ".le"), operands, opcode, dstmode, amode, bmode, 0b0, oops, iops> {
|
|
let Condition = 0b010;
|
|
}
|
|
|
|
def _E : _FootInstructionC<!strconcat(asm, ".e"), operands, opcode, dstmode, amode, bmode, 0b0, oops, iops> {
|
|
let Condition = 0b011;
|
|
}
|
|
|
|
def _GE : _FootInstructionC<!strconcat(asm, ".ge"), operands, opcode, dstmode, amode, bmode, 0b0, oops, iops> {
|
|
let Condition = 0b100;
|
|
}
|
|
|
|
def _G : _FootInstructionC<!strconcat(asm, ".g"), operands, opcode, dstmode, amode, bmode, 0b0, oops, iops> {
|
|
let Condition = 0b101;
|
|
}
|
|
|
|
def _NE : _FootInstructionC<!strconcat(asm, ".ne"), operands, opcode, dstmode, amode, bmode, 0b0, oops, iops> {
|
|
let Condition = 0b110;
|
|
}
|
|
|
|
def _A_R : _FootInstructionC<asm, operands, opcode, dstmode, amode, bmode, 0b1, oops, iops> {
|
|
let Condition = 0b000;
|
|
}
|
|
|
|
def _L_R : _FootInstructionC<!strconcat(asm, ".l"), operands, opcode, dstmode, amode, bmode, 0b1, oops, iops> {
|
|
let Condition = 0b001;
|
|
}
|
|
|
|
def _LE_R : _FootInstructionC<!strconcat(asm, ".le"), operands, opcode, dstmode, amode, bmode, 0b1, oops, iops> {
|
|
let Condition = 0b010;
|
|
}
|
|
|
|
def _E_R : _FootInstructionC<!strconcat(asm, ".e"), operands, opcode, dstmode, amode, bmode, 0b1, oops, iops> {
|
|
let Condition = 0b011;
|
|
}
|
|
|
|
def _GE_R : _FootInstructionC<!strconcat(asm, ".ge"), operands, opcode, dstmode, amode, bmode, 0b1, oops, iops> {
|
|
let Condition = 0b100;
|
|
}
|
|
|
|
def _G_R : _FootInstructionC<!strconcat(asm, ".g"), operands, opcode, dstmode, amode, bmode, 0b1, oops, iops> {
|
|
let Condition = 0b101;
|
|
}
|
|
|
|
def _NE_R : _FootInstructionC<!strconcat(asm, ".ne"), operands, opcode, dstmode, amode, bmode, 0b1, oops, iops> {
|
|
let Condition = 0b110;
|
|
}
|
|
}
|
|
|
|
multiclass _mmFootInstructionC<string asm, string operands,
|
|
bits<4> opcode,
|
|
bits<2> amode, bits<2> bmode,
|
|
dag oops, dag iops> {
|
|
defm _M : _mmmFootInstructionC<!strconcat(asm, ".m"), operands, opcode, 0b00, amode, bmode, oops, iops>;
|
|
defm _D : _mmmFootInstructionC<!strconcat(asm, ".d"), operands, opcode, 0b01, amode, bmode, oops, iops>;
|
|
defm _I : _mmmFootInstructionC<!strconcat(asm, ".i"), operands, opcode, 0b10, amode, bmode, oops, iops>;
|
|
defm _A : _mmmFootInstructionC<!strconcat(asm, ".a"), operands, opcode, 0b11, amode, bmode, oops, iops>;
|
|
}
|
|
|
|
multiclass _mFootInstructionC<string asm, string operands,
|
|
bits<4> opcode, bits<2> bmode,
|
|
dag oops, dag iops> {
|
|
defm _M : _mmFootInstructionC<!strconcat(asm, ".m"), operands, opcode, 0b00, bmode, oops, iops>;
|
|
defm _D : _mmFootInstructionC<!strconcat(asm, ".d"), operands, opcode, 0b01, bmode, oops, iops>;
|
|
defm _I : _mmFootInstructionC<!strconcat(asm, ".i"), operands, opcode, 0b10, bmode, oops, iops>;
|
|
defm _A : _mmFootInstructionC<!strconcat(asm, ".a"), operands, opcode, 0b11, bmode, oops, iops>;
|
|
}
|
|
|
|
multiclass FootInstructionC<string asm, bits<4> opcode,
|
|
dag oops = (outs), dag iops = (ins)> {
|
|
defm _M : _mFootInstructionC<!strconcat(asm, ".m"), "$dst, $a, $b", opcode, 0b00, oops, iops>;
|
|
defm _D : _mFootInstructionC<!strconcat(asm, ".d"), "$dst, $a, $b", opcode, 0b01, oops, iops>;
|
|
defm _I : _mFootInstructionC<!strconcat(asm, ".i"), "$dst, $a, $b", opcode, 0b10, oops, iops>;
|
|
defm _A : _mFootInstructionC<!strconcat(asm, ".a"), "$dst, $a, $b", opcode, 0b11, oops, iops>;
|
|
}
|