blob: 21f8a6535de89a3b03b687f3632fd662d024a786 [file] [log] [blame]
Misha Brukmane07c2aa2004-02-25 21:02:21 +00001//===- SparcV8Instrs.td - Target Description for SparcV8 Target -----------===//
Brian Gaekee785e532004-02-25 19:28:19 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Misha Brukmane07c2aa2004-02-25 21:02:21 +000010// This file describes the SparcV8 instructions in TableGen format.
Brian Gaekee785e532004-02-25 19:28:19 +000011//
12//===----------------------------------------------------------------------===//
13
Misha Brukmane07c2aa2004-02-25 21:02:21 +000014//===----------------------------------------------------------------------===//
Misha Brukman23e6c1f2004-02-26 00:37:12 +000015// Instruction format superclass
Misha Brukmane07c2aa2004-02-25 21:02:21 +000016//===----------------------------------------------------------------------===//
17
18class InstV8 : Instruction { // SparcV8 instruction baseline
19 field bits<32> Inst;
20
21 let Namespace = "V8";
22
23 bits<2> op;
24 let Inst{31-30} = op; // Top two bits are the 'op' field
25
26 // Bit attributes specific to SparcV8 instructions
27 bit isPasi = 0; // Does this instruction affect an alternate addr space?
28 bit isPrivileged = 0; // Is this a privileged instruction?
Brian Gaekee785e532004-02-25 19:28:19 +000029}
30
Chris Lattnera85d46e2004-02-28 19:45:39 +000031include "SparcV8InstrInfo_F2.td"
32include "SparcV8InstrInfo_F3.td"
Brian Gaekee785e532004-02-25 19:28:19 +000033
Misha Brukman23e6c1f2004-02-26 00:37:12 +000034//===----------------------------------------------------------------------===//
35// Instructions
36//===----------------------------------------------------------------------===//
37
Chris Lattner275f6452004-02-28 19:37:18 +000038// Pseudo instructions.
39def PHI : InstV8 {
40 let Name = "PHI";
41}
42def ADJCALLSTACKDOWN : InstV8 {
43 let Name = "ADJCALLSTACKDOWN";
44}
45def ADJCALLSTACKUP : InstV8 {
46 let Name = "ADJCALLSTACKUP";
47}
48
Brian Gaekea8056fa2004-03-06 05:32:13 +000049// Section A.3 - Synthetic Instructions, p. 85
50let isReturn = 1, isTerminator = 1, simm13 = 8 in
51 def RET : F3_2<2, 0b111000, "ret">;
52let isReturn = 1, isTerminator = 1, simm13 = 8 in
Brian Gaeke8542e082004-04-02 20:53:37 +000053 def RETL: F3_2<2, 0b111000, "retl">;
54
55// Section B.1 - Load Integer Instructions, p. 90
56def LDSBmr: F3_2<3, 0b001001, "ldsb">;
57def LDSHmr: F3_2<3, 0b001010, "ldsh">;
58def LDUBmr: F3_2<3, 0b000001, "ldub">;
59def LDUHmr: F3_2<3, 0b000010, "lduh">;
60def LDmr : F3_2<3, 0b000000, "ld">;
61def LDDmr : F3_2<3, 0b000011, "ldd">;
62
63// Section B.4 - Store Integer Instructions, p. 95
64def STBrm : F3_2<3, 0b000101, "stb">;
65def STHrm : F3_2<3, 0b000110, "sth">;
66def STrm : F3_2<3, 0b000100, "st">;
67def STDrm : F3_2<3, 0b000111, "std">;
Misha Brukman23e6c1f2004-02-26 00:37:12 +000068
Brian Gaeke775158d2004-03-04 04:37:45 +000069// Section B.9 - SETHI Instruction, p. 104
Brian Gaekee8061732004-03-04 00:56:25 +000070def SETHIi: F2_1<0b100, "sethi">;
71
Brian Gaeke8542e082004-04-02 20:53:37 +000072// Section B.10 - NOP Instruction, p. 105
73// (It's a special case of SETHI)
74let rd = 0, imm = 0 in
75 def NOP : F2_1<0b100, "nop">;
76
Brian Gaekebc1d27a2004-03-03 23:03:14 +000077// Section B.11 - Logical Instructions, p. 106
78def ANDri : F3_2<2, 0b000001, "and">;
79def ORrr : F3_1<2, 0b000010, "or">;
Brian Gaekee8061732004-03-04 00:56:25 +000080def ORri : F3_2<2, 0b000010, "or">;
Brian Gaekebc1d27a2004-03-03 23:03:14 +000081
82// Section B.12 - Shift Instructions, p. 107
83def SLLri : F3_1<2, 0b100101, "sll">;
84def SRLri : F3_1<2, 0b100110, "srl">;
85def SRAri : F3_1<2, 0b100111, "sra">;
86
87// Section B.13 - Add Instructions, p. 108
88def ADDrr : F3_1<2, 0b000000, "add">;
89
Brian Gaeke775158d2004-03-04 04:37:45 +000090// Section B.15 - Subtract Instructions, p. 110
91def SUBrr : F3_1<2, 0b000100, "sub">;
92
Brian Gaeke032f80f2004-03-16 22:37:13 +000093// Section B.18 - Multiply Instructions, p. 113
94def UMULrr : F3_1<2, 0b001010, "umul">;
95def SMULrr : F3_1<2, 0b001011, "smul">;
96
Brian Gaekea8056fa2004-03-06 05:32:13 +000097// Section B.20 - SAVE and RESTORE, p. 117
98def SAVErr : F3_1<2, 0b111100, "save">; // save r, r, r
99def SAVEri : F3_2<2, 0b111100, "save">; // save r, i, r
100def RESTORErr : F3_1<2, 0b111101, "restore">; // restore r, r, r
101def RESTOREri : F3_2<2, 0b111101, "restore">; // restore r, i, r
102
Brian Gaeke8542e082004-04-02 20:53:37 +0000103// Section B.24 - Call and Link Instruction, p. 125
Brian Gaekea8056fa2004-03-06 05:32:13 +0000104// This is the only Format 1 instruction
105def CALL : InstV8 {
106 bits<30> disp;
107 let op = 1;
108 let Inst{29-0} = disp;
109 let Name = "call";
110 let isCall = 1;
111}
112
Brian Gaekebc1d27a2004-03-03 23:03:14 +0000113// Section B.25 - Jump and Link, p. 126
Brian Gaekea8056fa2004-03-06 05:32:13 +0000114def JMPLrr : F3_1<2, 0b111000, "jmpl">; // jmpl [rs1+rs2], rd
115def JMPLri : F3_2<2, 0b111000, "jmpl">; // jmpl [rs1+imm], rd
Misha Brukman23e6c1f2004-02-26 00:37:12 +0000116