Transition to using 'let X = y' instead of 'set X = y'.
[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   let 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   let Inst{18-14} = rs1;
18 }
19
20 // F4_rs1rs2 - Common class of instructions that have rs1 and rs2 fields
21 class F4_rs1rs2 : F4_rs1 {
22   bits<5> rs2;
23   let Inst{4-0} = rs2;
24 }
25
26 // F4_rs1rs2rd - Common class of instructions that have 3 register operands
27 class F4_rs1rs2rd : F4_rs1rs2 {
28   bits<5> rd;
29   let Inst{29-25} = rd;
30 }
31
32 // F4_rs1rs2rd - Common class of instructions that have 2 reg and 1 imm operand
33 class F4_rs1simm11rd : F4_rs1 {
34   bits<11> simm11;
35   bits<5>  rd;
36
37   let Inst{10-0}  = simm11;
38   let Inst{29-25} = rd;
39 }
40
41 // F4_cc - Common class of instructions that have a cond field
42 class F4_cond : F4 {
43   bits<4> cond;
44   let Inst{17-14} = cond;
45 }
46
47 // F4_cc - Common class of instructions that have cc register as first operand
48 class F4_condcc : F4_cond {
49   bits<3> cc;
50   let Inst{18} = cc{2};
51   let Inst{12} = cc{1};
52   let Inst{11} = cc{0};
53 }
54
55 // Actual F4 instruction classes
56 //
57 class F4_1<bits<2> opVal, bits<6> op3Val, string name> : F4_rs1rs2rd {
58   bits<2> cc;
59
60   let op = opVal;
61   let op3 = op3Val;
62   let Name = name;
63   let Inst{13} = 0; // i bit
64   let Inst{12-11} = cc;
65   let Inst{10-5} = 0; // don't care
66 }
67
68 class F4_2<bits<2> opVal, bits<6> op3Val, string name> : F4_rs1simm11rd {
69   bits<2> cc;
70
71   let op = opVal;
72   let op3 = op3Val;
73   let Name = name;
74   let Inst{13} = 1; // i bit
75   let Inst{12-11} = cc;
76 }
77
78 class F4_3<bits<2> opVal, bits<6> op3Val, bits<4> condVal,
79            string name> : F4_condcc {
80   bits<5> rs2;
81   bits<5> rd;
82
83   let op = opVal;
84   let op3 = op3Val;
85   let cond = condVal;
86   let Name = name;
87   let Inst{29-25} = rd;
88   let Inst{13} = 0; // i bit
89   let Inst{10-5} = 0; // don't care
90   let 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> simm11;
96   bits<5>  rd;
97
98   let op   = opVal;
99   let op3  = op3Val;
100   let cond = condVal;
101   let Name = name;
102   let Inst{29-25} = rd;
103   let Inst{13} = 1; // i bit
104   let Inst{10-0} = simm11;
105 }  
106   
107 // FIXME: class F4_5
108
109 class F4_6<bits<2> opVal, bits<6> op3Val, bits<3> rcondVal,
110            bits<5> opf_lowVal, string name> : F4_rs1rs2rd {
111   let op  = opVal;
112   let op3 = op3Val;
113   let Name = name;
114   let Inst{13} = 0;
115   let Inst{12-10} = rcondVal;
116   let Inst{9-5} = opf_lowVal;
117 }
118
119 class F4_7<bits<2> opVal, bits<6> op3Val, bits<4> condVal,
120            bits<6> opf_lowVal, string name> : F4_cond {
121   bits<3> cc;
122   bits<5> rs2;
123   bits<5> rd;
124
125   let op   = opVal;
126   let op3  = op3Val;
127   let cond = condVal;
128   let Name = name;
129   let Inst{29-25} = rd;
130   let Inst{18}    = 0;
131   let Inst{13-11} = cc;
132   let Inst{10-5}  = opf_lowVal;
133   let Inst{4-0}   = rs2;
134 }
135
136 // FIXME: F4 classes 8-9