Combine the F2 and F3 instruction classes into one file for simplicity
[oota-llvm.git] / lib / Target / Sparc / SparcInstrFormats.td
1 //===- SparcV8InstrFormats.td - SparcV8 Instr Formats ------*- tablegen -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9
10 //===----------------------------------------------------------------------===//
11 // Format #2 instruction classes in the SparcV8
12 //===----------------------------------------------------------------------===//
13
14 class F2 : InstV8 {                   // Format 2 instructions
15   bits<3>  op2;
16   bits<22> imm22;
17   let op          = 0;    // op = 0
18   let Inst{24-22} = op2;
19   let Inst{21-0}  = imm22;
20 }
21
22 // Specific F2 classes: SparcV8 manual, page 44
23 //
24 class F2_1<bits<3> op2Val, string name> : F2 {
25   bits<5>  rd;
26   bits<22> imm;
27
28   let op2         = op2Val;
29   let Name        = name;
30
31   let Inst{29-25} = rd;
32 }
33
34 class F2_2<bits<4> condVal, bits<3> op2Val, string name> : F2 {
35   bits<4>   cond;
36   bit       annul = 0;     // currently unused
37
38   let cond        = condVal;
39   let op2         = op2Val;
40   let Name        = name;
41
42   let Inst{29}    = annul;
43   let Inst{28-25} = cond;
44 }
45
46 //===----------------------------------------------------------------------===//
47 // Format #3 instruction classes in the SparcV8
48 //===----------------------------------------------------------------------===//
49
50 class F3 : InstV8 {
51   bits<5> rd;
52   bits<6> op3;
53   bits<5> rs1;
54   let op{1} = 1;   // Op = 2 or 3
55   let Inst{29-25} = rd;
56   let Inst{24-19} = op3;
57   let Inst{18-14} = rs1;
58 }
59
60 // Specific F3 classes: SparcV8 manual, page 44
61 //
62 class F3_1<bits<2> opVal, bits<6> op3val, string name> : F3 {
63   bits<8> asi;
64   bits<5> rs2;
65
66   let op         = opVal;
67   let op3        = op3val;
68   let Name       = name;
69
70   let Inst{13}   = 0;     // i field = 0
71   let Inst{12-5} = asi;   // address space identifier
72   let Inst{4-0}  = rs2;
73 }
74
75 class F3_2<bits<2> opVal, bits<6> op3val, string name> : F3 {
76   bits<13> simm13;
77
78   let op         = opVal;
79   let op3        = op3val;
80   let Name       = name;
81
82   let Inst{13}   = 1;     // i field = 1
83   let Inst{12-0} = simm13;
84 }
85
86 // floating-point
87 class F3_3<bits<2> opVal, bits<6> op3val, bits<9> opfval, string name> : F3 {
88   bits<8> asi;
89   bits<5> rs2;
90
91   let op         = opVal;
92   let op3        = op3val;
93   let Name       = name;
94
95   let Inst{13-5} = opfval;   // fp opcode
96   let Inst{4-0}  = rs2;
97 }