A def. operand of a machine instruction may be an ordinary Value*,
[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
84   set op = opVal;
85   set op3 = op3Val;
86   set cond = condVal;
87   set Name = name;
88   set Inst{13} = 0; // i bit
89   //set Inst{10-5} = dontcare;
90   set Inst{4-0} = rs2;
91 }
92
93 class F4_4<bits<2> opVal, bits<6> op3Val, bits<4> condVal,
94            string name> : F4_condcc {
95   bits<11> sim11;
96   bits<5>  rd;
97
98   set op   = opVal;
99   set op3  = op3Val;
100   set cond = condVal;
101   set Name = name;
102   set Inst{13} = 1; // i bit
103   set Inst{10-0} = sim11;
104 }  
105   
106 // FIXME: class F4_5
107
108 class F4_6<bits<2> opVal, bits<6> op3Val, bits<3> rcondVal,
109            bits<5> opf_lowVal, string name> : F4_rs1rs2rd {
110   set op  = opVal;
111   set op3 = op3Val;
112   set Name = name;
113   set Inst{13} = 0;
114   set Inst{12-10} = rcondVal;
115   set Inst{9-5} = opf_lowVal;
116 }
117
118 class F4_7<bits<2> opVal, bits<6> op3Val, bits<4> condVal,
119            bits<6> opf_lowVal, string name> : F4_cond {
120   bits<3> cc;
121   bits<5> rs2;
122   bits<5> rd;
123
124   set op   = opVal;
125   set op3  = op3Val;
126   set cond = condVal;
127   set Name = name;
128   set Inst{29-25} = rd;
129   set Inst{18}    = 0;
130   set Inst{13-11} = cc;
131   set Inst{10-5}  = opf_lowVal;
132   set Inst{4-0}   = rs2;
133 }
134
135 // FIXME: F4 classes 8-9