LLVM 24.0.0git
SIDefines.h
Go to the documentation of this file.
1//===-- SIDefines.h - SI Helper Macros ----------------------*- C++ -*-===//
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/// \file
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_LIB_TARGET_AMDGPU_SIDEFINES_H
11#define LLVM_LIB_TARGET_AMDGPU_SIDEFINES_H
12
13#include "llvm/MC/MCInst.h"
14#include "llvm/MC/MCInstrDesc.h"
15#include "llvm/MC/MCInstrInfo.h"
17
18namespace llvm {
19
20// This needs to be kept in sync with the field bits in SIRegisterClass.
34
36// This must be kept in sync with the SIEncodingFamily class in SIInstrInfo.td
37// and the columns of the getMCOpcodeGen table.
38enum {
39 SI = 0,
40 VI = 1,
41 SDWA = 2,
42 SDWA9 = 3,
43 GFX80 = 4,
44 GFX9 = 5,
45 GFX10 = 6,
46 SDWA10 = 7,
47 GFX90A = 8,
48 GFX940 = 9,
49 GFX11 = 10,
50 GFX1170 = 11,
51 GFX12 = 12,
52 GFX1250 = 13,
53 GFX13 = 14,
54};
55}
56
57namespace SIInstrFlags {
58
59// Raw TSFlags bit constants — use the predicate functions below instead of
60// testing these directly. This namespace makes accidental direct use a
61// compile error outside of SIDefines.h itself.
63// This needs to be kept in sync with the field bits in InstSI.
64enum : uint64_t {
65 // Low bits - basic encoding information.
66 SALU = 1 << 0,
67 VALU = 1 << 1,
68
69 // SALU instruction formats.
70 SOP1 = 1 << 2,
71 SOP2 = 1 << 3,
72 SOPC = 1 << 4,
73 SOPK = 1 << 5,
74 SOPP = 1 << 6,
75
76 // VALU instruction formats.
77 VOP1 = 1 << 7,
78 VOP2 = 1 << 8,
79 VOPC = 1 << 9,
80
81 // TODO: Should this be spilt into VOP3 a and b?
82 VOP3 = 1 << 10,
83 VOP3P = 1 << 12,
84
85 VINTRP = 1 << 13,
86 SDWA = 1 << 14,
87 DPP = 1 << 15,
88 TRANS = 1 << 16,
89
90 // Memory instruction formats.
91 MUBUF = 1 << 17,
92 MTBUF = 1 << 18,
93 SMRD = 1 << 19,
94 MIMG = 1 << 20,
95 VIMAGE = 1 << 21,
96 VSAMPLE = 1 << 22,
97 EXP = 1 << 23,
98 FLAT = 1 << 24,
99 DS = 1 << 25,
100
101 // Combined SGPR/VGPR Spill bit
102 // Logic to separate them out is done in isSGPRSpill and isVGPRSpill
103 Spill = 1 << 26,
104
105 // LDSDIR instruction format.
106 LDSDIR = 1 << 28,
107
108 // VINTERP instruction format.
109 VINTERP = 1 << 29,
110
111 VOPD3 = 1 << 30,
112
113 // High bits - other information.
114 VM_CNT = UINT64_C(1) << 32,
115 EXP_CNT = UINT64_C(1) << 33,
116 LGKM_CNT = UINT64_C(1) << 34,
117
118 WQM = UINT64_C(1) << 35,
119 DisableWQM = UINT64_C(1) << 36,
120 Gather4 = UINT64_C(1) << 37,
121
122 TENSOR_CNT = UINT64_C(1) << 38,
123
124 SCALAR_STORE = UINT64_C(1) << 39,
125 FIXED_SIZE = UINT64_C(1) << 40,
126
127 ASYNC_CNT = UINT64_C(1) << 41,
128
129 VOP3_OPSEL = UINT64_C(1) << 42,
130 maybeAtomic = UINT64_C(1) << 43,
131
132 // A load or store pseudo of the VGPR "as memory" address space (13).
133 VGPRAsMem = UINT64_C(1) << 44,
134
135 // Is a clamp on FP type.
136 FPClamp = UINT64_C(1) << 45,
137
138 // Is an integer clamp
139 IntClamp = UINT64_C(1) << 46,
140
141 // Clamps lo component of register.
142 ClampLo = UINT64_C(1) << 47,
143
144 // Clamps hi component of register.
145 // ClampLo and ClampHi set for packed clamp.
146 ClampHi = UINT64_C(1) << 48,
147
148 // Is a packed VOP3P instruction.
149 IsPacked = UINT64_C(1) << 49,
150
151 // FLAT instruction accesses FLAT_GLBL segment.
152 FlatGlobal = UINT64_C(1) << 51,
153
154 // Uses floating point double precision rounding mode
155 FPDPRounding = UINT64_C(1) << 52,
156
157 // Instruction is FP atomic.
158 FPAtomic = UINT64_C(1) << 53,
159
160 // Is a MFMA instruction.
161 IsMAI = UINT64_C(1) << 54,
162
163 // Is a DOT instruction.
164 IsDOT = UINT64_C(1) << 55,
165
166 // FLAT instruction accesses FLAT_SCRATCH segment.
167 FlatScratch = UINT64_C(1) << 56,
168
169 // Atomic without return.
170 IsAtomicNoRet = UINT64_C(1) << 57,
171
172 // Atomic with return.
173 IsAtomicRet = UINT64_C(1) << 58,
174
175 // Is a WMMA instruction.
176 IsWMMA = UINT64_C(1) << 59,
177
178 // Whether tied sources will be read.
179 TiedSourceNotRead = UINT64_C(1) << 60,
180
181 // Is never uniform.
182 IsNeverUniform = UINT64_C(1) << 61,
183
184 // ds_gws_* instructions.
185 GWS = UINT64_C(1) << 62,
186
187 // Is a SWMMAC instruction.
188 IsSWMMAC = UINT64_C(1) << 63,
189};
190} // namespace DontUseRawTSFlags
191
192// Predicate functions over TSFlags — the single place where raw TSFlags bit
193// tests are written. All callers (SIInstrInfo methods, MC-layer code) go
194// through these so that bit-layout changes require updating only this file.
195//
196// getTSFlags is overloaded for MCInstrDesc, (MCInstrInfo, Opcode), and
197// (MCInstrInfo, MCInst) here; SIInstrInfo.h adds a MachineInstr overload in
198// namespace llvm so ADL finds it when predicates are instantiated with
199// MachineInstr.
200
201constexpr uint64_t getTSFlags(const MCInstrDesc &Desc) { return Desc.TSFlags; }
202inline uint64_t getTSFlags(const MCInstrInfo &MII, unsigned Opcode) {
203 return MII.get(Opcode).TSFlags;
204}
205inline uint64_t getTSFlags(const MCInstrInfo &MII, const MCInst &Inst) {
206 return MII.get(Inst.getOpcode()).TSFlags;
207}
208
209template <typename... T> constexpr bool isSALU(const T &...O) {
210 return getTSFlags(O...) & DontUseRawTSFlags::SALU;
211}
212template <typename... T> constexpr bool isVALU(const T &...O) {
213 return getTSFlags(O...) & DontUseRawTSFlags::VALU;
214}
215template <typename... T> constexpr bool isSOP1(const T &...O) {
216 return getTSFlags(O...) & DontUseRawTSFlags::SOP1;
217}
218template <typename... T> constexpr bool isSOP2(const T &...O) {
219 return getTSFlags(O...) & DontUseRawTSFlags::SOP2;
220}
221template <typename... T> constexpr bool isSOPC(const T &...O) {
222 return getTSFlags(O...) & DontUseRawTSFlags::SOPC;
223}
224template <typename... T> constexpr bool isSOPK(const T &...O) {
225 return getTSFlags(O...) & DontUseRawTSFlags::SOPK;
226}
227template <typename... T> constexpr bool isSOPP(const T &...O) {
228 return getTSFlags(O...) & DontUseRawTSFlags::SOPP;
229}
230template <typename... T> constexpr bool isVOP1(const T &...O) {
231 return getTSFlags(O...) & DontUseRawTSFlags::VOP1;
232}
233template <typename... T> constexpr bool isVOP2(const T &...O) {
234 return getTSFlags(O...) & DontUseRawTSFlags::VOP2;
235}
236template <typename... T> constexpr bool isVOPC(const T &...O) {
237 return getTSFlags(O...) & DontUseRawTSFlags::VOPC;
238}
239template <typename... T> constexpr bool isVOP3(const T &...O) {
240 return getTSFlags(O...) & DontUseRawTSFlags::VOP3;
241}
242template <typename... T> constexpr bool isVOP3P(const T &...O) {
244}
245template <typename... T> constexpr bool isVOP3Like(const T &...O) {
246 return getTSFlags(O...) &
248}
249template <typename... T> constexpr bool isVINTRP(const T &...O) {
251}
252template <typename... T> constexpr bool isSDWA(const T &...O) {
253 return getTSFlags(O...) & DontUseRawTSFlags::SDWA;
254}
255template <typename... T> constexpr bool isDPP(const T &...O) {
256 return getTSFlags(O...) & DontUseRawTSFlags::DPP;
257}
258template <typename... T> constexpr bool isTRANS(const T &...O) {
260}
261template <typename... T> constexpr bool isMUBUF(const T &...O) {
263}
264template <typename... T> constexpr bool isMTBUF(const T &...O) {
266}
267template <typename... T> constexpr bool isBuffer(const T &...O) {
268 return getTSFlags(O...) &
270}
271template <typename... T> constexpr bool isSMRD(const T &...O) {
272 return getTSFlags(O...) & DontUseRawTSFlags::SMRD;
273}
274template <typename... T> constexpr bool isMIMG(const T &...O) {
275 return getTSFlags(O...) & DontUseRawTSFlags::MIMG;
276}
277template <typename... T> constexpr bool isVIMAGE(const T &...O) {
279}
280template <typename... T> constexpr bool isVSAMPLE(const T &...O) {
282}
283template <typename... T> constexpr bool isEXP(const T &...O) {
284 return getTSFlags(O...) & DontUseRawTSFlags::EXP;
285}
286template <typename... T> constexpr bool isFLAT(const T &...O) {
287 return getTSFlags(O...) & DontUseRawTSFlags::FLAT;
288}
289template <typename... T> constexpr bool isDS(const T &...O) {
290 return getTSFlags(O...) & DontUseRawTSFlags::DS;
291}
292template <typename... T> constexpr bool isSpill(const T &...O) {
294}
295template <typename... T> constexpr bool isLDSDIR(const T &...O) {
297}
298template <typename... T> constexpr bool isVINTERP(const T &...O) {
300}
301template <typename... T> constexpr bool isWQM(const T &...O) {
302 return getTSFlags(O...) & DontUseRawTSFlags::WQM;
303}
304template <typename... T> constexpr bool isDisableWQM(const T &...O) {
306}
307template <typename... T> constexpr bool isGather4(const T &...O) {
309}
310template <typename... T> constexpr bool usesTENSOR_CNT(const T &...O) {
312}
313template <typename... T> constexpr bool isScalarStore(const T &...O) {
315}
316template <typename... T> constexpr bool isFixedSize(const T &...O) {
318}
319template <typename... T> constexpr bool usesASYNC_CNT(const T &...O) {
321}
322template <typename... T> constexpr bool hasVOP3OpSel(const T &...O) {
324}
325template <typename... T> constexpr bool isMaybeAtomic(const T &...O) {
327}
328template <typename... T> constexpr bool isVGPRAsMem(const T &...O) {
330}
331template <typename... T> constexpr bool hasFPClamp(const T &...O) {
333}
334template <typename... T> constexpr bool hasIntClamp(const T &...O) {
336}
337template <typename... T> constexpr bool hasClampLo(const T &...O) {
339}
340template <typename... T> constexpr bool hasClampHi(const T &...O) {
342}
343template <typename... T> constexpr bool isPacked(const T &...O) {
345}
346template <typename... T> constexpr bool isFlatGlobal(const T &...O) {
348}
349template <typename... T> constexpr bool usesFPDPRounding(const T &...O) {
351}
352template <typename... T> constexpr bool isFPAtomic(const T &...O) {
354}
355template <typename... T> constexpr bool isMAI(const T &...O) {
357}
358template <typename... T> constexpr bool isDOT(const T &...O) {
360}
361template <typename... T> constexpr bool isFlatScratch(const T &...O) {
363}
364template <typename... T> constexpr bool isAtomicNoRet(const T &...O) {
366}
367template <typename... T> constexpr bool isAtomicRet(const T &...O) {
369}
370template <typename... T> constexpr bool isWMMA(const T &...O) {
372}
373template <typename... T> constexpr bool isTiedSourceNotRead(const T &...O) {
375}
376template <typename... T> constexpr bool isNeverUniform(const T &...O) {
378}
379template <typename... T> constexpr bool isGWS(const T &...O) {
380 return getTSFlags(O...) & DontUseRawTSFlags::GWS;
381}
382template <typename... T> constexpr bool isSWMMAC(const T &...O) {
384}
385template <typename... T> constexpr bool isVOPD3(const T &...O) {
387}
388template <typename... T> constexpr bool usesVM_CNT(const T &...O) {
390}
391template <typename... T> constexpr bool usesLGKM_CNT(const T &...O) {
393}
394
395// Compound predicates.
396template <typename... T> constexpr bool isAtomic(const T &...O) {
397 return isAtomicNoRet(O...) || isAtomicRet(O...);
398}
399template <typename... T> constexpr bool isSegmentSpecificFLAT(const T &...O) {
400 return isFlatGlobal(O...) || isFlatScratch(O...);
401}
402// Any image-family instruction: pre-gfx11 MIMG, gfx11+ VIMAGE or VSAMPLE.
403template <typename... T> constexpr bool isImage(const T &...O) {
404 return isMIMG(O...) || isVIMAGE(O...) || isVSAMPLE(O...);
405}
406// Vector memory: buffer + image + flat.
407template <typename... T> constexpr bool isVMEM(const T &...O) {
408 return isMUBUF(O...) || isMTBUF(O...) || isImage(O...) || isFLAT(O...);
409}
410
411// v_cmp_class_* etc. use a 10-bit mask for what operation is checked.
412// The result is true if any of these tests are true.
413enum ClassFlags : unsigned {
414 S_NAN = 1 << 0, // Signaling NaN
415 Q_NAN = 1 << 1, // Quiet NaN
416 N_INFINITY = 1 << 2, // Negative infinity
417 N_NORMAL = 1 << 3, // Negative normal
418 N_SUBNORMAL = 1 << 4, // Negative subnormal
419 N_ZERO = 1 << 5, // Negative zero
420 P_ZERO = 1 << 6, // Positive zero
421 P_SUBNORMAL = 1 << 7, // Positive subnormal
422 P_NORMAL = 1 << 8, // Positive normal
423 P_INFINITY = 1 << 9 // Positive infinity
424};
425}
426
427namespace AMDGPU {
428
429enum OperandType : unsigned {
430 /// Operands with register, 32-bit, or 64-bit immediate
448
449 /// Operands with register or inline constant
460
461 // Operand for split barrier inline constant
463
464 /// Operand with 32-bit immediate that uses the constant bus.
468
469 /// Operands with an AccVGPR register or inline constant
473
474 // Operand for AV_MOV_B64_IMM_PSEUDO, which is a pair of 32-bit inline
475 // constants. Does not accept registers.
477
478 // Operand for source modifiers for VOP instructions
480
481 // Operand for SDWA instructions
483
486
489
492
495
498
499};
500}
501
502// Input operand modifiers bit-masks
503// NEG and SEXT share same bit-mask because they can't be set simultaneously.
504namespace SISrcMods {
505enum : unsigned {
506 NONE = 0,
507 NEG = 1 << 0, // Floating-point negate modifier
508 ABS = 1 << 1, // Floating-point absolute modifier
509 SEXT = 1 << 4, // Integer sign-extend modifier
510 NEG_HI = ABS, // Floating-point negate high packed component modifier.
511 OP_SEL_0 = 1 << 2,
512 OP_SEL_1 = 1 << 3,
513 DST_OP_SEL = 1 << 3 // VOP3 dst op_sel (share mask with OP_SEL_1)
514};
515}
516
517namespace SIOutMods {
518 enum : unsigned {
519 NONE = 0,
520 MUL2 = 1,
521 MUL4 = 2,
523 };
524}
525
526namespace AMDGPU {
527namespace VGPRIndexMode {
528
529enum Id : unsigned { // id of symbolic names
534
537};
538
548
549} // namespace VGPRIndexMode
550} // namespace AMDGPU
551
553 enum : unsigned {
555 VOP3 = 1,
556 SDWA = 2,
557 SDWA9 = 3,
558 DPP = 4,
560 };
561} // namespace AMDGPUAsmVariants
562
563namespace AMDGPU {
564namespace EncValues { // Encoding values of enum9/8/7 operands
565
566enum : unsigned {
583 VGPR_MIN = 256,
584 VGPR_MAX = 511,
585 IS_VGPR = 256, // Indicates VGPR or AGPR
586};
587
588} // namespace EncValues
589
590// Register codes as defined in the TableGen's HWEncoding field.
591namespace HWEncoding {
592enum : unsigned {
595 IS_VGPR = 1 << 10,
596 IS_AGPR = 1 << 11,
597 IS_HI16 = 1 << 12,
598};
599} // namespace HWEncoding
600
601namespace CPol {
602
603enum CPol {
604 GLC = 1,
605 SLC = 2,
606 DLC = 4,
607 SCC = 16,
613
614 // Below are GFX12+ cache policy bits
615
616 // Temporal hint
617 TH = 0x7, // All TH bits
618 TH_RT = 0, // regular
619 TH_NT = 1, // non-temporal
620 TH_HT = 2, // high-temporal
621 TH_LU = 3, // last use
622 TH_WB = 3, // regular (CU, SE), high-temporal with write-back (MALL)
623 TH_NT_RT = 4, // non-temporal (CU, SE), regular (MALL)
624 TH_RT_NT = 5, // regular (CU, SE), non-temporal (MALL)
625 TH_NT_HT = 6, // non-temporal (CU, SE), high-temporal (MALL)
626 TH_NT_WB = 7, // non-temporal (CU, SE), high-temporal with write-back (MALL)
627 TH_BYPASS = 3, // only to be used with scope = 3
628
629 TH_RESERVED = 7, // unused value for load insts
630
631 // Bits of TH for atomics
632 TH_ATOMIC_RETURN = GLC, // Returning vs non-returning
633 TH_ATOMIC_NT = SLC, // Non-temporal vs regular
634 TH_ATOMIC_CASCADE = 4, // Cascading vs regular
635
636 // Scope
639 SCOPE = SCOPE_MASK << SCOPE_SHIFT, // All Scope bits
644
645 NV = 1 << 5, // Non-volatile bit
646
647 SWZ = 1 << 6, // Swizzle bit
648
649 // Cache fill size
651 CFS_MASK = 0x3,
657
658 ALL = TH | SCOPE | NV | CFS,
659
660 SCAL = 1 << 9, // Scale offset bit
661
662 // Helper bits
663 TH_TYPE_LOAD = 1 << 27, // TH_LOAD policy
664 TH_TYPE_STORE = 1 << 28, // TH_STORE policy
665 TH_TYPE_ATOMIC = 1 << 29, // TH_ATOMIC policy
666 TH_REAL_BYPASS = 1 << 30, // is TH=3 bypass policy or not
667
668 // Volatile (used to preserve/signal operation volatility for buffer
669 // operations not a real instruction bit)
670 VOLATILE = 1 << 31,
671 // The set of "cache policy" bits used for compiler features that
672 // do not correspond to handware features.
674};
675
676} // namespace CPol
677
678namespace SendMsg { // Encoding of SIMM16 used in s_sendmsg* insns.
679
680enum Id { // Message ID, width(4) [3:0].
682
683 ID_GS_PreGFX11 = 2, // replaced in GFX11
684 ID_GS_DONE_PreGFX11 = 3, // replaced in GFX11
685
686 ID_HS_TESSFACTOR_GFX11Plus = 2, // reused in GFX11
687 ID_DEALLOC_VGPRS_GFX11Plus = 3, // reused in GFX11
688
689 ID_SAVEWAVE = 4, // added in GFX8, removed in GFX11
690 ID_STALL_WAVE_GEN = 5, // added in GFX9, removed in GFX12
691 ID_HALT_WAVES = 6, // added in GFX9, removed in GFX12
692 ID_ORDERED_PS_DONE = 7, // added in GFX9, removed in GFX11
693 ID_EARLY_PRIM_DEALLOC = 8, // added in GFX9, removed in GFX10
694 ID_GS_ALLOC_REQ = 9, // added in GFX9
695 ID_GET_DOORBELL = 10, // added in GFX9, removed in GFX11
696 ID_GET_DDID = 11, // added in GFX10, removed in GFX11
698
707
708 ID_RTN_GET_CLUSTER_BARRIER_STATE = 136, // added in GFX1250
709 ID_RTN_SAVE_WAVE_HAS_TDM = 152, // added in GFX1250
710
713};
714
715enum Op { // Both GS and SYS operation IDs.
718 // Bits used for operation encoding
720 OP_MASK_ = (((1 << OP_WIDTH_) - 1) << OP_SHIFT_),
721 // GS operations are encoded in bits 5:4
727 // SYS operations are encoded in bits 6:4
733};
734
744
745} // namespace SendMsg
746
747namespace WaitEvent { // Encoding of SIMM16 used in s_wait_event
748enum Id {
749 DONT_WAIT_EXPORT_READY = 1 << 0, // Only used in gfx11
750 EXPORT_READY = 1 << 1, // gfx12+
751};
752
753} // namespace WaitEvent
754
755namespace Hwreg { // Encoding of SIMM16 used in s_setreg/getreg* insns.
756
810
811enum Offset : unsigned { // Offset, (5) [10:6]
813 OFFSET_ME_ID = 8, // in HW_ID2
814};
815
817 FP_ROUND_MASK = 0xf << 0, // Bits 0..3
818 FP_DENORM_MASK = 0xf << 4, // Bits 4..7
821 LOD_CLAMP_MASK = 1 << 10,
822 DEBUG_MASK = 1 << 11,
823
824 // EXCP_EN fields.
832
834 VSKIP_MASK = 1 << 28,
835 CSP_MASK = 0x7u << 29, // Bits 29..31
836
837 // GFX1250
838 DST_VGPR_MSB = 0x3 << 12,
839 SRC0_VGPR_MSB = 0x3 << 14,
840 SRC1_VGPR_MSB = 0x3 << 16,
841 SRC2_VGPR_MSB = 0x3 << 18,
842 VGPR_MSB_MASK = 0xff << 12, // Bits 12..19
843
844 REPLAY_MODE = 1 << 25,
846};
847
848} // namespace Hwreg
849
919
920namespace UfmtGFX10 {
921enum UnifiedFormat : int64_t {
923
930
938
945
949
957
965
973
980
987
994
998
1006
1013
1016};
1017
1018} // namespace UfmtGFX10
1019
1020namespace UfmtGFX11 {
1021enum UnifiedFormat : int64_t {
1023
1030
1038
1045
1049
1057
1059
1061
1066
1073
1080
1084
1092
1099
1102};
1103
1104} // namespace UfmtGFX11
1105
1106namespace Swizzle { // Encoding of swizzle macro used in ds_swizzle_b32.
1107
1117
1118// clang-format off
1119enum EncBits : unsigned {
1120
1121 // swizzle mode encodings
1122
1125
1128
1130
1133
1135 FFT_MODE_LO = 0xE000,
1136
1137 // QUAD_PERM encodings
1138
1143
1144 // BITMASK_PERM encodings
1145
1149
1153
1154 // FFT encodings
1155
1158
1159 // ROTATE encodings
1161 ROTATE_DIR_SHIFT = 10, // bit position of rotate direction
1163 ROTATE_SIZE_SHIFT = 5, // bit position of rotate size
1165};
1166// clang-format on
1167
1168} // namespace Swizzle
1169
1170namespace SDWA {
1171
1172enum SdwaSel : unsigned {
1180};
1181
1182enum DstUnused : unsigned {
1186};
1187
1202
1203} // namespace SDWA
1204
1205namespace DPP {
1206
1207// clang-format off
1252// clang-format on
1253
1260
1261} // namespace DPP
1262
1263namespace Exp {
1264
1265enum Target : unsigned {
1269 ET_NULL = 9, // Pre-GFX11
1272 ET_POS4 = 16, // GFX10+
1273 ET_POS_LAST = ET_POS4, // Highest pos used on any subtarget
1274 ET_PRIM = 20, // GFX10+
1275 ET_DUAL_SRC_BLEND0 = 21, // GFX11+
1276 ET_DUAL_SRC_BLEND1 = 22, // GFX11+
1277 ET_PARAM0 = 32, // Pre-GFX11
1278 ET_PARAM31 = 63, // Pre-GFX11
1279
1287
1289};
1290
1291} // namespace Exp
1292
1313
1314namespace VOP3PEncoding {
1315
1317 OP_SEL_HI_0 = UINT64_C(1) << 59,
1318 OP_SEL_HI_1 = UINT64_C(1) << 60,
1319 OP_SEL_HI_2 = UINT64_C(1) << 14,
1320};
1321
1322} // namespace VOP3PEncoding
1323
1324namespace ImplicitArg {
1325// Implicit kernel argument offset for code object version 5.
1338
1339} // namespace ImplicitArg
1340
1342// Enum value used in cbsz/blgp for F8F6F4 MFMA operations to select the matrix
1343// format.
1351} // namespace MFMAScaleFormats
1352
1353namespace VirtRegFlag {
1354// Virtual register flags used for various target specific handlings during
1355// codegen.
1357 // Register operand in a whole-wave mode operation.
1358 WWM_REG = 1 << 0,
1359};
1360
1361} // namespace VirtRegFlag
1362
1363} // namespace AMDGPU
1364
1365namespace AMDGPU {
1366namespace Barrier {
1367
1376
1377} // namespace Barrier
1378
1380/// Synthetic aperture numbers. This is OR'd with the high
1381/// bits of the LDS aperture pointer.
1382///
1383/// NOTE: This is also documented in AMDGPUUsage.
1385 None = 0x00000000,
1386
1387 BARRIER = 0x00000001,
1388 VGPR = 0x00000003,
1389};
1390} // namespace SyntheticAperture
1391
1392} // namespace AMDGPU
1393
1394// clang-format off
1395
1396#define R_00B028_SPI_SHADER_PGM_RSRC1_PS 0x00B028
1397#define S_00B028_VGPRS(x) (((x) & 0x3F) << 0)
1398#define S_00B028_SGPRS(x) (((x) & 0x0F) << 6)
1399#define S_00B028_MEM_ORDERED(x) (((x) & 0x1) << 25)
1400#define G_00B028_MEM_ORDERED(x) (((x) >> 25) & 0x1)
1401#define C_00B028_MEM_ORDERED 0xFDFFFFFF
1402
1403#define R_00B02C_SPI_SHADER_PGM_RSRC2_PS 0x00B02C
1404#define S_00B02C_EXTRA_LDS_SIZE(x) (((x) & 0xFF) << 8)
1405#define R_00B128_SPI_SHADER_PGM_RSRC1_VS 0x00B128
1406#define S_00B128_MEM_ORDERED(x) (((x) & 0x1) << 27)
1407#define G_00B128_MEM_ORDERED(x) (((x) >> 27) & 0x1)
1408#define C_00B128_MEM_ORDERED 0xF7FFFFFF
1409
1410#define R_00B228_SPI_SHADER_PGM_RSRC1_GS 0x00B228
1411#define S_00B228_WGP_MODE(x) (((x) & 0x1) << 27)
1412#define G_00B228_WGP_MODE(x) (((x) >> 27) & 0x1)
1413#define C_00B228_WGP_MODE 0xF7FFFFFF
1414#define S_00B228_MEM_ORDERED(x) (((x) & 0x1) << 25)
1415#define G_00B228_MEM_ORDERED(x) (((x) >> 25) & 0x1)
1416#define C_00B228_MEM_ORDERED 0xFDFFFFFF
1417
1418#define R_00B328_SPI_SHADER_PGM_RSRC1_ES 0x00B328
1419#define R_00B428_SPI_SHADER_PGM_RSRC1_HS 0x00B428
1420#define S_00B428_WGP_MODE(x) (((x) & 0x1) << 26)
1421#define G_00B428_WGP_MODE(x) (((x) >> 26) & 0x1)
1422#define C_00B428_WGP_MODE 0xFBFFFFFF
1423#define S_00B428_MEM_ORDERED(x) (((x) & 0x1) << 24)
1424#define G_00B428_MEM_ORDERED(x) (((x) >> 24) & 0x1)
1425#define C_00B428_MEM_ORDERED 0xFEFFFFFF
1426
1427#define R_00B528_SPI_SHADER_PGM_RSRC1_LS 0x00B528
1428
1429#define R_00B84C_COMPUTE_PGM_RSRC2 0x00B84C
1430#define S_00B84C_SCRATCH_EN(x) (((x) & 0x1) << 0)
1431#define G_00B84C_SCRATCH_EN(x) (((x) >> 0) & 0x1)
1432#define C_00B84C_SCRATCH_EN 0xFFFFFFFE
1433#define S_00B84C_USER_SGPR(x) (((x) & 0x1F) << 1)
1434#define G_00B84C_USER_SGPR(x) (((x) >> 1) & 0x1F)
1435#define C_00B84C_USER_SGPR 0xFFFFFFC1
1436#define S_00B84C_TRAP_HANDLER(x) (((x) & 0x1) << 6)
1437#define G_00B84C_TRAP_HANDLER(x) (((x) >> 6) & 0x1)
1438#define C_00B84C_TRAP_HANDLER 0xFFFFFFBF
1439#define S_00B84C_TGID_X_EN(x) (((x) & 0x1) << 7)
1440#define G_00B84C_TGID_X_EN(x) (((x) >> 7) & 0x1)
1441#define C_00B84C_TGID_X_EN 0xFFFFFF7F
1442#define S_00B84C_TGID_Y_EN(x) (((x) & 0x1) << 8)
1443#define G_00B84C_TGID_Y_EN(x) (((x) >> 8) & 0x1)
1444#define C_00B84C_TGID_Y_EN 0xFFFFFEFF
1445#define S_00B84C_TGID_Z_EN(x) (((x) & 0x1) << 9)
1446#define G_00B84C_TGID_Z_EN(x) (((x) >> 9) & 0x1)
1447#define C_00B84C_TGID_Z_EN 0xFFFFFDFF
1448#define S_00B84C_TG_SIZE_EN(x) (((x) & 0x1) << 10)
1449#define G_00B84C_TG_SIZE_EN(x) (((x) >> 10) & 0x1)
1450#define C_00B84C_TG_SIZE_EN 0xFFFFFBFF
1451#define S_00B84C_TIDIG_COMP_CNT(x) (((x) & 0x03) << 11)
1452#define G_00B84C_TIDIG_COMP_CNT(x) (((x) >> 11) & 0x03)
1453#define C_00B84C_TIDIG_COMP_CNT 0xFFFFE7FF
1454/* CIK */
1455#define S_00B84C_EXCP_EN_MSB(x) (((x) & 0x03) << 13)
1456#define G_00B84C_EXCP_EN_MSB(x) (((x) >> 13) & 0x03)
1457#define C_00B84C_EXCP_EN_MSB 0xFFFF9FFF
1458/* */
1459#define S_00B84C_LDS_SIZE(x) (((x) & 0x1FF) << 15)
1460#define G_00B84C_LDS_SIZE(x) (((x) >> 15) & 0x1FF)
1461#define C_00B84C_LDS_SIZE 0xFF007FFF
1462#define S_00B84C_EXCP_EN(x) (((x) & 0x7F) << 24)
1463#define G_00B84C_EXCP_EN(x) (((x) >> 24) & 0x7F)
1464#define C_00B84C_EXCP_EN 0x80FFFFFF
1465
1466#define S_00B84C_USER_SGPR_GFX1250(x) (((x) & 0x3F) << 1)
1467#define G_00B84C_USER_SGPR_GFX1250(x) (((x) >> 1) & 0x3F)
1468#define C_00B84C_USER_SGPR_GFX1250 0xFFFFFF81
1469
1470#define R_0286CC_SPI_PS_INPUT_ENA 0x0286CC
1471#define R_0286D0_SPI_PS_INPUT_ADDR 0x0286D0
1472
1473#define R_00B848_COMPUTE_PGM_RSRC1 0x00B848
1474#define S_00B848_VGPRS(x) (((x) & 0x3F) << 0)
1475#define G_00B848_VGPRS(x) (((x) >> 0) & 0x3F)
1476#define C_00B848_VGPRS 0xFFFFFFC0
1477#define S_00B848_SGPRS(x) (((x) & 0x0F) << 6)
1478#define G_00B848_SGPRS(x) (((x) >> 6) & 0x0F)
1479#define C_00B848_SGPRS 0xFFFFFC3F
1480#define S_00B848_PRIORITY(x) (((x) & 0x03) << 10)
1481#define G_00B848_PRIORITY(x) (((x) >> 10) & 0x03)
1482#define C_00B848_PRIORITY 0xFFFFF3FF
1483#define S_00B848_FLOAT_MODE(x) (((x) & 0xFF) << 12)
1484#define G_00B848_FLOAT_MODE(x) (((x) >> 12) & 0xFF)
1485#define C_00B848_FLOAT_MODE 0xFFF00FFF
1486#define S_00B848_PRIV(x) (((x) & 0x1) << 20)
1487#define G_00B848_PRIV(x) (((x) >> 20) & 0x1)
1488#define C_00B848_PRIV 0xFFEFFFFF
1489#define S_00B848_DX10_CLAMP(x) (((x) & 0x1) << 21)
1490#define G_00B848_DX10_CLAMP(x) (((x) >> 21) & 0x1)
1491#define C_00B848_DX10_CLAMP 0xFFDFFFFF
1492#define S_00B848_RR_WG_MODE(x) (((x) & 0x1) << 21)
1493#define G_00B848_RR_WG_MODE(x) (((x) >> 21) & 0x1)
1494#define C_00B848_RR_WG_MODE 0xFFDFFFFF
1495#define S_00B848_DEBUG_MODE(x) (((x) & 0x1) << 22)
1496#define G_00B848_DEBUG_MODE(x) (((x) >> 22) & 0x1)
1497#define C_00B848_DEBUG_MODE 0xFFBFFFFF
1498#define S_00B848_IEEE_MODE(x) (((x) & 0x1) << 23)
1499#define G_00B848_IEEE_MODE(x) (((x) >> 23) & 0x1)
1500#define C_00B848_IEEE_MODE 0xFF7FFFFF
1501#define S_00B848_WGP_MODE(x) (((x) & 0x1) << 29)
1502#define G_00B848_WGP_MODE(x) (((x) >> 29) & 0x1)
1503#define C_00B848_WGP_MODE 0xDFFFFFFF
1504#define S_00B848_MEM_ORDERED(x) (((x) & 0x1) << 30)
1505#define G_00B848_MEM_ORDERED(x) (((x) >> 30) & 0x1)
1506#define C_00B848_MEM_ORDERED 0xBFFFFFFF
1507#define S_00B848_FWD_PROGRESS(x) (((x) & 0x1) << 31)
1508#define G_00B848_FWD_PROGRESS(x) (((x) >> 31) & 0x1)
1509#define C_00B848_FWD_PROGRESS 0x7FFFFFFF
1510
1511// Helpers for setting FLOAT_MODE
1512#define FP_ROUND_ROUND_TO_NEAREST 0
1513#define FP_ROUND_ROUND_TO_INF 1
1514#define FP_ROUND_ROUND_TO_NEGINF 2
1515#define FP_ROUND_ROUND_TO_ZERO 3
1516
1517// Bits 3:0 control rounding mode. 1:0 control single precision, 3:2 double
1518// precision.
1519#define FP_ROUND_MODE_SP(x) ((x) & 0x3)
1520#define FP_ROUND_MODE_DP(x) (((x) & 0x3) << 2)
1521
1522#define FP_DENORM_FLUSH_IN_FLUSH_OUT 0
1523#define FP_DENORM_FLUSH_OUT 1
1524#define FP_DENORM_FLUSH_IN 2
1525#define FP_DENORM_FLUSH_NONE 3
1526
1527
1528// Bits 7:4 control denormal handling. 5:4 control single precision, 6:7 double
1529// precision.
1530#define FP_DENORM_MODE_SP(x) (((x) & 0x3) << 4)
1531#define FP_DENORM_MODE_DP(x) (((x) & 0x3) << 6)
1532
1533#define R_00B860_COMPUTE_TMPRING_SIZE 0x00B860
1534#define S_00B860_WAVESIZE_PreGFX11(x) (((x) & 0x1FFF) << 12)
1535#define S_00B860_WAVESIZE_GFX11(x) (((x) & 0x7FFF) << 12)
1536#define S_00B860_WAVESIZE_GFX12Plus(x) (((x) & 0x3FFFF) << 12)
1537
1538#define R_0286E8_SPI_TMPRING_SIZE 0x0286E8
1539#define S_0286E8_WAVESIZE_PreGFX11(x) (((x) & 0x1FFF) << 12)
1540#define S_0286E8_WAVESIZE_GFX11(x) (((x) & 0x7FFF) << 12)
1541#define S_0286E8_WAVESIZE_GFX12Plus(x) (((x) & 0x3FFFF) << 12)
1542
1543#define R_028B54_VGT_SHADER_STAGES_EN 0x028B54
1544#define S_028B54_HS_W32_EN(x) (((x) & 0x1) << 21)
1545#define S_028B54_GS_W32_EN(x) (((x) & 0x1) << 22)
1546#define S_028B54_VS_W32_EN(x) (((x) & 0x1) << 23)
1547#define R_0286D8_SPI_PS_IN_CONTROL 0x0286D8
1548#define S_0286D8_PS_W32_EN(x) (((x) & 0x1) << 15)
1549#define R_00B800_COMPUTE_DISPATCH_INITIATOR 0x00B800
1550#define S_00B800_CS_W32_EN(x) (((x) & 0x1) << 15)
1551
1552#define R_SPILLED_SGPRS 0x4
1553#define R_SPILLED_VGPRS 0x8
1554
1555// clang-format on
1556
1557} // End namespace llvm
1558
1559#endif
AMDGPU address space definition.
uint64_t uint64_t
#define T
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:187
unsigned getOpcode() const
Definition MCInst.h:201
Describe properties that are true of each instruction in the target description file.
Interface to description of machine instruction set.
Definition MCInstrInfo.h:27
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
Definition MCInstrInfo.h:89
SyntheticAperture
Synthetic aperture numbers.
Definition SIDefines.h:1384
@ OPERAND_REG_IMM_V2FP64
Definition SIDefines.h:447
@ OPERAND_KIMM32
Operand with 32-bit immediate that uses the constant bus.
Definition SIDefines.h:465
@ OPERAND_REG_INLINE_C_LAST
Definition SIDefines.h:488
@ OPERAND_REG_IMM_INT64
Definition SIDefines.h:432
@ OPERAND_REG_IMM_V2FP16
Definition SIDefines.h:440
@ OPERAND_REG_INLINE_C_FP64
Definition SIDefines.h:456
@ OPERAND_REG_IMM_NOINLINE_FP16
Definition SIDefines.h:438
@ OPERAND_REG_INLINE_C_BF16
Definition SIDefines.h:453
@ OPERAND_REG_IMM_FIRST
Definition SIDefines.h:484
@ OPERAND_REG_INLINE_C_V2BF16
Definition SIDefines.h:458
@ OPERAND_REG_IMM_V2INT64
Definition SIDefines.h:443
@ OPERAND_REG_IMM_V2INT16
Definition SIDefines.h:442
@ OPERAND_REG_IMM_BF16
Definition SIDefines.h:436
@ OPERAND_REG_IMM_INT32
Operands with register, 32-bit, or 64-bit immediate.
Definition SIDefines.h:431
@ OPERAND_REG_IMM_V2BF16
Definition SIDefines.h:439
@ OPERAND_REG_INLINE_AC_FIRST
Definition SIDefines.h:490
@ OPERAND_REG_IMM_FP16
Definition SIDefines.h:437
@ OPERAND_REG_IMM_V2FP16_SPLAT
Definition SIDefines.h:441
@ OPERAND_REG_INLINE_C_INT64
Definition SIDefines.h:452
@ OPERAND_REG_INLINE_C_INT16
Operands with register or inline constant.
Definition SIDefines.h:450
@ OPERAND_REG_IMM_NOINLINE_V2FP16
Definition SIDefines.h:444
@ OPERAND_REG_IMM_FP64
Definition SIDefines.h:435
@ OPERAND_REG_INLINE_C_V2FP16
Definition SIDefines.h:459
@ OPERAND_REG_INLINE_AC_INT32
Operands with an AccVGPR register or inline constant.
Definition SIDefines.h:470
@ OPERAND_REG_INLINE_AC_FP32
Definition SIDefines.h:471
@ OPERAND_REG_IMM_V2INT32
Definition SIDefines.h:445
@ OPERAND_SDWA_VOPC_DST
Definition SIDefines.h:482
@ OPERAND_REG_IMM_FP32
Definition SIDefines.h:434
@ OPERAND_REG_INLINE_C_FIRST
Definition SIDefines.h:487
@ OPERAND_REG_INLINE_C_FP32
Definition SIDefines.h:455
@ OPERAND_REG_INLINE_AC_LAST
Definition SIDefines.h:491
@ OPERAND_REG_IMM_LAST
Definition SIDefines.h:485
@ OPERAND_REG_INLINE_C_INT32
Definition SIDefines.h:451
@ OPERAND_REG_INLINE_C_V2INT16
Definition SIDefines.h:457
@ OPERAND_INLINE_C_AV64_PSEUDO
Definition SIDefines.h:476
@ OPERAND_REG_IMM_V2FP32
Definition SIDefines.h:446
@ OPERAND_REG_INLINE_AC_FP64
Definition SIDefines.h:472
@ OPERAND_REG_INLINE_C_FP16
Definition SIDefines.h:454
@ OPERAND_REG_IMM_INT16
Definition SIDefines.h:433
@ OPERAND_INLINE_SPLIT_BARRIER_INT32
Definition SIDefines.h:462
@ OPERAND_FIRST_TARGET
Definition MCInstrDesc.h:81
constexpr bool isAtomicRet(const T &...O)
Definition SIDefines.h:367
constexpr bool isVOPC(const T &...O)
Definition SIDefines.h:236
constexpr bool isVOP3(const T &...O)
Definition SIDefines.h:239
constexpr bool isScalarStore(const T &...O)
Definition SIDefines.h:313
constexpr bool hasVOP3OpSel(const T &...O)
Definition SIDefines.h:322
constexpr bool isVOP1(const T &...O)
Definition SIDefines.h:230
constexpr bool isFPAtomic(const T &...O)
Definition SIDefines.h:352
constexpr bool usesVM_CNT(const T &...O)
Definition SIDefines.h:388
constexpr bool usesTENSOR_CNT(const T &...O)
Definition SIDefines.h:310
constexpr bool isMAI(const T &...O)
Definition SIDefines.h:355
constexpr bool isVOP2(const T &...O)
Definition SIDefines.h:233
constexpr bool isMaybeAtomic(const T &...O)
Definition SIDefines.h:325
constexpr bool isSWMMAC(const T &...O)
Definition SIDefines.h:382
constexpr bool isTRANS(const T &...O)
Definition SIDefines.h:258
constexpr bool isSOP2(const T &...O)
Definition SIDefines.h:218
constexpr bool isFLAT(const T &...O)
Definition SIDefines.h:286
constexpr bool isVOP3P(const T &...O)
Definition SIDefines.h:242
constexpr bool usesFPDPRounding(const T &...O)
Definition SIDefines.h:349
constexpr bool isDisableWQM(const T &...O)
Definition SIDefines.h:304
constexpr bool isBuffer(const T &...O)
Definition SIDefines.h:267
constexpr bool hasIntClamp(const T &...O)
Definition SIDefines.h:334
constexpr bool isAtomicNoRet(const T &...O)
Definition SIDefines.h:364
constexpr bool isMTBUF(const T &...O)
Definition SIDefines.h:264
constexpr bool isVIMAGE(const T &...O)
Definition SIDefines.h:277
constexpr bool isSMRD(const T &...O)
Definition SIDefines.h:271
constexpr bool isVOP3Like(const T &...O)
Definition SIDefines.h:245
constexpr bool isFlatScratch(const T &...O)
Definition SIDefines.h:361
constexpr bool isSpill(const T &...O)
Definition SIDefines.h:292
constexpr uint64_t getTSFlags(const MCInstrDesc &Desc)
Definition SIDefines.h:201
constexpr bool isMIMG(const T &...O)
Definition SIDefines.h:274
constexpr bool isVMEM(const T &...O)
Definition SIDefines.h:407
constexpr bool hasFPClamp(const T &...O)
Definition SIDefines.h:331
constexpr bool isNeverUniform(const T &...O)
Definition SIDefines.h:376
constexpr bool isImage(const T &...O)
Definition SIDefines.h:403
constexpr bool isWMMA(const T &...O)
Definition SIDefines.h:370
constexpr bool isVALU(const T &...O)
Definition SIDefines.h:212
constexpr bool isWQM(const T &...O)
Definition SIDefines.h:301
constexpr bool isVOPD3(const T &...O)
Definition SIDefines.h:385
constexpr bool hasClampLo(const T &...O)
Definition SIDefines.h:337
constexpr bool isGWS(const T &...O)
Definition SIDefines.h:379
constexpr bool isFlatGlobal(const T &...O)
Definition SIDefines.h:346
constexpr bool usesASYNC_CNT(const T &...O)
Definition SIDefines.h:319
constexpr bool isMUBUF(const T &...O)
Definition SIDefines.h:261
constexpr bool isSDWA(const T &...O)
Definition SIDefines.h:252
constexpr bool isTiedSourceNotRead(const T &...O)
Definition SIDefines.h:373
constexpr bool isEXP(const T &...O)
Definition SIDefines.h:283
constexpr bool usesLGKM_CNT(const T &...O)
Definition SIDefines.h:391
constexpr bool isSOPK(const T &...O)
Definition SIDefines.h:224
constexpr bool isSOPC(const T &...O)
Definition SIDefines.h:221
constexpr bool isVGPRAsMem(const T &...O)
Definition SIDefines.h:328
constexpr bool isSOPP(const T &...O)
Definition SIDefines.h:227
constexpr bool isDOT(const T &...O)
Definition SIDefines.h:358
constexpr bool isVINTRP(const T &...O)
Definition SIDefines.h:249
constexpr bool isVINTERP(const T &...O)
Definition SIDefines.h:298
constexpr bool isVSAMPLE(const T &...O)
Definition SIDefines.h:280
constexpr bool isDS(const T &...O)
Definition SIDefines.h:289
constexpr bool isAtomic(const T &...O)
Definition SIDefines.h:396
constexpr bool isLDSDIR(const T &...O)
Definition SIDefines.h:295
constexpr bool isSALU(const T &...O)
Definition SIDefines.h:209
constexpr bool isGather4(const T &...O)
Definition SIDefines.h:307
constexpr bool isPacked(const T &...O)
Definition SIDefines.h:343
constexpr bool hasClampHi(const T &...O)
Definition SIDefines.h:340
constexpr bool isDPP(const T &...O)
Definition SIDefines.h:255
constexpr bool isSOP1(const T &...O)
Definition SIDefines.h:215
constexpr bool isSegmentSpecificFLAT(const T &...O)
Definition SIDefines.h:399
constexpr bool isFixedSize(const T &...O)
Definition SIDefines.h:316
This is an optimization pass for GlobalISel generic memory operations.
Op::Description Desc
SIRCFlags
Definition SIDefines.h:21
@ HasSGPR
Definition SIDefines.h:29
@ HasAGPRBit
Definition SIDefines.h:24
@ HasSGPRbit
Definition SIDefines.h:25
@ RegTupleAlignUnitsWidth
Definition SIDefines.h:22
@ RegTupleAlignUnitsMask
Definition SIDefines.h:31
@ HasVGPRBit
Definition SIDefines.h:23
@ HasVGPR
Definition SIDefines.h:27
@ RegKindMask
Definition SIDefines.h:32
@ HasAGPR
Definition SIDefines.h:28