5285d18ced4659b0a56dfe01877c5116c81f4989
[oota-llvm.git] / lib / Target / R600 / VIInstrFormats.td
1 //===-- VIInstrFormats.td - VI Instruction Encodings ----------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // VI Instruction format definitions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 class DSe_vi <bits<8> op> : Enc64 {
15
16   bits<8> vdst;
17   bits<1> gds;
18   bits<8> addr;
19   bits<8> data0;
20   bits<8> data1;
21   bits<8> offset0;
22   bits<8> offset1;
23
24   let Inst{7-0} = offset0;
25   let Inst{15-8} = offset1;
26   let Inst{16} = gds;
27   let Inst{24-17} = op;
28   let Inst{31-26} = 0x36; //encoding
29   let Inst{39-32} = addr;
30   let Inst{47-40} = data0;
31   let Inst{55-48} = data1;
32   let Inst{63-56} = vdst;
33 }
34
35 class MUBUFe_vi <bits<7> op> : Enc64 {
36
37   bits<12> offset;
38   bits<1> offen;
39   bits<1> idxen;
40   bits<1> glc;
41   bits<1> lds;
42   bits<8> vaddr;
43   bits<8> vdata;
44   bits<7> srsrc;
45   bits<1> slc;
46   bits<1> tfe;
47   bits<8> soffset;
48
49   let Inst{11-0} = offset;
50   let Inst{12} = offen;
51   let Inst{13} = idxen;
52   let Inst{14} = glc;
53   let Inst{16} = lds;
54   let Inst{17} = slc;
55   let Inst{24-18} = op;
56   let Inst{31-26} = 0x38; //encoding
57   let Inst{39-32} = vaddr;
58   let Inst{47-40} = vdata;
59   let Inst{52-48} = srsrc{6-2};
60   let Inst{55} = tfe;
61   let Inst{63-56} = soffset;
62 }
63
64 class MTBUFe_vi <bits<4> op> : Enc64 {
65
66   bits<12> offset;
67   bits<1>  offen;
68   bits<1>  idxen;
69   bits<1>  glc;
70   bits<4>  dfmt;
71   bits<3>  nfmt;
72   bits<8>  vaddr;
73   bits<8>  vdata;
74   bits<7>  srsrc;
75   bits<1>  slc;
76   bits<1>  tfe;
77   bits<8>  soffset;
78
79   let Inst{11-0}  = offset;
80   let Inst{12}    = offen;
81   let Inst{13}    = idxen;
82   let Inst{14}    = glc;
83   let Inst{18-15} = op;
84   let Inst{22-19} = dfmt;
85   let Inst{25-23} = nfmt;
86   let Inst{31-26} = 0x3a; //encoding
87   let Inst{39-32} = vaddr;
88   let Inst{47-40} = vdata;
89   let Inst{52-48} = srsrc{6-2};
90   let Inst{54}    = slc;
91   let Inst{55}    = tfe;
92   let Inst{63-56} = soffset;
93 }
94
95 class SMEMe_vi <bits<8> op, bit imm> : Enc64 {
96
97   bits<7>  sbase;
98   bits<7>  sdata;
99   bits<1>  glc;
100   bits<20> offset;
101
102   let Inst{5-0}   = sbase{6-1};
103   let Inst{12-6}  = sdata;
104   let Inst{16}    = glc;
105   let Inst{17}    = imm;
106   let Inst{25-18} = op;
107   let Inst{31-26} = 0x30; //encoding
108   let Inst{51-32} = offset;
109 }
110
111 class VOP3e_vi <bits<10> op> : Enc64 {
112
113   bits<8> dst;
114   bits<2> src0_modifiers;
115   bits<9> src0;
116   bits<2> src1_modifiers;
117   bits<9> src1;
118   bits<2> src2_modifiers;
119   bits<9> src2;
120   bits<1> clamp;
121   bits<2> omod;
122
123   let Inst{7-0}   = dst;
124   let Inst{8}     = src0_modifiers{1};
125   let Inst{9}     = src1_modifiers{1};
126   let Inst{10}    = src2_modifiers{1};
127   let Inst{15}    = clamp;
128   let Inst{25-16} = op;
129   let Inst{31-26} = 0x34; //encoding
130   let Inst{40-32} = src0;
131   let Inst{49-41} = src1;
132   let Inst{58-50} = src2;
133   let Inst{60-59} = omod;
134   let Inst{61} = src0_modifiers{0};
135   let Inst{62} = src1_modifiers{0};
136   let Inst{63} = src2_modifiers{0};
137 }
138
139 class EXPe_vi : EXPe {
140   let Inst{31-26} = 0x31; //encoding
141 }
142
143 class VINTRPe_vi <bits<2> op> : VINTRPe <op> {
144   let Inst{31-26} = 0x35; // encoding
145 }