xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIRegisterInfo.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andric//===-- SIRegisterInfo.td - SI Register defs ---------------*- tablegen -*-===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric
90b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
105ffd83dbSDimitry Andric//  Subregister declarations
115ffd83dbSDimitry Andric//===----------------------------------------------------------------------===//
125ffd83dbSDimitry Andric
135ffd83dbSDimitry Andriclet Namespace = "AMDGPU" in {
145ffd83dbSDimitry Andric
155ffd83dbSDimitry Andricdef lo16 : SubRegIndex<16, 0>;
165ffd83dbSDimitry Andricdef hi16 : SubRegIndex<16, 16>;
175ffd83dbSDimitry Andric
18e8d8bef9SDimitry Andricforeach Index = 0...31 in {
195ffd83dbSDimitry Andric  def sub#Index : SubRegIndex<32, !shl(Index, 5)>;
205ffd83dbSDimitry Andric}
215ffd83dbSDimitry Andric
22e8d8bef9SDimitry Andricforeach Index = 1...31 in {
235ffd83dbSDimitry Andric  def sub#Index#_lo16 : ComposedSubRegIndex<!cast<SubRegIndex>(sub#Index), lo16>;
245ffd83dbSDimitry Andric  def sub#Index#_hi16 : ComposedSubRegIndex<!cast<SubRegIndex>(sub#Index), hi16>;
255ffd83dbSDimitry Andric}
265ffd83dbSDimitry Andric
27e8d8bef9SDimitry Andricforeach Size = {2...6,8,16} in {
2806c3fb27SDimitry Andric  foreach Index = !range(!sub(33, Size)) in {
2906c3fb27SDimitry Andric    def !interleave(!foreach(cur, !range(Size), "sub"#!add(cur, Index)), "_") :
305ffd83dbSDimitry Andric      SubRegIndex<!mul(Size, 32), !shl(Index, 5)> {
315ffd83dbSDimitry Andric      let CoveringSubRegIndices =
3206c3fb27SDimitry Andric        !foreach(cur, !range(Size), !cast<SubRegIndex>(sub#!add(cur, Index)));
335ffd83dbSDimitry Andric    }
345ffd83dbSDimitry Andric  }
355ffd83dbSDimitry Andric}
365ffd83dbSDimitry Andric
375ffd83dbSDimitry Andric}
385ffd83dbSDimitry Andric
395ffd83dbSDimitry Andric//===----------------------------------------------------------------------===//
400b57cec5SDimitry Andric//  Helpers
410b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
420b57cec5SDimitry Andric
430b57cec5SDimitry Andricclass getSubRegs<int size> {
440b57cec5SDimitry Andric  list<SubRegIndex> ret2 = [sub0, sub1];
450b57cec5SDimitry Andric  list<SubRegIndex> ret3 = [sub0, sub1, sub2];
460b57cec5SDimitry Andric  list<SubRegIndex> ret4 = [sub0, sub1, sub2, sub3];
470b57cec5SDimitry Andric  list<SubRegIndex> ret5 = [sub0, sub1, sub2, sub3, sub4];
485ffd83dbSDimitry Andric  list<SubRegIndex> ret6 = [sub0, sub1, sub2, sub3, sub4, sub5];
49fe6060f1SDimitry Andric  list<SubRegIndex> ret7 = [sub0, sub1, sub2, sub3, sub4, sub5, sub6];
500b57cec5SDimitry Andric  list<SubRegIndex> ret8 = [sub0, sub1, sub2, sub3, sub4, sub5, sub6, sub7];
51bdd1243dSDimitry Andric  list<SubRegIndex> ret9 = [sub0, sub1, sub2, sub3, sub4, sub5, sub6, sub7, sub8];
52bdd1243dSDimitry Andric  list<SubRegIndex> ret10 = [sub0, sub1, sub2, sub3,
53bdd1243dSDimitry Andric                             sub4, sub5, sub6, sub7,
54bdd1243dSDimitry Andric                             sub8, sub9];
55bdd1243dSDimitry Andric  list<SubRegIndex> ret11 = [sub0, sub1, sub2, sub3,
56bdd1243dSDimitry Andric                             sub4, sub5, sub6, sub7,
57bdd1243dSDimitry Andric                             sub8, sub9, sub10];
58bdd1243dSDimitry Andric  list<SubRegIndex> ret12 = [sub0, sub1, sub2, sub3,
59bdd1243dSDimitry Andric                             sub4, sub5, sub6, sub7,
60bdd1243dSDimitry Andric                             sub8, sub9, sub10, sub11];
610b57cec5SDimitry Andric  list<SubRegIndex> ret16 = [sub0, sub1, sub2, sub3,
620b57cec5SDimitry Andric                             sub4, sub5, sub6, sub7,
630b57cec5SDimitry Andric                             sub8, sub9, sub10, sub11,
640b57cec5SDimitry Andric                             sub12, sub13, sub14, sub15];
650b57cec5SDimitry Andric  list<SubRegIndex> ret32 = [sub0, sub1, sub2, sub3,
660b57cec5SDimitry Andric                             sub4, sub5, sub6, sub7,
670b57cec5SDimitry Andric                             sub8, sub9, sub10, sub11,
680b57cec5SDimitry Andric                             sub12, sub13, sub14, sub15,
690b57cec5SDimitry Andric                             sub16, sub17, sub18, sub19,
700b57cec5SDimitry Andric                             sub20, sub21, sub22, sub23,
710b57cec5SDimitry Andric                             sub24, sub25, sub26, sub27,
720b57cec5SDimitry Andric                             sub28, sub29, sub30, sub31];
730b57cec5SDimitry Andric
740b57cec5SDimitry Andric  list<SubRegIndex> ret = !if(!eq(size, 2), ret2,
750b57cec5SDimitry Andric                              !if(!eq(size, 3), ret3,
760b57cec5SDimitry Andric                                  !if(!eq(size, 4), ret4,
770b57cec5SDimitry Andric                                      !if(!eq(size, 5), ret5,
785ffd83dbSDimitry Andric                                          !if(!eq(size, 6), ret6,
79fe6060f1SDimitry Andric                                              !if(!eq(size, 7), ret7,
800b57cec5SDimitry Andric                                                  !if(!eq(size, 8), ret8,
81bdd1243dSDimitry Andric                                                      !if(!eq(size, 9), ret9,
82bdd1243dSDimitry Andric                                                          !if(!eq(size, 10), ret10,
83bdd1243dSDimitry Andric                                                              !if(!eq(size, 11), ret11,
84bdd1243dSDimitry Andric                                                                  !if(!eq(size, 12), ret12,
855ffd83dbSDimitry Andric                                                                      !if(!eq(size, 16), ret16,
86bdd1243dSDimitry Andric                                                                          ret32))))))))))));
870b57cec5SDimitry Andric}
880b57cec5SDimitry Andric
898bcb0991SDimitry Andric// Generates list of sequential register tuple names.
908bcb0991SDimitry Andric// E.g. RegSeq<3,2,2,"s">.ret -> [ "s[0:1]", "s[2:3]" ]
918bcb0991SDimitry Andricclass RegSeqNames<int last_reg, int stride, int size, string prefix,
928bcb0991SDimitry Andric                  int start = 0> {
938bcb0991SDimitry Andric  int next = !add(start, stride);
94e8d8bef9SDimitry Andric  int end_reg = !add(start, size, -1);
958bcb0991SDimitry Andric  list<string> ret =
968bcb0991SDimitry Andric    !if(!le(end_reg, last_reg),
978bcb0991SDimitry Andric        !listconcat([prefix # "[" # start # ":" # end_reg # "]"],
988bcb0991SDimitry Andric                    RegSeqNames<last_reg, stride, size, prefix, next>.ret),
998bcb0991SDimitry Andric                    []);
1000b57cec5SDimitry Andric}
1018bcb0991SDimitry Andric
10281ad6265SDimitry Andric// Generates list of dags for register tuples.
1038bcb0991SDimitry Andricclass RegSeqDags<RegisterClass RC, int last_reg, int stride, int size,
1048bcb0991SDimitry Andric                int start = 0> {
1058bcb0991SDimitry Andric  dag trunc_rc = (trunc RC,
1068bcb0991SDimitry Andric                  !if(!and(!eq(stride, 1), !eq(start, 0)),
107e8d8bef9SDimitry Andric                      !sub(!add(last_reg, 2), size),
1088bcb0991SDimitry Andric                      !add(last_reg, 1)));
1098bcb0991SDimitry Andric  list<dag> ret =
1108bcb0991SDimitry Andric    !if(!lt(start, size),
1118bcb0991SDimitry Andric        !listconcat([(add (decimate (shl trunc_rc, start), stride))],
1128bcb0991SDimitry Andric                    RegSeqDags<RC, last_reg, stride, size, !add(start, 1)>.ret),
1138bcb0991SDimitry Andric        []);
1140b57cec5SDimitry Andric}
1150b57cec5SDimitry Andric
1168bcb0991SDimitry Andricclass SIRegisterTuples<list<SubRegIndex> Indices, RegisterClass RC,
1178bcb0991SDimitry Andric                       int last_reg, int stride, int size, string prefix> :
1188bcb0991SDimitry Andric  RegisterTuples<Indices,
1198bcb0991SDimitry Andric                 RegSeqDags<RC, last_reg, stride, size>.ret,
1208bcb0991SDimitry Andric                 RegSeqNames<last_reg, stride, size, prefix>.ret>;
1218bcb0991SDimitry Andric
1220b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
1230b57cec5SDimitry Andric//  Declarations that describe the SI registers
1240b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
1255f757f3fSDimitry Andricclass SIReg <string n, bits<8> regIdx = 0, bit isAGPROrVGPR = 0,
1265f757f3fSDimitry Andric             bit isHi = 0> : Register<n> {
1270b57cec5SDimitry Andric  let Namespace = "AMDGPU";
1285f757f3fSDimitry Andric
1295f757f3fSDimitry Andric  // These are generic helper values we use to form actual register
1305f757f3fSDimitry Andric  // codes. They should not be assumed to match any particular register
1315f757f3fSDimitry Andric  // encodings on any particular subtargets.
1325f757f3fSDimitry Andric  let HWEncoding{7-0} = regIdx;
1335f757f3fSDimitry Andric  let HWEncoding{8} = isAGPROrVGPR;
1345f757f3fSDimitry Andric  let HWEncoding{9} = isHi;
1355f757f3fSDimitry Andric
1365f757f3fSDimitry Andric  int Index = !cast<int>(regIdx);
1370b57cec5SDimitry Andric}
1380b57cec5SDimitry Andric
139349cc55cSDimitry Andric// For register classes that use TSFlags.
140349cc55cSDimitry Andricclass SIRegisterClass <string n, list<ValueType> rTypes, int Align, dag rList>
141349cc55cSDimitry Andric  : RegisterClass <n, rTypes, Align, rList> {
142349cc55cSDimitry Andric  // For vector register classes.
143349cc55cSDimitry Andric  field bit HasVGPR = 0;
144349cc55cSDimitry Andric  field bit HasAGPR = 0;
145349cc55cSDimitry Andric
1464824e7fdSDimitry Andric  // For scalar register classes.
1474824e7fdSDimitry Andric  field bit HasSGPR = 0;
1484824e7fdSDimitry Andric
14906c3fb27SDimitry Andric  // Alignment of the first register in tuple (in 32-bit units).
15006c3fb27SDimitry Andric  field int RegTupleAlignUnits = 1;
15106c3fb27SDimitry Andric
152349cc55cSDimitry Andric  // These need to be kept in sync with the enum SIRCFlags.
15306c3fb27SDimitry Andric  let TSFlags{1-0} = RegTupleAlignUnits;
15406c3fb27SDimitry Andric  let TSFlags{2} = HasVGPR;
15506c3fb27SDimitry Andric  let TSFlags{3} = HasAGPR;
15606c3fb27SDimitry Andric  let TSFlags{4} = HasSGPR;
1575ffd83dbSDimitry Andric}
1585ffd83dbSDimitry Andric
1595f757f3fSDimitry Andricmulticlass SIRegLoHi16 <string n, bits<8> regIdx, bit ArtificialHigh = 1,
1605f757f3fSDimitry Andric                        bit isAGPROrVGPR = 0> {
1615f757f3fSDimitry Andric  def _LO16 : SIReg<n#".l", regIdx, isAGPROrVGPR>;
1625f757f3fSDimitry Andric  def _HI16 : SIReg<!if(ArtificialHigh, "", n#".h"), regIdx, isAGPROrVGPR,
1635f757f3fSDimitry Andric                    /* isHi */ 1> {
1645ffd83dbSDimitry Andric    let isArtificial = ArtificialHigh;
1655ffd83dbSDimitry Andric  }
1665ffd83dbSDimitry Andric  def "" : RegisterWithSubRegs<n, [!cast<Register>(NAME#"_LO16"),
1675ffd83dbSDimitry Andric                                   !cast<Register>(NAME#"_HI16")]> {
1685ffd83dbSDimitry Andric    let Namespace = "AMDGPU";
1695ffd83dbSDimitry Andric    let SubRegIndices = [lo16, hi16];
170e8d8bef9SDimitry Andric    let CoveredBySubRegs = !not(ArtificialHigh);
1715f757f3fSDimitry Andric    let HWEncoding{7-0} = regIdx;
1725f757f3fSDimitry Andric    let HWEncoding{8} = isAGPROrVGPR;
1735f757f3fSDimitry Andric
1745f757f3fSDimitry Andric    int Index = !cast<int>(regIdx);
1755ffd83dbSDimitry Andric  }
1765ffd83dbSDimitry Andric}
1775ffd83dbSDimitry Andric
1780b57cec5SDimitry Andric// Special Registers
1795ffd83dbSDimitry Andricdefm VCC_LO : SIRegLoHi16<"vcc_lo", 106>;
1805ffd83dbSDimitry Andricdefm VCC_HI : SIRegLoHi16<"vcc_hi", 107>;
1810b57cec5SDimitry Andric
1820b57cec5SDimitry Andric// Pseudo-registers: Used as placeholders during isel and immediately
1830b57cec5SDimitry Andric// replaced, never seeing the verifier.
1840b57cec5SDimitry Andricdef PRIVATE_RSRC_REG : SIReg<"private_rsrc", 0>;
1850b57cec5SDimitry Andricdef FP_REG : SIReg<"fp", 0>;
1860b57cec5SDimitry Andricdef SP_REG : SIReg<"sp", 0>;
1875ffd83dbSDimitry Andric
1885ffd83dbSDimitry Andric// Pseudo-register to represent the program-counter DWARF register.
1895ffd83dbSDimitry Andricdef PC_REG : SIReg<"pc", 0>, DwarfRegNum<[16, 16]> {
1905ffd83dbSDimitry Andric  // There is no physical register corresponding to a "program counter", but
1915ffd83dbSDimitry Andric  // we need to encode the concept in debug information in order to represent
1925ffd83dbSDimitry Andric  // things like the return value in unwind information.
1935ffd83dbSDimitry Andric  let isArtificial = 1;
1945ffd83dbSDimitry Andric}
1950b57cec5SDimitry Andric
1960b57cec5SDimitry Andric// VCC for 64-bit instructions
1975ffd83dbSDimitry Andricdef VCC : RegisterWithSubRegs<"vcc", [VCC_LO, VCC_HI]> {
1980b57cec5SDimitry Andric  let Namespace = "AMDGPU";
1990b57cec5SDimitry Andric  let SubRegIndices = [sub0, sub1];
20081ad6265SDimitry Andric  let HWEncoding = VCC_LO.HWEncoding;
2010b57cec5SDimitry Andric}
2020b57cec5SDimitry Andric
2035ffd83dbSDimitry Andricdefm EXEC_LO : SIRegLoHi16<"exec_lo", 126>, DwarfRegNum<[1, 1]>;
2045ffd83dbSDimitry Andricdefm EXEC_HI : SIRegLoHi16<"exec_hi", 127>;
2050b57cec5SDimitry Andric
2065ffd83dbSDimitry Andricdef EXEC : RegisterWithSubRegs<"exec", [EXEC_LO, EXEC_HI]>, DwarfRegNum<[17, 1]> {
2070b57cec5SDimitry Andric  let Namespace = "AMDGPU";
2080b57cec5SDimitry Andric  let SubRegIndices = [sub0, sub1];
20981ad6265SDimitry Andric  let HWEncoding = EXEC_LO.HWEncoding;
2100b57cec5SDimitry Andric}
2110b57cec5SDimitry Andric
2120b57cec5SDimitry Andric// 32-bit real registers, for MC only.
2130b57cec5SDimitry Andric// May be used with both 32-bit and 64-bit operands.
2145ffd83dbSDimitry Andricdefm SRC_VCCZ : SIRegLoHi16<"src_vccz", 251>;
2155ffd83dbSDimitry Andricdefm SRC_EXECZ : SIRegLoHi16<"src_execz", 252>;
2165ffd83dbSDimitry Andricdefm SRC_SCC : SIRegLoHi16<"src_scc", 253>;
2170b57cec5SDimitry Andric
2180b57cec5SDimitry Andric// 1-bit pseudo register, for codegen only.
2190b57cec5SDimitry Andric// Should never be emitted.
2200b57cec5SDimitry Andricdef SCC : SIReg<"scc">;
2210b57cec5SDimitry Andric
22281ad6265SDimitry Andric// Encoding changes between subtarget generations.
22381ad6265SDimitry Andric// See also Utils/AMDGPUBaseInfo.cpp MAP_REG2REG.
22481ad6265SDimitry Andricdefm M0_gfxpre11 : SIRegLoHi16 <"m0", 124>;
22581ad6265SDimitry Andricdefm M0_gfx11plus : SIRegLoHi16 <"m0", 125>;
22681ad6265SDimitry Andricdefm M0 : SIRegLoHi16 <"m0", 0>;
22781ad6265SDimitry Andric
22881ad6265SDimitry Andricdefm SGPR_NULL_gfxpre11 : SIRegLoHi16 <"null", 125>;
22981ad6265SDimitry Andricdefm SGPR_NULL_gfx11plus : SIRegLoHi16 <"null", 124>;
230bdd1243dSDimitry Andriclet isConstant = true in {
23181ad6265SDimitry Andricdefm SGPR_NULL : SIRegLoHi16 <"null", 0>;
23281ad6265SDimitry Andricdefm SGPR_NULL_HI : SIRegLoHi16 <"", 0>;
233bdd1243dSDimitry Andric} // isConstant = true
23481ad6265SDimitry Andric
23581ad6265SDimitry Andricdef SGPR_NULL64 :
23681ad6265SDimitry Andric    RegisterWithSubRegs<"null", [SGPR_NULL, SGPR_NULL_HI]> {
23781ad6265SDimitry Andric  let Namespace = "AMDGPU";
23881ad6265SDimitry Andric  let SubRegIndices = [sub0, sub1];
23981ad6265SDimitry Andric  let HWEncoding = SGPR_NULL.HWEncoding;
240bdd1243dSDimitry Andric  let isConstant = true;
24181ad6265SDimitry Andric}
2420b57cec5SDimitry Andric
243bdd1243dSDimitry Andric// Aperture registers are 64 bit registers with a LO/HI 32 bit.
244bdd1243dSDimitry Andric// HI 32 bit cannot be used, and LO 32 is used by instructions
245bdd1243dSDimitry Andric// with 32 bit sources.
246bdd1243dSDimitry Andric//
247bdd1243dSDimitry Andric// Note that the low 32 bits are essentially useless as they
248bdd1243dSDimitry Andric// don't contain the lower 32 bits of the address - they are in
249bdd1243dSDimitry Andric// the high 32 bits. The lower 32 bits are always zero (for base) or
250bdd1243dSDimitry Andric// -1 (for limit). Since we cannot access the high 32 bits, when we
251bdd1243dSDimitry Andric// need them, we need to do a 64 bit load and extract the bits manually.
2525f757f3fSDimitry Andricmulticlass ApertureRegister<string name, bits<8> regIdx> {
253bdd1243dSDimitry Andric  let isConstant = true in {
254bdd1243dSDimitry Andric    // FIXME: We shouldn't need to define subregisters for these (nor add them to any 16 bit
255bdd1243dSDimitry Andric    //  register classes), but if we don't it seems to confuse the TableGen
256bdd1243dSDimitry Andric    //  backend and we end up with a lot of weird register pressure sets and classes.
257bdd1243dSDimitry Andric    defm _LO : SIRegLoHi16 <name, regIdx>;
258bdd1243dSDimitry Andric    defm _HI : SIRegLoHi16 <"", regIdx>;
259bdd1243dSDimitry Andric
260bdd1243dSDimitry Andric    def "" : RegisterWithSubRegs<name, [!cast<Register>(NAME#_LO), !cast<Register>(NAME#_HI)]> {
261bdd1243dSDimitry Andric      let Namespace = "AMDGPU";
262bdd1243dSDimitry Andric      let SubRegIndices = [sub0, sub1];
263bdd1243dSDimitry Andric      let HWEncoding = !cast<Register>(NAME#_LO).HWEncoding;
264bdd1243dSDimitry Andric    }
265bdd1243dSDimitry Andric  } // isConstant = true
266bdd1243dSDimitry Andric}
267bdd1243dSDimitry Andric
268bdd1243dSDimitry Andricdefm SRC_SHARED_BASE   : ApertureRegister<"src_shared_base",   235>;
269bdd1243dSDimitry Andricdefm SRC_SHARED_LIMIT  : ApertureRegister<"src_shared_limit",  236>;
270bdd1243dSDimitry Andricdefm SRC_PRIVATE_BASE  : ApertureRegister<"src_private_base",  237>;
271bdd1243dSDimitry Andricdefm SRC_PRIVATE_LIMIT : ApertureRegister<"src_private_limit", 238>;
272bdd1243dSDimitry Andric
2735ffd83dbSDimitry Andricdefm SRC_POPS_EXITING_WAVE_ID : SIRegLoHi16<"src_pops_exiting_wave_id", 239>;
2740b57cec5SDimitry Andric
2755ffd83dbSDimitry Andric// Not addressable
2765ffd83dbSDimitry Andricdef MODE : SIReg <"mode", 0>;
2770b57cec5SDimitry Andric
2785ffd83dbSDimitry Andricdef LDS_DIRECT : SIReg <"src_lds_direct", 254> {
2795ffd83dbSDimitry Andric  // There is no physical register corresponding to this. This is an
2805ffd83dbSDimitry Andric  // encoding value in a source field, which will ultimately trigger a
2815ffd83dbSDimitry Andric  // read from m0.
2825ffd83dbSDimitry Andric  let isArtificial = 1;
2835ffd83dbSDimitry Andric}
2840b57cec5SDimitry Andric
2855ffd83dbSDimitry Andricdefm XNACK_MASK_LO : SIRegLoHi16<"xnack_mask_lo", 104>;
2865ffd83dbSDimitry Andricdefm XNACK_MASK_HI : SIRegLoHi16<"xnack_mask_hi", 105>;
2875ffd83dbSDimitry Andric
2885ffd83dbSDimitry Andricdef XNACK_MASK :
2895ffd83dbSDimitry Andric    RegisterWithSubRegs<"xnack_mask", [XNACK_MASK_LO, XNACK_MASK_HI]> {
2900b57cec5SDimitry Andric  let Namespace = "AMDGPU";
2910b57cec5SDimitry Andric  let SubRegIndices = [sub0, sub1];
29281ad6265SDimitry Andric  let HWEncoding = XNACK_MASK_LO.HWEncoding;
2930b57cec5SDimitry Andric}
2940b57cec5SDimitry Andric
2950b57cec5SDimitry Andric// Trap handler registers
2965ffd83dbSDimitry Andricdefm TBA_LO : SIRegLoHi16<"tba_lo", 108>;
2975ffd83dbSDimitry Andricdefm TBA_HI : SIRegLoHi16<"tba_hi", 109>;
2980b57cec5SDimitry Andric
2995ffd83dbSDimitry Andricdef TBA : RegisterWithSubRegs<"tba", [TBA_LO, TBA_HI]> {
3000b57cec5SDimitry Andric  let Namespace = "AMDGPU";
3010b57cec5SDimitry Andric  let SubRegIndices = [sub0, sub1];
30281ad6265SDimitry Andric  let HWEncoding = TBA_LO.HWEncoding;
3030b57cec5SDimitry Andric}
3040b57cec5SDimitry Andric
3055ffd83dbSDimitry Andricdefm TMA_LO : SIRegLoHi16<"tma_lo", 110>;
3065ffd83dbSDimitry Andricdefm TMA_HI : SIRegLoHi16<"tma_hi", 111>;
3070b57cec5SDimitry Andric
3085ffd83dbSDimitry Andricdef TMA : RegisterWithSubRegs<"tma", [TMA_LO, TMA_HI]> {
3090b57cec5SDimitry Andric  let Namespace = "AMDGPU";
3100b57cec5SDimitry Andric  let SubRegIndices = [sub0, sub1];
31181ad6265SDimitry Andric  let HWEncoding = TMA_LO.HWEncoding;
3120b57cec5SDimitry Andric}
3130b57cec5SDimitry Andric
314e8d8bef9SDimitry Andricforeach Index = 0...15 in {
3155ffd83dbSDimitry Andric  defm TTMP#Index#_vi       : SIRegLoHi16<"ttmp"#Index, !add(112, Index)>;
316e8d8bef9SDimitry Andric  defm TTMP#Index#_gfx9plus : SIRegLoHi16<"ttmp"#Index, !add(108, Index)>;
3175ffd83dbSDimitry Andric  defm TTMP#Index           : SIRegLoHi16<"ttmp"#Index, 0>;
3180b57cec5SDimitry Andric}
3190b57cec5SDimitry Andric
3205f757f3fSDimitry Andricmulticlass FLAT_SCR_LOHI_m <string n, bits<8> ci_e, bits<8> vi_e> {
3215ffd83dbSDimitry Andric  defm _ci : SIRegLoHi16<n, ci_e>;
3225ffd83dbSDimitry Andric  defm _vi : SIRegLoHi16<n, vi_e>;
3235ffd83dbSDimitry Andric  defm "" : SIRegLoHi16<n, 0>;
3240b57cec5SDimitry Andric}
3250b57cec5SDimitry Andric
3260b57cec5SDimitry Andricclass FlatReg <Register lo, Register hi, bits<16> encoding> :
3275ffd83dbSDimitry Andric    RegisterWithSubRegs<"flat_scratch", [lo, hi]> {
3280b57cec5SDimitry Andric  let Namespace = "AMDGPU";
3290b57cec5SDimitry Andric  let SubRegIndices = [sub0, sub1];
3300b57cec5SDimitry Andric  let HWEncoding = encoding;
3310b57cec5SDimitry Andric}
3320b57cec5SDimitry Andric
3330b57cec5SDimitry Andricdefm FLAT_SCR_LO : FLAT_SCR_LOHI_m<"flat_scratch_lo", 104, 102>; // Offset in units of 256-bytes.
3340b57cec5SDimitry Andricdefm FLAT_SCR_HI : FLAT_SCR_LOHI_m<"flat_scratch_hi", 105, 103>; // Size is the per-thread scratch size, in bytes.
3350b57cec5SDimitry Andric
3360b57cec5SDimitry Andricdef FLAT_SCR_ci : FlatReg<FLAT_SCR_LO_ci, FLAT_SCR_HI_ci, 104>;
3370b57cec5SDimitry Andricdef FLAT_SCR_vi : FlatReg<FLAT_SCR_LO_vi, FLAT_SCR_HI_vi, 102>;
3380b57cec5SDimitry Andricdef FLAT_SCR : FlatReg<FLAT_SCR_LO, FLAT_SCR_HI, 0>;
3390b57cec5SDimitry Andric
3400b57cec5SDimitry Andric// SGPR registers
341e8d8bef9SDimitry Andricforeach Index = 0...105 in {
3425ffd83dbSDimitry Andric  defm SGPR#Index :
3435ffd83dbSDimitry Andric     SIRegLoHi16 <"s"#Index, Index>,
3445ffd83dbSDimitry Andric     DwarfRegNum<[!if(!le(Index, 63), !add(Index, 32), !add(Index, 1024)),
3455ffd83dbSDimitry Andric                  !if(!le(Index, 63), !add(Index, 32), !add(Index, 1024))]>;
3460b57cec5SDimitry Andric}
3470b57cec5SDimitry Andric
3480b57cec5SDimitry Andric// VGPR registers
349e8d8bef9SDimitry Andricforeach Index = 0...255 in {
3505ffd83dbSDimitry Andric  defm VGPR#Index :
3515ffd83dbSDimitry Andric    SIRegLoHi16 <"v"#Index, Index, 0, 1>,
3525ffd83dbSDimitry Andric    DwarfRegNum<[!add(Index, 2560), !add(Index, 1536)]>;
3530b57cec5SDimitry Andric}
3540b57cec5SDimitry Andric
3550b57cec5SDimitry Andric// AccVGPR registers
356e8d8bef9SDimitry Andricforeach Index = 0...255 in {
3575ffd83dbSDimitry Andric  defm AGPR#Index :
3585ffd83dbSDimitry Andric      SIRegLoHi16 <"a"#Index, Index, 1, 1>,
3595ffd83dbSDimitry Andric      DwarfRegNum<[!add(Index, 3072), !add(Index, 2048)]>;
3600b57cec5SDimitry Andric}
3610b57cec5SDimitry Andric
3620b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
3630b57cec5SDimitry Andric//  Groupings using register classes and tuples
3640b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
3650b57cec5SDimitry Andric
3664824e7fdSDimitry Andricdef SCC_CLASS : SIRegisterClass<"AMDGPU", [i1], 1, (add SCC)> {
3670b57cec5SDimitry Andric  let CopyCost = -1;
3680b57cec5SDimitry Andric  let isAllocatable = 0;
3694824e7fdSDimitry Andric  let HasSGPR = 1;
370bdd1243dSDimitry Andric  let BaseClassOrder = 10000;
3710b57cec5SDimitry Andric}
3720b57cec5SDimitry Andric
3734824e7fdSDimitry Andricdef M0_CLASS : SIRegisterClass<"AMDGPU", [i32], 32, (add M0)> {
3740b57cec5SDimitry Andric  let CopyCost = 1;
3750b57cec5SDimitry Andric  let isAllocatable = 0;
3764824e7fdSDimitry Andric  let HasSGPR = 1;
3770b57cec5SDimitry Andric}
3780b57cec5SDimitry Andric
379647cbc5dSDimitry Andricdef M0_CLASS_LO16 : SIRegisterClass<"AMDGPU", [i16, f16, bf16], 16, (add M0_LO16)> {
3805ffd83dbSDimitry Andric  let CopyCost = 1;
3815ffd83dbSDimitry Andric  let Size = 16;
3825ffd83dbSDimitry Andric  let isAllocatable = 0;
3834824e7fdSDimitry Andric  let HasSGPR = 1;
3845ffd83dbSDimitry Andric}
3855ffd83dbSDimitry Andric
3860b57cec5SDimitry Andric// TODO: Do we need to set DwarfRegAlias on register tuples?
3870b57cec5SDimitry Andric
388647cbc5dSDimitry Andricdef SGPR_LO16 : SIRegisterClass<"AMDGPU", [i16, f16, bf16], 16,
3895ffd83dbSDimitry Andric                              (add (sequence "SGPR%u_LO16", 0, 105))> {
390972a253aSDimitry Andric  let AllocationPriority = 0;
3915ffd83dbSDimitry Andric  let Size = 16;
3925ffd83dbSDimitry Andric  let GeneratePressureSet = 0;
3934824e7fdSDimitry Andric  let HasSGPR = 1;
3945ffd83dbSDimitry Andric}
3955ffd83dbSDimitry Andric
396647cbc5dSDimitry Andricdef SGPR_HI16 : SIRegisterClass<"AMDGPU", [i16, f16, bf16], 16,
3975ffd83dbSDimitry Andric                              (add (sequence "SGPR%u_HI16", 0, 105))> {
3985ffd83dbSDimitry Andric  let isAllocatable = 0;
3995ffd83dbSDimitry Andric  let Size = 16;
4005ffd83dbSDimitry Andric  let GeneratePressureSet = 0;
4014824e7fdSDimitry Andric  let HasSGPR = 1;
4025ffd83dbSDimitry Andric}
4035ffd83dbSDimitry Andric
4040b57cec5SDimitry Andric// SGPR 32-bit registers
405647cbc5dSDimitry Andricdef SGPR_32 : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16], 32,
4068bcb0991SDimitry Andric                            (add (sequence "SGPR%u", 0, 105))> {
4070b57cec5SDimitry Andric  // Give all SGPR classes higher priority than VGPR classes, because
4080b57cec5SDimitry Andric  // we want to spill SGPRs to VGPRs.
409972a253aSDimitry Andric  let AllocationPriority = 0;
4105ffd83dbSDimitry Andric  let GeneratePressureSet = 0;
4114824e7fdSDimitry Andric  let HasSGPR = 1;
4120b57cec5SDimitry Andric}
4130b57cec5SDimitry Andric
4140b57cec5SDimitry Andric// SGPR 64-bit registers
4158bcb0991SDimitry Andricdef SGPR_64Regs : SIRegisterTuples<getSubRegs<2>.ret, SGPR_32, 105, 2, 2, "s">;
4160b57cec5SDimitry Andric
4175f757f3fSDimitry Andric// SGPR 96-bit registers.
41806c3fb27SDimitry Andricdef SGPR_96Regs : SIRegisterTuples<getSubRegs<3>.ret, SGPR_32, 105, 4, 3, "s">;
4190b57cec5SDimitry Andric
4200b57cec5SDimitry Andric// SGPR 128-bit registers
4218bcb0991SDimitry Andricdef SGPR_128Regs : SIRegisterTuples<getSubRegs<4>.ret, SGPR_32, 105, 4, 4, "s">;
4220b57cec5SDimitry Andric
4230b57cec5SDimitry Andric// SGPR 160-bit registers. No operations use these, but for symmetry with 160-bit VGPRs.
4248bcb0991SDimitry Andricdef SGPR_160Regs : SIRegisterTuples<getSubRegs<5>.ret, SGPR_32, 105, 4, 5, "s">;
4250b57cec5SDimitry Andric
426fe6060f1SDimitry Andric// SGPR 192-bit registers. No operations use these, but for symmetry with 192-bit VGPRs.
4275ffd83dbSDimitry Andricdef SGPR_192Regs : SIRegisterTuples<getSubRegs<6>.ret, SGPR_32, 105, 4, 6, "s">;
4285ffd83dbSDimitry Andric
429fe6060f1SDimitry Andric// SGPR 224-bit registers. No operations use these, but for symmetry with 224-bit VGPRs.
430fe6060f1SDimitry Andricdef SGPR_224Regs : SIRegisterTuples<getSubRegs<7>.ret, SGPR_32, 105, 4, 7, "s">;
431fe6060f1SDimitry Andric
4320b57cec5SDimitry Andric// SGPR 256-bit registers
4338bcb0991SDimitry Andricdef SGPR_256Regs : SIRegisterTuples<getSubRegs<8>.ret, SGPR_32, 105, 4, 8, "s">;
4340b57cec5SDimitry Andric
435bdd1243dSDimitry Andric// SGPR 288-bit registers. No operations use these, but for symmetry with 288-bit VGPRs.
436bdd1243dSDimitry Andricdef SGPR_288Regs : SIRegisterTuples<getSubRegs<9>.ret, SGPR_32, 105, 4, 9, "s">;
437bdd1243dSDimitry Andric
438bdd1243dSDimitry Andric// SGPR 320-bit registers. No operations use these, but for symmetry with 320-bit VGPRs.
439bdd1243dSDimitry Andricdef SGPR_320Regs : SIRegisterTuples<getSubRegs<10>.ret, SGPR_32, 105, 4, 10, "s">;
440bdd1243dSDimitry Andric
441bdd1243dSDimitry Andric// SGPR 352-bit registers. No operations use these, but for symmetry with 352-bit VGPRs.
442bdd1243dSDimitry Andricdef SGPR_352Regs : SIRegisterTuples<getSubRegs<11>.ret, SGPR_32, 105, 4, 11, "s">;
443bdd1243dSDimitry Andric
444bdd1243dSDimitry Andric// SGPR 384-bit registers. No operations use these, but for symmetry with 384-bit VGPRs.
445bdd1243dSDimitry Andricdef SGPR_384Regs : SIRegisterTuples<getSubRegs<12>.ret, SGPR_32, 105, 4, 12, "s">;
446bdd1243dSDimitry Andric
4470b57cec5SDimitry Andric// SGPR 512-bit registers
4488bcb0991SDimitry Andricdef SGPR_512Regs : SIRegisterTuples<getSubRegs<16>.ret, SGPR_32, 105, 4, 16, "s">;
4490b57cec5SDimitry Andric
4500b57cec5SDimitry Andric// SGPR 1024-bit registers
4518bcb0991SDimitry Andricdef SGPR_1024Regs : SIRegisterTuples<getSubRegs<32>.ret, SGPR_32, 105, 4, 32, "s">;
4520b57cec5SDimitry Andric
4530b57cec5SDimitry Andric// Trap handler TMP 32-bit registers
454647cbc5dSDimitry Andricdef TTMP_32 : SIRegisterClass<"AMDGPU", [i32, f32, v2i16, v2f16, v2bf16], 32,
4550b57cec5SDimitry Andric                            (add (sequence "TTMP%u", 0, 15))> {
4560b57cec5SDimitry Andric  let isAllocatable = 0;
4574824e7fdSDimitry Andric  let HasSGPR = 1;
4580b57cec5SDimitry Andric}
4590b57cec5SDimitry Andric
460fe6060f1SDimitry Andric// Trap handler TMP 16-bit registers
461647cbc5dSDimitry Andricdef TTMP_LO16 : SIRegisterClass<"AMDGPU", [i16, f16, bf16], 16,
4625ffd83dbSDimitry Andric                              (add (sequence "TTMP%u_LO16", 0, 15))> {
4635ffd83dbSDimitry Andric  let Size = 16;
4645ffd83dbSDimitry Andric  let isAllocatable = 0;
4654824e7fdSDimitry Andric  let HasSGPR = 1;
4665ffd83dbSDimitry Andric}
4675ffd83dbSDimitry Andric
4680b57cec5SDimitry Andric// Trap handler TMP 64-bit registers
4698bcb0991SDimitry Andricdef TTMP_64Regs : SIRegisterTuples<getSubRegs<2>.ret, TTMP_32, 15, 2, 2, "ttmp">;
4700b57cec5SDimitry Andric
471fe6060f1SDimitry Andric// Trap handler TMP 96-bit registers
472fe6060f1SDimitry Andricdef TTMP_96Regs : SIRegisterTuples<getSubRegs<3>.ret, TTMP_32, 15, 3, 3, "ttmp">;
473fe6060f1SDimitry Andric
4740b57cec5SDimitry Andric// Trap handler TMP 128-bit registers
4758bcb0991SDimitry Andricdef TTMP_128Regs : SIRegisterTuples<getSubRegs<4>.ret, TTMP_32, 15, 4, 4, "ttmp">;
4760b57cec5SDimitry Andric
477fe6060f1SDimitry Andric// Trap handler TMP 160-bit registers
478fe6060f1SDimitry Andricdef TTMP_160Regs : SIRegisterTuples<getSubRegs<5>.ret, TTMP_32, 15, 4, 5, "ttmp">;
479fe6060f1SDimitry Andric
480fe6060f1SDimitry Andric// Trap handler TMP 192-bit registers
481fe6060f1SDimitry Andricdef TTMP_192Regs : SIRegisterTuples<getSubRegs<6>.ret, TTMP_32, 15, 4, 6, "ttmp">;
482fe6060f1SDimitry Andric
483fe6060f1SDimitry Andric// Trap handler TMP 224-bit registers
484fe6060f1SDimitry Andricdef TTMP_224Regs : SIRegisterTuples<getSubRegs<7>.ret, TTMP_32, 15, 4, 7, "ttmp">;
485fe6060f1SDimitry Andric
486fe6060f1SDimitry Andric// Trap handler TMP 256-bit registers
4878bcb0991SDimitry Andricdef TTMP_256Regs : SIRegisterTuples<getSubRegs<8>.ret, TTMP_32, 15, 4, 8, "ttmp">;
4880b57cec5SDimitry Andric
489bdd1243dSDimitry Andric// Trap handler TMP 288-bit registers
490bdd1243dSDimitry Andricdef TTMP_288Regs : SIRegisterTuples<getSubRegs<9>.ret, TTMP_32, 15, 4, 9, "ttmp">;
491bdd1243dSDimitry Andric
492bdd1243dSDimitry Andric// Trap handler TMP 320-bit registers
493bdd1243dSDimitry Andricdef TTMP_320Regs : SIRegisterTuples<getSubRegs<10>.ret, TTMP_32, 15, 4, 10, "ttmp">;
494bdd1243dSDimitry Andric
495bdd1243dSDimitry Andric// Trap handler TMP 352-bit registers
496bdd1243dSDimitry Andricdef TTMP_352Regs : SIRegisterTuples<getSubRegs<11>.ret, TTMP_32, 15, 4, 11, "ttmp">;
497bdd1243dSDimitry Andric
498bdd1243dSDimitry Andric// Trap handler TMP 384-bit registers
499bdd1243dSDimitry Andricdef TTMP_384Regs : SIRegisterTuples<getSubRegs<12>.ret, TTMP_32, 15, 4, 12, "ttmp">;
500bdd1243dSDimitry Andric
501fe6060f1SDimitry Andric// Trap handler TMP 512-bit registers
5028bcb0991SDimitry Andricdef TTMP_512Regs : SIRegisterTuples<getSubRegs<16>.ret, TTMP_32, 15, 4, 16, "ttmp">;
5030b57cec5SDimitry Andric
5040b57cec5SDimitry Andricclass TmpRegTuplesBase<int index, int size,
5050b57cec5SDimitry Andric                       list<Register> subRegs,
5060b57cec5SDimitry Andric                       list<SubRegIndex> indices = getSubRegs<size>.ret,
507e8d8bef9SDimitry Andric                       int index1 = !add(index, size, -1),
5080b57cec5SDimitry Andric                       string name = "ttmp["#index#":"#index1#"]"> :
5098bcb0991SDimitry Andric  RegisterWithSubRegs<name, subRegs> {
5100b57cec5SDimitry Andric  let HWEncoding = subRegs[0].HWEncoding;
5110b57cec5SDimitry Andric  let SubRegIndices = indices;
5120b57cec5SDimitry Andric}
5130b57cec5SDimitry Andric
5140b57cec5SDimitry Andricclass TmpRegTuples<string tgt,
5150b57cec5SDimitry Andric                   int size,
5160b57cec5SDimitry Andric                   int index0,
5170b57cec5SDimitry Andric                   int index1 = !add(index0, 1),
5180b57cec5SDimitry Andric                   int index2 = !add(index0, !if(!eq(size, 2), 1, 2)),
5190b57cec5SDimitry Andric                   int index3 = !add(index0, !if(!eq(size, 2), 1, 3)),
5200b57cec5SDimitry Andric                   int index4 = !add(index0, !if(!eq(size, 8), 4, 1)),
5210b57cec5SDimitry Andric                   int index5 = !add(index0, !if(!eq(size, 8), 5, 1)),
5220b57cec5SDimitry Andric                   int index6 = !add(index0, !if(!eq(size, 8), 6, 1)),
5230b57cec5SDimitry Andric                   int index7 = !add(index0, !if(!eq(size, 8), 7, 1)),
5240b57cec5SDimitry Andric                   Register r0 = !cast<Register>("TTMP"#index0#tgt),
5250b57cec5SDimitry Andric                   Register r1 = !cast<Register>("TTMP"#index1#tgt),
5260b57cec5SDimitry Andric                   Register r2 = !cast<Register>("TTMP"#index2#tgt),
5270b57cec5SDimitry Andric                   Register r3 = !cast<Register>("TTMP"#index3#tgt),
5280b57cec5SDimitry Andric                   Register r4 = !cast<Register>("TTMP"#index4#tgt),
5290b57cec5SDimitry Andric                   Register r5 = !cast<Register>("TTMP"#index5#tgt),
5300b57cec5SDimitry Andric                   Register r6 = !cast<Register>("TTMP"#index6#tgt),
5310b57cec5SDimitry Andric                   Register r7 = !cast<Register>("TTMP"#index7#tgt)> :
5320b57cec5SDimitry Andric  TmpRegTuplesBase<index0, size,
5330b57cec5SDimitry Andric                   !if(!eq(size, 2), [r0, r1],
5340b57cec5SDimitry Andric                       !if(!eq(size, 4), [r0, r1, r2, r3],
5350b57cec5SDimitry Andric                                         [r0, r1, r2, r3, r4, r5, r6, r7])),
5360b57cec5SDimitry Andric                   getSubRegs<size>.ret>;
5370b57cec5SDimitry Andric
5380b57cec5SDimitry Andricforeach Index = {0, 2, 4, 6, 8, 10, 12, 14} in {
5390b57cec5SDimitry Andric  def TTMP#Index#_TTMP#!add(Index,1)#_vi       : TmpRegTuples<"_vi",   2, Index>;
540e8d8bef9SDimitry Andric  def TTMP#Index#_TTMP#!add(Index,1)#_gfx9plus : TmpRegTuples<"_gfx9plus", 2, Index>;
5410b57cec5SDimitry Andric}
5420b57cec5SDimitry Andric
5430b57cec5SDimitry Andricforeach Index = {0, 4, 8, 12} in {
5440b57cec5SDimitry Andric  def TTMP#Index#_TTMP#!add(Index,1)#
5450b57cec5SDimitry Andric                 _TTMP#!add(Index,2)#
5460b57cec5SDimitry Andric                 _TTMP#!add(Index,3)#_vi : TmpRegTuples<"_vi",   4, Index>;
5470b57cec5SDimitry Andric  def TTMP#Index#_TTMP#!add(Index,1)#
5480b57cec5SDimitry Andric                 _TTMP#!add(Index,2)#
549e8d8bef9SDimitry Andric                 _TTMP#!add(Index,3)#_gfx9plus : TmpRegTuples<"_gfx9plus", 4, Index>;
5500b57cec5SDimitry Andric}
5510b57cec5SDimitry Andric
5520b57cec5SDimitry Andricforeach Index = {0, 4, 8} in {
5530b57cec5SDimitry Andric  def TTMP#Index#_TTMP#!add(Index,1)#
5540b57cec5SDimitry Andric                 _TTMP#!add(Index,2)#
5550b57cec5SDimitry Andric                 _TTMP#!add(Index,3)#
5560b57cec5SDimitry Andric                 _TTMP#!add(Index,4)#
5570b57cec5SDimitry Andric                 _TTMP#!add(Index,5)#
5580b57cec5SDimitry Andric                 _TTMP#!add(Index,6)#
5590b57cec5SDimitry Andric                 _TTMP#!add(Index,7)#_vi : TmpRegTuples<"_vi",   8, Index>;
5600b57cec5SDimitry Andric  def TTMP#Index#_TTMP#!add(Index,1)#
5610b57cec5SDimitry Andric                 _TTMP#!add(Index,2)#
5620b57cec5SDimitry Andric                 _TTMP#!add(Index,3)#
5630b57cec5SDimitry Andric                 _TTMP#!add(Index,4)#
5640b57cec5SDimitry Andric                 _TTMP#!add(Index,5)#
5650b57cec5SDimitry Andric                 _TTMP#!add(Index,6)#
566e8d8bef9SDimitry Andric                 _TTMP#!add(Index,7)#_gfx9plus : TmpRegTuples<"_gfx9plus", 8, Index>;
5670b57cec5SDimitry Andric}
5680b57cec5SDimitry Andric
5690b57cec5SDimitry Andricdef TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15_vi :
5700b57cec5SDimitry Andric  TmpRegTuplesBase<0, 16,
5710b57cec5SDimitry Andric                   [TTMP0_vi, TTMP1_vi, TTMP2_vi, TTMP3_vi,
5720b57cec5SDimitry Andric                    TTMP4_vi, TTMP5_vi, TTMP6_vi, TTMP7_vi,
5730b57cec5SDimitry Andric                    TTMP8_vi, TTMP9_vi, TTMP10_vi, TTMP11_vi,
5740b57cec5SDimitry Andric                    TTMP12_vi, TTMP13_vi, TTMP14_vi, TTMP15_vi]>;
5750b57cec5SDimitry Andric
576e8d8bef9SDimitry Andricdef TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15_gfx9plus :
5770b57cec5SDimitry Andric  TmpRegTuplesBase<0, 16,
578e8d8bef9SDimitry Andric                   [TTMP0_gfx9plus, TTMP1_gfx9plus, TTMP2_gfx9plus, TTMP3_gfx9plus,
579e8d8bef9SDimitry Andric                    TTMP4_gfx9plus, TTMP5_gfx9plus, TTMP6_gfx9plus, TTMP7_gfx9plus,
580e8d8bef9SDimitry Andric                    TTMP8_gfx9plus, TTMP9_gfx9plus, TTMP10_gfx9plus, TTMP11_gfx9plus,
581e8d8bef9SDimitry Andric                    TTMP12_gfx9plus, TTMP13_gfx9plus, TTMP14_gfx9plus, TTMP15_gfx9plus]>;
5820b57cec5SDimitry Andric
5838bcb0991SDimitry Andricclass RegisterTypes<list<ValueType> reg_types> {
5848bcb0991SDimitry Andric  list<ValueType> types = reg_types;
5858bcb0991SDimitry Andric}
5868bcb0991SDimitry Andric
587647cbc5dSDimitry Andricdef Reg16Types : RegisterTypes<[i16, f16, bf16]>;
588647cbc5dSDimitry Andricdef Reg32Types : RegisterTypes<[i32, f32, v2i16, v2f16, v2bf16, p2, p3, p5, p6]>;
589*0fca6ea1SDimitry Andricdef Reg64Types : RegisterTypes<[i64, f64, v2i32, v2f32, p0, v4i16, v4f16, v4bf16]>;
590*0fca6ea1SDimitry Andricdef Reg96Types : RegisterTypes<[v3i32, v3f32]>;
591*0fca6ea1SDimitry Andricdef Reg128Types : RegisterTypes<[v4i32, v4f32, v2i64, v2f64, v8i16, v8f16, v8bf16]>;
5928bcb0991SDimitry Andric
593349cc55cSDimitry Andriclet HasVGPR = 1 in {
5945f757f3fSDimitry Andric// VOP3 and VINTERP can access 256 lo and 256 hi registers.
5955f757f3fSDimitry Andricdef VGPR_16 : SIRegisterClass<"AMDGPU",  Reg16Types.types, 16,
5965f757f3fSDimitry Andric                            (add (interleave (sequence "VGPR%u_LO16", 0, 255),
5975f757f3fSDimitry Andric                                             (sequence "VGPR%u_HI16", 0, 255)))> {
5985f757f3fSDimitry Andric  let AllocationPriority = 2;
5995f757f3fSDimitry Andric  let Size = 16;
6005f757f3fSDimitry Andric  let GeneratePressureSet = 0;
6015f757f3fSDimitry Andric
6025f757f3fSDimitry Andric  // This is the base class for VGPR{128..255}_{LO16,HI16}.
603bdd1243dSDimitry Andric  let BaseClassOrder = 17;
6045ffd83dbSDimitry Andric}
6058bcb0991SDimitry Andric
6065f757f3fSDimitry Andric// VOP1/2/C can access the First 128 lo and 128 hi registers.
6075f757f3fSDimitry Andric// The order of registers in the class determines order of allocation, so it is
6085f757f3fSDimitry Andric// important to interleave lo and hi registers.
6095f757f3fSDimitry Andricdef VGPR_16_Lo128 : SIRegisterClass<"AMDGPU",  Reg16Types.types, 16,
6105f757f3fSDimitry Andric                            (add (interleave (sequence "VGPR%u_LO16", 0, 127),
6115f757f3fSDimitry Andric                                             (sequence "VGPR%u_HI16", 0, 127)))> {
6125f757f3fSDimitry Andric  let Size = 16;
6135f757f3fSDimitry Andric  let GeneratePressureSet = 0;
6145f757f3fSDimitry Andric  let isAllocatable = 0;
6155f757f3fSDimitry Andric
6165f757f3fSDimitry Andric  // This is the base class for VGPR{0..127}_{LO16,HI16}.
6175f757f3fSDimitry Andric  let BaseClassOrder = 16;
6185f757f3fSDimitry Andric}
6195f757f3fSDimitry Andric
6200b57cec5SDimitry Andric// VGPR 32-bit registers
6210b57cec5SDimitry Andric// i16/f16 only on VI+
622349cc55cSDimitry Andricdef VGPR_32 : SIRegisterClass<"AMDGPU", !listconcat(Reg32Types.types, Reg16Types.types), 32,
6238bcb0991SDimitry Andric                            (add (sequence "VGPR%u", 0, 255))> {
624972a253aSDimitry Andric  let AllocationPriority = 0;
6250b57cec5SDimitry Andric  let Size = 32;
6265ffd83dbSDimitry Andric  let Weight = 1;
627bdd1243dSDimitry Andric  let BaseClassOrder = 32;
628bdd1243dSDimitry Andric}
629bdd1243dSDimitry Andric
630bdd1243dSDimitry Andric// Identical to VGPR_32 except it only contains the low 128 (Lo128) registers.
631bdd1243dSDimitry Andricdef VGPR_32_Lo128 : SIRegisterClass<"AMDGPU", !listconcat(Reg32Types.types, Reg16Types.types), 32,
632bdd1243dSDimitry Andric                            (add (sequence "VGPR%u", 0, 127))> {
633bdd1243dSDimitry Andric  let AllocationPriority = 0;
634bdd1243dSDimitry Andric  let GeneratePressureSet = 0;
635bdd1243dSDimitry Andric  let Size = 32;
636bdd1243dSDimitry Andric  let Weight = 1;
6370b57cec5SDimitry Andric}
638349cc55cSDimitry Andric} // End HasVGPR = 1
6390b57cec5SDimitry Andric
6400b57cec5SDimitry Andric// VGPR 64-bit registers
6418bcb0991SDimitry Andricdef VGPR_64 : SIRegisterTuples<getSubRegs<2>.ret, VGPR_32, 255, 1, 2, "v">;
6420b57cec5SDimitry Andric
6430b57cec5SDimitry Andric// VGPR 96-bit registers
6448bcb0991SDimitry Andricdef VGPR_96 : SIRegisterTuples<getSubRegs<3>.ret, VGPR_32, 255, 1, 3, "v">;
6450b57cec5SDimitry Andric
6460b57cec5SDimitry Andric// VGPR 128-bit registers
6478bcb0991SDimitry Andricdef VGPR_128 : SIRegisterTuples<getSubRegs<4>.ret, VGPR_32, 255, 1, 4, "v">;
6480b57cec5SDimitry Andric
6490b57cec5SDimitry Andric// VGPR 160-bit registers
6508bcb0991SDimitry Andricdef VGPR_160 : SIRegisterTuples<getSubRegs<5>.ret, VGPR_32, 255, 1, 5, "v">;
6510b57cec5SDimitry Andric
6525ffd83dbSDimitry Andric// VGPR 192-bit registers
6535ffd83dbSDimitry Andricdef VGPR_192 : SIRegisterTuples<getSubRegs<6>.ret, VGPR_32, 255, 1, 6, "v">;
6545ffd83dbSDimitry Andric
655fe6060f1SDimitry Andric// VGPR 224-bit registers
656fe6060f1SDimitry Andricdef VGPR_224 : SIRegisterTuples<getSubRegs<7>.ret, VGPR_32, 255, 1, 7, "v">;
657fe6060f1SDimitry Andric
6580b57cec5SDimitry Andric// VGPR 256-bit registers
6598bcb0991SDimitry Andricdef VGPR_256 : SIRegisterTuples<getSubRegs<8>.ret, VGPR_32, 255, 1, 8, "v">;
6600b57cec5SDimitry Andric
661bdd1243dSDimitry Andric// VGPR 288-bit registers
662bdd1243dSDimitry Andricdef VGPR_288 : SIRegisterTuples<getSubRegs<9>.ret, VGPR_32, 255, 1, 9, "v">;
663bdd1243dSDimitry Andric
664bdd1243dSDimitry Andric// VGPR 320-bit registers
665bdd1243dSDimitry Andricdef VGPR_320 : SIRegisterTuples<getSubRegs<10>.ret, VGPR_32, 255, 1, 10, "v">;
666bdd1243dSDimitry Andric
667bdd1243dSDimitry Andric// VGPR 352-bit registers
668bdd1243dSDimitry Andricdef VGPR_352 : SIRegisterTuples<getSubRegs<11>.ret, VGPR_32, 255, 1, 11, "v">;
669bdd1243dSDimitry Andric
670bdd1243dSDimitry Andric// VGPR 384-bit registers
671bdd1243dSDimitry Andricdef VGPR_384 : SIRegisterTuples<getSubRegs<12>.ret, VGPR_32, 255, 1, 12, "v">;
672bdd1243dSDimitry Andric
6730b57cec5SDimitry Andric// VGPR 512-bit registers
6748bcb0991SDimitry Andricdef VGPR_512 : SIRegisterTuples<getSubRegs<16>.ret, VGPR_32, 255, 1, 16, "v">;
6750b57cec5SDimitry Andric
6760b57cec5SDimitry Andric// VGPR 1024-bit registers
6778bcb0991SDimitry Andricdef VGPR_1024 : SIRegisterTuples<getSubRegs<32>.ret, VGPR_32, 255, 1, 32, "v">;
6780b57cec5SDimitry Andric
679349cc55cSDimitry Andriclet HasAGPR = 1 in {
680349cc55cSDimitry Andricdef AGPR_LO16 : SIRegisterClass<"AMDGPU", Reg16Types.types, 16,
6815ffd83dbSDimitry Andric                              (add (sequence "AGPR%u_LO16", 0, 255))> {
6825ffd83dbSDimitry Andric  let isAllocatable = 0;
6835ffd83dbSDimitry Andric  let Size = 16;
6845ffd83dbSDimitry Andric  let GeneratePressureSet = 0;
685bdd1243dSDimitry Andric  let BaseClassOrder = 16;
6865ffd83dbSDimitry Andric}
6875ffd83dbSDimitry Andric
6880b57cec5SDimitry Andric// AccVGPR 32-bit registers
689647cbc5dSDimitry Andricdef AGPR_32 : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16], 32,
6908bcb0991SDimitry Andric                            (add (sequence "AGPR%u", 0, 255))> {
691972a253aSDimitry Andric  let AllocationPriority = 0;
6920b57cec5SDimitry Andric  let Size = 32;
6935ffd83dbSDimitry Andric  let Weight = 1;
694bdd1243dSDimitry Andric  let BaseClassOrder = 32;
6950b57cec5SDimitry Andric}
696349cc55cSDimitry Andric} // End HasAGPR = 1
6970b57cec5SDimitry Andric
6980b57cec5SDimitry Andric// AGPR 64-bit registers
6998bcb0991SDimitry Andricdef AGPR_64 : SIRegisterTuples<getSubRegs<2>.ret, AGPR_32, 255, 1, 2, "a">;
7000b57cec5SDimitry Andric
7015ffd83dbSDimitry Andric// AGPR 96-bit registers
7025ffd83dbSDimitry Andricdef AGPR_96 : SIRegisterTuples<getSubRegs<3>.ret, AGPR_32, 255, 1, 3, "a">;
7035ffd83dbSDimitry Andric
7040b57cec5SDimitry Andric// AGPR 128-bit registers
7058bcb0991SDimitry Andricdef AGPR_128 : SIRegisterTuples<getSubRegs<4>.ret, AGPR_32, 255, 1, 4, "a">;
7060b57cec5SDimitry Andric
7075ffd83dbSDimitry Andric// AGPR 160-bit registers
7085ffd83dbSDimitry Andricdef AGPR_160 : SIRegisterTuples<getSubRegs<5>.ret, AGPR_32, 255, 1, 5, "a">;
7095ffd83dbSDimitry Andric
7105ffd83dbSDimitry Andric// AGPR 192-bit registers
7115ffd83dbSDimitry Andricdef AGPR_192 : SIRegisterTuples<getSubRegs<6>.ret, AGPR_32, 255, 1, 6, "a">;
7125ffd83dbSDimitry Andric
713fe6060f1SDimitry Andric// AGPR 224-bit registers
714fe6060f1SDimitry Andricdef AGPR_224 : SIRegisterTuples<getSubRegs<7>.ret, AGPR_32, 255, 1, 7, "a">;
715fe6060f1SDimitry Andric
7165ffd83dbSDimitry Andric// AGPR 256-bit registers
7175ffd83dbSDimitry Andricdef AGPR_256 : SIRegisterTuples<getSubRegs<8>.ret, AGPR_32, 255, 1, 8, "a">;
7185ffd83dbSDimitry Andric
719bdd1243dSDimitry Andric// AGPR 288-bit registers
720bdd1243dSDimitry Andricdef AGPR_288 : SIRegisterTuples<getSubRegs<9>.ret, AGPR_32, 255, 1, 9, "a">;
721bdd1243dSDimitry Andric
722bdd1243dSDimitry Andric// AGPR 320-bit registers
723bdd1243dSDimitry Andricdef AGPR_320 : SIRegisterTuples<getSubRegs<10>.ret, AGPR_32, 255, 1, 10, "a">;
724bdd1243dSDimitry Andric
725bdd1243dSDimitry Andric// AGPR 352-bit registers
726bdd1243dSDimitry Andricdef AGPR_352 : SIRegisterTuples<getSubRegs<11>.ret, AGPR_32, 255, 1, 11, "a">;
727bdd1243dSDimitry Andric
728bdd1243dSDimitry Andric// AGPR 384-bit registers
729bdd1243dSDimitry Andricdef AGPR_384 : SIRegisterTuples<getSubRegs<12>.ret, AGPR_32, 255, 1, 12, "a">;
730bdd1243dSDimitry Andric
7310b57cec5SDimitry Andric// AGPR 512-bit registers
7328bcb0991SDimitry Andricdef AGPR_512 : SIRegisterTuples<getSubRegs<16>.ret, AGPR_32, 255, 1, 16, "a">;
7330b57cec5SDimitry Andric
7340b57cec5SDimitry Andric// AGPR 1024-bit registers
7358bcb0991SDimitry Andricdef AGPR_1024 : SIRegisterTuples<getSubRegs<32>.ret, AGPR_32, 255, 1, 32, "a">;
7360b57cec5SDimitry Andric
7370b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
7380b57cec5SDimitry Andric//  Register classes used as source and destination
7390b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
7400b57cec5SDimitry Andric
741647cbc5dSDimitry Andricdef Pseudo_SReg_32 : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16], 32,
7425ffd83dbSDimitry Andric  (add FP_REG, SP_REG)> {
7430b57cec5SDimitry Andric  let isAllocatable = 0;
7440b57cec5SDimitry Andric  let CopyCost = -1;
7454824e7fdSDimitry Andric  let HasSGPR = 1;
746bdd1243dSDimitry Andric  let BaseClassOrder = 10000;
7470b57cec5SDimitry Andric}
7480b57cec5SDimitry Andric
749*0fca6ea1SDimitry Andricdef Pseudo_SReg_128 : SIRegisterClass<"AMDGPU", Reg128Types.types, 32,
7508bcb0991SDimitry Andric  (add PRIVATE_RSRC_REG)> {
7510b57cec5SDimitry Andric  let isAllocatable = 0;
7520b57cec5SDimitry Andric  let CopyCost = -1;
7534824e7fdSDimitry Andric  let HasSGPR = 1;
754bdd1243dSDimitry Andric  let BaseClassOrder = 10000;
7550b57cec5SDimitry Andric}
7560b57cec5SDimitry Andric
7575ffd83dbSDimitry Andricdef LDS_DIRECT_CLASS : RegisterClass<"AMDGPU", [i32], 32,
7588bcb0991SDimitry Andric  (add LDS_DIRECT)> {
7590b57cec5SDimitry Andric  let isAllocatable = 0;
7600b57cec5SDimitry Andric  let CopyCost = -1;
7610b57cec5SDimitry Andric}
7620b57cec5SDimitry Andric
7634824e7fdSDimitry Andriclet GeneratePressureSet = 0, HasSGPR = 1 in {
7640b57cec5SDimitry Andric// Subset of SReg_32 without M0 for SMRD instructions and alike.
7650b57cec5SDimitry Andric// See comments in SIInstructions.td for more info.
766647cbc5dSDimitry Andricdef SReg_32_XM0_XEXEC : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16, i1], 32,
7670b57cec5SDimitry Andric  (add SGPR_32, VCC_LO, VCC_HI, FLAT_SCR_LO, FLAT_SCR_HI, XNACK_MASK_LO, XNACK_MASK_HI,
768bdd1243dSDimitry Andric   SGPR_NULL, SGPR_NULL_HI, TTMP_32, TMA_LO, TMA_HI, TBA_LO, TBA_HI, SRC_SHARED_BASE_LO,
769bdd1243dSDimitry Andric   SRC_SHARED_LIMIT_LO, SRC_PRIVATE_BASE_LO, SRC_PRIVATE_LIMIT_LO, SRC_SHARED_BASE_HI,
770bdd1243dSDimitry Andric   SRC_SHARED_LIMIT_HI, SRC_PRIVATE_BASE_HI, SRC_PRIVATE_LIMIT_HI, SRC_POPS_EXITING_WAVE_ID,
7718bcb0991SDimitry Andric   SRC_VCCZ, SRC_EXECZ, SRC_SCC)> {
772972a253aSDimitry Andric  let AllocationPriority = 0;
7730b57cec5SDimitry Andric}
7740b57cec5SDimitry Andric
775647cbc5dSDimitry Andricdef SReg_LO16 : SIRegisterClass<"AMDGPU", [i16, f16, bf16], 16,
7765ffd83dbSDimitry Andric  (add SGPR_LO16, VCC_LO_LO16, VCC_HI_LO16, FLAT_SCR_LO_LO16, FLAT_SCR_HI_LO16,
77781ad6265SDimitry Andric   XNACK_MASK_LO_LO16, XNACK_MASK_HI_LO16, SGPR_NULL_LO16, SGPR_NULL_HI_LO16, TTMP_LO16,
778bdd1243dSDimitry Andric   TMA_LO_LO16, TMA_HI_LO16, TBA_LO_LO16, TBA_HI_LO16, SRC_SHARED_BASE_LO_LO16,
779bdd1243dSDimitry Andric   SRC_SHARED_LIMIT_LO_LO16, SRC_PRIVATE_BASE_LO_LO16, SRC_PRIVATE_LIMIT_LO_LO16,
780bdd1243dSDimitry Andric   SRC_SHARED_BASE_HI_LO16, SRC_SHARED_LIMIT_HI_LO16, SRC_PRIVATE_BASE_HI_LO16,
781bdd1243dSDimitry Andric   SRC_PRIVATE_LIMIT_HI_LO16, SRC_POPS_EXITING_WAVE_ID_LO16, SRC_VCCZ_LO16,
782bdd1243dSDimitry Andric   SRC_EXECZ_LO16, SRC_SCC_LO16, EXEC_LO_LO16, EXEC_HI_LO16, M0_CLASS_LO16)> {
7835ffd83dbSDimitry Andric  let Size = 16;
78406c3fb27SDimitry Andric  let isAllocatable = 0;
785bdd1243dSDimitry Andric  let BaseClassOrder = 16;
786bdd1243dSDimitry Andric}
787bdd1243dSDimitry Andric
788647cbc5dSDimitry Andricdef SReg_32_XEXEC : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16, i1], 32,
789bdd1243dSDimitry Andric  (add SReg_32_XM0_XEXEC, M0_CLASS)> {
790bdd1243dSDimitry Andric  let AllocationPriority = 0;
7915ffd83dbSDimitry Andric}
7925ffd83dbSDimitry Andric
793647cbc5dSDimitry Andricdef SReg_32_XEXEC_HI : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16, i1], 32,
794bdd1243dSDimitry Andric  (add SReg_32_XEXEC, EXEC_LO)> {
795972a253aSDimitry Andric  let AllocationPriority = 0;
7965ffd83dbSDimitry Andric}
7975ffd83dbSDimitry Andric
798647cbc5dSDimitry Andricdef SReg_32_XM0 : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16, i1], 32,
7998bcb0991SDimitry Andric  (add SReg_32_XM0_XEXEC, EXEC_LO, EXEC_HI)> {
800972a253aSDimitry Andric  let AllocationPriority = 0;
8010b57cec5SDimitry Andric}
8020b57cec5SDimitry Andric
8035ffd83dbSDimitry Andric} // End GeneratePressureSet = 0
8045ffd83dbSDimitry Andric
8050b57cec5SDimitry Andric// Register class for all scalar registers (SGPRs + Special Registers)
806647cbc5dSDimitry Andricdef SReg_32 : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16, i1], 32,
807bdd1243dSDimitry Andric  (add SReg_32_XM0, M0_CLASS)> {
808972a253aSDimitry Andric  let AllocationPriority = 0;
8094824e7fdSDimitry Andric  let HasSGPR = 1;
810bdd1243dSDimitry Andric  let BaseClassOrder = 32;
8110b57cec5SDimitry Andric}
8120b57cec5SDimitry Andric
8135ffd83dbSDimitry Andriclet GeneratePressureSet = 0 in {
814647cbc5dSDimitry Andricdef SRegOrLds_32 : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16], 32,
8155ffd83dbSDimitry Andric  (add SReg_32, LDS_DIRECT_CLASS)> {
8160b57cec5SDimitry Andric  let isAllocatable = 0;
8174824e7fdSDimitry Andric  let HasSGPR = 1;
8180b57cec5SDimitry Andric}
8190b57cec5SDimitry Andric
820*0fca6ea1SDimitry Andricdef SGPR_64 : SIRegisterClass<"AMDGPU", Reg64Types.types, 32,
8218bcb0991SDimitry Andric                            (add SGPR_64Regs)> {
8220b57cec5SDimitry Andric  let CopyCost = 1;
823972a253aSDimitry Andric  let AllocationPriority = 1;
8244824e7fdSDimitry Andric  let HasSGPR = 1;
8250b57cec5SDimitry Andric}
8260b57cec5SDimitry Andric
82706c3fb27SDimitry Andric// CCR (call clobbered registers) SGPR 64-bit registers
82806c3fb27SDimitry Andricdef CCR_SGPR_64 : SIRegisterClass<"AMDGPU", SGPR_64.RegTypes, 32, (add (trunc SGPR_64, 15))> {
82906c3fb27SDimitry Andric  let CopyCost = SGPR_64.CopyCost;
83006c3fb27SDimitry Andric  let AllocationPriority = SGPR_64.AllocationPriority;
83106c3fb27SDimitry Andric  let HasSGPR = 1;
83206c3fb27SDimitry Andric}
83306c3fb27SDimitry Andric
83406c3fb27SDimitry Andric// Call clobbered 64-bit SGPRs for AMDGPU_Gfx CC
83506c3fb27SDimitry Andricdef Gfx_CCR_SGPR_64 : SIRegisterClass<"AMDGPU", SGPR_64.RegTypes, 32,
83606c3fb27SDimitry Andric                                (add (trunc (shl SGPR_64, 18), 14))> { // s[36:37]-s[s62:63]
83706c3fb27SDimitry Andric  let CopyCost = SGPR_64.CopyCost;
83806c3fb27SDimitry Andric  let AllocationPriority = SGPR_64.AllocationPriority;
83906c3fb27SDimitry Andric  let HasSGPR = 1;
84006c3fb27SDimitry Andric}
84106c3fb27SDimitry Andric
842647cbc5dSDimitry Andricdef TTMP_64 : SIRegisterClass<"AMDGPU", [v2i32, i64, f64, v4i16, v4f16, v4bf16], 32,
8430b57cec5SDimitry Andric                            (add TTMP_64Regs)> {
8440b57cec5SDimitry Andric  let isAllocatable = 0;
8454824e7fdSDimitry Andric  let HasSGPR = 1;
8460b57cec5SDimitry Andric}
8470b57cec5SDimitry Andric
848647cbc5dSDimitry Andricdef SReg_64_XEXEC : SIRegisterClass<"AMDGPU", [v2i32, i64, v2f32, f64, i1, v4i16, v4f16, v4bf16], 32,
849bdd1243dSDimitry Andric  (add SGPR_64, VCC, FLAT_SCR, XNACK_MASK, SGPR_NULL64, SRC_SHARED_BASE,
850bdd1243dSDimitry Andric       SRC_SHARED_LIMIT, SRC_PRIVATE_BASE, SRC_PRIVATE_LIMIT, TTMP_64, TBA, TMA)> {
8510b57cec5SDimitry Andric  let CopyCost = 1;
852972a253aSDimitry Andric  let AllocationPriority = 1;
8534824e7fdSDimitry Andric  let HasSGPR = 1;
8540b57cec5SDimitry Andric}
8550b57cec5SDimitry Andric
856647cbc5dSDimitry Andricdef SReg_64 : SIRegisterClass<"AMDGPU", [v2i32, i64, v2f32, f64, i1, v4i16, v4f16, v4bf16], 32,
8578bcb0991SDimitry Andric  (add SReg_64_XEXEC, EXEC)> {
8580b57cec5SDimitry Andric  let CopyCost = 1;
859972a253aSDimitry Andric  let AllocationPriority = 1;
8604824e7fdSDimitry Andric  let HasSGPR = 1;
861bdd1243dSDimitry Andric  let BaseClassOrder = 64;
8620b57cec5SDimitry Andric}
8630b57cec5SDimitry Andric
8644824e7fdSDimitry Andricdef SReg_1_XEXEC : SIRegisterClass<"AMDGPU", [i1], 32,
865bdd1243dSDimitry Andric  (add SReg_64_XEXEC, SReg_32_XEXEC)> {
8660b57cec5SDimitry Andric  let CopyCost = 1;
8670b57cec5SDimitry Andric  let isAllocatable = 0;
8684824e7fdSDimitry Andric  let HasSGPR = 1;
8690b57cec5SDimitry Andric}
8700b57cec5SDimitry Andric
8714824e7fdSDimitry Andricdef SReg_1 : SIRegisterClass<"AMDGPU", [i1], 32,
872bdd1243dSDimitry Andric  (add SReg_1_XEXEC, EXEC, EXEC_LO, EXEC_HI)> {
8730b57cec5SDimitry Andric  let CopyCost = 1;
8740b57cec5SDimitry Andric  let isAllocatable = 0;
8754824e7fdSDimitry Andric  let HasSGPR = 1;
8760b57cec5SDimitry Andric}
8770b57cec5SDimitry Andric
878972a253aSDimitry Andricmulticlass SRegClass<int numRegs,
879fe6060f1SDimitry Andric                     list<ValueType> regTypes,
880fe6060f1SDimitry Andric                     SIRegisterTuples regList,
881fe6060f1SDimitry Andric                     SIRegisterTuples ttmpList = regList,
882fe6060f1SDimitry Andric                     int copyCost = !sra(!add(numRegs, 1), 1)> {
883fe6060f1SDimitry Andric  defvar hasTTMP = !ne(regList, ttmpList);
884fe6060f1SDimitry Andric  defvar suffix = !cast<string>(!mul(numRegs, 32));
885fe6060f1SDimitry Andric  defvar sgprName = !strconcat("SGPR_", suffix);
886fe6060f1SDimitry Andric  defvar ttmpName = !strconcat("TTMP_", suffix);
8870b57cec5SDimitry Andric
888972a253aSDimitry Andric  let AllocationPriority = !sub(numRegs, 1), CopyCost = copyCost, HasSGPR = 1 in {
8894824e7fdSDimitry Andric    def "" # sgprName : SIRegisterClass<"AMDGPU", regTypes, 32, (add regList)> {
8900b57cec5SDimitry Andric    }
8910b57cec5SDimitry Andric
892fe6060f1SDimitry Andric    if hasTTMP then {
8934824e7fdSDimitry Andric      def "" # ttmpName : SIRegisterClass<"AMDGPU", regTypes, 32, (add ttmpList)> {
8940b57cec5SDimitry Andric        let isAllocatable = 0;
8950b57cec5SDimitry Andric      }
896fe6060f1SDimitry Andric    }
8970b57cec5SDimitry Andric
898fe6060f1SDimitry Andric    def SReg_ # suffix :
8994824e7fdSDimitry Andric      SIRegisterClass<"AMDGPU", regTypes, 32,
900fe6060f1SDimitry Andric                    !con(!dag(add, [!cast<RegisterClass>(sgprName)], ["sgpr"]),
901fe6060f1SDimitry Andric                    !if(hasTTMP,
902fe6060f1SDimitry Andric                        !dag(add, [!cast<RegisterClass>(ttmpName)], ["ttmp"]),
903fe6060f1SDimitry Andric                        (add)))> {
9048bcb0991SDimitry Andric      let isAllocatable = 0;
905bdd1243dSDimitry Andric      let BaseClassOrder = !mul(numRegs, 32);
9060b57cec5SDimitry Andric    }
907fe6060f1SDimitry Andric  }
9080b57cec5SDimitry Andric}
9090b57cec5SDimitry Andric
910*0fca6ea1SDimitry Andricdefm "" : SRegClass<3, Reg96Types.types, SGPR_96Regs, TTMP_96Regs>;
911*0fca6ea1SDimitry Andricdefm "" : SRegClass<4, Reg128Types.types, SGPR_128Regs, TTMP_128Regs>;
912972a253aSDimitry Andricdefm "" : SRegClass<5, [v5i32, v5f32], SGPR_160Regs, TTMP_160Regs>;
913972a253aSDimitry Andricdefm "" : SRegClass<6, [v6i32, v6f32, v3i64, v3f64], SGPR_192Regs, TTMP_192Regs>;
914972a253aSDimitry Andricdefm "" : SRegClass<7, [v7i32, v7f32], SGPR_224Regs, TTMP_224Regs>;
915647cbc5dSDimitry Andricdefm "" : SRegClass<8, [v8i32, v8f32, v4i64, v4f64, v16i16, v16f16, v16bf16], SGPR_256Regs, TTMP_256Regs>;
916bdd1243dSDimitry Andricdefm "" : SRegClass<9, [v9i32, v9f32], SGPR_288Regs, TTMP_288Regs>;
917bdd1243dSDimitry Andricdefm "" : SRegClass<10, [v10i32, v10f32], SGPR_320Regs, TTMP_320Regs>;
918bdd1243dSDimitry Andricdefm "" : SRegClass<11, [v11i32, v11f32], SGPR_352Regs, TTMP_352Regs>;
919bdd1243dSDimitry Andricdefm "" : SRegClass<12, [v12i32, v12f32], SGPR_384Regs, TTMP_384Regs>;
920bdd1243dSDimitry Andric
921bdd1243dSDimitry Andriclet GlobalPriority = true in {
9221db9f3b2SDimitry Andricdefm "" : SRegClass<16, [v16i32, v16f32, v8i64, v8f64, v32i16, v32f16, v32bf16], SGPR_512Regs, TTMP_512Regs>;
923972a253aSDimitry Andricdefm "" : SRegClass<32, [v32i32, v32f32, v16i64, v16f64], SGPR_1024Regs>;
924bdd1243dSDimitry Andric}
9250b57cec5SDimitry Andric
926647cbc5dSDimitry Andricdef VRegOrLds_32 : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16], 32,
9278bcb0991SDimitry Andric                                 (add VGPR_32, LDS_DIRECT_CLASS)> {
9280b57cec5SDimitry Andric  let isAllocatable = 0;
929349cc55cSDimitry Andric  let HasVGPR = 1;
9300b57cec5SDimitry Andric}
9310b57cec5SDimitry Andric
9325ffd83dbSDimitry Andric// Register class for all vector registers (VGPRs + Interpolation Registers)
933fe6060f1SDimitry Andricclass VRegClassBase<int numRegs, list<ValueType> regTypes, dag regList> :
934349cc55cSDimitry Andric    SIRegisterClass<"AMDGPU", regTypes, 32, regList> {
9355ffd83dbSDimitry Andric  let Size = !mul(numRegs, 32);
9360b57cec5SDimitry Andric
9375ffd83dbSDimitry Andric  // Requires n v_mov_b32 to copy
9385ffd83dbSDimitry Andric  let CopyCost = numRegs;
939972a253aSDimitry Andric  let AllocationPriority = !sub(numRegs, 1);
9405ffd83dbSDimitry Andric  let Weight = numRegs;
9410b57cec5SDimitry Andric}
9420b57cec5SDimitry Andric
943fe6060f1SDimitry Andric// Define a register tuple class, along with one requiring an even
944fe6060f1SDimitry Andric// aligned base register.
945fe6060f1SDimitry Andricmulticlass VRegClass<int numRegs, list<ValueType> regTypes, dag regList> {
946349cc55cSDimitry Andric  let HasVGPR = 1 in {
947fe6060f1SDimitry Andric    // Define the regular class.
948bdd1243dSDimitry Andric    def "" : VRegClassBase<numRegs, regTypes, regList> {
949bdd1243dSDimitry Andric      let BaseClassOrder = !mul(numRegs, 32);
950bdd1243dSDimitry Andric    }
9510b57cec5SDimitry Andric
952fe6060f1SDimitry Andric    // Define 2-aligned variant
953bdd1243dSDimitry Andric    def _Align2 : VRegClassBase<numRegs, regTypes, (decimate regList, 2)> {
954bdd1243dSDimitry Andric      // Give aligned class higher priority in base class resolution
955bdd1243dSDimitry Andric      let BaseClassOrder = !sub(!mul(numRegs, 32), 1);
95606c3fb27SDimitry Andric      let RegTupleAlignUnits = 2;
957bdd1243dSDimitry Andric    }
9580b57cec5SDimitry Andric  }
959349cc55cSDimitry Andric}
9600b57cec5SDimitry Andric
961647cbc5dSDimitry Andricdefm VReg_64 : VRegClass<2, [i64, f64, v2i32, v2f32, v4f16, v4bf16, v4i16, p0, p1, p4],
962fe6060f1SDimitry Andric                                (add VGPR_64)>;
963*0fca6ea1SDimitry Andricdefm VReg_96 : VRegClass<3, Reg96Types.types, (add VGPR_96)>;
964*0fca6ea1SDimitry Andricdefm VReg_128 : VRegClass<4, Reg128Types.types, (add VGPR_128)>;
965fe6060f1SDimitry Andricdefm VReg_160 : VRegClass<5, [v5i32, v5f32], (add VGPR_160)>;
966fe6060f1SDimitry Andric
967fe6060f1SDimitry Andricdefm VReg_192 : VRegClass<6, [v6i32, v6f32, v3i64, v3f64], (add VGPR_192)>;
968fe6060f1SDimitry Andricdefm VReg_224 : VRegClass<7, [v7i32, v7f32], (add VGPR_224)>;
969647cbc5dSDimitry Andricdefm VReg_256 : VRegClass<8, [v8i32, v8f32, v4i64, v4f64, v16i16, v16f16, v16bf16], (add VGPR_256)>;
970bdd1243dSDimitry Andricdefm VReg_288 : VRegClass<9, [v9i32, v9f32], (add VGPR_288)>;
971bdd1243dSDimitry Andricdefm VReg_320 : VRegClass<10, [v10i32, v10f32], (add VGPR_320)>;
972bdd1243dSDimitry Andricdefm VReg_352 : VRegClass<11, [v11i32, v11f32], (add VGPR_352)>;
973bdd1243dSDimitry Andricdefm VReg_384 : VRegClass<12, [v12i32, v12f32], (add VGPR_384)>;
974bdd1243dSDimitry Andric
975bdd1243dSDimitry Andriclet GlobalPriority = true in {
9761db9f3b2SDimitry Andricdefm VReg_512 : VRegClass<16, [v16i32, v16f32, v8i64, v8f64, v32i16, v32f16, v32bf16], (add VGPR_512)>;
977fe6060f1SDimitry Andricdefm VReg_1024 : VRegClass<32, [v32i32, v32f32, v16i64, v16f64], (add VGPR_1024)>;
978bdd1243dSDimitry Andric}
979fe6060f1SDimitry Andric
980fe6060f1SDimitry Andricmulticlass ARegClass<int numRegs, list<ValueType> regTypes, dag regList> {
981349cc55cSDimitry Andric  let CopyCost = !add(numRegs, numRegs, 1), HasAGPR = 1 in {
982fe6060f1SDimitry Andric    // Define the regular class.
983bdd1243dSDimitry Andric    def "" : VRegClassBase<numRegs, regTypes, regList> {
984bdd1243dSDimitry Andric      let BaseClassOrder = !mul(numRegs, 32);
985bdd1243dSDimitry Andric    }
986fe6060f1SDimitry Andric
987fe6060f1SDimitry Andric    // Define 2-aligned variant
988bdd1243dSDimitry Andric    def _Align2 : VRegClassBase<numRegs, regTypes, (decimate regList, 2)> {
989bdd1243dSDimitry Andric      // Give aligned class higher priority in base class resolution
990bdd1243dSDimitry Andric      let BaseClassOrder = !sub(!mul(numRegs, 32), 1);
99106c3fb27SDimitry Andric      let RegTupleAlignUnits = 2;
992bdd1243dSDimitry Andric    }
993fe6060f1SDimitry Andric  }
994fe6060f1SDimitry Andric}
995fe6060f1SDimitry Andric
996fe6060f1SDimitry Andricdefm AReg_64 : ARegClass<2, [i64, f64, v2i32, v2f32, v4f16, v4i16],
9975ffd83dbSDimitry Andric                        (add AGPR_64)>;
998fe6060f1SDimitry Andricdefm AReg_96 : ARegClass<3, [v3i32, v3f32], (add AGPR_96)>;
999647cbc5dSDimitry Andricdefm AReg_128 : ARegClass<4, [v4i32, v4f32, v2i64, v2f64, v8i16, v8f16, v8bf16], (add AGPR_128)>;
1000fe6060f1SDimitry Andricdefm AReg_160 : ARegClass<5, [v5i32, v5f32], (add AGPR_160)>;
1001fe6060f1SDimitry Andricdefm AReg_192 : ARegClass<6, [v6i32, v6f32, v3i64, v3f64], (add AGPR_192)>;
1002fe6060f1SDimitry Andricdefm AReg_224 : ARegClass<7, [v7i32, v7f32], (add AGPR_224)>;
1003fe6060f1SDimitry Andricdefm AReg_256 : ARegClass<8, [v8i32, v8f32, v4i64, v4f64], (add AGPR_256)>;
1004bdd1243dSDimitry Andricdefm AReg_288 : ARegClass<9, [v9i32, v9f32], (add AGPR_288)>;
1005bdd1243dSDimitry Andricdefm AReg_320 : ARegClass<10, [v10i32, v10f32], (add AGPR_320)>;
1006bdd1243dSDimitry Andricdefm AReg_352 : ARegClass<11, [v11i32, v11f32], (add AGPR_352)>;
1007bdd1243dSDimitry Andricdefm AReg_384 : ARegClass<12, [v12i32, v12f32], (add AGPR_384)>;
1008bdd1243dSDimitry Andric
1009bdd1243dSDimitry Andriclet GlobalPriority = true in {
1010fe6060f1SDimitry Andricdefm AReg_512 : ARegClass<16, [v16i32, v16f32, v8i64, v8f64], (add AGPR_512)>;
1011fe6060f1SDimitry Andricdefm AReg_1024 : ARegClass<32, [v32i32, v32f32, v16i64, v16f64], (add AGPR_1024)>;
1012bdd1243dSDimitry Andric}
10130b57cec5SDimitry Andric
10145ffd83dbSDimitry Andric} // End GeneratePressureSet = 0
1015480093f4SDimitry Andric
10165ffd83dbSDimitry Andriclet GeneratePressureSet = 0 in {
101781ad6265SDimitry Andric// No register should ever be allocated using VReg_1. This is a hack for
101881ad6265SDimitry Andric// SelectionDAG that should always be lowered by SILowerI1Copies.  TableGen
101981ad6265SDimitry Andric// sorts register classes based on the number of registers in them so this is
1020480093f4SDimitry Andric// sorted to the end and not preferred over VGPR_32.
102181ad6265SDimitry Andricdef VReg_1 : SIRegisterClass<"AMDGPU", [i1], 32, (add)> {
10228bcb0991SDimitry Andric  let Size = 1;
1023349cc55cSDimitry Andric  let HasVGPR = 1;
10240b57cec5SDimitry Andric}
10250b57cec5SDimitry Andric
10265f757f3fSDimitry Andricdef VS_16 : SIRegisterClass<"AMDGPU", Reg16Types.types, 16,
10275f757f3fSDimitry Andric                          (add VGPR_16, SReg_32, LDS_DIRECT_CLASS)> {
10285f757f3fSDimitry Andric  let isAllocatable = 0;
10295f757f3fSDimitry Andric  let HasVGPR = 1;
10305f757f3fSDimitry Andric}
10315f757f3fSDimitry Andric
10325f757f3fSDimitry Andricdef VS_16_Lo128 : SIRegisterClass<"AMDGPU", Reg16Types.types, 16,
10335f757f3fSDimitry Andric                          (add VGPR_16_Lo128, SReg_32, LDS_DIRECT_CLASS)> {
10345f757f3fSDimitry Andric  let isAllocatable = 0;
10355f757f3fSDimitry Andric  let HasVGPR = 1;
10365f757f3fSDimitry Andric}
10375f757f3fSDimitry Andric
1038647cbc5dSDimitry Andricdef VS_32 : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16], 32,
10398bcb0991SDimitry Andric                          (add VGPR_32, SReg_32, LDS_DIRECT_CLASS)> {
10400b57cec5SDimitry Andric  let isAllocatable = 0;
1041349cc55cSDimitry Andric  let HasVGPR = 1;
10424824e7fdSDimitry Andric  let HasSGPR = 1;
10430b57cec5SDimitry Andric}
10440b57cec5SDimitry Andric
1045647cbc5dSDimitry Andricdef VS_32_Lo128 : SIRegisterClass<"AMDGPU", [i32, f32, i16, f16, bf16, v2i16, v2f16, v2bf16], 32,
1046bdd1243dSDimitry Andric                          (add VGPR_32_Lo128, SReg_32, LDS_DIRECT_CLASS)> {
1047bdd1243dSDimitry Andric  let isAllocatable = 0;
1048bdd1243dSDimitry Andric  let HasVGPR = 1;
1049bdd1243dSDimitry Andric  let HasSGPR = 1;
1050bdd1243dSDimitry Andric}
1051bdd1243dSDimitry Andric
1052*0fca6ea1SDimitry Andricdef VS_64 : SIRegisterClass<"AMDGPU", VReg_64.RegTypes, 32, (add VReg_64, SReg_64)> {
10530b57cec5SDimitry Andric  let isAllocatable = 0;
1054349cc55cSDimitry Andric  let HasVGPR = 1;
10554824e7fdSDimitry Andric  let HasSGPR = 1;
10560b57cec5SDimitry Andric}
10570b57cec5SDimitry Andric
10584824e7fdSDimitry Andricdef AV_32 : SIRegisterClass<"AMDGPU", VGPR_32.RegTypes, 32, (add VGPR_32, AGPR_32)> {
1059349cc55cSDimitry Andric  let HasVGPR = 1;
1060349cc55cSDimitry Andric  let HasAGPR = 1;
10610b57cec5SDimitry Andric}
10625ffd83dbSDimitry Andric} // End GeneratePressureSet = 0
10630b57cec5SDimitry Andric
10644824e7fdSDimitry Andric// Define a register tuple class, along with one requiring an even
10654824e7fdSDimitry Andric// aligned base register.
10664824e7fdSDimitry Andricmulticlass AVRegClass<int numRegs, list<ValueType> regTypes,
10674824e7fdSDimitry Andric                      dag vregList,  dag aregList> {
1068349cc55cSDimitry Andric  let HasVGPR = 1, HasAGPR = 1 in {
10694824e7fdSDimitry Andric    // Define the regular class.
10704824e7fdSDimitry Andric    def "" : VRegClassBase<numRegs, regTypes, (add vregList, aregList)>;
10714824e7fdSDimitry Andric
10724824e7fdSDimitry Andric    // Define 2-aligned variant
10734824e7fdSDimitry Andric    def _Align2 : VRegClassBase<numRegs, regTypes,
10744824e7fdSDimitry Andric                                (add (decimate vregList, 2),
107506c3fb27SDimitry Andric                                     (decimate aregList, 2))> {
107606c3fb27SDimitry Andric      let RegTupleAlignUnits = 2;
107706c3fb27SDimitry Andric    }
10784824e7fdSDimitry Andric  }
1079fe6060f1SDimitry Andric}
1080fe6060f1SDimitry Andric
10814824e7fdSDimitry Andricdefm AV_64 : AVRegClass<2, VReg_64.RegTypes, (add VGPR_64), (add AGPR_64)>;
10824824e7fdSDimitry Andricdefm AV_96 : AVRegClass<3, VReg_96.RegTypes, (add VGPR_96), (add AGPR_96)>;
10834824e7fdSDimitry Andricdefm AV_128 : AVRegClass<4, VReg_128.RegTypes, (add VGPR_128), (add AGPR_128)>;
10844824e7fdSDimitry Andricdefm AV_160 : AVRegClass<5, VReg_160.RegTypes, (add VGPR_160), (add AGPR_160)>;
108581ad6265SDimitry Andricdefm AV_192 : AVRegClass<6, VReg_192.RegTypes, (add VGPR_192), (add AGPR_192)>;
108681ad6265SDimitry Andricdefm AV_224 : AVRegClass<7, VReg_224.RegTypes, (add VGPR_224), (add AGPR_224)>;
108781ad6265SDimitry Andricdefm AV_256 : AVRegClass<8, VReg_256.RegTypes, (add VGPR_256), (add AGPR_256)>;
1088bdd1243dSDimitry Andricdefm AV_288 : AVRegClass<9, VReg_288.RegTypes, (add VGPR_288), (add AGPR_288)>;
1089bdd1243dSDimitry Andricdefm AV_320 : AVRegClass<10, VReg_320.RegTypes, (add VGPR_320), (add AGPR_320)>;
1090bdd1243dSDimitry Andricdefm AV_352 : AVRegClass<11, VReg_352.RegTypes, (add VGPR_352), (add AGPR_352)>;
1091bdd1243dSDimitry Andricdefm AV_384 : AVRegClass<12, VReg_384.RegTypes, (add VGPR_384), (add AGPR_384)>;
1092bdd1243dSDimitry Andric
1093bdd1243dSDimitry Andriclet GlobalPriority = true in {
109481ad6265SDimitry Andricdefm AV_512 : AVRegClass<16, VReg_512.RegTypes, (add VGPR_512), (add AGPR_512)>;
109581ad6265SDimitry Andricdefm AV_1024 : AVRegClass<32, VReg_1024.RegTypes, (add VGPR_1024), (add AGPR_1024)>;
1096bdd1243dSDimitry Andric}
1097fe6060f1SDimitry Andric
10980b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
10990b57cec5SDimitry Andric//  Register operands
11000b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11010b57cec5SDimitry Andric
11020b57cec5SDimitry Andricclass RegImmMatcher<string name> : AsmOperandClass {
11030b57cec5SDimitry Andric  let Name = name;
11040b57cec5SDimitry Andric  let RenderMethod = "addRegOrImmOperands";
11050b57cec5SDimitry Andric}
11060b57cec5SDimitry Andric
1107*0fca6ea1SDimitry Andricclass RegOrImmOperand <RegisterClass RegClass, string OperandTypeName>
1108*0fca6ea1SDimitry Andric  : RegisterOperand<RegClass> {
110906c3fb27SDimitry Andric    let OperandNamespace = "AMDGPU";
111006c3fb27SDimitry Andric    let OperandType = OperandTypeName;
1111*0fca6ea1SDimitry Andric    let ParserMatchClass = RegImmMatcher<!subst("_Deferred", "", NAME)>;
1112bdd1243dSDimitry Andric}
1113bdd1243dSDimitry Andric
1114*0fca6ea1SDimitry Andric// Should be in sync with the OperandSemantics defined in SIDefines.h
1115*0fca6ea1SDimitry Andricdef OperandSemantics {
1116*0fca6ea1SDimitry Andric  int INT = 0;
1117*0fca6ea1SDimitry Andric  int FP16 = 1;
1118*0fca6ea1SDimitry Andric  int BF16 = 2;
1119*0fca6ea1SDimitry Andric  int FP32 = 3;
1120*0fca6ea1SDimitry Andric  int FP64 = 4;
11215f757f3fSDimitry Andric}
11225f757f3fSDimitry Andric
11230b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11240b57cec5SDimitry Andric//  SSrc_* Operands with an SGPR or a 32-bit immediate
11250b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11260b57cec5SDimitry Andric
1127*0fca6ea1SDimitry Andricclass SrcRegOrImm9<RegisterClass regClass, string opWidth, string operandType,
1128*0fca6ea1SDimitry Andric                   int immWidth, int OperandSemantics>
1129*0fca6ea1SDimitry Andric    : RegOrImmOperand<regClass, operandType> {
1130*0fca6ea1SDimitry Andric  let DecoderMethod = "decodeSrcRegOrImm9<AMDGPUDisassembler::" # opWidth #
1131*0fca6ea1SDimitry Andric                      ", " # immWidth # ", " # OperandSemantics # ">";
1132*0fca6ea1SDimitry Andric}
11330b57cec5SDimitry Andric
1134*0fca6ea1SDimitry Andricdef SSrc_b16 : SrcRegOrImm9 <SReg_32, "OPW32", "OPERAND_REG_IMM_INT16", 16, OperandSemantics.INT>;
1135*0fca6ea1SDimitry Andricdef SSrc_bf16: SrcRegOrImm9 <SReg_32, "OPW32", "OPERAND_REG_IMM_BF16", 16, OperandSemantics.BF16>;
1136*0fca6ea1SDimitry Andricdef SSrc_f16 : SrcRegOrImm9 <SReg_32, "OPW32", "OPERAND_REG_IMM_FP16", 16, OperandSemantics.FP16>;
1137*0fca6ea1SDimitry Andricdef SSrc_b32 : SrcRegOrImm9 <SReg_32, "OPW32", "OPERAND_REG_IMM_INT32", 32, OperandSemantics.INT>;
1138*0fca6ea1SDimitry Andricdef SSrc_f32 : SrcRegOrImm9 <SReg_32, "OPW32", "OPERAND_REG_IMM_FP32", 32, OperandSemantics.FP32>;
1139*0fca6ea1SDimitry Andricdef SSrc_b64 : SrcRegOrImm9 <SReg_64, "OPW64", "OPERAND_REG_IMM_INT64", 64, OperandSemantics.INT>;
1140*0fca6ea1SDimitry Andric
1141*0fca6ea1SDimitry Andricdef SSrcOrLds_b32 : SrcRegOrImm9 <SRegOrLds_32, "OPW32", "OPERAND_REG_IMM_INT32", 32, OperandSemantics.INT>;
11420b57cec5SDimitry Andric
11430b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11445f757f3fSDimitry Andric//  SSrc_32_Deferred Operands with an SGPR or a 32-bit immediate for use with
11455f757f3fSDimitry Andric//  FMAMK/FMAAK
11465f757f3fSDimitry Andric//===----------------------------------------------------------------------===//
11475f757f3fSDimitry Andric
1148*0fca6ea1SDimitry Andricclass SrcRegOrImmDeferred9<RegisterClass regClass, string opWidth,
1149*0fca6ea1SDimitry Andric                           string operandType, int immWidth, int OperandSemantics>
1150*0fca6ea1SDimitry Andric    : RegOrImmOperand<regClass, operandType> {
1151*0fca6ea1SDimitry Andric  let DecoderMethod = "decodeSrcRegOrImmDeferred9<AMDGPUDisassembler::" #
1152*0fca6ea1SDimitry Andric                      opWidth # ", " # immWidth # ", " # OperandSemantics # ">";
1153*0fca6ea1SDimitry Andric}
1154*0fca6ea1SDimitry Andric
1155*0fca6ea1SDimitry Andricdef SSrc_f32_Deferred : SrcRegOrImmDeferred9<SReg_32, "OPW32", "OPERAND_REG_IMM_FP32_DEFERRED", 32, OperandSemantics.FP32>;
11565f757f3fSDimitry Andric
11575f757f3fSDimitry Andric//===----------------------------------------------------------------------===//
11580b57cec5SDimitry Andric//  SCSrc_* Operands with an SGPR or a inline constant
11590b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11600b57cec5SDimitry Andric
1161*0fca6ea1SDimitry Andricdef SCSrc_b32 : SrcRegOrImm9 <SReg_32, "OPW32", "OPERAND_REG_INLINE_C_INT32", 32, OperandSemantics.INT>;
1162*0fca6ea1SDimitry Andricdef SCSrc_b64 : SrcRegOrImm9 <SReg_64, "OPW64", "OPERAND_REG_INLINE_C_INT64", 64, OperandSemantics.INT>;
11630b57cec5SDimitry Andric
11640b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11650b57cec5SDimitry Andric//  VSrc_* Operands with an SGPR, VGPR or a 32-bit immediate
11660b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11670b57cec5SDimitry Andric
11685f757f3fSDimitry Andric// The current and temporary future default used case for VOP3.
1169*0fca6ea1SDimitry Andricdef VSrc_b16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_IMM_INT16", 16, OperandSemantics.INT>;
1170*0fca6ea1SDimitry Andricdef VSrc_bf16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_IMM_BF16", 16, OperandSemantics.BF16>;
1171*0fca6ea1SDimitry Andricdef VSrc_f16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_IMM_FP16", 16, OperandSemantics.FP16>;
11725f757f3fSDimitry Andric
11735f757f3fSDimitry Andric// True16 VOP3 operands.
1174*0fca6ea1SDimitry Andricdef VSrcT_b16 : RegOrImmOperand <VS_16, "OPERAND_REG_IMM_INT16"> {
1175*0fca6ea1SDimitry Andric  let EncoderMethod = "getMachineOpValueT16";
11765f757f3fSDimitry Andric  let DecoderMethod = "decodeOperand_VSrcT16";
11775f757f3fSDimitry Andric}
1178*0fca6ea1SDimitry Andricdef VSrcT_bf16 : RegOrImmOperand <VS_16, "OPERAND_REG_IMM_BF16"> {
1179*0fca6ea1SDimitry Andric  let EncoderMethod = "getMachineOpValueT16";
1180*0fca6ea1SDimitry Andric  let DecoderMethod = "decodeOperand_VSrcT16";
1181*0fca6ea1SDimitry Andric}
1182*0fca6ea1SDimitry Andricdef VSrcT_f16 : RegOrImmOperand <VS_16, "OPERAND_REG_IMM_FP16"> {
1183*0fca6ea1SDimitry Andric  let EncoderMethod = "getMachineOpValueT16";
11845f757f3fSDimitry Andric  let DecoderMethod = "decodeOperand_VSrcT16";
11855f757f3fSDimitry Andric}
11865f757f3fSDimitry Andric
11875f757f3fSDimitry Andric// True16 VOP1/2/C operands.
1188*0fca6ea1SDimitry Andricdef VSrcT_b16_Lo128 : RegOrImmOperand <VS_16_Lo128, "OPERAND_REG_IMM_INT16"> {
1189*0fca6ea1SDimitry Andric  let EncoderMethod = "getMachineOpValueT16Lo128";
11905f757f3fSDimitry Andric  let DecoderMethod = "decodeOperand_VSrcT16_Lo128";
11915f757f3fSDimitry Andric}
1192*0fca6ea1SDimitry Andricdef VSrcT_bf16_Lo128 : RegOrImmOperand <VS_16_Lo128, "OPERAND_REG_IMM_BF16"> {
1193*0fca6ea1SDimitry Andric  let EncoderMethod = "getMachineOpValueT16Lo128";
1194*0fca6ea1SDimitry Andric  let DecoderMethod = "decodeOperand_VSrcT16_Lo128";
1195*0fca6ea1SDimitry Andric}
1196*0fca6ea1SDimitry Andricdef VSrcT_f16_Lo128 : RegOrImmOperand <VS_16_Lo128, "OPERAND_REG_IMM_FP16"> {
1197*0fca6ea1SDimitry Andric  let EncoderMethod = "getMachineOpValueT16Lo128";
11985f757f3fSDimitry Andric  let DecoderMethod = "decodeOperand_VSrcT16_Lo128";
11995f757f3fSDimitry Andric}
12005f757f3fSDimitry Andric
12015f757f3fSDimitry Andric// The current and temporary future default used case for fake VOP1/2/C.
1202*0fca6ea1SDimitry Andric// For VOP1,2,C True16 instructions. _Lo128 use first 128 32-bit VGPRs only.
1203*0fca6ea1SDimitry Andricdef VSrcFake16_b16_Lo128 : SrcRegOrImm9 <VS_32_Lo128, "OPW16", "OPERAND_REG_IMM_INT16", 16, OperandSemantics.INT>;
1204*0fca6ea1SDimitry Andricdef VSrcFake16_bf16_Lo128 : SrcRegOrImm9 <VS_32_Lo128, "OPW16", "OPERAND_REG_IMM_BF16", 16, OperandSemantics.BF16>;
1205*0fca6ea1SDimitry Andricdef VSrcFake16_f16_Lo128 : SrcRegOrImm9 <VS_32_Lo128, "OPW16", "OPERAND_REG_IMM_FP16", 16, OperandSemantics.FP16>;
12065f757f3fSDimitry Andric
1207*0fca6ea1SDimitry Andricdef VSrc_b32 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_IMM_INT32", 32, OperandSemantics.INT>;
1208*0fca6ea1SDimitry Andricdef VSrc_f32 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_IMM_FP32", 32, OperandSemantics.FP32>;
1209*0fca6ea1SDimitry Andricdef VSrc_v2b16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_IMM_V2INT16", 32, OperandSemantics.INT>;
1210*0fca6ea1SDimitry Andricdef VSrc_v2bf16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_IMM_V2BF16", 16, OperandSemantics.BF16>;
1211*0fca6ea1SDimitry Andricdef VSrc_v2f16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_IMM_V2FP16", 16, OperandSemantics.FP16>;
1212*0fca6ea1SDimitry Andricdef VSrc_b64 : SrcRegOrImm9 <VS_64, "OPW64", "OPERAND_REG_IMM_INT64", 64, OperandSemantics.INT>;
1213*0fca6ea1SDimitry Andricdef VSrc_f64 : SrcRegOrImm9 <VS_64, "OPW64", "OPERAND_REG_IMM_FP64", 64, OperandSemantics.FP64> {
12145f757f3fSDimitry Andric  let DecoderMethod = "decodeOperand_VSrc_f64";
12155f757f3fSDimitry Andric}
1216*0fca6ea1SDimitry Andricdef VSrc_v2b32 : SrcRegOrImm9 <VS_64, "OPW64", "OPERAND_REG_IMM_V2INT32", 32, OperandSemantics.INT>;
1217*0fca6ea1SDimitry Andricdef VSrc_v2f32 : SrcRegOrImm9 <VS_64, "OPW64", "OPERAND_REG_IMM_V2FP32", 32, OperandSemantics.FP32>;
12180b57cec5SDimitry Andric
12190b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
1220349cc55cSDimitry Andric//  VSrc_*_Deferred Operands with an SGPR, VGPR or a 32-bit immediate for use
1221349cc55cSDimitry Andric//  with FMAMK/FMAAK
1222349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
1223349cc55cSDimitry Andric
1224*0fca6ea1SDimitry Andricdef VSrc_bf16_Deferred : SrcRegOrImmDeferred9<VS_32, "OPW16", "OPERAND_REG_IMM_BF16_DEFERRED", 16, OperandSemantics.BF16>;
1225*0fca6ea1SDimitry Andricdef VSrc_f16_Deferred : SrcRegOrImmDeferred9<VS_32, "OPW16", "OPERAND_REG_IMM_FP16_DEFERRED", 16, OperandSemantics.FP16>;
1226*0fca6ea1SDimitry Andricdef VSrc_f32_Deferred : SrcRegOrImmDeferred9<VS_32, "OPW32", "OPERAND_REG_IMM_FP32_DEFERRED", 32, OperandSemantics.FP32>;
1227bdd1243dSDimitry Andric
1228*0fca6ea1SDimitry Andricdef VSrcFake16_bf16_Lo128_Deferred
1229*0fca6ea1SDimitry Andric  : SrcRegOrImmDeferred9<VS_32_Lo128, "OPW16", "OPERAND_REG_IMM_BF16_DEFERRED", 16, OperandSemantics.BF16>;
1230*0fca6ea1SDimitry Andricdef VSrcFake16_f16_Lo128_Deferred
1231*0fca6ea1SDimitry Andric  : SrcRegOrImmDeferred9<VS_32_Lo128, "OPW16", "OPERAND_REG_IMM_FP16_DEFERRED", 16, OperandSemantics.FP16>;
1232349cc55cSDimitry Andric
1233349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
1234fe6060f1SDimitry Andric//  VRegSrc_* Operands with a VGPR
12350b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
12360b57cec5SDimitry Andric
12370b57cec5SDimitry Andric// This is for operands with the enum(9), VSrc encoding restriction,
12380b57cec5SDimitry Andric// but only allows VGPRs.
1239*0fca6ea1SDimitry Andricclass SrcReg9<RegisterClass regClass, string width> : RegisterOperand<regClass> {
1240*0fca6ea1SDimitry Andric  let DecoderMethod = "decodeSrcReg9<AMDGPUDisassembler::" # width # ">";
12410b57cec5SDimitry Andric}
12420b57cec5SDimitry Andric
1243*0fca6ea1SDimitry Andricdef VRegSrc_32 : SrcReg9<VGPR_32, "OPW32">;
1244*0fca6ea1SDimitry Andricdef VRegSrc_64 : SrcReg9<VReg_64, "OPW64">;
1245*0fca6ea1SDimitry Andricdef VRegSrc_96 : SrcReg9<VReg_96, "OPW96">;
1246*0fca6ea1SDimitry Andricdef VRegSrc_128: SrcReg9<VReg_128, "OPW128">;
1247*0fca6ea1SDimitry Andricdef VRegSrc_256: SrcReg9<VReg_256, "OPW256">;
1248*0fca6ea1SDimitry Andricdef VRegOrLdsSrc_32 : SrcReg9<VRegOrLds_32, "OPW32">;
124906c3fb27SDimitry Andric
125081ad6265SDimitry Andric//===----------------------------------------------------------------------===//
125181ad6265SDimitry Andric// VGPRSrc_*
125281ad6265SDimitry Andric//===----------------------------------------------------------------------===//
125381ad6265SDimitry Andric
125481ad6265SDimitry Andric// An 8-bit RegisterOperand wrapper for a VGPR
125581ad6265SDimitry Andricdef VGPRSrc_32 : RegisterOperand<VGPR_32> {
125681ad6265SDimitry Andric  let DecoderMethod = "DecodeVGPR_32RegisterClass";
125781ad6265SDimitry Andric}
1258bdd1243dSDimitry Andricdef VGPRSrc_32_Lo128 : RegisterOperand<VGPR_32_Lo128> {
1259bdd1243dSDimitry Andric  let DecoderMethod = "DecodeVGPR_32RegisterClass";
1260bdd1243dSDimitry Andric}
126181ad6265SDimitry Andric
1262*0fca6ea1SDimitry Andricdef VGPRSrc_96 : RegisterOperand<VReg_96> {
1263*0fca6ea1SDimitry Andric  let DecoderMethod = "DecodeVReg_96RegisterClass";
1264*0fca6ea1SDimitry Andric}
1265*0fca6ea1SDimitry Andric
12665f757f3fSDimitry Andricdef VGPRSrc_16_Lo128 : RegisterOperand<VGPR_16_Lo128> {
12675f757f3fSDimitry Andric  let DecoderMethod = "DecodeVGPR_16_Lo128RegisterClass";
12685f757f3fSDimitry Andric  let EncoderMethod = "getMachineOpValueT16Lo128";
12695f757f3fSDimitry Andric}
12705f757f3fSDimitry Andric
1271*0fca6ea1SDimitry Andric// True 16 operands.
1272*0fca6ea1SDimitry Andricdef VGPRSrc_16 : RegisterOperand<VGPR_16> {
1273*0fca6ea1SDimitry Andric  let DecoderMethod = "DecodeVGPR_16RegisterClass";
1274*0fca6ea1SDimitry Andric  let EncoderMethod = "getMachineOpValueT16";
1275*0fca6ea1SDimitry Andric}
1276*0fca6ea1SDimitry Andric
12770b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
12780b57cec5SDimitry Andric//  ASrc_* Operands with an AccVGPR
12790b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
12800b57cec5SDimitry Andric
1281*0fca6ea1SDimitry Andricclass AVOperand<RegisterClass regClass, string decoder, string width>
1282*0fca6ea1SDimitry Andric    : RegisterOperand<regClass> {
1283*0fca6ea1SDimitry Andric  let DecoderMethod = decoder # "<AMDGPUDisassembler::" # width # ">";
12840b57cec5SDimitry Andric  let EncoderMethod = "getAVOperandEncoding";
12850b57cec5SDimitry Andric}
12860b57cec5SDimitry Andric
1287*0fca6ea1SDimitry Andricdef ARegSrc_32 : AVOperand<AGPR_32, "decodeSrcA9", "OPW32">;
1288*0fca6ea1SDimitry Andric
12890b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
12900b57cec5SDimitry Andric//  VCSrc_* Operands with an SGPR, VGPR or an inline constant
12910b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
12920b57cec5SDimitry Andric
1293*0fca6ea1SDimitry Andricdef VCSrc_b16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_INLINE_C_INT16", 16, OperandSemantics.INT>;
1294*0fca6ea1SDimitry Andricdef VCSrc_bf16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_INLINE_C_BF16", 16, OperandSemantics.BF16>;
1295*0fca6ea1SDimitry Andricdef VCSrc_f16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_INLINE_C_FP16", 16, OperandSemantics.FP16>;
1296*0fca6ea1SDimitry Andricdef VCSrc_b32 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_INLINE_C_INT32", 32, OperandSemantics.INT>;
1297*0fca6ea1SDimitry Andricdef VCSrc_f32 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_INLINE_C_FP32", 32, OperandSemantics.FP32>;
1298*0fca6ea1SDimitry Andricdef VCSrc_v2b16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_INLINE_C_V2INT16", 32, OperandSemantics.INT>;
1299*0fca6ea1SDimitry Andricdef VCSrc_v2bf16: SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_INLINE_C_V2BF16", 16, OperandSemantics.BF16>;
1300*0fca6ea1SDimitry Andricdef VCSrc_v2f16 : SrcRegOrImm9 <VS_32, "OPW32", "OPERAND_REG_INLINE_C_V2FP16", 16, OperandSemantics.FP16>;
13010b57cec5SDimitry Andric
13020b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
13030b57cec5SDimitry Andric//  VISrc_* Operands with a VGPR or an inline constant
13040b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
13050b57cec5SDimitry Andric
1306*0fca6ea1SDimitry Andricdef VISrc_64_bf16 : SrcRegOrImm9 <VReg_64, "OPW64", "OPERAND_REG_INLINE_C_BF16", 16, OperandSemantics.BF16>;
1307*0fca6ea1SDimitry Andricdef VISrc_64_f16 : SrcRegOrImm9 <VReg_64, "OPW64", "OPERAND_REG_INLINE_C_FP16", 16, OperandSemantics.FP16>;
1308*0fca6ea1SDimitry Andricdef VISrc_64_b32 : SrcRegOrImm9 <VReg_64, "OPW64", "OPERAND_REG_INLINE_C_INT32", 32, OperandSemantics.INT>;
1309*0fca6ea1SDimitry Andricdef VISrc_64_f64 : SrcRegOrImm9 <VReg_64, "OPW64", "OPERAND_REG_INLINE_C_FP64", 64, OperandSemantics.FP64>;
1310*0fca6ea1SDimitry Andricdef VISrc_128_bf16 : SrcRegOrImm9 <VReg_128, "OPW128", "OPERAND_REG_INLINE_C_BF16", 16, OperandSemantics.BF16>;
1311*0fca6ea1SDimitry Andricdef VISrc_128_f16 : SrcRegOrImm9 <VReg_128, "OPW128", "OPERAND_REG_INLINE_C_FP16", 16, OperandSemantics.FP16>;
1312*0fca6ea1SDimitry Andricdef VISrc_128_b32 : SrcRegOrImm9 <VReg_128, "OPW128", "OPERAND_REG_INLINE_C_INT32", 32, OperandSemantics.INT>;
1313*0fca6ea1SDimitry Andricdef VISrc_128_f32 : SrcRegOrImm9 <VReg_128, "OPW128", "OPERAND_REG_INLINE_C_FP32", 32, OperandSemantics.FP32>;
1314*0fca6ea1SDimitry Andricdef VISrc_256_b32 : SrcRegOrImm9 <VReg_256, "OPW256", "OPERAND_REG_INLINE_C_INT32", 32, OperandSemantics.INT>;
1315*0fca6ea1SDimitry Andricdef VISrc_256_f32 : SrcRegOrImm9 <VReg_256, "OPW256", "OPERAND_REG_INLINE_C_FP32", 32, OperandSemantics.FP32>;
1316*0fca6ea1SDimitry Andricdef VISrc_256_f64 : SrcRegOrImm9 <VReg_256, "OPW256", "OPERAND_REG_INLINE_C_FP64", 64, OperandSemantics.FP64>;
1317*0fca6ea1SDimitry Andricdef VISrc_512_b32 : SrcRegOrImm9 <VReg_512, "OPW512", "OPERAND_REG_INLINE_C_INT32", 32, OperandSemantics.INT>;
1318*0fca6ea1SDimitry Andricdef VISrc_512_f32 : SrcRegOrImm9 <VReg_512, "OPW512", "OPERAND_REG_INLINE_C_FP32", 32, OperandSemantics.FP32>;
1319*0fca6ea1SDimitry Andricdef VISrc_1024_b32 : SrcRegOrImm9 <VReg_1024, "OPW1024", "OPERAND_REG_INLINE_C_INT32", 32, OperandSemantics.INT>;
1320*0fca6ea1SDimitry Andricdef VISrc_1024_f32 : SrcRegOrImm9 <VReg_1024, "OPW1024", "OPERAND_REG_INLINE_C_FP32", 32, OperandSemantics.FP32>;
13210b57cec5SDimitry Andric
13220b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
132381ad6265SDimitry Andric//  AVSrc_*, AVDst_*, AVLdSt_* Operands with an AGPR or VGPR
13240b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
13250b57cec5SDimitry Andric
1326*0fca6ea1SDimitry Andricclass AVSrcOperand<RegisterClass regClass, string width>
1327*0fca6ea1SDimitry Andric  : AVOperand<regClass, "decodeSrcAV10", width>;
13280b57cec5SDimitry Andric
1329*0fca6ea1SDimitry Andricdef AVSrc_32 : AVSrcOperand<AV_32, "OPW32">;
1330*0fca6ea1SDimitry Andricdef AVSrc_64 : AVSrcOperand<AV_64, "OPW64">;
1331*0fca6ea1SDimitry Andricdef AVSrc_128 : AVSrcOperand<AV_128, "OPW128">;
13320b57cec5SDimitry Andric
1333*0fca6ea1SDimitry Andricclass AVDstOperand<RegisterClass regClass, string width>
1334*0fca6ea1SDimitry Andric  : AVOperand<regClass, "decodeAV10", width>;
133581ad6265SDimitry Andric
1336*0fca6ea1SDimitry Andricdef AVDst_128 : AVDstOperand<AV_128, "OPW128">;
1337*0fca6ea1SDimitry Andricdef AVDst_512 : AVDstOperand<AV_512, "OPW512">;
133881ad6265SDimitry Andric
1339*0fca6ea1SDimitry Andricclass AVLdStOperand<RegisterClass regClass, string width>
1340*0fca6ea1SDimitry Andric  : AVOperand<regClass, "decodeAVLdSt", width>;
134181ad6265SDimitry Andric
1342*0fca6ea1SDimitry Andricdef AVLdSt_32 : AVLdStOperand<AV_32, "OPW32">;
1343*0fca6ea1SDimitry Andricdef AVLdSt_64 : AVLdStOperand<AV_64, "OPW64">;
1344*0fca6ea1SDimitry Andricdef AVLdSt_96 : AVLdStOperand<AV_96, "OPW96">;
1345*0fca6ea1SDimitry Andricdef AVLdSt_128 : AVLdStOperand<AV_128, "OPW128">;
1346*0fca6ea1SDimitry Andricdef AVLdSt_160 : AVLdStOperand<AV_160, "OPW160">;
1347*0fca6ea1SDimitry Andricdef AVLdSt_1024 : AVLdStOperand<AV_1024, "OPW1024">;
1348fe6060f1SDimitry Andric
13490b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
13500b57cec5SDimitry Andric//  ACSrc_* Operands with an AGPR or an inline constant
13510b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
13520b57cec5SDimitry Andric
1353*0fca6ea1SDimitry Andricclass SrcRegOrImmA9<RegisterClass regClass, string opWidth, string operandType,
1354*0fca6ea1SDimitry Andric                    int immWidth, int OperandSemantics>
1355*0fca6ea1SDimitry Andric    : RegOrImmOperand<regClass, operandType> {
1356*0fca6ea1SDimitry Andric  let DecoderMethod = "decodeSrcRegOrImmA9<AMDGPUDisassembler::" # opWidth #
1357*0fca6ea1SDimitry Andric                      ", " # immWidth # ", " # OperandSemantics # ">";
1358*0fca6ea1SDimitry Andric}
1359*0fca6ea1SDimitry Andric
1360*0fca6ea1SDimitry Andricdef AISrc_64_f64 : SrcRegOrImmA9 <AReg_64, "OPW64", "OPERAND_REG_INLINE_AC_FP64", 64, OperandSemantics.FP64>;
1361*0fca6ea1SDimitry Andricdef AISrc_128_f32 : SrcRegOrImmA9 <AReg_128, "OPW128", "OPERAND_REG_INLINE_AC_FP32", 32, OperandSemantics.FP32>;
1362*0fca6ea1SDimitry Andricdef AISrc_128_b32 : SrcRegOrImmA9 <AReg_128, "OPW128", "OPERAND_REG_INLINE_AC_INT32", 32, OperandSemantics.INT>;
1363*0fca6ea1SDimitry Andricdef AISrc_256_f64 : SrcRegOrImmA9 <AReg_256, "OPW256", "OPERAND_REG_INLINE_AC_FP64", 64, OperandSemantics.FP64>;
1364*0fca6ea1SDimitry Andricdef AISrc_512_f32 : SrcRegOrImmA9 <AReg_512, "OPW512", "OPERAND_REG_INLINE_AC_FP32", 32, OperandSemantics.FP32>;
1365*0fca6ea1SDimitry Andricdef AISrc_512_b32 : SrcRegOrImmA9 <AReg_512, "OPW512", "OPERAND_REG_INLINE_AC_INT32", 32, OperandSemantics.INT>;
1366*0fca6ea1SDimitry Andricdef AISrc_1024_f32 : SrcRegOrImmA9 <AReg_1024, "OPW1024", "OPERAND_REG_INLINE_AC_FP32", 32, OperandSemantics.FP32>;
1367*0fca6ea1SDimitry Andricdef AISrc_1024_b32 : SrcRegOrImmA9 <AReg_1024, "OPW1024", "OPERAND_REG_INLINE_AC_INT32", 32, OperandSemantics.INT>;
1368