Added LLVM copyright header.
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9_F4.td
1 //===- SparcV9_F4.td - Format 4 instructions: Sparc V9 Target -------------===//
2 // 
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
10 //----------------------- F4 classes -----------------------------------------
11
12 // F4 - Common superclass of all F4 instructions.  All instructions have an op3
13 // field.
14 class F4 : InstV9 {
15   bits<6> op3;
16   let Inst{24-19} = op3;
17 }
18
19 // F4_rs1 - Common class of instructions that use an rs1 field
20 class F4_rs1 : F4 {
21   bits<5> rs1;
22   let Inst{18-14} = rs1;
23 }
24
25 // F4_rs1rs2 - Common class of instructions that have rs1 and rs2 fields
26 class F4_rs1rs2 : F4_rs1 {
27   bits<5> rs2;
28   let Inst{4-0} = rs2;
29 }
30
31 // F4_rs1rs2rd - Common class of instructions that have 3 register operands
32 class F4_rs1rs2rd : F4_rs1rs2 {
33   bits<5> rd;
34   let Inst{29-25} = rd;
35 }
36
37 // F4_rs1rs2rd - Common class of instructions that have 2 reg and 1 imm operand
38 class F4_rs1simm11rd : F4_rs1 {
39   bits<11> simm11;
40   bits<5>  rd;
41
42   let Inst{10-0}  = simm11;
43   let Inst{29-25} = rd;
44 }
45
46 // F4_cc - Common class of instructions that have a cond field
47 class F4_cond : F4 {
48   bits<4> cond;
49   let Inst{17-14} = cond;
50 }
51
52 // F4_cc - Common class of instructions that have cc register as first operand
53 class F4_condcc : F4_cond {
54   bits<3> cc;
55   let Inst{18} = cc{2};
56   let Inst{12} = cc{1};
57   let Inst{11} = cc{0};
58 }
59
60 // Actual F4 instruction classes
61 //
62 class F4_1<bits<2> opVal, bits<6> op3Val, string name> : F4_rs1rs2rd {
63   bits<2> cc;
64
65   let op = opVal;
66   let op3 = op3Val;
67   let Name = name;
68   let Inst{13} = 0; // i bit
69   let Inst{12-11} = cc;
70   let Inst{10-5} = 0; // don't care
71 }
72
73 class F4_2<bits<2> opVal, bits<6> op3Val, string name> : F4_rs1simm11rd {
74   bits<2> cc;
75
76   let op = opVal;
77   let op3 = op3Val;
78   let Name = name;
79   let Inst{13} = 1; // i bit
80   let Inst{12-11} = cc;
81 }
82
83 class F4_3<bits<2> opVal, bits<6> op3Val, bits<4> condVal,
84            string name> : F4_condcc {
85   bits<5> rs2;
86   bits<5> rd;
87
88   let op = opVal;
89   let op3 = op3Val;
90   let cond = condVal;
91   let Name = name;
92   let Inst{29-25} = rd;
93   let Inst{13} = 0; // i bit
94   let Inst{10-5} = 0; // don't care
95   let Inst{4-0} = rs2;
96 }
97
98 class F4_4<bits<2> opVal, bits<6> op3Val, bits<4> condVal,
99            string name> : F4_condcc {
100   bits<11> simm11;
101   bits<5>  rd;
102
103   let op   = opVal;
104   let op3  = op3Val;
105   let cond = condVal;
106   let Name = name;
107   let Inst{29-25} = rd;
108   let Inst{13} = 1; // i bit
109   let Inst{10-0} = simm11;
110 }  
111   
112 // FIXME: class F4_5
113
114 class F4_6<bits<2> opVal, bits<6> op3Val, bits<3> rcondVal,
115            bits<5> opf_lowVal, string name> : F4_rs1rs2rd {
116   let op  = opVal;
117   let op3 = op3Val;
118   let Name = name;
119   let Inst{13} = 0;
120   let Inst{12-10} = rcondVal;
121   let Inst{9-5} = opf_lowVal;
122 }
123
124 class F4_7<bits<2> opVal, bits<6> op3Val, bits<4> condVal,
125            bits<6> opf_lowVal, string name> : F4_cond {
126   bits<3> cc;
127   bits<5> rs2;
128   bits<5> rd;
129
130   let op   = opVal;
131   let op3  = op3Val;
132   let cond = condVal;
133   let Name = name;
134   let Inst{29-25} = rd;
135   let Inst{18}    = 0;
136   let Inst{13-11} = cc;
137   let Inst{10-5}  = opf_lowVal;
138   let Inst{4-0}   = rs2;
139 }
140
141 // FIXME: F4 classes 8-9