LLVM 24.0.0git
AMDGPUAsmUtils.cpp
Go to the documentation of this file.
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
12namespace llvm::AMDGPU {
13
14//===----------------------------------------------------------------------===//
15// Custom Operands.
16//
17// A table of custom operands must be ordered by Encoding in ascending order
18// to enable binary search lookup. Within entries that share the same encoding,
19// "primary" operand names should be listed first followed by aliases if any.
20//
21//===----------------------------------------------------------------------===//
22
23/// Map from the encoding of a sendmsg/hwreg asm operand to it's name.
24template <size_t N>
26 unsigned Encoding,
27 const MCSubtargetInfo &STI) {
28 // Find the first entry with the target encoding
29 auto First =
30 std::lower_bound(Table, Table + N, Encoding,
31 [](const CustomOperand &Entry, unsigned TargetEncoding) {
32 return Entry.Encoding < TargetEncoding;
33 });
34
35 // Search through entries with the same encoding to find the first valid one
36 for (auto It = First; It != Table + N && It->Encoding == Encoding; ++It) {
37 if (It->Encoding == Encoding && (!It->Cond || It->Cond(STI)))
38 return It->Name;
39 }
40
41 return "";
42}
43
44/// Map from a symbolic name for a sendmsg/hwreg asm operand to it's encoding.
45template <size_t N>
47 StringRef Name,
48 const MCSubtargetInfo &STI) {
49 int64_t InvalidEncoding = OPR_ID_UNKNOWN;
50 for (const CustomOperand &Entry : Table) {
51 if (Entry.Name != Name)
52 continue;
53
54 if (!Entry.Cond || Entry.Cond(STI))
55 return Entry.Encoding;
56
57 InvalidEncoding = OPR_ID_UNSUPPORTED;
58 }
59
60 return InvalidEncoding;
61}
62
63namespace DepCtr {
64
65// NOLINTBEGIN
67 // Name max dflt offset width constraint
68 {{"depctr_hold_cnt"}, 1, 1, 7, 1, isGFX10_BEncoding},
69 {{"depctr_sa_sdst"}, 1, 1, 0, 1},
70 {{"depctr_va_vdst"}, 15, 15, 12, 4},
71 {{"depctr_va_sdst"}, 7, 7, 9, 3},
72 {{"depctr_va_ssrc"}, 1, 1, 8, 1},
73 {{"depctr_va_vcc"}, 1, 1, 1, 1},
74 {{"depctr_vm_vsrc"}, 7, 7, 2, 3},
75};
76// NOLINTEND
77
78const int DEP_CTR_SIZE =
79 static_cast<int>(sizeof(DepCtrInfo) / sizeof(CustomOperandVal));
80
81} // namespace DepCtr
82
83namespace SendMsg {
84
85// Disable lint checking here since it makes these tables unreadable.
86// NOLINTBEGIN
87// clang-format off
88
89static constexpr CustomOperand MsgOperands[] = {
90 {{"MSG_INTERRUPT"}, ID_INTERRUPT},
91 {{"MSG_GS"}, ID_GS_PreGFX11, isNotGFX11Plus},
92 {{"MSG_HS_TESSFACTOR"}, ID_HS_TESSFACTOR_GFX11Plus, isGFX11Plus},
93 {{"MSG_GS_DONE"}, ID_GS_DONE_PreGFX11, isNotGFX11Plus},
94 {{"MSG_DEALLOC_VGPRS"}, ID_DEALLOC_VGPRS_GFX11Plus, isGFX11Plus},
95 {{"MSG_SAVEWAVE"}, ID_SAVEWAVE, isGFX8_GFX9_GFX10},
96 {{"MSG_STALL_WAVE_GEN"}, ID_STALL_WAVE_GEN, isGFX9_GFX10_GFX11},
97 {{"MSG_HALT_WAVES"}, ID_HALT_WAVES, isGFX9_GFX10_GFX11},
98 {{"MSG_ORDERED_PS_DONE"}, ID_ORDERED_PS_DONE, isGFX9_GFX10},
99 {{"MSG_EARLY_PRIM_DEALLOC"}, ID_EARLY_PRIM_DEALLOC, isGFX9_GFX10},
100 {{"MSG_GS_ALLOC_REQ"}, ID_GS_ALLOC_REQ, isGFX9Plus},
101 {{"MSG_GET_DOORBELL"}, ID_GET_DOORBELL, isGFX9_GFX10},
102 {{"MSG_GET_DDID"}, ID_GET_DDID, isGFX10},
103 {{"MSG_SYSMSG"}, ID_SYSMSG},
104 {{"MSG_RTN_GET_DOORBELL"}, ID_RTN_GET_DOORBELL, isGFX11Plus},
105 {{"MSG_RTN_GET_DDID"}, ID_RTN_GET_DDID, isGFX11Plus},
106 {{"MSG_RTN_GET_TMA"}, ID_RTN_GET_TMA, isGFX11Plus},
107 {{"MSG_RTN_GET_REALTIME"}, ID_RTN_GET_REALTIME, isGFX11Plus},
108 {{"MSG_RTN_SAVE_WAVE"}, ID_RTN_SAVE_WAVE, isGFX11Plus},
109 {{"MSG_RTN_GET_TBA"}, ID_RTN_GET_TBA, isGFX11Plus},
110 {{"MSG_RTN_GET_TBA_TO_PC"}, ID_RTN_GET_TBA_TO_PC, isGFX11Plus},
111 {{"MSG_RTN_GET_SE_AID_ID"}, ID_RTN_GET_SE_AID_ID, isGFX12Plus},
112 {{"MSG_RTN_GET_CLUSTER_BARRIER_STATE"}, ID_RTN_GET_CLUSTER_BARRIER_STATE,
114 {{"MSG_RTN_SAVE_WAVE_HAS_TDM"}, ID_RTN_SAVE_WAVE_HAS_TDM, isGFX1250Plus}
115};
116
117static constexpr CustomOperand SysMsgOperands[] = {
118 {{"SYSMSG_OP_ECC_ERR_INTERRUPT"}, OP_SYS_ECC_ERR_INTERRUPT},
119 {{"SYSMSG_OP_REG_RD"}, OP_SYS_REG_RD},
120 {{"SYSMSG_OP_HOST_TRAP_ACK"}, OP_SYS_HOST_TRAP_ACK, isNotGFX9Plus},
121 {{"SYSMSG_OP_TTRACE_PC"}, OP_SYS_TTRACE_PC},
122};
123
124static constexpr CustomOperand StreamMsgOperands[] = {
125 {{"GS_OP_NOP"}, OP_GS_NOP},
126 {{"GS_OP_CUT"}, OP_GS_CUT},
127 {{"GS_OP_EMIT"}, OP_GS_EMIT},
128 {{"GS_OP_EMIT_CUT"}, OP_GS_EMIT_CUT},
129};
130
131// clang-format on
132// NOLINTEND
133
134int64_t getMsgId(StringRef Name, const MCSubtargetInfo &STI) {
135 return getEncodingFromOperandTable(MsgOperands, Name, STI);
136}
137
139 return getNameFromOperandTable(MsgOperands, Encoding, STI);
140}
141
142int64_t getMsgOpId(int64_t MsgId, StringRef Name, const MCSubtargetInfo &STI) {
143 if (MsgId == ID_SYSMSG)
146}
147
148StringRef getMsgOpName(int64_t MsgId, uint64_t Encoding,
149 const MCSubtargetInfo &STI) {
150 assert(msgRequiresOp(MsgId, STI) && "must have an operand");
151
152 if (MsgId == ID_SYSMSG)
153 return getNameFromOperandTable(SysMsgOperands, Encoding, STI);
154 return getNameFromOperandTable(StreamMsgOperands, Encoding, STI);
155}
156
157} // namespace SendMsg
158
159namespace WaitEvent {
160
161// clang-format off
162static constexpr CustomOperand WaitEventOperands[] = {
163 {{"{ export_ready: 0 }"}, 0, isGFX12Plus},
164 {{"{ dont_wait_export_ready: 0 }"}, 0, isGFX11},
165 {{"{ dont_wait_export_ready: 1 }"}, DONT_WAIT_EXPORT_READY, isGFX11},
166 {{"{ export_ready: 1 }"}, EXPORT_READY, isGFX12Plus}
167};
168// clang-format on
169
173} // namespace WaitEvent
174
175namespace Hwreg {
176
177// Disable lint checking for this block since it makes the table unreadable.
178// NOLINTBEGIN
179// clang-format off
180static constexpr CustomOperand Operands[] = {
181 {{"HW_REG_WAVE_MODE"}, ID_MODE, isGFX12Plus},
182 {{"HW_REG_MODE"}, ID_MODE},
183 {{"HW_REG_WAVE_STATUS"}, ID_STATUS, isGFX12Plus},
184 {{"HW_REG_STATUS"}, ID_STATUS},
185 {{"HW_REG_TRAPSTS"}, ID_TRAPSTS, isNotGFX12Plus},
186 {{"HW_REG_HW_ID"}, ID_HW_ID, isNotGFX10Plus},
187 {{"HW_REG_WAVE_STATE_PRIV"}, ID_STATE_PRIV, isGFX12Plus},
188 {{"HW_REG_STATE_PRIV"}, ID_STATE_PRIV, isGFX12Plus},
189 {{"HW_REG_WAVE_GPR_ALLOC"}, ID_GPR_ALLOC, isGFX12Plus},
190 {{"HW_REG_GPR_ALLOC"}, ID_GPR_ALLOC},
191 {{"HW_REG_WAVE_LDS_ALLOC"}, ID_LDS_ALLOC, isGFX12Plus},
192 {{"HW_REG_LDS_ALLOC"}, ID_LDS_ALLOC},
193 {{"HW_REG_IB_STS"}, ID_IB_STS},
194 {{"HW_REG_PERF_SNAPSHOT_DATA"}, ID_PERF_SNAPSHOT_DATA_gfx12, isGFX12Plus},
195 {{"HW_REG_PERF_SNAPSHOT_PC_LO"}, ID_PERF_SNAPSHOT_PC_LO_gfx12, isGFX12Plus},
196 {{"HW_REG_PERF_SNAPSHOT_PC_HI"}, ID_PERF_SNAPSHOT_PC_HI_gfx12, isGFX12Plus},
197 {{"HW_REG_SH_MEM_BASES"}, ID_MEM_BASES, isGFX9_GFX10_GFX11},
198 {{"HW_REG_PERF_SNAPSHOT_DATA1"}, ID_PERF_SNAPSHOT_DATA1, isGFX12Plus},
199 {{"HW_REG_TBA_LO"}, ID_TBA_LO, isGFX9_GFX10},
200 {{"HW_REG_PERF_SNAPSHOT_DATA2"}, ID_PERF_SNAPSHOT_DATA2, isGFX12Plus},
201 {{"HW_REG_TBA_HI"}, ID_TBA_HI, isGFX9_GFX10},
202 {{"HW_REG_WAVE_EXCP_FLAG_PRIV"}, ID_EXCP_FLAG_PRIV, isGFX12Plus},
203 {{"HW_REG_EXCP_FLAG_PRIV"}, ID_EXCP_FLAG_PRIV, isGFX12Plus},
204 {{"HW_REG_TMA_LO"}, ID_TMA_LO, isGFX9_GFX10},
205 {{"HW_REG_PERF_SNAPSHOT_PC_LO"}, ID_PERF_SNAPSHOT_PC_LO_gfx11, isGFX11},
206 {{"HW_REG_WAVE_EXCP_FLAG_USER"}, ID_EXCP_FLAG_USER, isGFX12Plus},
207 {{"HW_REG_EXCP_FLAG_USER"}, ID_EXCP_FLAG_USER, isGFX12Plus},
208 {{"HW_REG_TMA_HI"}, ID_TMA_HI, isGFX9_GFX10},
209 {{"HW_REG_PERF_SNAPSHOT_PC_HI"}, ID_PERF_SNAPSHOT_PC_HI_gfx11, isGFX11},
210 {{"HW_REG_WAVE_TRAP_CTRL"}, ID_TRAP_CTRL, isGFX12Plus},
211 {{"HW_REG_TRAP_CTRL"}, ID_TRAP_CTRL, isGFX12Plus},
212 {{"HW_REG_FLAT_SCR_LO"}, ID_FLAT_SCR_LO, isGFX10_GFX11},
213 {{"HW_REG_WAVE_SCRATCH_BASE_LO"}, ID_FLAT_SCR_LO, isGFX12Plus},
214 {{"HW_REG_SCRATCH_BASE_LO"}, ID_FLAT_SCR_LO, isGFX12Plus},
215 {{"HW_REG_XCC_ID"}, ID_XCC_ID, isGFX940},
216 {{"HW_REG_FLAT_SCR_HI"}, ID_FLAT_SCR_HI, isGFX10_GFX11},
217 {{"HW_REG_WAVE_SCRATCH_BASE_HI"}, ID_FLAT_SCR_HI, isGFX12Plus},
218 {{"HW_REG_SCRATCH_BASE_HI"}, ID_FLAT_SCR_HI, isGFX12Plus},
219 {{"HW_REG_SQ_PERF_SNAPSHOT_DATA"}, ID_SQ_PERF_SNAPSHOT_DATA, isGFX940},
220 {{"HW_REG_XNACK_MASK"}, ID_XNACK_MASK, isGFX10Before1030},
221 {{"HW_REG_SQ_PERF_SNAPSHOT_DATA1"}, ID_SQ_PERF_SNAPSHOT_DATA1, isGFX940},
222 {{"HW_REG_WAVE_HW_ID1"}, ID_HW_ID1, isGFX12Plus},
223 {{"HW_REG_HW_ID1"}, ID_HW_ID1, isGFX10Plus},
224 {{"HW_REG_HW_ID"}, ID_HW_ID1, isGFX10},
225 {{"HW_REG_SQ_PERF_SNAPSHOT_PC_LO"}, ID_SQ_PERF_SNAPSHOT_PC_LO, isGFX940},
226 {{"HW_REG_WAVE_HW_ID2"}, ID_HW_ID2, isGFX12Plus},
227 {{"HW_REG_HW_ID2"}, ID_HW_ID2, isGFX10Plus},
228 {{"HW_REG_SQ_PERF_SNAPSHOT_PC_HI"}, ID_SQ_PERF_SNAPSHOT_PC_HI, isGFX940},
229 {{"HW_REG_POPS_PACKER"}, ID_POPS_PACKER, isGFX10},
230 {{"HW_REG_WAVE_SCHED_MODE"}, ID_SCHED_MODE, isGFX12Plus},
231 {{"HW_REG_PERF_SNAPSHOT_DATA"}, ID_PERF_SNAPSHOT_DATA_gfx11, isGFX11},
232 {{"HW_REG_IB_STS2"}, ID_IB_STS2, isGFX1250Plus},
233 {{"HW_REG_SHADER_CYCLES"}, ID_SHADER_CYCLES, isGFX10_3_GFX11},
234 {{"HW_REG_SHADER_CYCLES_LO"}, ID_SHADER_CYCLES, isGFX12Plus},
235 {{"HW_REG_SHADER_CYCLES_HI"}, ID_SHADER_CYCLES_HI, isGFX12Plus},
236 {{"HW_REG_WAVE_DVGPR_ALLOC_LO"}, ID_DVGPR_ALLOC_LO, isGFX12Plus},
237 {{"HW_REG_DVGPR_ALLOC_LO"}, ID_DVGPR_ALLOC_LO, isGFX12Plus},
238 {{"HW_REG_WAVE_DVGPR_ALLOC_HI"}, ID_DVGPR_ALLOC_HI, isGFX12Plus},
239 {{"HW_REG_DVGPR_ALLOC_HI"}, ID_DVGPR_ALLOC_HI, isGFX12Plus},
240 {{"HW_REG_XNACK_STATE_PRIV"}, ID_XNACK_STATE_PRIV, isGFX1250Plus},
241 {{"HW_REG_XNACK_MASK"}, ID_XNACK_MASK_gfx1250, isGFX1250Plus},
242
243};
244// clang-format on
245// NOLINTEND
246
247int64_t getHwregId(StringRef Name, const MCSubtargetInfo &STI) {
248 return getEncodingFromOperandTable(Operands, Name, STI);
249}
250
252 return getNameFromOperandTable(Operands, Encoding, STI);
253}
254
255} // namespace Hwreg
256
257namespace MTBUFFormat {
258
260 "BUF_DATA_FORMAT_INVALID",
261 "BUF_DATA_FORMAT_8",
262 "BUF_DATA_FORMAT_16",
263 "BUF_DATA_FORMAT_8_8",
264 "BUF_DATA_FORMAT_32",
265 "BUF_DATA_FORMAT_16_16",
266 "BUF_DATA_FORMAT_10_11_11",
267 "BUF_DATA_FORMAT_11_11_10",
268 "BUF_DATA_FORMAT_10_10_10_2",
269 "BUF_DATA_FORMAT_2_10_10_10",
270 "BUF_DATA_FORMAT_8_8_8_8",
271 "BUF_DATA_FORMAT_32_32",
272 "BUF_DATA_FORMAT_16_16_16_16",
273 "BUF_DATA_FORMAT_32_32_32",
274 "BUF_DATA_FORMAT_32_32_32_32",
275 "BUF_DATA_FORMAT_RESERVED_15"
276};
277
279 "BUF_NUM_FORMAT_UNORM",
280 "BUF_NUM_FORMAT_SNORM",
281 "BUF_NUM_FORMAT_USCALED",
282 "BUF_NUM_FORMAT_SSCALED",
283 "BUF_NUM_FORMAT_UINT",
284 "BUF_NUM_FORMAT_SINT",
285 "",
286 "BUF_NUM_FORMAT_FLOAT"
287};
288
290 "BUF_NUM_FORMAT_UNORM",
291 "BUF_NUM_FORMAT_SNORM",
292 "BUF_NUM_FORMAT_USCALED",
293 "BUF_NUM_FORMAT_SSCALED",
294 "BUF_NUM_FORMAT_UINT",
295 "BUF_NUM_FORMAT_SINT",
296 "BUF_NUM_FORMAT_SNORM_OGL",
297 "BUF_NUM_FORMAT_FLOAT"
298};
299
300StringLiteral const NfmtSymbolicVI[] = { // VI and GFX9
301 "BUF_NUM_FORMAT_UNORM",
302 "BUF_NUM_FORMAT_SNORM",
303 "BUF_NUM_FORMAT_USCALED",
304 "BUF_NUM_FORMAT_SSCALED",
305 "BUF_NUM_FORMAT_UINT",
306 "BUF_NUM_FORMAT_SINT",
307 "BUF_NUM_FORMAT_RESERVED_6",
308 "BUF_NUM_FORMAT_FLOAT"
309};
310
312 "BUF_FMT_INVALID",
313
314 "BUF_FMT_8_UNORM",
315 "BUF_FMT_8_SNORM",
316 "BUF_FMT_8_USCALED",
317 "BUF_FMT_8_SSCALED",
318 "BUF_FMT_8_UINT",
319 "BUF_FMT_8_SINT",
320
321 "BUF_FMT_16_UNORM",
322 "BUF_FMT_16_SNORM",
323 "BUF_FMT_16_USCALED",
324 "BUF_FMT_16_SSCALED",
325 "BUF_FMT_16_UINT",
326 "BUF_FMT_16_SINT",
327 "BUF_FMT_16_FLOAT",
328
329 "BUF_FMT_8_8_UNORM",
330 "BUF_FMT_8_8_SNORM",
331 "BUF_FMT_8_8_USCALED",
332 "BUF_FMT_8_8_SSCALED",
333 "BUF_FMT_8_8_UINT",
334 "BUF_FMT_8_8_SINT",
335
336 "BUF_FMT_32_UINT",
337 "BUF_FMT_32_SINT",
338 "BUF_FMT_32_FLOAT",
339
340 "BUF_FMT_16_16_UNORM",
341 "BUF_FMT_16_16_SNORM",
342 "BUF_FMT_16_16_USCALED",
343 "BUF_FMT_16_16_SSCALED",
344 "BUF_FMT_16_16_UINT",
345 "BUF_FMT_16_16_SINT",
346 "BUF_FMT_16_16_FLOAT",
347
348 "BUF_FMT_10_11_11_UNORM",
349 "BUF_FMT_10_11_11_SNORM",
350 "BUF_FMT_10_11_11_USCALED",
351 "BUF_FMT_10_11_11_SSCALED",
352 "BUF_FMT_10_11_11_UINT",
353 "BUF_FMT_10_11_11_SINT",
354 "BUF_FMT_10_11_11_FLOAT",
355
356 "BUF_FMT_11_11_10_UNORM",
357 "BUF_FMT_11_11_10_SNORM",
358 "BUF_FMT_11_11_10_USCALED",
359 "BUF_FMT_11_11_10_SSCALED",
360 "BUF_FMT_11_11_10_UINT",
361 "BUF_FMT_11_11_10_SINT",
362 "BUF_FMT_11_11_10_FLOAT",
363
364 "BUF_FMT_10_10_10_2_UNORM",
365 "BUF_FMT_10_10_10_2_SNORM",
366 "BUF_FMT_10_10_10_2_USCALED",
367 "BUF_FMT_10_10_10_2_SSCALED",
368 "BUF_FMT_10_10_10_2_UINT",
369 "BUF_FMT_10_10_10_2_SINT",
370
371 "BUF_FMT_2_10_10_10_UNORM",
372 "BUF_FMT_2_10_10_10_SNORM",
373 "BUF_FMT_2_10_10_10_USCALED",
374 "BUF_FMT_2_10_10_10_SSCALED",
375 "BUF_FMT_2_10_10_10_UINT",
376 "BUF_FMT_2_10_10_10_SINT",
377
378 "BUF_FMT_8_8_8_8_UNORM",
379 "BUF_FMT_8_8_8_8_SNORM",
380 "BUF_FMT_8_8_8_8_USCALED",
381 "BUF_FMT_8_8_8_8_SSCALED",
382 "BUF_FMT_8_8_8_8_UINT",
383 "BUF_FMT_8_8_8_8_SINT",
384
385 "BUF_FMT_32_32_UINT",
386 "BUF_FMT_32_32_SINT",
387 "BUF_FMT_32_32_FLOAT",
388
389 "BUF_FMT_16_16_16_16_UNORM",
390 "BUF_FMT_16_16_16_16_SNORM",
391 "BUF_FMT_16_16_16_16_USCALED",
392 "BUF_FMT_16_16_16_16_SSCALED",
393 "BUF_FMT_16_16_16_16_UINT",
394 "BUF_FMT_16_16_16_16_SINT",
395 "BUF_FMT_16_16_16_16_FLOAT",
396
397 "BUF_FMT_32_32_32_UINT",
398 "BUF_FMT_32_32_32_SINT",
399 "BUF_FMT_32_32_32_FLOAT",
400 "BUF_FMT_32_32_32_32_UINT",
401 "BUF_FMT_32_32_32_32_SINT",
402 "BUF_FMT_32_32_32_32_FLOAT"
403};
404
405unsigned const DfmtNfmt2UFmtGFX10[] = {
407
414
422
429
433
441
449
457
464
471
478
482
490
497};
498
500 "BUF_FMT_INVALID",
501
502 "BUF_FMT_8_UNORM",
503 "BUF_FMT_8_SNORM",
504 "BUF_FMT_8_USCALED",
505 "BUF_FMT_8_SSCALED",
506 "BUF_FMT_8_UINT",
507 "BUF_FMT_8_SINT",
508
509 "BUF_FMT_16_UNORM",
510 "BUF_FMT_16_SNORM",
511 "BUF_FMT_16_USCALED",
512 "BUF_FMT_16_SSCALED",
513 "BUF_FMT_16_UINT",
514 "BUF_FMT_16_SINT",
515 "BUF_FMT_16_FLOAT",
516
517 "BUF_FMT_8_8_UNORM",
518 "BUF_FMT_8_8_SNORM",
519 "BUF_FMT_8_8_USCALED",
520 "BUF_FMT_8_8_SSCALED",
521 "BUF_FMT_8_8_UINT",
522 "BUF_FMT_8_8_SINT",
523
524 "BUF_FMT_32_UINT",
525 "BUF_FMT_32_SINT",
526 "BUF_FMT_32_FLOAT",
527
528 "BUF_FMT_16_16_UNORM",
529 "BUF_FMT_16_16_SNORM",
530 "BUF_FMT_16_16_USCALED",
531 "BUF_FMT_16_16_SSCALED",
532 "BUF_FMT_16_16_UINT",
533 "BUF_FMT_16_16_SINT",
534 "BUF_FMT_16_16_FLOAT",
535
536 "BUF_FMT_10_11_11_FLOAT",
537
538 "BUF_FMT_11_11_10_FLOAT",
539
540 "BUF_FMT_10_10_10_2_UNORM",
541 "BUF_FMT_10_10_10_2_SNORM",
542 "BUF_FMT_10_10_10_2_UINT",
543 "BUF_FMT_10_10_10_2_SINT",
544
545 "BUF_FMT_2_10_10_10_UNORM",
546 "BUF_FMT_2_10_10_10_SNORM",
547 "BUF_FMT_2_10_10_10_USCALED",
548 "BUF_FMT_2_10_10_10_SSCALED",
549 "BUF_FMT_2_10_10_10_UINT",
550 "BUF_FMT_2_10_10_10_SINT",
551
552 "BUF_FMT_8_8_8_8_UNORM",
553 "BUF_FMT_8_8_8_8_SNORM",
554 "BUF_FMT_8_8_8_8_USCALED",
555 "BUF_FMT_8_8_8_8_SSCALED",
556 "BUF_FMT_8_8_8_8_UINT",
557 "BUF_FMT_8_8_8_8_SINT",
558
559 "BUF_FMT_32_32_UINT",
560 "BUF_FMT_32_32_SINT",
561 "BUF_FMT_32_32_FLOAT",
562
563 "BUF_FMT_16_16_16_16_UNORM",
564 "BUF_FMT_16_16_16_16_SNORM",
565 "BUF_FMT_16_16_16_16_USCALED",
566 "BUF_FMT_16_16_16_16_SSCALED",
567 "BUF_FMT_16_16_16_16_UINT",
568 "BUF_FMT_16_16_16_16_SINT",
569 "BUF_FMT_16_16_16_16_FLOAT",
570
571 "BUF_FMT_32_32_32_UINT",
572 "BUF_FMT_32_32_32_SINT",
573 "BUF_FMT_32_32_32_FLOAT",
574 "BUF_FMT_32_32_32_32_UINT",
575 "BUF_FMT_32_32_32_32_SINT",
576 "BUF_FMT_32_32_32_32_FLOAT"
577};
578
579unsigned const DfmtNfmt2UFmtGFX11[] = {
581
588
596
603
607
615
617
619
624
631
638
642
650
657};
658
659} // namespace MTBUFFormat
660
661namespace Swizzle {
662
663// clang-format off
664// This must be in sync with llvm::AMDGPU::Swizzle::Id enum members, see SIDefines.h.
665const char *const IdSymbolic[] = {
666 "QUAD_PERM",
667 "BITMASK_PERM",
668 "SWAP",
669 "REVERSE",
670 "BROADCAST",
671 "FFT",
672 "ROTATE",
673};
674// clang-format on
675
676} // namespace Swizzle
677
678namespace VGPRIndexMode {
679
680// This must be in sync with llvm::AMDGPU::VGPRIndexMode::Id enum members, see SIDefines.h.
681const char* const IdSymbolic[] = {
682 "SRC0",
683 "SRC1",
684 "SRC2",
685 "DST",
686};
687
688} // namespace VGPRIndexMode
689
690namespace UCVersion {
691
693 // GFX6, GFX8 and GFX9 don't support s_version and there are no
694 // UC_VERSION_GFX* codes for them.
695 static const GFXVersion Versions[] = {{"UC_VERSION_GFX7", 0},
696 {"UC_VERSION_GFX10", 4},
697 {"UC_VERSION_GFX11", 6},
698 {"UC_VERSION_GFX12", 9}};
699
700 return Versions;
701}
702
703} // namespace UCVersion
704
705} // namespace llvm::AMDGPU
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned uint64_t
static std::vector< std::pair< int, unsigned > > Swizzle(std::vector< std::pair< int, unsigned > > Src, R600InstrInfo::BankSwizzle Swz)
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Generic base class for all target subtargets.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition StringRef.h:888
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
const CustomOperandVal DepCtrInfo[]
StringRef getHwreg(uint64_t Encoding, const MCSubtargetInfo &STI)
int64_t getHwregId(StringRef Name, const MCSubtargetInfo &STI)
static constexpr CustomOperand Operands[]
StringLiteral const UfmtSymbolicGFX11[]
unsigned const DfmtNfmt2UFmtGFX10[]
StringLiteral const DfmtSymbolic[]
StringLiteral const NfmtSymbolicGFX10[]
unsigned const DfmtNfmt2UFmtGFX11[]
StringLiteral const NfmtSymbolicVI[]
StringLiteral const NfmtSymbolicSICI[]
StringLiteral const UfmtSymbolicGFX10[]
int64_t getMsgOpId(int64_t MsgId, StringRef Name, const MCSubtargetInfo &STI)
Map from a symbolic name for a sendmsg operation to the operation portion of the immediate encoding.
int64_t getMsgId(StringRef Name, const MCSubtargetInfo &STI)
Map from a symbolic name for a msg_id to the message portion of the immediate encoding.
static constexpr CustomOperand SysMsgOperands[]
static constexpr CustomOperand StreamMsgOperands[]
StringRef getMsgName(uint64_t Encoding, const MCSubtargetInfo &STI)
Map from an encoding to the symbolic name for a msg_id immediate.
static constexpr CustomOperand MsgOperands[]
StringRef getMsgOpName(int64_t MsgId, uint64_t Encoding, const MCSubtargetInfo &STI)
Map from an encoding to the symbolic name for a sendmsg operation.
bool msgRequiresOp(int64_t MsgId, const MCSubtargetInfo &STI)
const char *const IdSymbolic[]
ArrayRef< GFXVersion > getGFXVersions()
const char *const IdSymbolic[]
static constexpr CustomOperand WaitEventOperands[]
StringRef getWaitEventMaskName(uint64_t Encoding, const MCSubtargetInfo &STI)
bool isGFX10_BEncoding(const MCSubtargetInfo &STI)
bool isGFX10_GFX11(const MCSubtargetInfo &STI)
bool isGFX10Before1030(const MCSubtargetInfo &STI)
const int OPR_ID_UNSUPPORTED
bool isGFX10(const MCSubtargetInfo &STI)
static int64_t getEncodingFromOperandTable(const CustomOperand(&Table)[N], StringRef Name, const MCSubtargetInfo &STI)
Map from a symbolic name for a sendmsg/hwreg asm operand to it's encoding.
bool isGFX12Plus(const MCSubtargetInfo &STI)
bool isGFX940(const MCSubtargetInfo &STI)
bool isGFX11(const MCSubtargetInfo &STI)
bool isGFX10_3_GFX11(const MCSubtargetInfo &STI)
bool isGFX8_GFX9_GFX10(const MCSubtargetInfo &STI)
bool isNotGFX10Plus(const MCSubtargetInfo &STI)
static StringRef getNameFromOperandTable(const CustomOperand(&Table)[N], unsigned Encoding, const MCSubtargetInfo &STI)
Map from the encoding of a sendmsg/hwreg asm operand to it's name.
bool isNotGFX11Plus(const MCSubtargetInfo &STI)
bool isGFX11Plus(const MCSubtargetInfo &STI)
bool isGFX10Plus(const MCSubtargetInfo &STI)
bool isNotGFX9Plus(const MCSubtargetInfo &STI)
bool isGFX9Plus(const MCSubtargetInfo &STI)
const int OPR_ID_UNKNOWN
bool isGFX1250Plus(const MCSubtargetInfo &STI)
bool isNotGFX12Plus(const MCSubtargetInfo &STI)
bool isGFX9_GFX10_GFX11(const MCSubtargetInfo &STI)
bool isGFX9_GFX10(const MCSubtargetInfo &STI)
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
Definition ModRef.h:74
#define N