First attempt at handling frame index elimination.
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9_F3.td
1 //===- SparcV9_F3.td - Format 3 Instructions: SparcV9 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 //===----------------------------------------------------------------------===//
11 // Format #3 classes
12 //
13
14 // F3 - Common superclass of all F3 instructions.  All instructions have an op3
15 // field.
16 class F3 : InstV9 {
17   bits<6> op3;
18   let op{1} = 1;   // Op = 2 or 3
19   let Inst{24-19} = op3;
20 }
21
22 // F3_rs1 - Common class of instructions that have an rs1 field
23 class F3_rs1 : F3 {
24   bits<5> rs1;
25   let Inst{18-14} = rs1;
26 }
27
28 // F3_rs1rs2 - Common class of instructions that only have rs1 and rs2 fields
29 class F3_rs1rs2 : F3_rs1 {
30   bits<5> rs2;
31   let Inst{4-0} = rs2;
32 }
33
34 // F3_rs1rs2 - Common class of instructions that only have rs1 and rs2 fields
35 class F3_rs1rs2rd : F3_rs1rs2 {
36   bits<5> rd;
37   let Inst{29-25} = rd;
38 }
39
40 // F3_rs1simm13 - Common class of instructions that only have rs1 and simm13
41 class F3_rs1simm13 : F3_rs1 {
42   bits<13> simm13;
43   let Inst{12-0} = simm13;
44 }
45
46 class F3_rs1simm13rd : F3_rs1simm13 {
47   bits<5> rd;
48   let Inst{29-25} = rd;
49 }
50
51 // F3_rs1rd - Common class of instructions that have an rs1 and rd fields
52 class F3_rs1rd : F3_rs1 {
53   bits<5> rd;
54   let Inst{29-25} = rd;
55 }
56
57 // F3_rs2 - Common class of instructions that don't use an rs1
58 class F3_rs2 : F3 {
59   bits<5> rs2;
60   let Inst{4-0} = rs2;
61 }
62
63 // F3_rs2rd - Common class of instructions that use rs2 and rd, but not rs1
64 class F3_rs2rd : F3_rs2 {
65   bits<5> rd;
66   let Inst{29-25} = rd;
67 }
68
69 // F3_rd - Common class of instructions that have an rd field
70 class F3_rd : F3 {
71   bits<5> rd;
72   let Inst{29-25} = rd;
73 }
74
75 // F3_rdrs1 - Common class of instructions that have rd and rs1 fields
76 class F3_rdrs1 : F3_rd {
77   bits<5> rs1;
78   let Inst{18-14} = rs1;
79 }
80
81 // F3_rdrs1simm13 - Common class of instructions that have rd, rs1, and simm13
82 class F3_rdrs1simm13 : F3_rdrs1 {
83   bits<13> simm13;
84   let Inst{12-0} = simm13;
85 }
86
87 // F3_rdrs1rs2 - Common class of instructions that have rd, rs1, and rs2 fields
88 class F3_rdrs1rs2 : F3_rdrs1 {
89   bits<5> rs2;
90   let Inst{4-0} = rs2;
91 }
92
93
94 // Specific F3 classes...
95 //
96
97 class F3_1<bits<2> opVal, bits<6> op3val, string name> : F3_rs1rs2rd {
98   let op  = opVal;
99   let op3 = op3val;
100   let Name = name;
101   let Inst{13} = 0;   // i field = 0
102   let Inst{12-5} = 0; // don't care
103 }
104
105 // The store instructions seem to like to see rd first, then rs1 and rs2
106 class F3_1rd<bits<2> opVal, bits<6> op3val, string name> : F3_rdrs1rs2 {
107   let op  = opVal;
108   let op3 = op3val;
109   let Name = name;
110   let Inst{13} = 0;   // i field = 0
111   let Inst{12-5} = 0; // don't care
112 }
113
114 class F3_2<bits<2> opVal, bits<6> op3val, string name> : F3_rs1simm13rd {
115   let op  = opVal;
116   let op3 = op3val;
117   let Name = name;
118   let Inst{13} = 1;   // i field = 1
119 }
120
121 // The store instructions seem to like to see rd first, then rs1 and imm
122 class F3_2rd<bits<2> opVal, bits<6> op3val, string name> : F3_rdrs1simm13 {
123   let op  = opVal;
124   let op3 = op3val;
125   let Name = name;
126   let Inst{13} = 1;   // i field = 1
127 }
128
129 class F3_3<bits<2> opVal, bits<6> op3val, string name> : F3_rs1rs2 {
130   let op   = opVal;
131   let op3  = op3val;
132   let Name = name;
133   let Inst{29-25} = 0; // don't care
134   let Inst{13} = 0;    // i field = 0
135   let Inst{12-5} = 0;  // don't care
136 }
137
138 class F3_4<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1simm13 {
139   let op   = opVal;
140   let op3  = op3Val;
141   let Name = name;
142   let Inst{29-25} = 0; // don't care
143   let Inst{13} = 1;    // i field = 1
144   let Inst{12-0} = simm13;
145 }
146
147 class F3_5<bits<2> opVal, bits<6> op3Val, bits<3> rcondVal,
148            string name> : F3_rs1rs2rd {
149   let op  = opVal;
150   let op3 = op3Val;
151   let Name = name;
152   let Inst{13} = 0;           // i field = 0
153   let Inst{12-10} = rcondVal; // rcond field
154   let Inst{9-5} = 0;          // don't care
155 }
156
157 class F3_6<bits<2> opVal, bits<6> op3Val, bits<3> rcondVal,
158            string name> : F3_rs1 {
159   bits<10> simm10;
160   bits<5>  rd;
161
162   let op  = opVal;
163   let op3 = op3Val;
164   let Name = name;
165   let Inst{29-25} = rd;
166   let Inst{13} = 1;           // i field = 1
167   let Inst{12-10} = rcondVal; // rcond field
168   let Inst{9-0} = simm10;
169 }
170
171 //FIXME: classes 7-10 not defined!!
172
173 class F3_11<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1rs2rd {
174   bit x;
175   let op = opVal;
176   let op3 = op3Val;
177   let Name = name;
178   let Inst{13} = 0; // i field = 0
179   let Inst{12} = x;
180   let Inst{11-5} = 0; // don't care
181 }
182
183 class F3_12<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1 {
184   bits<5> shcnt;
185   bits<5> rd;
186
187   let op  = opVal;
188   let op3 = op3Val;
189   let Name = name;
190   let Inst{29-25} = rd;
191   let Inst{13} = 1; // i field = 1
192   let Inst{12} = 0; // x field = 0
193   let Inst{11-5} = 0; // don't care
194   let Inst{4-0} = shcnt;
195 }
196
197 class F3_13<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1 {
198   bits<6> shcnt;
199   bits<5> rd;
200
201   let op  = opVal;
202   let op3 = op3Val;
203   let Name = name;
204   let Inst{29-25} = rd;
205   let Inst{13} = 1; // i field = 1
206   let Inst{12} = 1; // x field = 1
207   let Inst{11-6} = 0; // don't care
208   let Inst{5-0} = shcnt;
209 }
210
211 class F3_14<bits<2> opVal, bits<6> op3Val,
212             bits<9> opfVal, string name> : F3_rs2rd {
213   let op  = opVal;
214   let op3 = op3Val;
215   let Name = name;
216   let Inst{18-14} = 0; // don't care
217   let Inst{13-5} = opfVal;
218 }
219
220 class F3_15<bits<2> opVal, bits<6> op3Val,
221             bits<9> opfVal, string name> : F3 {
222   bits<2> cc;
223   bits<5> rs1;
224   bits<5> rs2;
225
226   let op  = opVal;
227   let op3 = op3Val;
228   let Name = name;
229   let Inst{29-27} = 0; // defined to be zero
230   let Inst{26-25} = cc;
231   let Inst{18-14} = rs1;
232   let Inst{13-5}  = opfVal;
233   let Inst{4-0}   = rs2;
234 }
235   
236 class F3_16<bits<2> opVal,  bits<6> op3Val,
237             bits<9> opfval, string name> : F3_rs1rs2rd {
238   let op  = opVal;
239   let op3 = op3Val;
240   let Name = name;
241   let Inst{13-5} = opfval;
242 }
243
244 class F3_17<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1rd {
245   let op = opVal;
246   let op3 = op3Val;
247   let Name = name;
248   let Inst{13-0} = 0; // don't care
249 }
250
251 class F3_18<bits<5> fcn, string name> : F3 {
252   let op = 2;
253   let op3 = 0b111110;
254   let Name = name;
255   let Inst{29-25} = fcn;
256   let Inst{18-0 } = 0; // don't care;
257 }
258
259 class F3_19<bits<2> opVal, bits<6> op3Val, string name> : F3_rd {
260   let op = opVal;
261   let op3 = op3Val;
262   let Name = name;
263   let Inst{18-0} = 0; // don't care
264 }
265
266 // FIXME: class F3_20
267 // FIXME: class F3_21