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