2004-02-25 22:02:21 +01:00
|
|
|
//===- SparcV8Instrs.td - Target Description for SparcV8 Target -----------===//
|
2004-02-25 20:28:19 +01:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2004-02-25 22:02:21 +01:00
|
|
|
// This file describes the SparcV8 instructions in TableGen format.
|
2004-02-25 20:28:19 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2004-02-25 22:02:21 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
2004-02-26 01:37:12 +01:00
|
|
|
// Instruction format superclass
|
2004-02-25 22:02:21 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
2004-02-25 20:28:19 +01:00
|
|
|
|
2004-02-25 22:02:21 +01:00
|
|
|
class InstV8 : Instruction { // SparcV8 instruction baseline
|
|
|
|
field bits<32> Inst;
|
|
|
|
|
|
|
|
let Namespace = "V8";
|
|
|
|
|
|
|
|
bits<2> op;
|
|
|
|
let Inst{31-30} = op; // Top two bits are the 'op' field
|
|
|
|
|
|
|
|
// Bit attributes specific to SparcV8 instructions
|
|
|
|
bit isPasi = 0; // Does this instruction affect an alternate addr space?
|
|
|
|
bit isPrivileged = 0; // Is this a privileged instruction?
|
|
|
|
}
|
2004-02-25 20:28:19 +01:00
|
|
|
|
2004-09-22 23:38:42 +02:00
|
|
|
include "SparcV8InstrFormats.td"
|
2004-02-25 20:28:19 +01:00
|
|
|
|
2004-02-26 01:37:12 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2004-02-28 20:37:18 +01:00
|
|
|
// Pseudo instructions.
|
2005-12-16 08:13:26 +01:00
|
|
|
class PseudoInstV8<string asmstr, dag ops> : InstV8 {
|
|
|
|
let AsmString = asmstr;
|
2005-12-16 07:02:58 +01:00
|
|
|
dag OperandList = ops;
|
2004-02-28 20:37:18 +01:00
|
|
|
}
|
2005-12-16 07:02:58 +01:00
|
|
|
def PHI : PseudoInstV8<"PHI", (ops variable_ops)>;
|
2005-12-16 08:13:26 +01:00
|
|
|
def ADJCALLSTACKDOWN : PseudoInstV8<"!ADJCALLSTACKDOWN $amt",
|
|
|
|
(ops i32imm:$amt)>;
|
|
|
|
def ADJCALLSTACKUP : PseudoInstV8<"!ADJCALLSTACKUP $amt",
|
|
|
|
(ops i32imm:$amt)>;
|
|
|
|
//def IMPLICIT_USE : PseudoInstV8<"!IMPLICIT_USE",(ops variable_ops)>;
|
|
|
|
def IMPLICIT_DEF : PseudoInstV8<"!IMPLICIT_DEF $dst",
|
|
|
|
(ops IntRegs:$dst)>;
|
|
|
|
def FpMOVD : PseudoInstV8<"!FpMOVD", (ops)>; // pseudo 64-bit double move
|
2004-02-28 20:37:18 +01:00
|
|
|
|
2004-03-06 06:32:13 +01:00
|
|
|
// Section A.3 - Synthetic Instructions, p. 85
|
2004-05-08 06:21:32 +02:00
|
|
|
// special cases of JMPL:
|
2004-10-15 00:32:49 +02:00
|
|
|
let isReturn = 1, isTerminator = 1, hasDelaySlot = 1 in {
|
|
|
|
let rd = I7.Num, rs1 = G0.Num, simm13 = 8 in
|
2005-12-16 07:25:42 +01:00
|
|
|
def RET : F3_2<2, 0b111000,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"ret $b, $c, $dst">;
|
2004-10-15 00:32:49 +02:00
|
|
|
let rd = O7.Num, rs1 = G0.Num, simm13 = 8 in
|
2005-12-16 08:10:02 +01:00
|
|
|
def RETL: F3_2<2, 0b111000, (ops),
|
|
|
|
"retl">;
|
2004-10-15 00:32:49 +02:00
|
|
|
}
|
2004-05-08 06:21:32 +02:00
|
|
|
// CMP is a special case of SUBCC where destination is ignored, by setting it to
|
|
|
|
// %g0 (hardwired zero).
|
|
|
|
// FIXME: should keep track of the fact that it defs the integer condition codes
|
|
|
|
let rd = 0 in
|
2005-12-16 07:25:42 +01:00
|
|
|
def CMPri: F3_2<2, 0b010100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"cmp $b, $c, $dst">;
|
2004-04-02 22:53:37 +02:00
|
|
|
|
|
|
|
// Section B.1 - Load Integer Instructions, p. 90
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDSB: F3_2<3, 0b001001,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"ldsb [$b+$c], $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDSH: F3_2<3, 0b001010,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"ldsh [$b+$c], $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDUB: F3_2<3, 0b000001,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"ldub [$b+$c], $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDUH: F3_2<3, 0b000010,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"lduh [$b+$c], $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def LD : F3_2<3, 0b000000,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"ld [$b+$c], $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDD : F3_2<3, 0b000011,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"ldd [$b+$c], $dst">;
|
2004-04-02 22:53:37 +02:00
|
|
|
|
2004-06-18 07:19:27 +02:00
|
|
|
// Section B.2 - Load Floating-point Instructions, p. 92
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDFrr : F3_1<3, 0b100000,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
2005-12-16 08:10:02 +01:00
|
|
|
"ld [$b+$c], $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDFri : F3_2<3, 0b100000,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"ld [$b+$c], $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDDFrr : F3_1<3, 0b100011,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
2005-12-16 08:10:02 +01:00
|
|
|
"ldd [$b+$c], $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDDFri : F3_2<3, 0b100011,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"ldd [$b+$c], $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDFSRrr: F3_1<3, 0b100001,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
2005-12-16 08:10:02 +01:00
|
|
|
"ld [$b+$c], $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def LDFSRri: F3_2<3, 0b100001,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"ld [$b+$c], $dst">;
|
2004-06-18 07:19:27 +02:00
|
|
|
|
2004-04-02 22:53:37 +02:00
|
|
|
// Section B.4 - Store Integer Instructions, p. 95
|
2005-12-16 07:25:42 +01:00
|
|
|
def STB : F3_2<3, 0b000101,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
|
|
|
|
"stb $src, [$base+$offset]">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def STH : F3_2<3, 0b000110,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
|
|
|
|
"sth $src, [$base+$offset]">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ST : F3_2<3, 0b000100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
|
|
|
|
"st $src, [$base+$offset]">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def STD : F3_2<3, 0b000111,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
|
|
|
|
"std $src, [$base+$offset]">;
|
2004-06-24 09:36:59 +02:00
|
|
|
|
|
|
|
// Section B.5 - Store Floating-point Instructions, p. 97
|
2005-12-16 07:25:42 +01:00
|
|
|
def STFrr : F3_1<3, 0b100100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, IntRegs:$src),
|
|
|
|
"st $src, [$base+$offset]">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def STFri : F3_2<3, 0b100100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
|
|
|
|
"st $src, [$base+$offset]">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def STDFrr : F3_1<3, 0b100111,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, IntRegs:$src),
|
|
|
|
"std $src, [$base+$offset]">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def STDFri : F3_2<3, 0b100111,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
|
|
|
|
"std $src, [$base+$offset]">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def STFSRrr : F3_1<3, 0b100101,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, IntRegs:$src),
|
|
|
|
"st $src, [$base+$offset]">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def STFSRri : F3_2<3, 0b100101,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
|
|
|
|
"st $src, [$base+$offset]">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def STDFQrr : F3_1<3, 0b100110,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, IntRegs:$src),
|
|
|
|
"std $src, [$base+$offset]">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def STDFQri : F3_2<3, 0b100110,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
|
|
|
|
"std $src, [$base+$offset]">;
|
2004-02-26 01:37:12 +01:00
|
|
|
|
2004-03-04 05:37:45 +01:00
|
|
|
// Section B.9 - SETHI Instruction, p. 104
|
2005-12-16 08:18:48 +01:00
|
|
|
def SETHIi: F2_1<0b100,
|
|
|
|
(ops IntRegs:$dst, i32imm:$src),
|
|
|
|
"sethi $src, $dst">;
|
2004-03-04 01:56:25 +01:00
|
|
|
|
2004-04-02 22:53:37 +02:00
|
|
|
// Section B.10 - NOP Instruction, p. 105
|
|
|
|
// (It's a special case of SETHI)
|
2004-10-15 00:33:32 +02:00
|
|
|
let rd = 0, imm22 = 0 in
|
2005-12-16 08:18:48 +01:00
|
|
|
def NOP : F2_1<0b100, (ops), "nop">;
|
2004-04-02 22:53:37 +02:00
|
|
|
|
2004-03-04 00:03:14 +01:00
|
|
|
// Section B.11 - Logical Instructions, p. 106
|
2005-12-16 07:25:42 +01:00
|
|
|
def ANDrr : F3_1<2, 0b000001,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"and $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ANDri : F3_2<2, 0b000001,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"and $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ANDCCrr : F3_1<2, 0b010001,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"andcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ANDCCri : F3_2<2, 0b010001,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"andcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ANDNrr : F3_1<2, 0b000101,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"andn $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ANDNri : F3_2<2, 0b000101,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"andn $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ANDNCCrr: F3_1<2, 0b010101,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"andncc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ANDNCCri: F3_2<2, 0b010101,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"andncc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ORrr : F3_1<2, 0b000010,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"or $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ORri : F3_2<2, 0b000010,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"or $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ORCCrr : F3_1<2, 0b010010,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"orcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ORCCri : F3_2<2, 0b010010,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"orcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ORNrr : F3_1<2, 0b000110,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"orn $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ORNri : F3_2<2, 0b000110,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"orn $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ORNCCrr : F3_1<2, 0b010110,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"orncc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ORNCCri : F3_2<2, 0b010110,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"orncc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def XORrr : F3_1<2, 0b000011,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"xor $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def XORri : F3_2<2, 0b000011,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"xor $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def XORCCrr : F3_1<2, 0b010011,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"xorcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def XORCCri : F3_2<2, 0b010011,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"xorcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def XNORrr : F3_1<2, 0b000111,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"xnor $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def XNORri : F3_2<2, 0b000111,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"xnor $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def XNORCCrr: F3_1<2, 0b010111,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"xnorcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def XNORCCri: F3_2<2, 0b010111,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"xnorcc $b, $c, $dst">;
|
2004-03-04 00:03:14 +01:00
|
|
|
|
|
|
|
// Section B.12 - Shift Instructions, p. 107
|
2005-12-16 07:25:42 +01:00
|
|
|
def SLLrr : F3_1<2, 0b100101,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"sll $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SLLri : F3_2<2, 0b100101,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"sll $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SRLrr : F3_1<2, 0b100110,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"srl $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SRLri : F3_2<2, 0b100110,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"srl $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SRArr : F3_1<2, 0b100111,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"sra $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SRAri : F3_2<2, 0b100111,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"sla $b, $c, $dst">;
|
2004-03-04 00:03:14 +01:00
|
|
|
|
|
|
|
// Section B.13 - Add Instructions, p. 108
|
2005-12-16 07:25:42 +01:00
|
|
|
def ADDrr : F3_1<2, 0b000000,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"add $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ADDri : F3_2<2, 0b000000,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"add $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ADDCCrr : F3_1<2, 0b010000,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"addcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ADDCCri : F3_2<2, 0b010000,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"addcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ADDXrr : F3_1<2, 0b001000,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"addx $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ADDXri : F3_2<2, 0b001000,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"addx $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ADDXCCrr: F3_1<2, 0b011000,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"addxcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def ADDXCCri: F3_2<2, 0b011000,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"addxcc $b, $c, $dst">;
|
2004-03-04 00:03:14 +01:00
|
|
|
|
2004-03-04 05:37:45 +01:00
|
|
|
// Section B.15 - Subtract Instructions, p. 110
|
2005-12-16 07:25:42 +01:00
|
|
|
def SUBrr : F3_1<2, 0b000100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"sub $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SUBri : F3_2<2, 0b000100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"sub $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SUBCCrr : F3_1<2, 0b010100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"subcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SUBCCri : F3_2<2, 0b010100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"subcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SUBXrr : F3_1<2, 0b001100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"subx $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SUBXri : F3_2<2, 0b001100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"subx $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SUBXCCrr: F3_1<2, 0b011100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"subxcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SUBXCCri: F3_2<2, 0b011100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"subxcc $b, $c, $dst">;
|
2004-03-04 05:37:45 +01:00
|
|
|
|
2004-03-16 23:37:13 +01:00
|
|
|
// Section B.18 - Multiply Instructions, p. 113
|
2005-12-16 07:25:42 +01:00
|
|
|
def UMULrr : F3_1<2, 0b001010,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"umul $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def UMULri : F3_2<2, 0b001010,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"umul $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SMULrr : F3_1<2, 0b001011,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"smul $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SMULri : F3_2<2, 0b001011,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"smul $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def UMULCCrr: F3_1<2, 0b011010,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"umulcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def UMULCCri: F3_2<2, 0b011010,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"umulcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SMULCCrr: F3_1<2, 0b011011,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"smulcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SMULCCri: F3_2<2, 0b011011,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"smulcc $b, $c, $dst">;
|
2004-03-16 23:37:13 +01:00
|
|
|
|
2004-04-07 06:01:00 +02:00
|
|
|
// Section B.19 - Divide Instructions, p. 115
|
2005-12-16 07:25:42 +01:00
|
|
|
def UDIVrr : F3_1<2, 0b001110,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"udiv $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def UDIVri : F3_2<2, 0b001110,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"udiv $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SDIVrr : F3_1<2, 0b001111,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"sdiv $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SDIVri : F3_2<2, 0b001111,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"sdiv $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def UDIVCCrr : F3_1<2, 0b011110,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"udivcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def UDIVCCri : F3_2<2, 0b011110,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"udivcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SDIVCCrr : F3_1<2, 0b011111,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"sdivcc $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SDIVCCri : F3_2<2, 0b011111,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"sdivcc $b, $c, $dst">;
|
2004-04-07 06:01:00 +02:00
|
|
|
|
2004-03-06 06:32:13 +01:00
|
|
|
// Section B.20 - SAVE and RESTORE, p. 117
|
2005-12-16 07:25:42 +01:00
|
|
|
def SAVErr : F3_1<2, 0b111100,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"save $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def SAVEri : F3_2<2, 0b111100,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"save $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def RESTORErr : F3_1<2, 0b111101,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"restore $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def RESTOREri : F3_2<2, 0b111101,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"restore $b, $c, $dst">;
|
2004-03-06 06:32:13 +01:00
|
|
|
|
2004-05-08 06:21:32 +02:00
|
|
|
// Section B.21 - Branch on Integer Condition Codes Instructions, p. 119
|
2004-06-18 00:34:29 +02:00
|
|
|
|
|
|
|
// conditional branch class:
|
|
|
|
class BranchV8<bits<4> cc, string nm> : F2_2<cc, 0b010, nm> {
|
|
|
|
let isBranch = 1;
|
|
|
|
let isTerminator = 1;
|
2004-09-30 06:04:48 +02:00
|
|
|
let hasDelaySlot = 1;
|
2004-06-18 00:34:29 +02:00
|
|
|
}
|
2004-07-31 04:24:37 +02:00
|
|
|
|
|
|
|
let isBarrier = 1 in
|
|
|
|
def BA : BranchV8<0b1000, "ba">;
|
2004-06-18 00:34:29 +02:00
|
|
|
def BN : BranchV8<0b0000, "bn">;
|
|
|
|
def BNE : BranchV8<0b1001, "bne">;
|
|
|
|
def BE : BranchV8<0b0001, "be">;
|
|
|
|
def BG : BranchV8<0b1010, "bg">;
|
|
|
|
def BLE : BranchV8<0b0010, "ble">;
|
|
|
|
def BGE : BranchV8<0b1011, "bge">;
|
|
|
|
def BL : BranchV8<0b0011, "bl">;
|
|
|
|
def BGU : BranchV8<0b1100, "bgu">;
|
|
|
|
def BLEU : BranchV8<0b0100, "bleu">;
|
|
|
|
def BCC : BranchV8<0b1101, "bcc">;
|
|
|
|
def BCS : BranchV8<0b0101, "bcs">;
|
2004-05-08 06:21:32 +02:00
|
|
|
|
2004-07-08 11:08:22 +02:00
|
|
|
// Section B.22 - Branch on Floating-point Condition Codes Instructions, p. 121
|
|
|
|
|
|
|
|
// floating-point conditional branch class:
|
|
|
|
class FPBranchV8<bits<4> cc, string nm> : F2_2<cc, 0b110, nm> {
|
|
|
|
let isBranch = 1;
|
|
|
|
let isTerminator = 1;
|
2004-09-30 06:04:48 +02:00
|
|
|
let hasDelaySlot = 1;
|
2004-07-08 11:08:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
def FBA : FPBranchV8<0b1000, "fba">;
|
|
|
|
def FBN : FPBranchV8<0b0000, "fbn">;
|
|
|
|
def FBU : FPBranchV8<0b0111, "fbu">;
|
|
|
|
def FBG : FPBranchV8<0b0110, "fbg">;
|
|
|
|
def FBUG : FPBranchV8<0b0101, "fbug">;
|
|
|
|
def FBL : FPBranchV8<0b0100, "fbl">;
|
|
|
|
def FBUL : FPBranchV8<0b0011, "fbul">;
|
|
|
|
def FBLG : FPBranchV8<0b0010, "fblg">;
|
|
|
|
def FBNE : FPBranchV8<0b0001, "fbne">;
|
|
|
|
def FBE : FPBranchV8<0b1001, "fbe">;
|
|
|
|
def FBUE : FPBranchV8<0b1010, "fbue">;
|
|
|
|
def FBGE : FPBranchV8<0b1011, "fbge">;
|
|
|
|
def FBUGE: FPBranchV8<0b1100, "fbuge">;
|
|
|
|
def FBLE : FPBranchV8<0b1101, "fble">;
|
|
|
|
def FBULE: FPBranchV8<0b1110, "fbule">;
|
|
|
|
def FBO : FPBranchV8<0b1111, "fbo">;
|
|
|
|
|
2004-11-16 08:32:09 +01:00
|
|
|
|
|
|
|
|
2004-04-02 22:53:37 +02:00
|
|
|
// Section B.24 - Call and Link Instruction, p. 125
|
2004-03-06 06:32:13 +01:00
|
|
|
// This is the only Format 1 instruction
|
2004-11-16 08:32:09 +01:00
|
|
|
let Uses = [O0, O1, O2, O3, O4, O5], hasDelaySlot = 1, isCall = 1 in {
|
2004-09-30 06:04:48 +02:00
|
|
|
// pc-relative call:
|
2004-11-16 08:32:09 +01:00
|
|
|
let Defs = [O0, O1, O2, O3, O4, O5, O7, G1, G2, G3, G4, G5, G6, G7,
|
|
|
|
D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15] in
|
2004-09-29 22:45:05 +02:00
|
|
|
def CALL : InstV8 {
|
|
|
|
bits<30> disp;
|
|
|
|
let op = 1;
|
|
|
|
let Inst{29-0} = disp;
|
|
|
|
let Name = "call";
|
|
|
|
}
|
2004-11-16 08:32:09 +01:00
|
|
|
|
|
|
|
// indirect call (O7 is an EXPLICIT def in indirect calls, so it cannot also
|
|
|
|
// be an implicit def):
|
|
|
|
let Defs = [O0, O1, O2, O3, O4, O5, G1, G2, G3, G4, G5, G6, G7,
|
|
|
|
D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15] in
|
2005-12-16 07:52:00 +01:00
|
|
|
def JMPLrr : F3_1<2, 0b111000,
|
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"jmpl $b+$c, $dst">;
|
2004-09-29 22:45:05 +02:00
|
|
|
}
|
2004-02-26 01:37:12 +01:00
|
|
|
|
2004-04-07 06:06:46 +02:00
|
|
|
// Section B.29 - Write State Register Instructions
|
2005-12-16 07:25:42 +01:00
|
|
|
def WRrr : F3_1<2, 0b110000,
|
2005-12-16 07:52:00 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
|
|
|
|
"wr $b, $c, $dst">;
|
2005-12-16 07:25:42 +01:00
|
|
|
def WRri : F3_2<2, 0b110000,
|
2005-12-16 08:10:02 +01:00
|
|
|
(ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
|
|
|
|
"wr $b, $c, $dst">;
|
2004-04-07 07:04:01 +02:00
|
|
|
|
2004-06-28 00:53:56 +02:00
|
|
|
// Convert Integer to Floating-point Instructions, p. 141
|
|
|
|
def FITOS : F3_3<2, 0b110100, 0b011000100, "fitos">;
|
2004-09-29 21:59:07 +02:00
|
|
|
def FITOD : F3_3<2, 0b110100, 0b011001000, "fitod">;
|
2004-06-28 00:53:56 +02:00
|
|
|
|
2004-10-14 21:39:35 +02:00
|
|
|
// Convert Floating-point to Integer Instructions, p. 142
|
|
|
|
def FSTOI : F3_3<2, 0b110100, 0b011010001, "fstoi">;
|
|
|
|
def FDTOI : F3_3<2, 0b110100, 0b011010010, "fdtoi">;
|
|
|
|
|
2004-06-24 23:22:09 +02:00
|
|
|
// Convert between Floating-point Formats Instructions, p. 143
|
|
|
|
def FSTOD : F3_3<2, 0b110100, 0b011001001, "fstod">;
|
|
|
|
def FDTOS : F3_3<2, 0b110100, 0b011000110, "fdtos">;
|
|
|
|
|
2004-06-18 08:28:10 +02:00
|
|
|
// Floating-point Move Instructions, p. 144
|
|
|
|
def FMOVS : F3_3<2, 0b110100, 0b000000001, "fmovs">;
|
|
|
|
def FNEGS : F3_3<2, 0b110100, 0b000000101, "fnegs">;
|
|
|
|
def FABSS : F3_3<2, 0b110100, 0b000001001, "fabss">;
|
|
|
|
|
2004-06-28 00:53:56 +02:00
|
|
|
// Floating-point Add and Subtract Instructions, p. 146
|
|
|
|
def FADDS : F3_3<2, 0b110100, 0b001000001, "fadds">;
|
|
|
|
def FADDD : F3_3<2, 0b110100, 0b001000010, "faddd">;
|
|
|
|
def FSUBS : F3_3<2, 0b110100, 0b001000101, "fsubs">;
|
|
|
|
def FSUBD : F3_3<2, 0b110100, 0b001000110, "fsubd">;
|
|
|
|
|
|
|
|
// Floating-point Multiply and Divide Instructions, p. 147
|
|
|
|
def FMULS : F3_3<2, 0b110100, 0b001001001, "fmuls">;
|
|
|
|
def FMULD : F3_3<2, 0b110100, 0b001001010, "fmuld">;
|
|
|
|
def FSMULD : F3_3<2, 0b110100, 0b001101001, "fsmuld">;
|
|
|
|
def FDIVS : F3_3<2, 0b110100, 0b001001101, "fdivs">;
|
|
|
|
def FDIVD : F3_3<2, 0b110100, 0b001001110, "fdivd">;
|
2004-06-24 23:22:09 +02:00
|
|
|
|
2004-07-08 11:08:22 +02:00
|
|
|
// Floating-point Compare Instructions, p. 148
|
2004-09-30 06:04:48 +02:00
|
|
|
// Note: the 2nd template arg is different for these guys.
|
|
|
|
// Note 2: the result of a FCMP is not available until the 2nd cycle
|
|
|
|
// after the instr is retired, but there is no interlock. This behavior
|
|
|
|
// is modelled as a delay slot.
|
|
|
|
let hasDelaySlot = 1 in {
|
|
|
|
def FCMPS : F3_3<2, 0b110101, 0b001010001, "fcmps">;
|
|
|
|
def FCMPD : F3_3<2, 0b110101, 0b001010010, "fcmpd">;
|
|
|
|
def FCMPES : F3_3<2, 0b110101, 0b001010101, "fcmpes">;
|
|
|
|
def FCMPED : F3_3<2, 0b110101, 0b001010110, "fcmped">;
|
|
|
|
}
|
2004-07-08 11:08:22 +02:00
|
|
|
|