1 //===-- AMDILTokenDesc.td - AMDIL Token Definitions --*- tablegen -*-----===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===--------------------------------------------------------------------===//
10 include "AMDILEnumeratedTypes.td"
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;
17 // Section 2.2.1 - IL Language Token
18 class ILLang<bits<8> client_type> : ILToken<0> {
19 let _bits{0-7} = client_type;
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;
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;
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;
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;
55 //let _bits{9-12} = shift_scale;
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;
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;
87 let _bits{21-23} = divComp.Value;
88 let _bits{24-31} = clamp;
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;
99 class ILLiteral<bits<32> val> : ILToken<0> {
103 // All tokens required for a destination register
104 class ILDstReg<ILDst Reg, ILDstMod Mod, ILRelAddr Rel, ILSrc Reg_Rel, ILSrcMod Reg_Rel_Mod> {
108 ILSrc reg_rel = Reg_Rel;
109 ILSrcMod reg_rel_mod = Reg_Rel_Mod;
112 // All tokens required for a source register
113 class ILSrcReg<ILSrc Reg, ILSrcMod Mod, ILRelAddr Rel, ILSrc Reg_Rel, ILSrcMod Reg_Rel_Mod> {
117 ILSrc reg_rel = Reg_Rel;
118 ILSrcMod reg_rel_mod = Reg_Rel_Mod;