* Removed unused classes: the rd field is always mentioned as the last reg.
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9_F3.td
1 //===- Sparc.td - Target Description for Sparc V9 Target --------*- C++ -*-===//
2 // vim:ft=cpp
3 //===----------------------------------------------------------------------===//
4
5 //===----------------------------------------------------------------------===//
6 // Format #3 classes
7 //
8
9 // F3 - Common superclass of all F3 instructions.  All instructions have an op3
10 // field.
11 class F3 : InstV9 {
12   bits<6> op3;
13   set op{1} = 1;   // Op = 2 or 3
14   set Inst{24-19} = op3;
15 }
16
17 // F3_rs1 - Common class of instructions that have an rs1 field
18 class F3_rs1 : F3 {
19   bits<5> rs1;
20   set Inst{18-14} = rs1;
21 }
22
23 // F3_rs1rs2 - Common class of instructions that only have rs1 and rs2 fields
24 class F3_rs1rs2 : F3_rs1 {
25   bits<5> rs2;
26   set Inst{4-0} = rs2;
27 }
28
29 // F3_rs1rs2 - Common class of instructions that only have rs1 and rs2 fields
30 class F3_rs1rs2rd : F3_rs1rs2 {
31   bits<5> rd;
32   set Inst{29-25} = rd;
33   set Inst{4-0} = rs2;
34 }
35
36 // F3_rs1simm13 - Common class of instructions that only have rs1 and simm13
37 class F3_rs1simm13 : F3_rs1 {
38   bits<13> simm13;
39   set Inst{12-0} = simm13;
40 }
41
42 class F3_rs1simm13rd : F3_rs1simm13 {
43   bits<5> rd;
44   set Inst{29-25} = rd;
45 }
46
47 // F3_rs1rd - Common class of instructions that have an rs1 and rd fields
48 class F3_rs1rd : F3_rs1 {
49   bits<5> rd;
50   set Inst{29-25} = rd;
51 }
52
53 // F3_rs2 - Common class of instructions that don't use an rs1
54 class F3_rs2 : F3 {
55   bits<5> rs2;
56   set Inst{4-0} = rs2;
57 }
58
59 // F3_rs2rd - Common class of instructions use rs2 and rd, but not rs1
60 class F3_rs2rd : F3_rs2 {
61   bits<5> rd;
62   set Inst{29-25} = rd;
63 }
64
65 // F3_rd - Common class of instructions that only have an rd field
66 class F3_rd : F3 {
67   bits<5> rd;
68   set Inst{29-25} = rd;
69 }
70
71
72 // Specific F3 classes...
73 //
74
75 class F3_1<bits<2> opVal, bits<6> op3val, string name> : F3_rs1rs2rd {
76   set op  = opVal;
77   set op3 = op3val;
78   set Name = name;
79   set Inst{13} = 0;   // i field = 0
80   //set Inst{12-5} = dontcare;
81 }
82
83 class F3_2<bits<2> opVal, bits<6> op3val, string name> : F3_rs1simm13rd {
84   set op  = opVal;
85   set op3 = op3val;
86   set Name = name;
87   set Inst{13} = 1;   // i field = 1
88 }
89
90 class F3_3<bits<2> opVal, bits<6> op3val, string name> : F3_rs1rs2 {
91   set op   = opVal;
92   set op3  = op3val;
93   set Name = name;
94   set Inst{13}  = 0;
95 }
96
97 class F3_4<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1simm13 {
98   bits<13> simm;
99   set op   = opVal;
100   set op3  = op3Val;
101   set Name = name;
102   //set Inst{29-25} = dontcare;
103   set Inst{13}  = 1;
104   set Inst{12-0} = simm;
105 }
106
107 class F3_5<bits<2> opVal, bits<6> op3Val, bits<3> rcondVal,
108            string name> : F3_rs1rs2rd {
109   set op  = opVal;
110   set op3 = op3Val;
111   set Name = name;
112   set Inst{13} = 0;           // i field = 0
113   set Inst{12-10} = rcondVal; // rcond field
114 }
115
116 class F3_6<bits<2> opVal, bits<6> op3Val, bits<3> rcondVal,
117            string name> : F3_rs1 {
118   bits<10> simm10;
119   bits<5>  rd;
120
121   set op  = opVal;
122   set op3 = op3Val;
123   set Name = name;
124   set Inst{13} = 1;           // i field = 1
125   set Inst{12-10} = rcondVal; // rcond field
126 }
127
128 //FIXME: classes 7-10 not defined!!
129
130 class F3_11<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1rs2rd {
131   bit x;
132   set op = opVal;
133   set op3 = op3Val;
134   set Name = name;
135   set Inst{13} = 0; // i field = 0
136   set Inst{12} = x;
137   //set Inst{11-5} = dontcare;
138 }
139
140 class F3_12<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1 {
141   bits<5> shcnt;
142   bits<5> rd;
143
144   set op  = opVal;
145   set op3 = op3Val;
146   set Name = name;
147   set Inst{29-25} = rd;
148   set Inst{13} = 1; // i field = 1
149   set Inst{12} = 0; // x field = 0
150   //set Inst{11-5} = dontcare;
151   set Inst{4-0} = shcnt;
152 }
153
154 class F3_13<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1 {
155   bits<6> shcnt;
156   bits<5> rd;
157
158   set op  = opVal;
159   set op3 = op3Val;
160   set Name = name;
161   set Inst{29-25} = rd;
162   set Inst{13} = 1; // i field = 1
163   set Inst{12} = 1; // x field = 1
164   //set Inst{11-6} = dontcare;
165   set Inst{5-0} = shcnt;
166 }
167
168 class F3_14<bits<2> opVal, bits<6> op3Val,
169             bits<9> opfval, string name> : F3_rs2rd {
170   set op  = opVal;
171   set op3 = op3Val;
172   set Name = name;
173   //set Inst{18-14} = dontcare;
174   set Inst{13-5} = opfval;
175 }
176   
177 class F3_16<bits<2> opVal,  bits<6> op3Val,
178             bits<9> opfval, string name> : F3_rs1rs2rd {
179   set op  = opVal;
180   set op3 = op3Val;
181   set Name = name;
182   set Inst{13-5} = opfval;
183 }
184
185 class F3_17<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1rd {
186   set op = opVal;
187   set op3 = op3Val;
188   set Name = name;
189   //Inst{13-0} = dontcare;
190 }
191
192 class F3_18<bits<5> fcn, string name> : F3 {
193   set op = 2;
194   set op3 = 0b111110;
195   set Name = name;
196   set Inst{29-25} = fcn;
197   //set Inst{18-0 } = dontcare;
198 }
199
200 class F3_19<bits<2> opVal, bits<6> op3Val, string name> : F3_rd {
201   set op = opVal;
202   set op3 = op3Val;
203   set Name = name;
204   //Inst{18-0} = dontcare;
205 }
206
207 // FIXME: class F3_20
208 // FIXME: class F3_21