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