1 //===-- SIRegisterInfo.td - SI Register defs ---------------*- 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 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
14 class getSubRegs<int size> {
15 list<SubRegIndex> ret2 = [sub0, sub1];
16 list<SubRegIndex> ret3 = [sub0, sub1, sub2];
17 list<SubRegIndex> ret4 = [sub0, sub1, sub2, sub3];
18 list<SubRegIndex> ret8 = [sub0, sub1, sub2, sub3, sub4, sub5, sub6, sub7];
19 list<SubRegIndex> ret16 = [sub0, sub1, sub2, sub3,
20 sub4, sub5, sub6, sub7,
21 sub8, sub9, sub10, sub11,
22 sub12, sub13, sub14, sub15];
24 list<SubRegIndex> ret = !if(!eq(size, 2), ret2,
25 !if(!eq(size, 3), ret3,
26 !if(!eq(size, 4), ret4,
27 !if(!eq(size, 8), ret8, ret16))));
30 //===----------------------------------------------------------------------===//
31 // Declarations that describe the SI registers
32 //===----------------------------------------------------------------------===//
33 class SIReg <string n, bits<16> regIdx = 0> : Register<n>,
34 DwarfRegNum<[!cast<int>(HWEncoding)]> {
35 let Namespace = "AMDGPU";
37 // This is the not yet the complete register encoding. An additional
38 // bit is set for VGPRs.
39 let HWEncoding = regIdx;
43 def VCC_LO : SIReg<"vcc_lo", 106>;
44 def VCC_HI : SIReg<"vcc_hi", 107>;
46 // Pseudo-registers: Used as placeholders during isel and immediately
47 // replaced, never seeing the verifier.
48 def PRIVATE_RSRC_REG : SIReg<"", 0>;
49 def FP_REG : SIReg<"", 0>;
50 def SP_REG : SIReg<"", 0>;
51 def SCRATCH_WAVE_OFFSET_REG : SIReg<"", 0>;
53 // VCC for 64-bit instructions
54 def VCC : RegisterWithSubRegs<"vcc", [VCC_LO, VCC_HI]>,
55 DwarfRegAlias<VCC_LO> {
56 let Namespace = "AMDGPU";
57 let SubRegIndices = [sub0, sub1];
61 def EXEC_LO : SIReg<"exec_lo", 126>;
62 def EXEC_HI : SIReg<"exec_hi", 127>;
64 def EXEC : RegisterWithSubRegs<"EXEC", [EXEC_LO, EXEC_HI]>,
65 DwarfRegAlias<EXEC_LO> {
66 let Namespace = "AMDGPU";
67 let SubRegIndices = [sub0, sub1];
71 def SCC : SIReg<"scc", 253>;
72 def M0 : SIReg <"m0", 124>;
74 def SRC_SHARED_BASE : SIReg<"src_shared_base", 235>;
75 def SRC_SHARED_LIMIT : SIReg<"src_shared_limit", 236>;
76 def SRC_PRIVATE_BASE : SIReg<"src_private_base", 237>;
77 def SRC_PRIVATE_LIMIT : SIReg<"src_private_limit", 238>;
79 // Trap handler registers
80 def TBA_LO : SIReg<"tba_lo", 108>;
81 def TBA_HI : SIReg<"tba_hi", 109>;
83 def TBA : RegisterWithSubRegs<"tba", [TBA_LO, TBA_HI]>,
84 DwarfRegAlias<TBA_LO> {
85 let Namespace = "AMDGPU";
86 let SubRegIndices = [sub0, sub1];
90 def TMA_LO : SIReg<"tma_lo", 110>;
91 def TMA_HI : SIReg<"tma_hi", 111>;
93 def TMA : RegisterWithSubRegs<"tma", [TMA_LO, TMA_HI]>,
94 DwarfRegAlias<TMA_LO> {
95 let Namespace = "AMDGPU";
96 let SubRegIndices = [sub0, sub1];
100 foreach Index = 0-15 in {
101 def TTMP#Index#_vi : SIReg<"ttmp"#Index, !add(112, Index)>;
102 def TTMP#Index#_gfx9 : SIReg<"ttmp"#Index, !add(108, Index)>;
103 def TTMP#Index : SIReg<"", 0>;
106 multiclass FLAT_SCR_LOHI_m <string n, bits<16> ci_e, bits<16> vi_e> {
107 def _ci : SIReg<n, ci_e>;
108 def _vi : SIReg<n, vi_e>;
109 def "" : SIReg<"", 0>;
112 class FlatReg <Register lo, Register hi, bits<16> encoding> :
113 RegisterWithSubRegs<"flat_scratch", [lo, hi]>,
115 let Namespace = "AMDGPU";
116 let SubRegIndices = [sub0, sub1];
117 let HWEncoding = encoding;
120 defm FLAT_SCR_LO : FLAT_SCR_LOHI_m<"flat_scratch_lo", 104, 102>; // Offset in units of 256-bytes.
121 defm FLAT_SCR_HI : FLAT_SCR_LOHI_m<"flat_scratch_hi", 105, 103>; // Size is the per-thread scratch size, in bytes.
123 def FLAT_SCR_ci : FlatReg<FLAT_SCR_LO_ci, FLAT_SCR_HI_ci, 104>;
124 def FLAT_SCR_vi : FlatReg<FLAT_SCR_LO_vi, FLAT_SCR_HI_vi, 102>;
125 def FLAT_SCR : FlatReg<FLAT_SCR_LO, FLAT_SCR_HI, 0>;
128 foreach Index = 0-103 in {
129 def SGPR#Index : SIReg <"SGPR"#Index, Index>;
133 foreach Index = 0-255 in {
134 def VGPR#Index : SIReg <"VGPR"#Index, Index> {
135 let HWEncoding{8} = 1;
139 //===----------------------------------------------------------------------===//
140 // Groupings using register classes and tuples
141 //===----------------------------------------------------------------------===//
143 def SCC_CLASS : RegisterClass<"AMDGPU", [i1], 1, (add SCC)> {
145 let isAllocatable = 0;
148 def M0_CLASS : RegisterClass<"AMDGPU", [i32], 32, (add M0)> {
150 let isAllocatable = 0;
153 // TODO: Do we need to set DwarfRegAlias on register tuples?
155 // SGPR 32-bit registers
156 def SGPR_32 : RegisterClass<"AMDGPU", [i32, f32, i16, f16, v2i16, v2f16], 32,
157 (add (sequence "SGPR%u", 0, 103))> {
158 // Give all SGPR classes higher priority than VGPR classes, because
159 // we want to spill SGPRs to VGPRs.
160 let AllocationPriority = 7;
163 // SGPR 64-bit registers
164 def SGPR_64Regs : RegisterTuples<getSubRegs<2>.ret,
165 [(add (decimate SGPR_32, 2)),
166 (add (decimate (shl SGPR_32, 1), 2))]>;
168 // SGPR 128-bit registers
169 def SGPR_128Regs : RegisterTuples<getSubRegs<4>.ret,
170 [(add (decimate SGPR_32, 4)),
171 (add (decimate (shl SGPR_32, 1), 4)),
172 (add (decimate (shl SGPR_32, 2), 4)),
173 (add (decimate (shl SGPR_32, 3), 4))]>;
175 // SGPR 256-bit registers
176 def SGPR_256Regs : RegisterTuples<getSubRegs<8>.ret,
177 [(add (decimate SGPR_32, 4)),
178 (add (decimate (shl SGPR_32, 1), 4)),
179 (add (decimate (shl SGPR_32, 2), 4)),
180 (add (decimate (shl SGPR_32, 3), 4)),
181 (add (decimate (shl SGPR_32, 4), 4)),
182 (add (decimate (shl SGPR_32, 5), 4)),
183 (add (decimate (shl SGPR_32, 6), 4)),
184 (add (decimate (shl SGPR_32, 7), 4))]>;
186 // SGPR 512-bit registers
187 def SGPR_512Regs : RegisterTuples<getSubRegs<16>.ret,
188 [(add (decimate SGPR_32, 4)),
189 (add (decimate (shl SGPR_32, 1), 4)),
190 (add (decimate (shl SGPR_32, 2), 4)),
191 (add (decimate (shl SGPR_32, 3), 4)),
192 (add (decimate (shl SGPR_32, 4), 4)),
193 (add (decimate (shl SGPR_32, 5), 4)),
194 (add (decimate (shl SGPR_32, 6), 4)),
195 (add (decimate (shl SGPR_32, 7), 4)),
196 (add (decimate (shl SGPR_32, 8), 4)),
197 (add (decimate (shl SGPR_32, 9), 4)),
198 (add (decimate (shl SGPR_32, 10), 4)),
199 (add (decimate (shl SGPR_32, 11), 4)),
200 (add (decimate (shl SGPR_32, 12), 4)),
201 (add (decimate (shl SGPR_32, 13), 4)),
202 (add (decimate (shl SGPR_32, 14), 4)),
203 (add (decimate (shl SGPR_32, 15), 4))]>;
205 // Trap handler TMP 32-bit registers
206 def TTMP_32 : RegisterClass<"AMDGPU", [i32, f32, v2i16, v2f16], 32,
207 (add (sequence "TTMP%u", 0, 15))> {
208 let isAllocatable = 0;
211 // Trap handler TMP 64-bit registers
212 def TTMP_64Regs : RegisterTuples<getSubRegs<2>.ret,
213 [(add (decimate TTMP_32, 2)),
214 (add (decimate (shl TTMP_32, 1), 2))]>;
216 // Trap handler TMP 128-bit registers
217 def TTMP_128Regs : RegisterTuples<getSubRegs<4>.ret,
218 [(add (decimate TTMP_32, 4)),
219 (add (decimate (shl TTMP_32, 1), 4)),
220 (add (decimate (shl TTMP_32, 2), 4)),
221 (add (decimate (shl TTMP_32, 3), 4))]>;
223 def TTMP_256Regs : RegisterTuples<getSubRegs<8>.ret,
224 [(add (decimate TTMP_32, 4)),
225 (add (decimate (shl TTMP_32, 1), 4)),
226 (add (decimate (shl TTMP_32, 2), 4)),
227 (add (decimate (shl TTMP_32, 3), 4)),
228 (add (decimate (shl TTMP_32, 4), 4)),
229 (add (decimate (shl TTMP_32, 5), 4)),
230 (add (decimate (shl TTMP_32, 6), 4)),
231 (add (decimate (shl TTMP_32, 7), 4))]>;
233 def TTMP_512Regs : RegisterTuples<getSubRegs<16>.ret,
234 [(add (decimate TTMP_32, 4)),
235 (add (decimate (shl TTMP_32, 1), 4)),
236 (add (decimate (shl TTMP_32, 2), 4)),
237 (add (decimate (shl TTMP_32, 3), 4)),
238 (add (decimate (shl TTMP_32, 4), 4)),
239 (add (decimate (shl TTMP_32, 5), 4)),
240 (add (decimate (shl TTMP_32, 6), 4)),
241 (add (decimate (shl TTMP_32, 7), 4)),
242 (add (decimate (shl TTMP_32, 8), 4)),
243 (add (decimate (shl TTMP_32, 9), 4)),
244 (add (decimate (shl TTMP_32, 10), 4)),
245 (add (decimate (shl TTMP_32, 11), 4)),
246 (add (decimate (shl TTMP_32, 12), 4)),
247 (add (decimate (shl TTMP_32, 13), 4)),
248 (add (decimate (shl TTMP_32, 14), 4)),
249 (add (decimate (shl TTMP_32, 15), 4))]>;
251 class TmpRegTuplesBase<int index, int size,
252 list<Register> subRegs,
253 list<SubRegIndex> indices = getSubRegs<size>.ret,
254 int index1 = !add(index, !add(size, -1)),
255 string name = "ttmp["#index#":"#index1#"]"> :
256 RegisterWithSubRegs<name, subRegs> {
257 let HWEncoding = subRegs[0].HWEncoding;
258 let SubRegIndices = indices;
261 class TmpRegTuples<string tgt,
264 int index1 = !add(index0, 1),
265 int index2 = !add(index0, !if(!eq(size, 2), 1, 2)),
266 int index3 = !add(index0, !if(!eq(size, 2), 1, 3)),
267 int index4 = !add(index0, !if(!eq(size, 8), 4, 1)),
268 int index5 = !add(index0, !if(!eq(size, 8), 5, 1)),
269 int index6 = !add(index0, !if(!eq(size, 8), 6, 1)),
270 int index7 = !add(index0, !if(!eq(size, 8), 7, 1)),
271 Register r0 = !cast<Register>("TTMP"#index0#tgt),
272 Register r1 = !cast<Register>("TTMP"#index1#tgt),
273 Register r2 = !cast<Register>("TTMP"#index2#tgt),
274 Register r3 = !cast<Register>("TTMP"#index3#tgt),
275 Register r4 = !cast<Register>("TTMP"#index4#tgt),
276 Register r5 = !cast<Register>("TTMP"#index5#tgt),
277 Register r6 = !cast<Register>("TTMP"#index6#tgt),
278 Register r7 = !cast<Register>("TTMP"#index7#tgt)> :
279 TmpRegTuplesBase<index0, size,
280 !if(!eq(size, 2), [r0, r1],
281 !if(!eq(size, 4), [r0, r1, r2, r3],
282 [r0, r1, r2, r3, r4, r5, r6, r7])),
283 getSubRegs<size>.ret>;
285 foreach Index = {0, 2, 4, 6, 8, 10, 12, 14} in {
286 def TTMP#Index#_TTMP#!add(Index,1)#_vi : TmpRegTuples<"_vi", 2, Index>;
287 def TTMP#Index#_TTMP#!add(Index,1)#_gfx9 : TmpRegTuples<"_gfx9", 2, Index>;
290 foreach Index = {0, 4, 8, 12} in {
291 def TTMP#Index#_TTMP#!add(Index,1)#
293 _TTMP#!add(Index,3)#_vi : TmpRegTuples<"_vi", 4, Index>;
294 def TTMP#Index#_TTMP#!add(Index,1)#
296 _TTMP#!add(Index,3)#_gfx9 : TmpRegTuples<"_gfx9", 4, Index>;
299 foreach Index = {0, 4, 8} in {
300 def TTMP#Index#_TTMP#!add(Index,1)#
306 _TTMP#!add(Index,7)#_vi : TmpRegTuples<"_vi", 8, Index>;
307 def TTMP#Index#_TTMP#!add(Index,1)#
313 _TTMP#!add(Index,7)#_gfx9 : TmpRegTuples<"_gfx9", 8, Index>;
316 def TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15_vi :
317 TmpRegTuplesBase<0, 16,
318 [TTMP0_vi, TTMP1_vi, TTMP2_vi, TTMP3_vi,
319 TTMP4_vi, TTMP5_vi, TTMP6_vi, TTMP7_vi,
320 TTMP8_vi, TTMP9_vi, TTMP10_vi, TTMP11_vi,
321 TTMP12_vi, TTMP13_vi, TTMP14_vi, TTMP15_vi]>;
323 def TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15_gfx9 :
324 TmpRegTuplesBase<0, 16,
325 [TTMP0_gfx9, TTMP1_gfx9, TTMP2_gfx9, TTMP3_gfx9,
326 TTMP4_gfx9, TTMP5_gfx9, TTMP6_gfx9, TTMP7_gfx9,
327 TTMP8_gfx9, TTMP9_gfx9, TTMP10_gfx9, TTMP11_gfx9,
328 TTMP12_gfx9, TTMP13_gfx9, TTMP14_gfx9, TTMP15_gfx9]>;
331 // VGPR 32-bit registers
332 // i16/f16 only on VI+
333 def VGPR_32 : RegisterClass<"AMDGPU", [i32, f32, i16, f16, v2i16, v2f16], 32,
334 (add (sequence "VGPR%u", 0, 255))> {
335 let AllocationPriority = 1;
339 // VGPR 64-bit registers
340 def VGPR_64 : RegisterTuples<getSubRegs<2>.ret,
341 [(add (trunc VGPR_32, 255)),
342 (add (shl VGPR_32, 1))]>;
344 // VGPR 96-bit registers
345 def VGPR_96 : RegisterTuples<getSubRegs<3>.ret,
346 [(add (trunc VGPR_32, 254)),
347 (add (shl VGPR_32, 1)),
348 (add (shl VGPR_32, 2))]>;
350 // VGPR 128-bit registers
351 def VGPR_128 : RegisterTuples<getSubRegs<4>.ret,
352 [(add (trunc VGPR_32, 253)),
353 (add (shl VGPR_32, 1)),
354 (add (shl VGPR_32, 2)),
355 (add (shl VGPR_32, 3))]>;
357 // VGPR 256-bit registers
358 def VGPR_256 : RegisterTuples<getSubRegs<8>.ret,
359 [(add (trunc VGPR_32, 249)),
360 (add (shl VGPR_32, 1)),
361 (add (shl VGPR_32, 2)),
362 (add (shl VGPR_32, 3)),
363 (add (shl VGPR_32, 4)),
364 (add (shl VGPR_32, 5)),
365 (add (shl VGPR_32, 6)),
366 (add (shl VGPR_32, 7))]>;
368 // VGPR 512-bit registers
369 def VGPR_512 : RegisterTuples<getSubRegs<16>.ret,
370 [(add (trunc VGPR_32, 241)),
371 (add (shl VGPR_32, 1)),
372 (add (shl VGPR_32, 2)),
373 (add (shl VGPR_32, 3)),
374 (add (shl VGPR_32, 4)),
375 (add (shl VGPR_32, 5)),
376 (add (shl VGPR_32, 6)),
377 (add (shl VGPR_32, 7)),
378 (add (shl VGPR_32, 8)),
379 (add (shl VGPR_32, 9)),
380 (add (shl VGPR_32, 10)),
381 (add (shl VGPR_32, 11)),
382 (add (shl VGPR_32, 12)),
383 (add (shl VGPR_32, 13)),
384 (add (shl VGPR_32, 14)),
385 (add (shl VGPR_32, 15))]>;
387 //===----------------------------------------------------------------------===//
388 // Register classes used as source and destination
389 //===----------------------------------------------------------------------===//
391 def Pseudo_SReg_32 : RegisterClass<"AMDGPU", [i32, f32, i16, f16, v2i16, v2f16], 32,
392 (add FP_REG, SP_REG, SCRATCH_WAVE_OFFSET_REG)> {
393 let isAllocatable = 0;
397 def Pseudo_SReg_128 : RegisterClass<"AMDGPU", [v4i32, v2i64], 32,
398 (add PRIVATE_RSRC_REG)> {
399 let isAllocatable = 0;
403 // Subset of SReg_32 without M0 for SMRD instructions and alike.
404 // See comments in SIInstructions.td for more info.
405 def SReg_32_XM0_XEXEC : RegisterClass<"AMDGPU", [i32, f32, i16, f16, v2i16, v2f16], 32,
406 (add SGPR_32, VCC_LO, VCC_HI, FLAT_SCR_LO, FLAT_SCR_HI,
407 TTMP_32, TMA_LO, TMA_HI, TBA_LO, TBA_HI, SRC_SHARED_BASE, SRC_SHARED_LIMIT,
408 SRC_PRIVATE_BASE, SRC_PRIVATE_LIMIT)> {
409 let AllocationPriority = 7;
412 def SReg_32_XEXEC_HI : RegisterClass<"AMDGPU", [i32, f32, i16, f16, v2i16, v2f16], 32,
413 (add SReg_32_XM0_XEXEC, EXEC_LO, M0_CLASS)> {
414 let AllocationPriority = 7;
417 def SReg_32_XM0 : RegisterClass<"AMDGPU", [i32, f32, i16, f16, v2i16, v2f16], 32,
418 (add SReg_32_XM0_XEXEC, EXEC_LO, EXEC_HI)> {
419 let AllocationPriority = 7;
422 // Register class for all scalar registers (SGPRs + Special Registers)
423 def SReg_32 : RegisterClass<"AMDGPU", [i32, f32, i16, f16, v2i16, v2f16], 32,
424 (add SReg_32_XM0, M0_CLASS, EXEC_LO, EXEC_HI, SReg_32_XEXEC_HI)> {
425 let AllocationPriority = 7;
428 def SGPR_64 : RegisterClass<"AMDGPU", [v2i32, i64, f64], 32, (add SGPR_64Regs)> {
430 let AllocationPriority = 8;
433 def TTMP_64 : RegisterClass<"AMDGPU", [v2i32, i64, f64], 32, (add TTMP_64Regs)> {
434 let isAllocatable = 0;
437 def SReg_64_XEXEC : RegisterClass<"AMDGPU", [v2i32, i64, f64, i1], 32,
438 (add SGPR_64, VCC, FLAT_SCR, TTMP_64, TBA, TMA)> {
440 let AllocationPriority = 8;
443 def SReg_64 : RegisterClass<"AMDGPU", [v2i32, i64, f64, i1], 32,
444 (add SReg_64_XEXEC, EXEC)> {
446 let AllocationPriority = 8;
449 // Requires 2 s_mov_b64 to copy
450 let CopyCost = 2 in {
452 def SGPR_128 : RegisterClass<"AMDGPU", [v4i32, v16i8, v2i64], 32, (add SGPR_128Regs)> {
453 let AllocationPriority = 10;
456 def TTMP_128 : RegisterClass<"AMDGPU", [v4i32, v16i8, v2i64], 32, (add TTMP_128Regs)> {
457 let isAllocatable = 0;
460 def SReg_128 : RegisterClass<"AMDGPU", [v4i32, v16i8, v2i64], 32,
461 (add SGPR_128, TTMP_128)> {
462 let AllocationPriority = 10;
465 } // End CopyCost = 2
467 def SGPR_256 : RegisterClass<"AMDGPU", [v8i32, v8f32], 32, (add SGPR_256Regs)> {
468 let AllocationPriority = 11;
471 def TTMP_256 : RegisterClass<"AMDGPU", [v8i32, v8f32], 32, (add TTMP_256Regs)> {
472 let isAllocatable = 0;
475 def SReg_256 : RegisterClass<"AMDGPU", [v8i32, v8f32], 32,
476 (add SGPR_256, TTMP_256)> {
477 // Requires 4 s_mov_b64 to copy
479 let AllocationPriority = 11;
482 def SGPR_512 : RegisterClass<"AMDGPU", [v16i32, v16f32], 32, (add SGPR_512Regs)> {
483 let AllocationPriority = 12;
486 def TTMP_512 : RegisterClass<"AMDGPU", [v16i32, v16f32], 32, (add TTMP_512Regs)> {
487 let isAllocatable = 0;
490 def SReg_512 : RegisterClass<"AMDGPU", [v16i32, v16f32], 32,
491 (add SGPR_512, TTMP_512)> {
492 // Requires 8 s_mov_b64 to copy
494 let AllocationPriority = 12;
497 // Register class for all vector registers (VGPRs + Interploation Registers)
498 def VReg_64 : RegisterClass<"AMDGPU", [i64, f64, v2i32, v2f32], 32, (add VGPR_64)> {
501 // Requires 2 v_mov_b32 to copy
503 let AllocationPriority = 2;
506 def VReg_96 : RegisterClass<"AMDGPU", [untyped], 32, (add VGPR_96)> {
509 // Requires 3 v_mov_b32 to copy
511 let AllocationPriority = 3;
514 def VReg_128 : RegisterClass<"AMDGPU", [v4i32, v4f32, v2i64, v2f64], 32, (add VGPR_128)> {
517 // Requires 4 v_mov_b32 to copy
519 let AllocationPriority = 4;
522 def VReg_256 : RegisterClass<"AMDGPU", [v8i32, v8f32], 32, (add VGPR_256)> {
525 let AllocationPriority = 5;
528 def VReg_512 : RegisterClass<"AMDGPU", [v16i32, v16f32], 32, (add VGPR_512)> {
531 let AllocationPriority = 6;
534 def VReg_1 : RegisterClass<"AMDGPU", [i1], 32, (add VGPR_32)> {
538 def VS_32 : RegisterClass<"AMDGPU", [i32, f32, i16, f16, v2i16, v2f16], 32,
539 (add VGPR_32, SReg_32)> {
540 let isAllocatable = 0;
543 def VS_64 : RegisterClass<"AMDGPU", [i64, f64], 32, (add VReg_64, SReg_64)> {
544 let isAllocatable = 0;
547 //===----------------------------------------------------------------------===//
549 //===----------------------------------------------------------------------===//
551 class RegImmMatcher<string name> : AsmOperandClass {
553 let RenderMethod = "addRegOrImmOperands";
556 multiclass SIRegOperand <string rc, string MatchName, string opType> {
557 let OperandNamespace = "AMDGPU" in {
558 def _b16 : RegisterOperand<!cast<RegisterClass>(rc#"_32")> {
559 let OperandType = opType#"_INT16";
560 let ParserMatchClass = RegImmMatcher<MatchName#"B16">;
561 let DecoderMethod = "decodeOperand_VSrc16";
564 def _f16 : RegisterOperand<!cast<RegisterClass>(rc#"_32")> {
565 let OperandType = opType#"_FP16";
566 let ParserMatchClass = RegImmMatcher<MatchName#"F16">;
567 let DecoderMethod = "decodeOperand_VSrc16";
570 def _b32 : RegisterOperand<!cast<RegisterClass>(rc#"_32")> {
571 let OperandType = opType#"_INT32";
572 let ParserMatchClass = RegImmMatcher<MatchName#"B32">;
575 def _f32 : RegisterOperand<!cast<RegisterClass>(rc#"_32")> {
576 let OperandType = opType#"_FP32";
577 let ParserMatchClass = RegImmMatcher<MatchName#"F32">;
580 def _b64 : RegisterOperand<!cast<RegisterClass>(rc#"_64")> {
581 let OperandType = opType#"_INT64";
582 let ParserMatchClass = RegImmMatcher<MatchName#"B64">;
585 def _f64 : RegisterOperand<!cast<RegisterClass>(rc#"_64")> {
586 let OperandType = opType#"_FP64";
587 let ParserMatchClass = RegImmMatcher<MatchName#"F64">;
590 def _v2b16 : RegisterOperand<!cast<RegisterClass>(rc#"_32")> {
591 let OperandType = opType#"_V2INT16";
592 let ParserMatchClass = RegImmMatcher<MatchName#"V2B16">;
593 let DecoderMethod = "decodeOperand_VSrcV216";
596 def _v2f16 : RegisterOperand<!cast<RegisterClass>(rc#"_32")> {
597 let OperandType = opType#"_V2FP16";
598 let ParserMatchClass = RegImmMatcher<MatchName#"V2F16">;
599 let DecoderMethod = "decodeOperand_VSrcV216";
604 // FIXME: 64-bit sources can sometimes use 32-bit constants.
605 multiclass RegImmOperand <string rc, string MatchName>
606 : SIRegOperand<rc, MatchName, "OPERAND_REG_IMM">;
608 multiclass RegInlineOperand <string rc, string MatchName>
609 : SIRegOperand<rc, MatchName, "OPERAND_REG_INLINE_C">;
611 //===----------------------------------------------------------------------===//
612 // SSrc_* Operands with an SGPR or a 32-bit immediate
613 //===----------------------------------------------------------------------===//
615 defm SSrc : RegImmOperand<"SReg", "SSrc">;
617 //===----------------------------------------------------------------------===//
618 // SCSrc_* Operands with an SGPR or a inline constant
619 //===----------------------------------------------------------------------===//
621 defm SCSrc : RegInlineOperand<"SReg", "SCSrc"> ;
623 def SCSrc_i1 : RegisterOperand<SReg_64_XEXEC>;
625 //===----------------------------------------------------------------------===//
626 // VSrc_* Operands with an SGPR, VGPR or a 32-bit immediate
627 //===----------------------------------------------------------------------===//
629 defm VSrc : RegImmOperand<"VS", "VSrc">;
631 def VSrc_128 : RegisterOperand<VReg_128> {
632 let DecoderMethod = "DecodeVS_128RegisterClass";
635 //===----------------------------------------------------------------------===//
636 // VSrc_* Operands with an VGPR
637 //===----------------------------------------------------------------------===//
639 // This is for operands with the enum(9), VSrc encoding restriction,
640 // but only allows VGPRs.
641 def VRegSrc_32 : RegisterOperand<VGPR_32> {
642 //let ParserMatchClass = RegImmMatcher<"VRegSrc32">;
643 let DecoderMethod = "DecodeVS_32RegisterClass";
646 //===----------------------------------------------------------------------===//
647 // VCSrc_* Operands with an SGPR, VGPR or an inline constant
648 //===----------------------------------------------------------------------===//
650 defm VCSrc : RegInlineOperand<"VS", "VCSrc">;