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 // Is a clamp on FP type.
133 FPClamp = UINT64_C(1) << 45,
134
135 // Is an integer clamp
136 IntClamp = UINT64_C(1) << 46,
137
138 // Clamps lo component of register.
139 ClampLo = UINT64_C(1) << 47,
140
141 // Clamps hi component of register.
142 // ClampLo and ClampHi set for packed clamp.
143 ClampHi = UINT64_C(1) << 48,
144
145 // Is a packed VOP3P instruction.
146 IsPacked = UINT64_C(1) << 49,
147
148 // FLAT instruction accesses FLAT_GLBL segment.
149 FlatGlobal = UINT64_C(1) << 51,
150
151 // Uses floating point double precision rounding mode
152 FPDPRounding = UINT64_C(1) << 52,
153
154 // Instruction is FP atomic.
155 FPAtomic = UINT64_C(1) << 53,
156
157 // Is a MFMA instruction.
158 IsMAI = UINT64_C(1) << 54,
159
160 // Is a DOT instruction.
161 IsDOT = UINT64_C(1) << 55,
162
163 // FLAT instruction accesses FLAT_SCRATCH segment.
164 FlatScratch = UINT64_C(1) << 56,
165
166 // Atomic without return.
167 IsAtomicNoRet = UINT64_C(1) << 57,
168
169 // Atomic with return.
170 IsAtomicRet = UINT64_C(1) << 58,
171
172 // Is a WMMA instruction.
173 IsWMMA = UINT64_C(1) << 59,
174
175 // Whether tied sources will be read.
176 TiedSourceNotRead = UINT64_C(1) << 60,
177
178 // Is never uniform.
179 IsNeverUniform = UINT64_C(1) << 61,
180
181 // ds_gws_* instructions.
182 GWS = UINT64_C(1) << 62,
183
184 // Is a SWMMAC instruction.
185 IsSWMMAC = UINT64_C(1) << 63,
186};
187} // namespace DontUseRawTSFlags
188
189// Predicate functions over TSFlags — the single place where raw TSFlags bit
190// tests are written. All callers (SIInstrInfo methods, MC-layer code) go
191// through these so that bit-layout changes require updating only this file.
192//
193// getTSFlags is overloaded for MCInstrDesc, (MCInstrInfo, Opcode), and
194// (MCInstrInfo, MCInst) here; SIInstrInfo.h adds a MachineInstr overload in
195// namespace llvm so ADL finds it when predicates are instantiated with
196// MachineInstr.
197
198constexpr uint64_t getTSFlags(const MCInstrDesc &Desc) { return Desc.TSFlags; }
199inline uint64_t getTSFlags(const MCInstrInfo &MII, unsigned Opcode) {
200 return MII.get(Opcode).TSFlags;
201}
202inline uint64_t getTSFlags(const MCInstrInfo &MII, const MCInst &Inst) {
203 return MII.get(Inst.getOpcode()).TSFlags;
204}
205
206template <typename... T> constexpr bool isSALU(const T &...O) {
207 return getTSFlags(O...) & DontUseRawTSFlags::SALU;
208}
209template <typename... T> constexpr bool isVALU(const T &...O) {
210 return getTSFlags(O...) & DontUseRawTSFlags::VALU;
211}
212template <typename... T> constexpr bool isSOP1(const T &...O) {
213 return getTSFlags(O...) & DontUseRawTSFlags::SOP1;
214}
215template <typename... T> constexpr bool isSOP2(const T &...O) {
216 return getTSFlags(O...) & DontUseRawTSFlags::SOP2;
217}
218template <typename... T> constexpr bool isSOPC(const T &...O) {
219 return getTSFlags(O...) & DontUseRawTSFlags::SOPC;
220}
221template <typename... T> constexpr bool isSOPK(const T &...O) {
222 return getTSFlags(O...) & DontUseRawTSFlags::SOPK;
223}
224template <typename... T> constexpr bool isSOPP(const T &...O) {
225 return getTSFlags(O...) & DontUseRawTSFlags::SOPP;
226}
227template <typename... T> constexpr bool isVOP1(const T &...O) {
228 return getTSFlags(O...) & DontUseRawTSFlags::VOP1;
229}
230template <typename... T> constexpr bool isVOP2(const T &...O) {
231 return getTSFlags(O...) & DontUseRawTSFlags::VOP2;
232}
233template <typename... T> constexpr bool isVOPC(const T &...O) {
234 return getTSFlags(O...) & DontUseRawTSFlags::VOPC;
235}
236template <typename... T> constexpr bool isVOP3(const T &...O) {
237 return getTSFlags(O...) & DontUseRawTSFlags::VOP3;
238}
239template <typename... T> constexpr bool isVOP3P(const T &...O) {
241}
242template <typename... T> constexpr bool isVOP3Like(const T &...O) {
243 return getTSFlags(O...) &
245}
246template <typename... T> constexpr bool isVINTRP(const T &...O) {
248}
249template <typename... T> constexpr bool isSDWA(const T &...O) {
250 return getTSFlags(O...) & DontUseRawTSFlags::SDWA;
251}
252template <typename... T> constexpr bool isDPP(const T &...O) {
253 return getTSFlags(O...) & DontUseRawTSFlags::DPP;
254}
255template <typename... T> constexpr bool isTRANS(const T &...O) {
257}
258template <typename... T> constexpr bool isMUBUF(const T &...O) {
260}
261template <typename... T> constexpr bool isMTBUF(const T &...O) {
263}
264template <typename... T> constexpr bool isBuffer(const T &...O) {
265 return getTSFlags(O...) &
267}
268template <typename... T> constexpr bool isSMRD(const T &...O) {
269 return getTSFlags(O...) & DontUseRawTSFlags::SMRD;
270}
271template <typename... T> constexpr bool isMIMG(const T &...O) {
272 return getTSFlags(O...) & DontUseRawTSFlags::MIMG;
273}
274template <typename... T> constexpr bool isVIMAGE(const T &...O) {
276}
277template <typename... T> constexpr bool isVSAMPLE(const T &...O) {
279}
280template <typename... T> constexpr bool isEXP(const T &...O) {
281 return getTSFlags(O...) & DontUseRawTSFlags::EXP;
282}
283template <typename... T> constexpr bool isFLAT(const T &...O) {
284 return getTSFlags(O...) & DontUseRawTSFlags::FLAT;
285}
286template <typename... T> constexpr bool isDS(const T &...O) {
287 return getTSFlags(O...) & DontUseRawTSFlags::DS;
288}
289template <typename... T> constexpr bool isSpill(const T &...O) {
291}
292template <typename... T> constexpr bool isLDSDIR(const T &...O) {
294}
295template <typename... T> constexpr bool isVINTERP(const T &...O) {
297}
298template <typename... T> constexpr bool isWQM(const T &...O) {
299 return getTSFlags(O...) & DontUseRawTSFlags::WQM;
300}
301template <typename... T> constexpr bool isDisableWQM(const T &...O) {
303}
304template <typename... T> constexpr bool isGather4(const T &...O) {
306}
307template <typename... T> constexpr bool usesTENSOR_CNT(const T &...O) {
309}
310template <typename... T> constexpr bool isScalarStore(const T &...O) {
312}
313template <typename... T> constexpr bool isFixedSize(const T &...O) {
315}
316template <typename... T> constexpr bool usesASYNC_CNT(const T &...O) {
318}
319template <typename... T> constexpr bool hasVOP3OpSel(const T &...O) {
321}
322template <typename... T> constexpr bool isMaybeAtomic(const T &...O) {
324}
325template <typename... T> constexpr bool hasFPClamp(const T &...O) {
327}
328template <typename... T> constexpr bool hasIntClamp(const T &...O) {
330}
331template <typename... T> constexpr bool hasClampLo(const T &...O) {
333}
334template <typename... T> constexpr bool hasClampHi(const T &...O) {
336}
337template <typename... T> constexpr bool isPacked(const T &...O) {
339}
340template <typename... T> constexpr bool isFlatGlobal(const T &...O) {
342}
343template <typename... T> constexpr bool usesFPDPRounding(const T &...O) {
345}
346template <typename... T> constexpr bool isFPAtomic(const T &...O) {
348}
349template <typename... T> constexpr bool isMAI(const T &...O) {
351}
352template <typename... T> constexpr bool isDOT(const T &...O) {
354}
355template <typename... T> constexpr bool isFlatScratch(const T &...O) {
357}
358template <typename... T> constexpr bool isAtomicNoRet(const T &...O) {
360}
361template <typename... T> constexpr bool isAtomicRet(const T &...O) {
363}
364template <typename... T> constexpr bool isWMMA(const T &...O) {
366}
367template <typename... T> constexpr bool isTiedSourceNotRead(const T &...O) {
369}
370template <typename... T> constexpr bool isNeverUniform(const T &...O) {
372}
373template <typename... T> constexpr bool isGWS(const T &...O) {
374 return getTSFlags(O...) & DontUseRawTSFlags::GWS;
375}
376template <typename... T> constexpr bool isSWMMAC(const T &...O) {
378}
379template <typename... T> constexpr bool isVOPD3(const T &...O) {
381}
382template <typename... T> constexpr bool usesVM_CNT(const T &...O) {
384}
385template <typename... T> constexpr bool usesLGKM_CNT(const T &...O) {
387}
388
389// Compound predicates.
390template <typename... T> constexpr bool isAtomic(const T &...O) {
391 return isAtomicNoRet(O...) || isAtomicRet(O...);
392}
393template <typename... T> constexpr bool isSegmentSpecificFLAT(const T &...O) {
394 return isFlatGlobal(O...) || isFlatScratch(O...);
395}
396// Any image-family instruction: pre-gfx11 MIMG, gfx11+ VIMAGE or VSAMPLE.
397template <typename... T> constexpr bool isImage(const T &...O) {
398 return isMIMG(O...) || isVIMAGE(O...) || isVSAMPLE(O...);
399}
400// Vector memory: buffer + image + flat.
401template <typename... T> constexpr bool isVMEM(const T &...O) {
402 return isMUBUF(O...) || isMTBUF(O...) || isImage(O...) || isFLAT(O...);
403}
404
405// v_cmp_class_* etc. use a 10-bit mask for what operation is checked.
406// The result is true if any of these tests are true.
407enum ClassFlags : unsigned {
408 S_NAN = 1 << 0, // Signaling NaN
409 Q_NAN = 1 << 1, // Quiet NaN
410 N_INFINITY = 1 << 2, // Negative infinity
411 N_NORMAL = 1 << 3, // Negative normal
412 N_SUBNORMAL = 1 << 4, // Negative subnormal
413 N_ZERO = 1 << 5, // Negative zero
414 P_ZERO = 1 << 6, // Positive zero
415 P_SUBNORMAL = 1 << 7, // Positive subnormal
416 P_NORMAL = 1 << 8, // Positive normal
417 P_INFINITY = 1 << 9 // Positive infinity
418};
419}
420
421namespace AMDGPU {
422
423enum OperandType : unsigned {
424 /// Operands with register, 32-bit, or 64-bit immediate
442
443 /// Operands with register or inline constant
454
455 // Operand for split barrier inline constant
457
458 /// Operand with 32-bit immediate that uses the constant bus.
462
463 /// Operands with an AccVGPR register or inline constant
467
468 // Operand for AV_MOV_B64_IMM_PSEUDO, which is a pair of 32-bit inline
469 // constants. Does not accept registers.
471
472 // Operand for source modifiers for VOP instructions
474
475 // Operand for SDWA instructions
477
480
483
486
489
492
493};
494}
495
496// Input operand modifiers bit-masks
497// NEG and SEXT share same bit-mask because they can't be set simultaneously.
498namespace SISrcMods {
499enum : unsigned {
500 NONE = 0,
501 NEG = 1 << 0, // Floating-point negate modifier
502 ABS = 1 << 1, // Floating-point absolute modifier
503 SEXT = 1 << 4, // Integer sign-extend modifier
504 NEG_HI = ABS, // Floating-point negate high packed component modifier.
505 OP_SEL_0 = 1 << 2,
506 OP_SEL_1 = 1 << 3,
507 DST_OP_SEL = 1 << 3 // VOP3 dst op_sel (share mask with OP_SEL_1)
508};
509}
510
511namespace SIOutMods {
512 enum : unsigned {
513 NONE = 0,
514 MUL2 = 1,
515 MUL4 = 2,
517 };
518}
519
520namespace AMDGPU {
521namespace VGPRIndexMode {
522
523enum Id : unsigned { // id of symbolic names
528
531};
532
542
543} // namespace VGPRIndexMode
544} // namespace AMDGPU
545
547 enum : unsigned {
549 VOP3 = 1,
550 SDWA = 2,
551 SDWA9 = 3,
552 DPP = 4,
554 };
555} // namespace AMDGPUAsmVariants
556
557namespace AMDGPU {
558namespace EncValues { // Encoding values of enum9/8/7 operands
559
560enum : unsigned {
575 VGPR_MIN = 256,
576 VGPR_MAX = 511,
577 IS_VGPR = 256, // Indicates VGPR or AGPR
578};
579
580} // namespace EncValues
581
582// Register codes as defined in the TableGen's HWEncoding field.
583namespace HWEncoding {
584enum : unsigned {
587 IS_VGPR = 1 << 10,
588 IS_AGPR = 1 << 11,
589 IS_HI16 = 1 << 12,
590};
591} // namespace HWEncoding
592
593namespace CPol {
594
595enum CPol {
596 GLC = 1,
597 SLC = 2,
598 DLC = 4,
599 SCC = 16,
605
606 // Below are GFX12+ cache policy bits
607
608 // Temporal hint
609 TH = 0x7, // All TH bits
610 TH_RT = 0, // regular
611 TH_NT = 1, // non-temporal
612 TH_HT = 2, // high-temporal
613 TH_LU = 3, // last use
614 TH_WB = 3, // regular (CU, SE), high-temporal with write-back (MALL)
615 TH_NT_RT = 4, // non-temporal (CU, SE), regular (MALL)
616 TH_RT_NT = 5, // regular (CU, SE), non-temporal (MALL)
617 TH_NT_HT = 6, // non-temporal (CU, SE), high-temporal (MALL)
618 TH_NT_WB = 7, // non-temporal (CU, SE), high-temporal with write-back (MALL)
619 TH_BYPASS = 3, // only to be used with scope = 3
620
621 TH_RESERVED = 7, // unused value for load insts
622
623 // Bits of TH for atomics
624 TH_ATOMIC_RETURN = GLC, // Returning vs non-returning
625 TH_ATOMIC_NT = SLC, // Non-temporal vs regular
626 TH_ATOMIC_CASCADE = 4, // Cascading vs regular
627
628 // Scope
631 SCOPE = SCOPE_MASK << SCOPE_SHIFT, // All Scope bits
636
637 NV = 1 << 5, // Non-volatile bit
638
639 SWZ = 1 << 6, // Swizzle bit
640
641 SCAL = 1 << 11, // Scale offset bit
642
643 ALL = TH | SCOPE | NV,
644
645 // Helper bits
646 TH_TYPE_LOAD = 1 << 7, // TH_LOAD policy
647 TH_TYPE_STORE = 1 << 8, // TH_STORE policy
648 TH_TYPE_ATOMIC = 1 << 9, // TH_ATOMIC policy
649 TH_REAL_BYPASS = 1 << 10, // is TH=3 bypass policy or not
650
651 // Volatile (used to preserve/signal operation volatility for buffer
652 // operations not a real instruction bit)
653 VOLATILE = 1 << 31,
654 // The set of "cache policy" bits used for compiler features that
655 // do not correspond to handware features.
657};
658
659} // namespace CPol
660
661namespace SendMsg { // Encoding of SIMM16 used in s_sendmsg* insns.
662
663enum Id { // Message ID, width(4) [3:0].
665
666 ID_GS_PreGFX11 = 2, // replaced in GFX11
667 ID_GS_DONE_PreGFX11 = 3, // replaced in GFX11
668
669 ID_HS_TESSFACTOR_GFX11Plus = 2, // reused in GFX11
670 ID_DEALLOC_VGPRS_GFX11Plus = 3, // reused in GFX11
671
672 ID_SAVEWAVE = 4, // added in GFX8, removed in GFX11
673 ID_STALL_WAVE_GEN = 5, // added in GFX9, removed in GFX12
674 ID_HALT_WAVES = 6, // added in GFX9, removed in GFX12
675 ID_ORDERED_PS_DONE = 7, // added in GFX9, removed in GFX11
676 ID_EARLY_PRIM_DEALLOC = 8, // added in GFX9, removed in GFX10
677 ID_GS_ALLOC_REQ = 9, // added in GFX9
678 ID_GET_DOORBELL = 10, // added in GFX9, removed in GFX11
679 ID_GET_DDID = 11, // added in GFX10, removed in GFX11
681
690
691 ID_RTN_GET_CLUSTER_BARRIER_STATE = 136, // added in GFX1250
692 ID_RTN_SAVE_WAVE_HAS_TDM = 152, // added in GFX1250
693
696};
697
698enum Op { // Both GS and SYS operation IDs.
701 // Bits used for operation encoding
703 OP_MASK_ = (((1 << OP_WIDTH_) - 1) << OP_SHIFT_),
704 // GS operations are encoded in bits 5:4
710 // SYS operations are encoded in bits 6:4
716};
717
727
728} // namespace SendMsg
729
730namespace WaitEvent { // Encoding of SIMM16 used in s_wait_event
731enum Id {
732 DONT_WAIT_EXPORT_READY = 1 << 0, // Only used in gfx11
733 EXPORT_READY = 1 << 1, // gfx12+
734};
735
736} // namespace WaitEvent
737
738namespace Hwreg { // Encoding of SIMM16 used in s_setreg/getreg* insns.
739
793
794enum Offset : unsigned { // Offset, (5) [10:6]
796 OFFSET_ME_ID = 8, // in HW_ID2
797};
798
800 FP_ROUND_MASK = 0xf << 0, // Bits 0..3
801 FP_DENORM_MASK = 0xf << 4, // Bits 4..7
804 LOD_CLAMP_MASK = 1 << 10,
805 DEBUG_MASK = 1 << 11,
806
807 // EXCP_EN fields.
815
817 VSKIP_MASK = 1 << 28,
818 CSP_MASK = 0x7u << 29, // Bits 29..31
819
820 // GFX1250
821 DST_VGPR_MSB = 0x3 << 12,
822 SRC0_VGPR_MSB = 0x3 << 14,
823 SRC1_VGPR_MSB = 0x3 << 16,
824 SRC2_VGPR_MSB = 0x3 << 18,
825 VGPR_MSB_MASK = 0xff << 12, // Bits 12..19
826
827 REPLAY_MODE = 1 << 25,
829};
830
831} // namespace Hwreg
832
902
903namespace UfmtGFX10 {
904enum UnifiedFormat : int64_t {
906
913
921
928
932
940
948
956
963
970
977
981
989
996
999};
1000
1001} // namespace UfmtGFX10
1002
1003namespace UfmtGFX11 {
1004enum UnifiedFormat : int64_t {
1006
1013
1021
1028
1032
1040
1042
1044
1049
1056
1063
1067
1075
1082
1085};
1086
1087} // namespace UfmtGFX11
1088
1089namespace Swizzle { // Encoding of swizzle macro used in ds_swizzle_b32.
1090
1100
1101// clang-format off
1102enum EncBits : unsigned {
1103
1104 // swizzle mode encodings
1105
1108
1111
1113
1116
1118 FFT_MODE_LO = 0xE000,
1119
1120 // QUAD_PERM encodings
1121
1126
1127 // BITMASK_PERM encodings
1128
1132
1136
1137 // FFT encodings
1138
1141
1142 // ROTATE encodings
1144 ROTATE_DIR_SHIFT = 10, // bit position of rotate direction
1146 ROTATE_SIZE_SHIFT = 5, // bit position of rotate size
1148};
1149// clang-format on
1150
1151} // namespace Swizzle
1152
1153namespace SDWA {
1154
1155enum SdwaSel : unsigned {
1163};
1164
1165enum DstUnused : unsigned {
1169};
1170
1185
1186} // namespace SDWA
1187
1188namespace DPP {
1189
1190// clang-format off
1235// clang-format on
1236
1243
1244} // namespace DPP
1245
1246namespace Exp {
1247
1248enum Target : unsigned {
1252 ET_NULL = 9, // Pre-GFX11
1255 ET_POS4 = 16, // GFX10+
1256 ET_POS_LAST = ET_POS4, // Highest pos used on any subtarget
1257 ET_PRIM = 20, // GFX10+
1258 ET_DUAL_SRC_BLEND0 = 21, // GFX11+
1259 ET_DUAL_SRC_BLEND1 = 22, // GFX11+
1260 ET_PARAM0 = 32, // Pre-GFX11
1261 ET_PARAM31 = 63, // Pre-GFX11
1262
1270
1272};
1273
1274} // namespace Exp
1275
1296
1297namespace VOP3PEncoding {
1298
1300 OP_SEL_HI_0 = UINT64_C(1) << 59,
1301 OP_SEL_HI_1 = UINT64_C(1) << 60,
1302 OP_SEL_HI_2 = UINT64_C(1) << 14,
1303};
1304
1305} // namespace VOP3PEncoding
1306
1307namespace ImplicitArg {
1308// Implicit kernel argument offset for code object version 5.
1321
1322} // namespace ImplicitArg
1323
1325// Enum value used in cbsz/blgp for F8F6F4 MFMA operations to select the matrix
1326// format.
1334} // namespace MFMAScaleFormats
1335
1336namespace VirtRegFlag {
1337// Virtual register flags used for various target specific handlings during
1338// codegen.
1340 // Register operand in a whole-wave mode operation.
1341 WWM_REG = 1 << 0,
1342};
1343
1344} // namespace VirtRegFlag
1345
1346} // namespace AMDGPU
1347
1348namespace AMDGPU {
1349namespace Barrier {
1350
1359
1360} // namespace Barrier
1361
1363/// Synthetic aperture numbers. This is OR'd with the high
1364/// bits of the LDS aperture pointer.
1365///
1366/// NOTE: This is also documented in AMDGPUUsage.
1368 None = 0x00000000,
1369
1370 BARRIER = 0x00000001,
1371};
1372} // namespace SyntheticAperture
1373
1374} // namespace AMDGPU
1375
1376// clang-format off
1377
1378#define R_00B028_SPI_SHADER_PGM_RSRC1_PS 0x00B028
1379#define S_00B028_VGPRS(x) (((x) & 0x3F) << 0)
1380#define S_00B028_SGPRS(x) (((x) & 0x0F) << 6)
1381#define S_00B028_MEM_ORDERED(x) (((x) & 0x1) << 25)
1382#define G_00B028_MEM_ORDERED(x) (((x) >> 25) & 0x1)
1383#define C_00B028_MEM_ORDERED 0xFDFFFFFF
1384
1385#define R_00B02C_SPI_SHADER_PGM_RSRC2_PS 0x00B02C
1386#define S_00B02C_EXTRA_LDS_SIZE(x) (((x) & 0xFF) << 8)
1387#define R_00B128_SPI_SHADER_PGM_RSRC1_VS 0x00B128
1388#define S_00B128_MEM_ORDERED(x) (((x) & 0x1) << 27)
1389#define G_00B128_MEM_ORDERED(x) (((x) >> 27) & 0x1)
1390#define C_00B128_MEM_ORDERED 0xF7FFFFFF
1391
1392#define R_00B228_SPI_SHADER_PGM_RSRC1_GS 0x00B228
1393#define S_00B228_WGP_MODE(x) (((x) & 0x1) << 27)
1394#define G_00B228_WGP_MODE(x) (((x) >> 27) & 0x1)
1395#define C_00B228_WGP_MODE 0xF7FFFFFF
1396#define S_00B228_MEM_ORDERED(x) (((x) & 0x1) << 25)
1397#define G_00B228_MEM_ORDERED(x) (((x) >> 25) & 0x1)
1398#define C_00B228_MEM_ORDERED 0xFDFFFFFF
1399
1400#define R_00B328_SPI_SHADER_PGM_RSRC1_ES 0x00B328
1401#define R_00B428_SPI_SHADER_PGM_RSRC1_HS 0x00B428
1402#define S_00B428_WGP_MODE(x) (((x) & 0x1) << 26)
1403#define G_00B428_WGP_MODE(x) (((x) >> 26) & 0x1)
1404#define C_00B428_WGP_MODE 0xFBFFFFFF
1405#define S_00B428_MEM_ORDERED(x) (((x) & 0x1) << 24)
1406#define G_00B428_MEM_ORDERED(x) (((x) >> 24) & 0x1)
1407#define C_00B428_MEM_ORDERED 0xFEFFFFFF
1408
1409#define R_00B528_SPI_SHADER_PGM_RSRC1_LS 0x00B528
1410
1411#define R_00B84C_COMPUTE_PGM_RSRC2 0x00B84C
1412#define S_00B84C_SCRATCH_EN(x) (((x) & 0x1) << 0)
1413#define G_00B84C_SCRATCH_EN(x) (((x) >> 0) & 0x1)
1414#define C_00B84C_SCRATCH_EN 0xFFFFFFFE
1415#define S_00B84C_USER_SGPR(x) (((x) & 0x1F) << 1)
1416#define G_00B84C_USER_SGPR(x) (((x) >> 1) & 0x1F)
1417#define C_00B84C_USER_SGPR 0xFFFFFFC1
1418#define S_00B84C_TRAP_HANDLER(x) (((x) & 0x1) << 6)
1419#define G_00B84C_TRAP_HANDLER(x) (((x) >> 6) & 0x1)
1420#define C_00B84C_TRAP_HANDLER 0xFFFFFFBF
1421#define S_00B84C_TGID_X_EN(x) (((x) & 0x1) << 7)
1422#define G_00B84C_TGID_X_EN(x) (((x) >> 7) & 0x1)
1423#define C_00B84C_TGID_X_EN 0xFFFFFF7F
1424#define S_00B84C_TGID_Y_EN(x) (((x) & 0x1) << 8)
1425#define G_00B84C_TGID_Y_EN(x) (((x) >> 8) & 0x1)
1426#define C_00B84C_TGID_Y_EN 0xFFFFFEFF
1427#define S_00B84C_TGID_Z_EN(x) (((x) & 0x1) << 9)
1428#define G_00B84C_TGID_Z_EN(x) (((x) >> 9) & 0x1)
1429#define C_00B84C_TGID_Z_EN 0xFFFFFDFF
1430#define S_00B84C_TG_SIZE_EN(x) (((x) & 0x1) << 10)
1431#define G_00B84C_TG_SIZE_EN(x) (((x) >> 10) & 0x1)
1432#define C_00B84C_TG_SIZE_EN 0xFFFFFBFF
1433#define S_00B84C_TIDIG_COMP_CNT(x) (((x) & 0x03) << 11)
1434#define G_00B84C_TIDIG_COMP_CNT(x) (((x) >> 11) & 0x03)
1435#define C_00B84C_TIDIG_COMP_CNT 0xFFFFE7FF
1436/* CIK */
1437#define S_00B84C_EXCP_EN_MSB(x) (((x) & 0x03) << 13)
1438#define G_00B84C_EXCP_EN_MSB(x) (((x) >> 13) & 0x03)
1439#define C_00B84C_EXCP_EN_MSB 0xFFFF9FFF
1440/* */
1441#define S_00B84C_LDS_SIZE(x) (((x) & 0x1FF) << 15)
1442#define G_00B84C_LDS_SIZE(x) (((x) >> 15) & 0x1FF)
1443#define C_00B84C_LDS_SIZE 0xFF007FFF
1444#define S_00B84C_EXCP_EN(x) (((x) & 0x7F) << 24)
1445#define G_00B84C_EXCP_EN(x) (((x) >> 24) & 0x7F)
1446#define C_00B84C_EXCP_EN 0x80FFFFFF
1447
1448#define S_00B84C_USER_SGPR_GFX1250(x) (((x) & 0x3F) << 1)
1449#define G_00B84C_USER_SGPR_GFX1250(x) (((x) >> 1) & 0x3F)
1450#define C_00B84C_USER_SGPR_GFX1250 0xFFFFFF81
1451
1452#define R_0286CC_SPI_PS_INPUT_ENA 0x0286CC
1453#define R_0286D0_SPI_PS_INPUT_ADDR 0x0286D0
1454
1455#define R_00B848_COMPUTE_PGM_RSRC1 0x00B848
1456#define S_00B848_VGPRS(x) (((x) & 0x3F) << 0)
1457#define G_00B848_VGPRS(x) (((x) >> 0) & 0x3F)
1458#define C_00B848_VGPRS 0xFFFFFFC0
1459#define S_00B848_SGPRS(x) (((x) & 0x0F) << 6)
1460#define G_00B848_SGPRS(x) (((x) >> 6) & 0x0F)
1461#define C_00B848_SGPRS 0xFFFFFC3F
1462#define S_00B848_PRIORITY(x) (((x) & 0x03) << 10)
1463#define G_00B848_PRIORITY(x) (((x) >> 10) & 0x03)
1464#define C_00B848_PRIORITY 0xFFFFF3FF
1465#define S_00B848_FLOAT_MODE(x) (((x) & 0xFF) << 12)
1466#define G_00B848_FLOAT_MODE(x) (((x) >> 12) & 0xFF)
1467#define C_00B848_FLOAT_MODE 0xFFF00FFF
1468#define S_00B848_PRIV(x) (((x) & 0x1) << 20)
1469#define G_00B848_PRIV(x) (((x) >> 20) & 0x1)
1470#define C_00B848_PRIV 0xFFEFFFFF
1471#define S_00B848_DX10_CLAMP(x) (((x) & 0x1) << 21)
1472#define G_00B848_DX10_CLAMP(x) (((x) >> 21) & 0x1)
1473#define C_00B848_DX10_CLAMP 0xFFDFFFFF
1474#define S_00B848_RR_WG_MODE(x) (((x) & 0x1) << 21)
1475#define G_00B848_RR_WG_MODE(x) (((x) >> 21) & 0x1)
1476#define C_00B848_RR_WG_MODE 0xFFDFFFFF
1477#define S_00B848_DEBUG_MODE(x) (((x) & 0x1) << 22)
1478#define G_00B848_DEBUG_MODE(x) (((x) >> 22) & 0x1)
1479#define C_00B848_DEBUG_MODE 0xFFBFFFFF
1480#define S_00B848_IEEE_MODE(x) (((x) & 0x1) << 23)
1481#define G_00B848_IEEE_MODE(x) (((x) >> 23) & 0x1)
1482#define C_00B848_IEEE_MODE 0xFF7FFFFF
1483#define S_00B848_WGP_MODE(x) (((x) & 0x1) << 29)
1484#define G_00B848_WGP_MODE(x) (((x) >> 29) & 0x1)
1485#define C_00B848_WGP_MODE 0xDFFFFFFF
1486#define S_00B848_MEM_ORDERED(x) (((x) & 0x1) << 30)
1487#define G_00B848_MEM_ORDERED(x) (((x) >> 30) & 0x1)
1488#define C_00B848_MEM_ORDERED 0xBFFFFFFF
1489#define S_00B848_FWD_PROGRESS(x) (((x) & 0x1) << 31)
1490#define G_00B848_FWD_PROGRESS(x) (((x) >> 31) & 0x1)
1491#define C_00B848_FWD_PROGRESS 0x7FFFFFFF
1492
1493// Helpers for setting FLOAT_MODE
1494#define FP_ROUND_ROUND_TO_NEAREST 0
1495#define FP_ROUND_ROUND_TO_INF 1
1496#define FP_ROUND_ROUND_TO_NEGINF 2
1497#define FP_ROUND_ROUND_TO_ZERO 3
1498
1499// Bits 3:0 control rounding mode. 1:0 control single precision, 3:2 double
1500// precision.
1501#define FP_ROUND_MODE_SP(x) ((x) & 0x3)
1502#define FP_ROUND_MODE_DP(x) (((x) & 0x3) << 2)
1503
1504#define FP_DENORM_FLUSH_IN_FLUSH_OUT 0
1505#define FP_DENORM_FLUSH_OUT 1
1506#define FP_DENORM_FLUSH_IN 2
1507#define FP_DENORM_FLUSH_NONE 3
1508
1509
1510// Bits 7:4 control denormal handling. 5:4 control single precision, 6:7 double
1511// precision.
1512#define FP_DENORM_MODE_SP(x) (((x) & 0x3) << 4)
1513#define FP_DENORM_MODE_DP(x) (((x) & 0x3) << 6)
1514
1515#define R_00B860_COMPUTE_TMPRING_SIZE 0x00B860
1516#define S_00B860_WAVESIZE_PreGFX11(x) (((x) & 0x1FFF) << 12)
1517#define S_00B860_WAVESIZE_GFX11(x) (((x) & 0x7FFF) << 12)
1518#define S_00B860_WAVESIZE_GFX12Plus(x) (((x) & 0x3FFFF) << 12)
1519
1520#define R_0286E8_SPI_TMPRING_SIZE 0x0286E8
1521#define S_0286E8_WAVESIZE_PreGFX11(x) (((x) & 0x1FFF) << 12)
1522#define S_0286E8_WAVESIZE_GFX11(x) (((x) & 0x7FFF) << 12)
1523#define S_0286E8_WAVESIZE_GFX12Plus(x) (((x) & 0x3FFFF) << 12)
1524
1525#define R_028B54_VGT_SHADER_STAGES_EN 0x028B54
1526#define S_028B54_HS_W32_EN(x) (((x) & 0x1) << 21)
1527#define S_028B54_GS_W32_EN(x) (((x) & 0x1) << 22)
1528#define S_028B54_VS_W32_EN(x) (((x) & 0x1) << 23)
1529#define R_0286D8_SPI_PS_IN_CONTROL 0x0286D8
1530#define S_0286D8_PS_W32_EN(x) (((x) & 0x1) << 15)
1531#define R_00B800_COMPUTE_DISPATCH_INITIATOR 0x00B800
1532#define S_00B800_CS_W32_EN(x) (((x) & 0x1) << 15)
1533
1534#define R_SPILLED_SGPRS 0x4
1535#define R_SPILLED_VGPRS 0x8
1536
1537// clang-format on
1538
1539} // End namespace llvm
1540
1541#endif
AMDGPU address space definition.
unsigned uint64_t
#define T
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
unsigned getOpcode() const
Definition MCInst.h:202
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:1367
@ OPERAND_REG_IMM_V2FP64
Definition SIDefines.h:441
@ OPERAND_KIMM32
Operand with 32-bit immediate that uses the constant bus.
Definition SIDefines.h:459
@ OPERAND_REG_INLINE_C_LAST
Definition SIDefines.h:482
@ OPERAND_REG_IMM_INT64
Definition SIDefines.h:426
@ OPERAND_REG_IMM_V2FP16
Definition SIDefines.h:434
@ OPERAND_REG_INLINE_C_FP64
Definition SIDefines.h:450
@ OPERAND_REG_IMM_NOINLINE_FP16
Definition SIDefines.h:432
@ OPERAND_REG_INLINE_C_BF16
Definition SIDefines.h:447
@ OPERAND_REG_IMM_FIRST
Definition SIDefines.h:478
@ OPERAND_REG_INLINE_C_V2BF16
Definition SIDefines.h:452
@ OPERAND_REG_IMM_V2INT64
Definition SIDefines.h:437
@ OPERAND_REG_IMM_V2INT16
Definition SIDefines.h:436
@ OPERAND_REG_IMM_BF16
Definition SIDefines.h:430
@ OPERAND_REG_IMM_INT32
Operands with register, 32-bit, or 64-bit immediate.
Definition SIDefines.h:425
@ OPERAND_REG_IMM_V2BF16
Definition SIDefines.h:433
@ OPERAND_REG_INLINE_AC_FIRST
Definition SIDefines.h:484
@ OPERAND_REG_IMM_FP16
Definition SIDefines.h:431
@ OPERAND_REG_IMM_V2FP16_SPLAT
Definition SIDefines.h:435
@ OPERAND_REG_INLINE_C_INT64
Definition SIDefines.h:446
@ OPERAND_REG_INLINE_C_INT16
Operands with register or inline constant.
Definition SIDefines.h:444
@ OPERAND_REG_IMM_NOINLINE_V2FP16
Definition SIDefines.h:438
@ OPERAND_REG_IMM_FP64
Definition SIDefines.h:429
@ OPERAND_REG_INLINE_C_V2FP16
Definition SIDefines.h:453
@ OPERAND_REG_INLINE_AC_INT32
Operands with an AccVGPR register or inline constant.
Definition SIDefines.h:464
@ OPERAND_REG_INLINE_AC_FP32
Definition SIDefines.h:465
@ OPERAND_REG_IMM_V2INT32
Definition SIDefines.h:439
@ OPERAND_SDWA_VOPC_DST
Definition SIDefines.h:476
@ OPERAND_REG_IMM_FP32
Definition SIDefines.h:428
@ OPERAND_REG_INLINE_C_FIRST
Definition SIDefines.h:481
@ OPERAND_REG_INLINE_C_FP32
Definition SIDefines.h:449
@ OPERAND_REG_INLINE_AC_LAST
Definition SIDefines.h:485
@ OPERAND_REG_IMM_LAST
Definition SIDefines.h:479
@ OPERAND_REG_INLINE_C_INT32
Definition SIDefines.h:445
@ OPERAND_REG_INLINE_C_V2INT16
Definition SIDefines.h:451
@ OPERAND_INLINE_C_AV64_PSEUDO
Definition SIDefines.h:470
@ OPERAND_REG_IMM_V2FP32
Definition SIDefines.h:440
@ OPERAND_REG_INLINE_AC_FP64
Definition SIDefines.h:466
@ OPERAND_REG_INLINE_C_FP16
Definition SIDefines.h:448
@ OPERAND_REG_IMM_INT16
Definition SIDefines.h:427
@ OPERAND_INLINE_SPLIT_BARRIER_INT32
Definition SIDefines.h:456
@ OPERAND_FIRST_TARGET
Definition MCInstrDesc.h:81
constexpr bool isAtomicRet(const T &...O)
Definition SIDefines.h:361
constexpr bool isVOPC(const T &...O)
Definition SIDefines.h:233
constexpr bool isVOP3(const T &...O)
Definition SIDefines.h:236
constexpr bool isScalarStore(const T &...O)
Definition SIDefines.h:310
constexpr bool hasVOP3OpSel(const T &...O)
Definition SIDefines.h:319
constexpr bool isVOP1(const T &...O)
Definition SIDefines.h:227
constexpr bool isFPAtomic(const T &...O)
Definition SIDefines.h:346
constexpr bool usesVM_CNT(const T &...O)
Definition SIDefines.h:382
constexpr bool usesTENSOR_CNT(const T &...O)
Definition SIDefines.h:307
constexpr bool isMAI(const T &...O)
Definition SIDefines.h:349
constexpr bool isVOP2(const T &...O)
Definition SIDefines.h:230
constexpr bool isMaybeAtomic(const T &...O)
Definition SIDefines.h:322
constexpr bool isSWMMAC(const T &...O)
Definition SIDefines.h:376
constexpr bool isTRANS(const T &...O)
Definition SIDefines.h:255
constexpr bool isSOP2(const T &...O)
Definition SIDefines.h:215
constexpr bool isFLAT(const T &...O)
Definition SIDefines.h:283
constexpr bool isVOP3P(const T &...O)
Definition SIDefines.h:239
constexpr bool usesFPDPRounding(const T &...O)
Definition SIDefines.h:343
constexpr bool isDisableWQM(const T &...O)
Definition SIDefines.h:301
constexpr bool isBuffer(const T &...O)
Definition SIDefines.h:264
constexpr bool hasIntClamp(const T &...O)
Definition SIDefines.h:328
constexpr bool isAtomicNoRet(const T &...O)
Definition SIDefines.h:358
constexpr bool isMTBUF(const T &...O)
Definition SIDefines.h:261
constexpr bool isVIMAGE(const T &...O)
Definition SIDefines.h:274
constexpr bool isSMRD(const T &...O)
Definition SIDefines.h:268
constexpr bool isVOP3Like(const T &...O)
Definition SIDefines.h:242
constexpr bool isFlatScratch(const T &...O)
Definition SIDefines.h:355
constexpr bool isSpill(const T &...O)
Definition SIDefines.h:289
constexpr uint64_t getTSFlags(const MCInstrDesc &Desc)
Definition SIDefines.h:198
constexpr bool isMIMG(const T &...O)
Definition SIDefines.h:271
constexpr bool isVMEM(const T &...O)
Definition SIDefines.h:401
constexpr bool hasFPClamp(const T &...O)
Definition SIDefines.h:325
constexpr bool isNeverUniform(const T &...O)
Definition SIDefines.h:370
constexpr bool isImage(const T &...O)
Definition SIDefines.h:397
constexpr bool isWMMA(const T &...O)
Definition SIDefines.h:364
constexpr bool isVALU(const T &...O)
Definition SIDefines.h:209
constexpr bool isWQM(const T &...O)
Definition SIDefines.h:298
constexpr bool isVOPD3(const T &...O)
Definition SIDefines.h:379
constexpr bool hasClampLo(const T &...O)
Definition SIDefines.h:331
constexpr bool isGWS(const T &...O)
Definition SIDefines.h:373
constexpr bool isFlatGlobal(const T &...O)
Definition SIDefines.h:340
constexpr bool usesASYNC_CNT(const T &...O)
Definition SIDefines.h:316
constexpr bool isMUBUF(const T &...O)
Definition SIDefines.h:258
constexpr bool isSDWA(const T &...O)
Definition SIDefines.h:249
constexpr bool isTiedSourceNotRead(const T &...O)
Definition SIDefines.h:367
constexpr bool isEXP(const T &...O)
Definition SIDefines.h:280
constexpr bool usesLGKM_CNT(const T &...O)
Definition SIDefines.h:385
constexpr bool isSOPK(const T &...O)
Definition SIDefines.h:221
constexpr bool isSOPC(const T &...O)
Definition SIDefines.h:218
constexpr bool isSOPP(const T &...O)
Definition SIDefines.h:224
constexpr bool isDOT(const T &...O)
Definition SIDefines.h:352
constexpr bool isVINTRP(const T &...O)
Definition SIDefines.h:246
constexpr bool isVINTERP(const T &...O)
Definition SIDefines.h:295
constexpr bool isVSAMPLE(const T &...O)
Definition SIDefines.h:277
constexpr bool isDS(const T &...O)
Definition SIDefines.h:286
constexpr bool isAtomic(const T &...O)
Definition SIDefines.h:390
constexpr bool isLDSDIR(const T &...O)
Definition SIDefines.h:292
constexpr bool isSALU(const T &...O)
Definition SIDefines.h:206
constexpr bool isGather4(const T &...O)
Definition SIDefines.h:304
constexpr bool isPacked(const T &...O)
Definition SIDefines.h:337
constexpr bool hasClampHi(const T &...O)
Definition SIDefines.h:334
constexpr bool isDPP(const T &...O)
Definition SIDefines.h:252
constexpr bool isSOP1(const T &...O)
Definition SIDefines.h:212
constexpr bool isSegmentSpecificFLAT(const T &...O)
Definition SIDefines.h:393
constexpr bool isFixedSize(const T &...O)
Definition SIDefines.h:313
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