xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/Utils/AMDGPUAsmUtils.cpp (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
1 //===-- AMDGPUAsmUtils.cpp - AsmParser/InstPrinter common -----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #include "AMDGPUAsmUtils.h"
9 #include "AMDGPUBaseInfo.h"
10 #include "SIDefines.h"
11 
12 namespace llvm {
13 namespace AMDGPU {
14 
15 namespace DepCtr {
16 
17 // NOLINTBEGIN
18 const CustomOperandVal DepCtrInfo[] = {
19   // Name               max dflt offset width  constraint
20   {{"depctr_hold_cnt"},  1,   1,    7,    1,   isGFX10_BEncoding},
21   {{"depctr_sa_sdst"},   1,   1,    0,    1},
22   {{"depctr_va_vdst"},  15,  15,   12,    4},
23   {{"depctr_va_sdst"},   7,   7,    9,    3},
24   {{"depctr_va_ssrc"},   1,   1,    8,    1},
25   {{"depctr_va_vcc"},    1,   1,    1,    1},
26   {{"depctr_vm_vsrc"},   7,   7,    2,    3},
27 };
28 // NOLINTEND
29 
30 const int DEP_CTR_SIZE =
31     static_cast<int>(sizeof(DepCtrInfo) / sizeof(CustomOperandVal));
32 
33 } // namespace DepCtr
34 
35 namespace SendMsg {
36 
37 // Disable lint checking for this block since it makes the table unreadable.
38 // NOLINTBEGIN
39 // clang-format off
40 const CustomOperand<const MCSubtargetInfo &> Msg[] = {
41   {{""}},
42   {{"MSG_INTERRUPT"},           ID_INTERRUPT},
43   {{"MSG_GS"},                  ID_GS_PreGFX11,             isNotGFX11Plus},
44   {{"MSG_GS_DONE"},             ID_GS_DONE_PreGFX11,        isNotGFX11Plus},
45   {{"MSG_SAVEWAVE"},            ID_SAVEWAVE,                isGFX8_GFX9_GFX10},
46   {{"MSG_STALL_WAVE_GEN"},      ID_STALL_WAVE_GEN,          isGFX9_GFX10_GFX11},
47   {{"MSG_HALT_WAVES"},          ID_HALT_WAVES,              isGFX9_GFX10_GFX11},
48   {{"MSG_ORDERED_PS_DONE"},     ID_ORDERED_PS_DONE,         isGFX9_GFX10},
49   {{"MSG_EARLY_PRIM_DEALLOC"},  ID_EARLY_PRIM_DEALLOC,      isGFX9_GFX10},
50   {{"MSG_GS_ALLOC_REQ"},        ID_GS_ALLOC_REQ,            isGFX9Plus},
51   {{"MSG_GET_DOORBELL"},        ID_GET_DOORBELL,            isGFX9_GFX10},
52   {{"MSG_GET_DDID"},            ID_GET_DDID,                isGFX10},
53   {{"MSG_HS_TESSFACTOR"},       ID_HS_TESSFACTOR_GFX11Plus, isGFX11Plus},
54   {{"MSG_DEALLOC_VGPRS"},       ID_DEALLOC_VGPRS_GFX11Plus, isGFX11Plus},
55   {{""}},
56   {{"MSG_SYSMSG"},              ID_SYSMSG},
57   {{"MSG_RTN_GET_DOORBELL"},    ID_RTN_GET_DOORBELL,        isGFX11Plus},
58   {{"MSG_RTN_GET_DDID"},        ID_RTN_GET_DDID,            isGFX11Plus},
59   {{"MSG_RTN_GET_TMA"},         ID_RTN_GET_TMA,             isGFX11Plus},
60   {{"MSG_RTN_GET_REALTIME"},    ID_RTN_GET_REALTIME,        isGFX11Plus},
61   {{"MSG_RTN_SAVE_WAVE"},       ID_RTN_SAVE_WAVE,           isGFX11Plus},
62   {{"MSG_RTN_GET_TBA"},         ID_RTN_GET_TBA,             isGFX11Plus},
63   {{"MSG_RTN_GET_SE_AID_ID"},   ID_RTN_GET_SE_AID_ID,       isGFX12Plus},
64 };
65 // clang-format on
66 // NOLINTEND
67 
68 const int MSG_SIZE = static_cast<int>(
69     sizeof(Msg) / sizeof(CustomOperand<const MCSubtargetInfo &>));
70 
71 // These two must be in sync with llvm::AMDGPU::SendMsg::Op enum members, see SIDefines.h.
72 const char *const OpSysSymbolic[OP_SYS_LAST_] = {
73   nullptr,
74   "SYSMSG_OP_ECC_ERR_INTERRUPT",
75   "SYSMSG_OP_REG_RD",
76   "SYSMSG_OP_HOST_TRAP_ACK",
77   "SYSMSG_OP_TTRACE_PC"
78 };
79 
80 const char *const OpGsSymbolic[OP_GS_LAST_] = {
81   "GS_OP_NOP",
82   "GS_OP_CUT",
83   "GS_OP_EMIT",
84   "GS_OP_EMIT_CUT"
85 };
86 
87 } // namespace SendMsg
88 
89 namespace Hwreg {
90 
91 // Disable lint checking for this block since it makes the table unreadable.
92 // NOLINTBEGIN
93 // clang-format off
94 const CustomOperand<const MCSubtargetInfo &> Opr[] = {
95   {{""}},
96   {{"HW_REG_MODE"},          ID_MODE},
97   {{"HW_REG_STATUS"},        ID_STATUS},
98   {{"HW_REG_TRAPSTS"},       ID_TRAPSTS,     isNotGFX12Plus},
99   {{"HW_REG_HW_ID"},         ID_HW_ID,       isNotGFX10Plus},
100   {{"HW_REG_GPR_ALLOC"},     ID_GPR_ALLOC},
101   {{"HW_REG_LDS_ALLOC"},     ID_LDS_ALLOC},
102   {{"HW_REG_IB_STS"},        ID_IB_STS},
103   {{""}},
104   {{""}},
105   {{"HW_REG_PERF_SNAPSHOT_DATA"},  ID_PERF_SNAPSHOT_DATA_gfx12,  isGFX12Plus},
106   {{"HW_REG_PERF_SNAPSHOT_PC_LO"}, ID_PERF_SNAPSHOT_PC_LO_gfx12, isGFX12Plus},
107   {{"HW_REG_PERF_SNAPSHOT_PC_HI"}, ID_PERF_SNAPSHOT_PC_HI_gfx12, isGFX12Plus},
108   {{""}},
109   {{""}},
110   {{"HW_REG_SH_MEM_BASES"},  ID_MEM_BASES,   isGFX9_GFX10_GFX11},
111   {{"HW_REG_TBA_LO"},        ID_TBA_LO,      isGFX9_GFX10},
112   {{"HW_REG_TBA_HI"},        ID_TBA_HI,      isGFX9_GFX10},
113   {{"HW_REG_TMA_LO"},        ID_TMA_LO,      isGFX9_GFX10},
114   {{"HW_REG_TMA_HI"},        ID_TMA_HI,      isGFX9_GFX10},
115   {{"HW_REG_FLAT_SCR_LO"},   ID_FLAT_SCR_LO, isGFX10_GFX11},
116   {{"HW_REG_FLAT_SCR_HI"},   ID_FLAT_SCR_HI, isGFX10_GFX11},
117   {{"HW_REG_XNACK_MASK"},    ID_XNACK_MASK,  isGFX10Before1030},
118   {{"HW_REG_HW_ID1"},        ID_HW_ID1,      isGFX10Plus},
119   {{"HW_REG_HW_ID2"},        ID_HW_ID2,      isGFX10Plus},
120   {{"HW_REG_POPS_PACKER"},   ID_POPS_PACKER, isGFX10},
121   {{""}},
122   {{"HW_REG_PERF_SNAPSHOT_DATA"}, ID_PERF_SNAPSHOT_DATA_gfx11, isGFX11},
123   {{""}},
124   {{"HW_REG_SHADER_CYCLES"},    ID_SHADER_CYCLES,    isGFX10_3_GFX11},
125   {{"HW_REG_SHADER_CYCLES_HI"}, ID_SHADER_CYCLES_HI, isGFX12Plus},
126   {{"HW_REG_DVGPR_ALLOC_LO"},   ID_DVGPR_ALLOC_LO,   isGFX12Plus},
127   {{"HW_REG_DVGPR_ALLOC_HI"},   ID_DVGPR_ALLOC_HI,   isGFX12Plus},
128 
129   // Register numbers reused in GFX11
130   {{"HW_REG_PERF_SNAPSHOT_PC_LO"}, ID_PERF_SNAPSHOT_PC_LO_gfx11, isGFX11},
131   {{"HW_REG_PERF_SNAPSHOT_PC_HI"}, ID_PERF_SNAPSHOT_PC_HI_gfx11, isGFX11},
132 
133   // Register numbers reused in GFX12+
134   {{"HW_REG_STATE_PRIV"},          ID_STATE_PRIV,          isGFX12Plus},
135   {{"HW_REG_PERF_SNAPSHOT_DATA1"}, ID_PERF_SNAPSHOT_DATA1, isGFX12Plus},
136   {{"HW_REG_PERF_SNAPSHOT_DATA2"}, ID_PERF_SNAPSHOT_DATA2, isGFX12Plus},
137   {{"HW_REG_EXCP_FLAG_PRIV"},      ID_EXCP_FLAG_PRIV,      isGFX12Plus},
138   {{"HW_REG_EXCP_FLAG_USER"},      ID_EXCP_FLAG_USER,      isGFX12Plus},
139   {{"HW_REG_TRAP_CTRL"},           ID_TRAP_CTRL,           isGFX12Plus},
140   {{"HW_REG_SCRATCH_BASE_LO"},     ID_FLAT_SCR_LO,         isGFX12Plus},
141   {{"HW_REG_SCRATCH_BASE_HI"},     ID_FLAT_SCR_HI,         isGFX12Plus},
142   {{"HW_REG_SHADER_CYCLES_LO"},    ID_SHADER_CYCLES,       isGFX12Plus},
143 
144   // GFX940 specific registers
145   {{"HW_REG_XCC_ID"},                 ID_XCC_ID,                 isGFX940},
146   {{"HW_REG_SQ_PERF_SNAPSHOT_DATA"},  ID_SQ_PERF_SNAPSHOT_DATA,  isGFX940},
147   {{"HW_REG_SQ_PERF_SNAPSHOT_DATA1"}, ID_SQ_PERF_SNAPSHOT_DATA1, isGFX940},
148   {{"HW_REG_SQ_PERF_SNAPSHOT_PC_LO"}, ID_SQ_PERF_SNAPSHOT_PC_LO, isGFX940},
149   {{"HW_REG_SQ_PERF_SNAPSHOT_PC_HI"}, ID_SQ_PERF_SNAPSHOT_PC_HI, isGFX940},
150 
151   // Aliases
152   {{"HW_REG_HW_ID"},                  ID_HW_ID1,                 isGFX10},
153 };
154 // clang-format on
155 // NOLINTEND
156 
157 const int OPR_SIZE = static_cast<int>(
158     sizeof(Opr) / sizeof(CustomOperand<const MCSubtargetInfo &>));
159 
160 } // namespace Hwreg
161 
162 namespace MTBUFFormat {
163 
164 StringLiteral const DfmtSymbolic[] = {
165   "BUF_DATA_FORMAT_INVALID",
166   "BUF_DATA_FORMAT_8",
167   "BUF_DATA_FORMAT_16",
168   "BUF_DATA_FORMAT_8_8",
169   "BUF_DATA_FORMAT_32",
170   "BUF_DATA_FORMAT_16_16",
171   "BUF_DATA_FORMAT_10_11_11",
172   "BUF_DATA_FORMAT_11_11_10",
173   "BUF_DATA_FORMAT_10_10_10_2",
174   "BUF_DATA_FORMAT_2_10_10_10",
175   "BUF_DATA_FORMAT_8_8_8_8",
176   "BUF_DATA_FORMAT_32_32",
177   "BUF_DATA_FORMAT_16_16_16_16",
178   "BUF_DATA_FORMAT_32_32_32",
179   "BUF_DATA_FORMAT_32_32_32_32",
180   "BUF_DATA_FORMAT_RESERVED_15"
181 };
182 
183 StringLiteral const NfmtSymbolicGFX10[] = {
184   "BUF_NUM_FORMAT_UNORM",
185   "BUF_NUM_FORMAT_SNORM",
186   "BUF_NUM_FORMAT_USCALED",
187   "BUF_NUM_FORMAT_SSCALED",
188   "BUF_NUM_FORMAT_UINT",
189   "BUF_NUM_FORMAT_SINT",
190   "",
191   "BUF_NUM_FORMAT_FLOAT"
192 };
193 
194 StringLiteral const NfmtSymbolicSICI[] = {
195   "BUF_NUM_FORMAT_UNORM",
196   "BUF_NUM_FORMAT_SNORM",
197   "BUF_NUM_FORMAT_USCALED",
198   "BUF_NUM_FORMAT_SSCALED",
199   "BUF_NUM_FORMAT_UINT",
200   "BUF_NUM_FORMAT_SINT",
201   "BUF_NUM_FORMAT_SNORM_OGL",
202   "BUF_NUM_FORMAT_FLOAT"
203 };
204 
205 StringLiteral const NfmtSymbolicVI[] = {    // VI and GFX9
206   "BUF_NUM_FORMAT_UNORM",
207   "BUF_NUM_FORMAT_SNORM",
208   "BUF_NUM_FORMAT_USCALED",
209   "BUF_NUM_FORMAT_SSCALED",
210   "BUF_NUM_FORMAT_UINT",
211   "BUF_NUM_FORMAT_SINT",
212   "BUF_NUM_FORMAT_RESERVED_6",
213   "BUF_NUM_FORMAT_FLOAT"
214 };
215 
216 StringLiteral const UfmtSymbolicGFX10[] = {
217   "BUF_FMT_INVALID",
218 
219   "BUF_FMT_8_UNORM",
220   "BUF_FMT_8_SNORM",
221   "BUF_FMT_8_USCALED",
222   "BUF_FMT_8_SSCALED",
223   "BUF_FMT_8_UINT",
224   "BUF_FMT_8_SINT",
225 
226   "BUF_FMT_16_UNORM",
227   "BUF_FMT_16_SNORM",
228   "BUF_FMT_16_USCALED",
229   "BUF_FMT_16_SSCALED",
230   "BUF_FMT_16_UINT",
231   "BUF_FMT_16_SINT",
232   "BUF_FMT_16_FLOAT",
233 
234   "BUF_FMT_8_8_UNORM",
235   "BUF_FMT_8_8_SNORM",
236   "BUF_FMT_8_8_USCALED",
237   "BUF_FMT_8_8_SSCALED",
238   "BUF_FMT_8_8_UINT",
239   "BUF_FMT_8_8_SINT",
240 
241   "BUF_FMT_32_UINT",
242   "BUF_FMT_32_SINT",
243   "BUF_FMT_32_FLOAT",
244 
245   "BUF_FMT_16_16_UNORM",
246   "BUF_FMT_16_16_SNORM",
247   "BUF_FMT_16_16_USCALED",
248   "BUF_FMT_16_16_SSCALED",
249   "BUF_FMT_16_16_UINT",
250   "BUF_FMT_16_16_SINT",
251   "BUF_FMT_16_16_FLOAT",
252 
253   "BUF_FMT_10_11_11_UNORM",
254   "BUF_FMT_10_11_11_SNORM",
255   "BUF_FMT_10_11_11_USCALED",
256   "BUF_FMT_10_11_11_SSCALED",
257   "BUF_FMT_10_11_11_UINT",
258   "BUF_FMT_10_11_11_SINT",
259   "BUF_FMT_10_11_11_FLOAT",
260 
261   "BUF_FMT_11_11_10_UNORM",
262   "BUF_FMT_11_11_10_SNORM",
263   "BUF_FMT_11_11_10_USCALED",
264   "BUF_FMT_11_11_10_SSCALED",
265   "BUF_FMT_11_11_10_UINT",
266   "BUF_FMT_11_11_10_SINT",
267   "BUF_FMT_11_11_10_FLOAT",
268 
269   "BUF_FMT_10_10_10_2_UNORM",
270   "BUF_FMT_10_10_10_2_SNORM",
271   "BUF_FMT_10_10_10_2_USCALED",
272   "BUF_FMT_10_10_10_2_SSCALED",
273   "BUF_FMT_10_10_10_2_UINT",
274   "BUF_FMT_10_10_10_2_SINT",
275 
276   "BUF_FMT_2_10_10_10_UNORM",
277   "BUF_FMT_2_10_10_10_SNORM",
278   "BUF_FMT_2_10_10_10_USCALED",
279   "BUF_FMT_2_10_10_10_SSCALED",
280   "BUF_FMT_2_10_10_10_UINT",
281   "BUF_FMT_2_10_10_10_SINT",
282 
283   "BUF_FMT_8_8_8_8_UNORM",
284   "BUF_FMT_8_8_8_8_SNORM",
285   "BUF_FMT_8_8_8_8_USCALED",
286   "BUF_FMT_8_8_8_8_SSCALED",
287   "BUF_FMT_8_8_8_8_UINT",
288   "BUF_FMT_8_8_8_8_SINT",
289 
290   "BUF_FMT_32_32_UINT",
291   "BUF_FMT_32_32_SINT",
292   "BUF_FMT_32_32_FLOAT",
293 
294   "BUF_FMT_16_16_16_16_UNORM",
295   "BUF_FMT_16_16_16_16_SNORM",
296   "BUF_FMT_16_16_16_16_USCALED",
297   "BUF_FMT_16_16_16_16_SSCALED",
298   "BUF_FMT_16_16_16_16_UINT",
299   "BUF_FMT_16_16_16_16_SINT",
300   "BUF_FMT_16_16_16_16_FLOAT",
301 
302   "BUF_FMT_32_32_32_UINT",
303   "BUF_FMT_32_32_32_SINT",
304   "BUF_FMT_32_32_32_FLOAT",
305   "BUF_FMT_32_32_32_32_UINT",
306   "BUF_FMT_32_32_32_32_SINT",
307   "BUF_FMT_32_32_32_32_FLOAT"
308 };
309 
310 unsigned const DfmtNfmt2UFmtGFX10[] = {
311   DFMT_INVALID     | (NFMT_UNORM   << NFMT_SHIFT),
312 
313   DFMT_8           | (NFMT_UNORM   << NFMT_SHIFT),
314   DFMT_8           | (NFMT_SNORM   << NFMT_SHIFT),
315   DFMT_8           | (NFMT_USCALED << NFMT_SHIFT),
316   DFMT_8           | (NFMT_SSCALED << NFMT_SHIFT),
317   DFMT_8           | (NFMT_UINT    << NFMT_SHIFT),
318   DFMT_8           | (NFMT_SINT    << NFMT_SHIFT),
319 
320   DFMT_16          | (NFMT_UNORM   << NFMT_SHIFT),
321   DFMT_16          | (NFMT_SNORM   << NFMT_SHIFT),
322   DFMT_16          | (NFMT_USCALED << NFMT_SHIFT),
323   DFMT_16          | (NFMT_SSCALED << NFMT_SHIFT),
324   DFMT_16          | (NFMT_UINT    << NFMT_SHIFT),
325   DFMT_16          | (NFMT_SINT    << NFMT_SHIFT),
326   DFMT_16          | (NFMT_FLOAT   << NFMT_SHIFT),
327 
328   DFMT_8_8         | (NFMT_UNORM   << NFMT_SHIFT),
329   DFMT_8_8         | (NFMT_SNORM   << NFMT_SHIFT),
330   DFMT_8_8         | (NFMT_USCALED << NFMT_SHIFT),
331   DFMT_8_8         | (NFMT_SSCALED << NFMT_SHIFT),
332   DFMT_8_8         | (NFMT_UINT    << NFMT_SHIFT),
333   DFMT_8_8         | (NFMT_SINT    << NFMT_SHIFT),
334 
335   DFMT_32          | (NFMT_UINT    << NFMT_SHIFT),
336   DFMT_32          | (NFMT_SINT    << NFMT_SHIFT),
337   DFMT_32          | (NFMT_FLOAT   << NFMT_SHIFT),
338 
339   DFMT_16_16       | (NFMT_UNORM   << NFMT_SHIFT),
340   DFMT_16_16       | (NFMT_SNORM   << NFMT_SHIFT),
341   DFMT_16_16       | (NFMT_USCALED << NFMT_SHIFT),
342   DFMT_16_16       | (NFMT_SSCALED << NFMT_SHIFT),
343   DFMT_16_16       | (NFMT_UINT    << NFMT_SHIFT),
344   DFMT_16_16       | (NFMT_SINT    << NFMT_SHIFT),
345   DFMT_16_16       | (NFMT_FLOAT   << NFMT_SHIFT),
346 
347   DFMT_10_11_11    | (NFMT_UNORM   << NFMT_SHIFT),
348   DFMT_10_11_11    | (NFMT_SNORM   << NFMT_SHIFT),
349   DFMT_10_11_11    | (NFMT_USCALED << NFMT_SHIFT),
350   DFMT_10_11_11    | (NFMT_SSCALED << NFMT_SHIFT),
351   DFMT_10_11_11    | (NFMT_UINT    << NFMT_SHIFT),
352   DFMT_10_11_11    | (NFMT_SINT    << NFMT_SHIFT),
353   DFMT_10_11_11    | (NFMT_FLOAT   << NFMT_SHIFT),
354 
355   DFMT_11_11_10    | (NFMT_UNORM   << NFMT_SHIFT),
356   DFMT_11_11_10    | (NFMT_SNORM   << NFMT_SHIFT),
357   DFMT_11_11_10    | (NFMT_USCALED << NFMT_SHIFT),
358   DFMT_11_11_10    | (NFMT_SSCALED << NFMT_SHIFT),
359   DFMT_11_11_10    | (NFMT_UINT    << NFMT_SHIFT),
360   DFMT_11_11_10    | (NFMT_SINT    << NFMT_SHIFT),
361   DFMT_11_11_10    | (NFMT_FLOAT   << NFMT_SHIFT),
362 
363   DFMT_10_10_10_2  | (NFMT_UNORM   << NFMT_SHIFT),
364   DFMT_10_10_10_2  | (NFMT_SNORM   << NFMT_SHIFT),
365   DFMT_10_10_10_2  | (NFMT_USCALED << NFMT_SHIFT),
366   DFMT_10_10_10_2  | (NFMT_SSCALED << NFMT_SHIFT),
367   DFMT_10_10_10_2  | (NFMT_UINT    << NFMT_SHIFT),
368   DFMT_10_10_10_2  | (NFMT_SINT    << NFMT_SHIFT),
369 
370   DFMT_2_10_10_10  | (NFMT_UNORM   << NFMT_SHIFT),
371   DFMT_2_10_10_10  | (NFMT_SNORM   << NFMT_SHIFT),
372   DFMT_2_10_10_10  | (NFMT_USCALED << NFMT_SHIFT),
373   DFMT_2_10_10_10  | (NFMT_SSCALED << NFMT_SHIFT),
374   DFMT_2_10_10_10  | (NFMT_UINT    << NFMT_SHIFT),
375   DFMT_2_10_10_10  | (NFMT_SINT    << NFMT_SHIFT),
376 
377   DFMT_8_8_8_8     | (NFMT_UNORM   << NFMT_SHIFT),
378   DFMT_8_8_8_8     | (NFMT_SNORM   << NFMT_SHIFT),
379   DFMT_8_8_8_8     | (NFMT_USCALED << NFMT_SHIFT),
380   DFMT_8_8_8_8     | (NFMT_SSCALED << NFMT_SHIFT),
381   DFMT_8_8_8_8     | (NFMT_UINT    << NFMT_SHIFT),
382   DFMT_8_8_8_8     | (NFMT_SINT    << NFMT_SHIFT),
383 
384   DFMT_32_32       | (NFMT_UINT    << NFMT_SHIFT),
385   DFMT_32_32       | (NFMT_SINT    << NFMT_SHIFT),
386   DFMT_32_32       | (NFMT_FLOAT   << NFMT_SHIFT),
387 
388   DFMT_16_16_16_16 | (NFMT_UNORM   << NFMT_SHIFT),
389   DFMT_16_16_16_16 | (NFMT_SNORM   << NFMT_SHIFT),
390   DFMT_16_16_16_16 | (NFMT_USCALED << NFMT_SHIFT),
391   DFMT_16_16_16_16 | (NFMT_SSCALED << NFMT_SHIFT),
392   DFMT_16_16_16_16 | (NFMT_UINT    << NFMT_SHIFT),
393   DFMT_16_16_16_16 | (NFMT_SINT    << NFMT_SHIFT),
394   DFMT_16_16_16_16 | (NFMT_FLOAT   << NFMT_SHIFT),
395 
396   DFMT_32_32_32    | (NFMT_UINT    << NFMT_SHIFT),
397   DFMT_32_32_32    | (NFMT_SINT    << NFMT_SHIFT),
398   DFMT_32_32_32    | (NFMT_FLOAT   << NFMT_SHIFT),
399   DFMT_32_32_32_32 | (NFMT_UINT    << NFMT_SHIFT),
400   DFMT_32_32_32_32 | (NFMT_SINT    << NFMT_SHIFT),
401   DFMT_32_32_32_32 | (NFMT_FLOAT   << NFMT_SHIFT)
402 };
403 
404 StringLiteral const UfmtSymbolicGFX11[] = {
405   "BUF_FMT_INVALID",
406 
407   "BUF_FMT_8_UNORM",
408   "BUF_FMT_8_SNORM",
409   "BUF_FMT_8_USCALED",
410   "BUF_FMT_8_SSCALED",
411   "BUF_FMT_8_UINT",
412   "BUF_FMT_8_SINT",
413 
414   "BUF_FMT_16_UNORM",
415   "BUF_FMT_16_SNORM",
416   "BUF_FMT_16_USCALED",
417   "BUF_FMT_16_SSCALED",
418   "BUF_FMT_16_UINT",
419   "BUF_FMT_16_SINT",
420   "BUF_FMT_16_FLOAT",
421 
422   "BUF_FMT_8_8_UNORM",
423   "BUF_FMT_8_8_SNORM",
424   "BUF_FMT_8_8_USCALED",
425   "BUF_FMT_8_8_SSCALED",
426   "BUF_FMT_8_8_UINT",
427   "BUF_FMT_8_8_SINT",
428 
429   "BUF_FMT_32_UINT",
430   "BUF_FMT_32_SINT",
431   "BUF_FMT_32_FLOAT",
432 
433   "BUF_FMT_16_16_UNORM",
434   "BUF_FMT_16_16_SNORM",
435   "BUF_FMT_16_16_USCALED",
436   "BUF_FMT_16_16_SSCALED",
437   "BUF_FMT_16_16_UINT",
438   "BUF_FMT_16_16_SINT",
439   "BUF_FMT_16_16_FLOAT",
440 
441   "BUF_FMT_10_11_11_FLOAT",
442 
443   "BUF_FMT_11_11_10_FLOAT",
444 
445   "BUF_FMT_10_10_10_2_UNORM",
446   "BUF_FMT_10_10_10_2_SNORM",
447   "BUF_FMT_10_10_10_2_UINT",
448   "BUF_FMT_10_10_10_2_SINT",
449 
450   "BUF_FMT_2_10_10_10_UNORM",
451   "BUF_FMT_2_10_10_10_SNORM",
452   "BUF_FMT_2_10_10_10_USCALED",
453   "BUF_FMT_2_10_10_10_SSCALED",
454   "BUF_FMT_2_10_10_10_UINT",
455   "BUF_FMT_2_10_10_10_SINT",
456 
457   "BUF_FMT_8_8_8_8_UNORM",
458   "BUF_FMT_8_8_8_8_SNORM",
459   "BUF_FMT_8_8_8_8_USCALED",
460   "BUF_FMT_8_8_8_8_SSCALED",
461   "BUF_FMT_8_8_8_8_UINT",
462   "BUF_FMT_8_8_8_8_SINT",
463 
464   "BUF_FMT_32_32_UINT",
465   "BUF_FMT_32_32_SINT",
466   "BUF_FMT_32_32_FLOAT",
467 
468   "BUF_FMT_16_16_16_16_UNORM",
469   "BUF_FMT_16_16_16_16_SNORM",
470   "BUF_FMT_16_16_16_16_USCALED",
471   "BUF_FMT_16_16_16_16_SSCALED",
472   "BUF_FMT_16_16_16_16_UINT",
473   "BUF_FMT_16_16_16_16_SINT",
474   "BUF_FMT_16_16_16_16_FLOAT",
475 
476   "BUF_FMT_32_32_32_UINT",
477   "BUF_FMT_32_32_32_SINT",
478   "BUF_FMT_32_32_32_FLOAT",
479   "BUF_FMT_32_32_32_32_UINT",
480   "BUF_FMT_32_32_32_32_SINT",
481   "BUF_FMT_32_32_32_32_FLOAT"
482 };
483 
484 unsigned const DfmtNfmt2UFmtGFX11[] = {
485   DFMT_INVALID     | (NFMT_UNORM   << NFMT_SHIFT),
486 
487   DFMT_8           | (NFMT_UNORM   << NFMT_SHIFT),
488   DFMT_8           | (NFMT_SNORM   << NFMT_SHIFT),
489   DFMT_8           | (NFMT_USCALED << NFMT_SHIFT),
490   DFMT_8           | (NFMT_SSCALED << NFMT_SHIFT),
491   DFMT_8           | (NFMT_UINT    << NFMT_SHIFT),
492   DFMT_8           | (NFMT_SINT    << NFMT_SHIFT),
493 
494   DFMT_16          | (NFMT_UNORM   << NFMT_SHIFT),
495   DFMT_16          | (NFMT_SNORM   << NFMT_SHIFT),
496   DFMT_16          | (NFMT_USCALED << NFMT_SHIFT),
497   DFMT_16          | (NFMT_SSCALED << NFMT_SHIFT),
498   DFMT_16          | (NFMT_UINT    << NFMT_SHIFT),
499   DFMT_16          | (NFMT_SINT    << NFMT_SHIFT),
500   DFMT_16          | (NFMT_FLOAT   << NFMT_SHIFT),
501 
502   DFMT_8_8         | (NFMT_UNORM   << NFMT_SHIFT),
503   DFMT_8_8         | (NFMT_SNORM   << NFMT_SHIFT),
504   DFMT_8_8         | (NFMT_USCALED << NFMT_SHIFT),
505   DFMT_8_8         | (NFMT_SSCALED << NFMT_SHIFT),
506   DFMT_8_8         | (NFMT_UINT    << NFMT_SHIFT),
507   DFMT_8_8         | (NFMT_SINT    << NFMT_SHIFT),
508 
509   DFMT_32          | (NFMT_UINT    << NFMT_SHIFT),
510   DFMT_32          | (NFMT_SINT    << NFMT_SHIFT),
511   DFMT_32          | (NFMT_FLOAT   << NFMT_SHIFT),
512 
513   DFMT_16_16       | (NFMT_UNORM   << NFMT_SHIFT),
514   DFMT_16_16       | (NFMT_SNORM   << NFMT_SHIFT),
515   DFMT_16_16       | (NFMT_USCALED << NFMT_SHIFT),
516   DFMT_16_16       | (NFMT_SSCALED << NFMT_SHIFT),
517   DFMT_16_16       | (NFMT_UINT    << NFMT_SHIFT),
518   DFMT_16_16       | (NFMT_SINT    << NFMT_SHIFT),
519   DFMT_16_16       | (NFMT_FLOAT   << NFMT_SHIFT),
520 
521   DFMT_10_11_11    | (NFMT_FLOAT   << NFMT_SHIFT),
522 
523   DFMT_11_11_10    | (NFMT_FLOAT   << NFMT_SHIFT),
524 
525   DFMT_10_10_10_2  | (NFMT_UNORM   << NFMT_SHIFT),
526   DFMT_10_10_10_2  | (NFMT_SNORM   << NFMT_SHIFT),
527   DFMT_10_10_10_2  | (NFMT_UINT    << NFMT_SHIFT),
528   DFMT_10_10_10_2  | (NFMT_SINT    << NFMT_SHIFT),
529 
530   DFMT_2_10_10_10  | (NFMT_UNORM   << NFMT_SHIFT),
531   DFMT_2_10_10_10  | (NFMT_SNORM   << NFMT_SHIFT),
532   DFMT_2_10_10_10  | (NFMT_USCALED << NFMT_SHIFT),
533   DFMT_2_10_10_10  | (NFMT_SSCALED << NFMT_SHIFT),
534   DFMT_2_10_10_10  | (NFMT_UINT    << NFMT_SHIFT),
535   DFMT_2_10_10_10  | (NFMT_SINT    << NFMT_SHIFT),
536 
537   DFMT_8_8_8_8     | (NFMT_UNORM   << NFMT_SHIFT),
538   DFMT_8_8_8_8     | (NFMT_SNORM   << NFMT_SHIFT),
539   DFMT_8_8_8_8     | (NFMT_USCALED << NFMT_SHIFT),
540   DFMT_8_8_8_8     | (NFMT_SSCALED << NFMT_SHIFT),
541   DFMT_8_8_8_8     | (NFMT_UINT    << NFMT_SHIFT),
542   DFMT_8_8_8_8     | (NFMT_SINT    << NFMT_SHIFT),
543 
544   DFMT_32_32       | (NFMT_UINT    << NFMT_SHIFT),
545   DFMT_32_32       | (NFMT_SINT    << NFMT_SHIFT),
546   DFMT_32_32       | (NFMT_FLOAT   << NFMT_SHIFT),
547 
548   DFMT_16_16_16_16 | (NFMT_UNORM   << NFMT_SHIFT),
549   DFMT_16_16_16_16 | (NFMT_SNORM   << NFMT_SHIFT),
550   DFMT_16_16_16_16 | (NFMT_USCALED << NFMT_SHIFT),
551   DFMT_16_16_16_16 | (NFMT_SSCALED << NFMT_SHIFT),
552   DFMT_16_16_16_16 | (NFMT_UINT    << NFMT_SHIFT),
553   DFMT_16_16_16_16 | (NFMT_SINT    << NFMT_SHIFT),
554   DFMT_16_16_16_16 | (NFMT_FLOAT   << NFMT_SHIFT),
555 
556   DFMT_32_32_32    | (NFMT_UINT    << NFMT_SHIFT),
557   DFMT_32_32_32    | (NFMT_SINT    << NFMT_SHIFT),
558   DFMT_32_32_32    | (NFMT_FLOAT   << NFMT_SHIFT),
559   DFMT_32_32_32_32 | (NFMT_UINT    << NFMT_SHIFT),
560   DFMT_32_32_32_32 | (NFMT_SINT    << NFMT_SHIFT),
561   DFMT_32_32_32_32 | (NFMT_FLOAT   << NFMT_SHIFT)
562 };
563 
564 } // namespace MTBUFFormat
565 
566 namespace Swizzle {
567 
568 // This must be in sync with llvm::AMDGPU::Swizzle::Id enum members, see SIDefines.h.
569 const char* const IdSymbolic[] = {
570   "QUAD_PERM",
571   "BITMASK_PERM",
572   "SWAP",
573   "REVERSE",
574   "BROADCAST",
575 };
576 
577 } // namespace Swizzle
578 
579 namespace VGPRIndexMode {
580 
581 // This must be in sync with llvm::AMDGPU::VGPRIndexMode::Id enum members, see SIDefines.h.
582 const char* const IdSymbolic[] = {
583   "SRC0",
584   "SRC1",
585   "SRC2",
586   "DST",
587 };
588 
589 } // namespace VGPRIndexMode
590 
591 } // namespace AMDGPU
592 } // namespace llvm
593