radeon/llvm: Add some comments
[mesa.git] / src / gallium / drivers / radeon / AMDILTokenDesc.td
1 //===-- AMDILTokenDesc.td - AMDIL Token Definitions --*- tablegen -*-----===//
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 include "AMDILEnumeratedTypes.td"
11
12 // Each token is 32 bits as specified in section 2.1 of the IL spec
13 class ILToken <bits<32> n> {
14 field bits<32> _bits = n;
15 }
16
17 // Section 2.2.1 - IL Language Token
18 class ILLang<bits<8> client_type> : ILToken<0> {
19 let _bits{0-7} = client_type;
20 }
21
22 // Section 2.2.2 - IL Version Token
23 class ILVersion<bits<8> minor_version, bits<8> major_version, ILShader shader_type> : ILToken<0> {
24 let _bits{0-7} = minor_version;
25 let _bits{8-15} = major_version;
26 let _bits{16-23} = shader_type.Value;
27 }
28
29 // Section 2.2.3 - IL Opcode Token
30 class ILOpcode<ILOpCode opcode, bits<14> control, bit sec_mod_pre, bit pri_mod_pre> : ILToken<0> {
31 let _bits{0-15} = opcode.Value;
32 let _bits{16-29} = control;
33 let _bits{30} = sec_mod_pre;
34 let _bits{31} = pri_mod_pre;
35 }
36
37 // Section 2.2.4 - IL Destination Token
38 class ILDst<AMDILReg register_num, ILRegType register_type, bit mod_pre, bits<2> relative_address, bit dimension, bit immediate_pre, bit extended> : ILToken<0> {
39 let _bits{0-15} = register_num.Value;
40 let _bits{16-21} = register_type.Value;
41 let _bits{22} = mod_pre;
42 let _bits{23-24} = relative_address;
43 let _bits{25} = dimension;
44 let _bits{26} = immediate_pre;
45 let _bits{31} = extended;
46 }
47
48 // Section 2.2.5 - IL Destination Modifier Token
49 class ILDstMod<ILModDstComp x, ILModDstComp y, ILModDstComp z, ILModDstComp w, bit clamp, ILShiftScale shift_scale> : ILToken<0> {
50 let _bits{0-1} = x.Value;
51 let _bits{2-3} = y.Value;
52 let _bits{4-5} = z.Value;
53 let _bits{6-7} = w.Value;
54 let _bits{8} = clamp;
55 //let _bits{9-12} = shift_scale;
56 }
57
58 // Section 2.2.6 - IL Source Token
59 class ILSrc<AMDILReg register_num, ILRegType register_type, bit mod_pre, bits<2> relative_address, bit dimension, bit immediate_pre, bit extended> : ILToken<0> {
60 let _bits{0-15} = register_num.Value;
61 let _bits{16-21} = register_type.Value;
62 let _bits{22} = mod_pre;
63 let _bits{23-24} = relative_address;
64 let _bits{25} = dimension;
65 let _bits{26} = immediate_pre;
66 let _bits{31} = extended;
67 }
68
69 // Section 2.2.7 - IL Source Modifier Token
70 class ILSrcMod<ILComponentSelect swizzle_x, bit negate_x, ILComponentSelect swizzle_y, bit negate_y,
71 ILComponentSelect swizzle_z, bit negate_z, ILComponentSelect swizzle_w, bit negate_w,
72 bit invert, bit bias, bit x2, bit sign, bit abs, ILDivComp divComp,
73 bits<8> clamp> : ILToken<0> {
74 let _bits{0-2} = swizzle_x.Value;
75 let _bits{3} = negate_x;
76 let _bits{4-6} = swizzle_y.Value;
77 let _bits{7} = negate_y;
78 let _bits{8-10} = swizzle_z.Value;
79 let _bits{11} = negate_z;
80 let _bits{12-14} = swizzle_w.Value;
81 let _bits{15} = negate_w;
82 let _bits{16} = invert;
83 let _bits{17} = bias;
84 let _bits{18} = x2;
85 let _bits{19} = sign;
86 let _bits{20} = abs;
87 let _bits{21-23} = divComp.Value;
88 let _bits{24-31} = clamp;
89 }
90
91 // Section 2.2.8 - IL Relative Address Token
92 class ILRelAddr<AMDILReg address_register, bit loop_relative, ILAddressing component> : ILToken<0> {
93 let _bits{0-15} = address_register.Value;
94 let _bits{16} = loop_relative;
95 let _bits{17-19} = component.Value;
96 }
97
98 // IL Literal Token
99 class ILLiteral<bits<32> val> : ILToken<0> {
100 let _bits = val;
101 }
102
103 // All tokens required for a destination register
104 class ILDstReg<ILDst Reg, ILDstMod Mod, ILRelAddr Rel, ILSrc Reg_Rel, ILSrcMod Reg_Rel_Mod> {
105 ILDst reg = Reg;
106 ILDstMod mod = Mod;
107 ILRelAddr rel = Rel;
108 ILSrc reg_rel = Reg_Rel;
109 ILSrcMod reg_rel_mod = Reg_Rel_Mod;
110 }
111
112 // All tokens required for a source register
113 class ILSrcReg<ILSrc Reg, ILSrcMod Mod, ILRelAddr Rel, ILSrc Reg_Rel, ILSrcMod Reg_Rel_Mod> {
114 ILSrc reg = Reg;
115 ILSrcMod mod = Mod;
116 ILRelAddr rel = Rel;
117 ILSrc reg_rel = Reg_Rel;
118 ILSrcMod reg_rel_mod = Reg_Rel_Mod;
119 }
120