2 class SIReg <string n, bits<16> encoding = 0> : Register<n> {
3 let Namespace = "AMDGPU";
4 let HWEncoding = encoding;
7 class SI_64 <string n, list<Register> subregs, bits<16> encoding> : RegisterWithSubRegs<n, subregs> {
8 let Namespace = "AMDGPU";
9 let SubRegIndices = [sub0, sub1];
10 let HWEncoding = encoding;
13 class SGPR_32 <bits<16> num, string name> : SIReg<name, num>;
15 class VGPR_32 <bits<16> num, string name> : SIReg<name, num> {
16 let HWEncoding{8} = 1;
20 def VCC : SIReg<"VCC", 106>;
21 def EXEC_LO : SIReg <"EXEC LO", 126>;
22 def EXEC_HI : SIReg <"EXEC HI", 127>;
23 def EXEC : SI_64<"EXEC", [EXEC_LO, EXEC_HI], 126>;
24 def SCC : SIReg<"SCC", 253>;
25 def M0 : SIReg <"M0", 124>;
27 //Interpolation registers
28 def PERSP_SAMPLE_I : SIReg <"PERSP_SAMPLE_I">;
29 def PERSP_SAMPLE_J : SIReg <"PERSP_SAMPLE_J">;
30 def PERSP_CENTER_I : SIReg <"PERSP_CENTER_I">;
31 def PERSP_CENTER_J : SIReg <"PERSP_CENTER_J">;
32 def PERSP_CENTROID_I : SIReg <"PERSP_CENTROID_I">;
33 def PERSP_CENTROID_J : SIReg <"PERP_CENTROID_J">;
34 def PERSP_I_W : SIReg <"PERSP_I_W">;
35 def PERSP_J_W : SIReg <"PERSP_J_W">;
36 def PERSP_1_W : SIReg <"PERSP_1_W">;
37 def LINEAR_SAMPLE_I : SIReg <"LINEAR_SAMPLE_I">;
38 def LINEAR_SAMPLE_J : SIReg <"LINEAR_SAMPLE_J">;
39 def LINEAR_CENTER_I : SIReg <"LINEAR_CENTER_I">;
40 def LINEAR_CENTER_J : SIReg <"LINEAR_CENTER_J">;
41 def LINEAR_CENTROID_I : SIReg <"LINEAR_CENTROID_I">;
42 def LINEAR_CENTROID_J : SIReg <"LINEAR_CENTROID_J">;
43 def LINE_STIPPLE_TEX_COORD : SIReg <"LINE_STIPPLE_TEX_COORD">;
44 def POS_X_FLOAT : SIReg <"POS_X_FLOAT">;
45 def POS_Y_FLOAT : SIReg <"POS_Y_FLOAT">;
46 def POS_Z_FLOAT : SIReg <"POS_Z_FLOAT">;
47 def POS_W_FLOAT : SIReg <"POS_W_FLOAT">;
48 def FRONT_FACE : SIReg <"FRONT_FACE">;
49 def ANCILLARY : SIReg <"ANCILLARY">;
50 def SAMPLE_COVERAGE : SIReg <"SAMPLE_COVERAGE">;
51 def POS_FIXED_PT : SIReg <"POS_FIXED_PT">;
53 // SGPR 32-bit registers
54 foreach Index = 0-101 in {
55 def SGPR#Index : SGPR_32 <Index, "SGPR"#Index>;
58 def SGPR_32 : RegisterClass<"AMDGPU", [f32, i32], 32,
59 (add (sequence "SGPR%u", 0, 101))>;
61 // SGPR 64-bit registers
62 def SGPR_64 : RegisterTuples<[sub0, sub1],
63 [(add (decimate SGPR_32, 2)),
64 (add(decimate (rotl SGPR_32, 1), 2))]>;
66 // SGPR 128-bit registers
67 def SGPR_128 : RegisterTuples<[sub0, sub1, sub2, sub3],
68 [(add (decimate SGPR_32, 4)),
69 (add (decimate (rotl SGPR_32, 1), 4)),
70 (add (decimate (rotl SGPR_32, 2), 4)),
71 (add (decimate (rotl SGPR_32, 3), 4))]>;
73 // SGPR 256-bit registers
74 def SGPR_256 : RegisterTuples<[sub0, sub1, sub2, sub3, sub4, sub5, sub6, sub7],
75 [(add (decimate SGPR_32, 8)),
76 (add (decimate (rotl SGPR_32, 1), 8)),
77 (add (decimate (rotl SGPR_32, 2), 8)),
78 (add (decimate (rotl SGPR_32, 3), 8)),
79 (add (decimate (rotl SGPR_32, 4), 8)),
80 (add (decimate (rotl SGPR_32, 5), 8)),
81 (add (decimate (rotl SGPR_32, 6), 8)),
82 (add (decimate (rotl SGPR_32, 7), 8))]>;
84 // VGPR 32-bit registers
85 foreach Index = 0-255 in {
86 def VGPR#Index : VGPR_32 <Index, "VGPR"#Index>;
89 def VGPR_32 : RegisterClass<"AMDGPU", [f32, i32], 32,
90 (add (sequence "VGPR%u", 0, 255))>;
92 // VGPR 64-bit registers
93 def VGPR_64 : RegisterTuples<[sub0, sub1],
95 (add (rotl VGPR_32, 1))]>;
97 // VGPR 128-bit registers
98 def VGPR_128 : RegisterTuples<[sub0, sub1, sub2, sub3],
100 (add (rotl VGPR_32, 1)),
101 (add (rotl VGPR_32, 2)),
102 (add (rotl VGPR_32, 3))]>;
104 // VGPR 256-bit registers
105 def VGPR_256 : RegisterTuples<[sub0, sub1, sub2, sub3, sub4, sub5, sub6, sub7],
107 (add (rotl VGPR_32, 1)),
108 (add (rotl VGPR_32, 2)),
109 (add (rotl VGPR_32, 3)),
110 (add (rotl VGPR_32, 4)),
111 (add (rotl VGPR_32, 5)),
112 (add (rotl VGPR_32, 6)),
113 (add (rotl VGPR_32, 7))]>;
115 // VGPR 512-bit registers
116 def VGPR_512 : RegisterTuples<[sub0, sub1, sub2, sub3, sub4, sub5, sub6, sub7,
117 sub8, sub9, sub10, sub11, sub12, sub13, sub14, sub15],
119 (add (rotl VGPR_32, 1)),
120 (add (rotl VGPR_32, 2)),
121 (add (rotl VGPR_32, 3)),
122 (add (rotl VGPR_32, 4)),
123 (add (rotl VGPR_32, 5)),
124 (add (rotl VGPR_32, 6)),
125 (add (rotl VGPR_32, 7)),
126 (add (rotl VGPR_32, 8)),
127 (add (rotl VGPR_32, 9)),
128 (add (rotl VGPR_32, 10)),
129 (add (rotl VGPR_32, 11)),
130 (add (rotl VGPR_32, 12)),
131 (add (rotl VGPR_32, 13)),
132 (add (rotl VGPR_32, 14)),
133 (add (rotl VGPR_32, 15))]>;
135 // Register class for all scalar registers (SGPRs + Special Registers)
136 def SReg_32 : RegisterClass<"AMDGPU", [f32, i32], 32,
137 (add SGPR_32, M0, EXEC_LO, EXEC_HI)
140 def SReg_64 : RegisterClass<"AMDGPU", [i1, i64], 64, (add SGPR_64, VCC, EXEC)>;
142 def SReg_128 : RegisterClass<"AMDGPU", [v4f32, v4i32], 128, (add SGPR_128)>;
144 def SReg_256 : RegisterClass<"AMDGPU", [v8i32], 256, (add SGPR_256)>;
146 // Register class for all vector registers (VGPRs + Interploation Registers)
147 def VReg_32 : RegisterClass<"AMDGPU", [f32, i32, v1i32], 32,
149 PERSP_SAMPLE_I, PERSP_SAMPLE_J,
150 PERSP_CENTER_I, PERSP_CENTER_J,
151 PERSP_CENTROID_I, PERSP_CENTROID_J,
152 PERSP_I_W, PERSP_J_W, PERSP_1_W,
153 LINEAR_SAMPLE_I, LINEAR_SAMPLE_J,
154 LINEAR_CENTER_I, LINEAR_CENTER_J,
155 LINEAR_CENTROID_I, LINEAR_CENTROID_J,
156 LINE_STIPPLE_TEX_COORD,
168 def VReg_64 : RegisterClass<"AMDGPU", [i64, v2i32], 64, (add VGPR_64)>;
170 def VReg_128 : RegisterClass<"AMDGPU", [v4f32, v4i32], 128, (add VGPR_128)>;
172 def VReg_256 : RegisterClass<"AMDGPU", [v8i32], 256, (add VGPR_256)>;
174 def VReg_512 : RegisterClass<"AMDGPU", [v16i32], 512, (add VGPR_512)>;
176 // [SV]Src_* operands can have either an immediate or an register
177 def SSrc_32 : RegisterClass<"AMDGPU", [i32, f32], 32, (add SReg_32)>;
179 def SSrc_64 : RegisterClass<"AMDGPU", [i1, i64], 64, (add SReg_64)>;
181 def VSrc_32 : RegisterClass<"AMDGPU", [i32, f32], 32, (add VReg_32, SReg_32)>;
183 def VSrc_64 : RegisterClass<"AMDGPU", [i64], 64, (add SReg_64, VReg_64)>;
185 // Special register classes for predicates and the M0 register
186 def SCCReg : RegisterClass<"AMDGPU", [i1], 1, (add SCC)>;
187 def VCCReg : RegisterClass<"AMDGPU", [i1], 1, (add VCC)>;
188 def EXECReg : RegisterClass<"AMDGPU", [i1], 1, (add EXEC)>;
189 def M0Reg : RegisterClass<"AMDGPU", [i32], 32, (add M0)>;