Because the format of the shift instructions is `shift r, shcnt, r', the
[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 class F3_rd : F3 {
18   bits<5> rd;
19   set Inst{29-25} = rd;
20 }
21
22 class F3_rdsimm13 : F3_rd {
23   bits<13> simm13;
24   set Inst{12-0} = simm13;
25 }
26
27 class F3_rdsimm13rs1 : F3_rdsimm13 {
28   bits<5> rs1;
29   set Inst{18-14} = rs1;
30 }
31
32 // F3_rdrs1 - Common superclass of instructions that use rd & rs1
33 class F3_rdrs1 : F3_rd {
34   bits<5> rs1;
35   set Inst{18-14} = rs1;
36 }
37
38 // F3_rs1rdrs2 - Common superclass of instructions with rd, rs1, & rs2 fields
39 class F3_rdrs1rs2 : F3_rdrs1 {
40   bits<5> rs2;
41   set Inst{4-0} = rs2;
42 }
43
44 // F3_rs1 - Common class of instructions that do not have an rd field,
45 // but start at rs1
46 class F3_rs1 : F3 {
47   bits<5> rs1;
48   //set Inst{29-25} = dontcare;
49   set Inst{18-14} = rs1;
50 }
51
52 // F3_rs1rs2 - Common class of instructions that only have rs1 and rs2 fields
53 class F3_rs1rs2 : F3_rs1 {
54   bits<5> rs2;
55   //set Inst{12-5} = dontcare;
56   set Inst{4-0} = rs2;
57 }
58
59 // F3_rs1simm13 - Common class of instructions that only have rs1 and simm13
60 class F3_rs1simm13 : F3_rs1 {
61   bits<13> simm13;
62   set Inst{12-0} = simm13;
63 }
64
65
66 // Specific F3 classes...
67 //
68
69 class F3_1<bits<2> opVal, bits<6> op3val, string name> : F3_rdrs1rs2 {
70   set op  = opVal;
71   set op3 = op3val;
72   set Name = name;
73   set Inst{13} = 0;   // i field = 0
74   //set Inst{12-5} = dontcare;
75 }
76
77 class F3_2<bits<2> opVal, bits<6> op3val, string name> : F3_rdsimm13rs1 {
78   set op  = opVal;
79   set op3 = op3val;
80   set Name = name;
81   set Inst{13} = 1;   // i field = 1
82 }
83
84 class F3_3<bits<2> opVal, bits<6> op3val, string name> : F3_rs1rs2 {
85   set op   = opVal;
86   set op3  = op3val;
87   set Name = name;
88   set Inst{13}  = 0;
89 }
90
91 class F3_4<bits<2> opVal, bits<6> op3Val, string name> : F3_rs1simm13 {
92   bits<13> simm;
93   set op   = opVal;
94   set op3  = op3Val;
95   set Name = name;
96   //set Inst{29-25} = dontcare;
97   set Inst{13}  = 1;
98   set Inst{12-0} = simm;
99 }
100
101 class F3_11<bits<2> opVal, bits<6> op3Val, string name> : F3_rdrs1rs2 {
102   bit x;
103   set op = opVal;
104   set op3 = op3Val;
105   set Name = name;
106   set Inst{13} = 0; // i field = 0
107   set Inst{12} = x;
108   //set Inst{11-5} = dontcare;
109 }
110
111 class F3_12<bits<2> opVal, bits<6> op3Val, string name> : F3_rd {
112   bits<5> shcnt;
113   bits<5> rs1;
114
115   set op  = opVal;
116   set op3 = op3Val;
117   set Name = name;
118   set Inst{18-14} = rs1;
119   set Inst{13} = 1; // i field = 1
120   set Inst{12} = 0; // x field = 0
121   //set Inst{11-5} = dontcare;
122   set Inst{4-0} = shcnt;
123 }
124
125 class F3_13<bits<2> opVal, bits<6> op3Val, string name> : F3_rd {
126   bits<6> shcnt;
127   bits<5> rs1;
128
129   set op  = opVal;
130   set op3 = op3Val;
131   set Name = name;
132   set Inst{18-14} = rs1;
133   set Inst{13} = 1; // i field = 1
134   set Inst{12} = 1; // x field = 1
135   //set Inst{11-6} = dontcare;
136   set Inst{5-0} = shcnt;
137 }
138
139 class F3_14<bits<2> opVal, bits<6> op3Val,
140             bits<9> opfval, string name> : F3_rdrs1rs2 {
141   set op  = opVal;
142   set op3 = op3Val;
143   set Name = name;
144   //set Inst{18-14} = dontcare;
145   set Inst{13-5} = opfval;
146 }
147   
148 class F3_16<bits<2> opVal,  bits<6> op3Val,
149             bits<9> opfval, string name> : F3_rdrs1rs2 {
150   set op  = opVal;
151   set op3 = op3Val;
152   set Name = name;
153   set Inst{13-5} = opfval;
154 }
155
156 class F3_17<bits<2> opVal, bits<6> op3Val, string name> : F3_rdrs1 {
157   set op = opVal;
158   set op3 = op3Val;
159   set Name = name;
160   //Inst{13-0} = dontcare;
161 }
162
163 class F3_18<bits<5> fcn, string name> : F3 {
164   set op = 2;
165   set op3 = 0b111110;
166   set Name = name;
167   set Inst{29-25} = fcn;
168   //set Inst{18-0 } = dontcare;
169 }
170
171 class F3_19<bits<2> opVal, bits<6> op3Val, string name> : F3_rd {
172   set op = opVal;
173   set op3 = op3Val;
174   set Name = name;
175   //Inst{18-0} = dontcare;
176 }
177
178 // FIXME: class F3_20
179 // FIXME: class F3_21