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 // Cache fill size
643 CFS_MASK = 0x3,
649
650 ALL = TH | SCOPE | NV | CFS,
651
652 SCAL = 1 << 9, // Scale offset bit
653
654 // Helper bits
655 TH_TYPE_LOAD = 1 << 27, // TH_LOAD policy
656 TH_TYPE_STORE = 1 << 28, // TH_STORE policy
657 TH_TYPE_ATOMIC = 1 << 29, // TH_ATOMIC policy
658 TH_REAL_BYPASS = 1 << 30, // is TH=3 bypass policy or not
659
660 // Volatile (used to preserve/signal operation volatility for buffer
661 // operations not a real instruction bit)
662 VOLATILE = 1 << 31,
663 // The set of "cache policy" bits used for compiler features that
664 // do not correspond to handware features.
666};
667
668} // namespace CPol
669
670namespace SendMsg { // Encoding of SIMM16 used in s_sendmsg* insns.
671
672enum Id { // Message ID, width(4) [3:0].
674
675 ID_GS_PreGFX11 = 2, // replaced in GFX11
676 ID_GS_DONE_PreGFX11 = 3, // replaced in GFX11
677
678 ID_HS_TESSFACTOR_GFX11Plus = 2, // reused in GFX11
679 ID_DEALLOC_VGPRS_GFX11Plus = 3, // reused in GFX11
680
681 ID_SAVEWAVE = 4, // added in GFX8, removed in GFX11
682 ID_STALL_WAVE_GEN = 5, // added in GFX9, removed in GFX12
683 ID_HALT_WAVES = 6, // added in GFX9, removed in GFX12
684 ID_ORDERED_PS_DONE = 7, // added in GFX9, removed in GFX11
685 ID_EARLY_PRIM_DEALLOC = 8, // added in GFX9, removed in GFX10
686 ID_GS_ALLOC_REQ = 9, // added in GFX9
687 ID_GET_DOORBELL = 10, // added in GFX9, removed in GFX11
688 ID_GET_DDID = 11, // added in GFX10, removed in GFX11
690
699
700 ID_RTN_GET_CLUSTER_BARRIER_STATE = 136, // added in GFX1250
701 ID_RTN_SAVE_WAVE_HAS_TDM = 152, // added in GFX1250
702
705};
706
707enum Op { // Both GS and SYS operation IDs.
710 // Bits used for operation encoding
712 OP_MASK_ = (((1 << OP_WIDTH_) - 1) << OP_SHIFT_),
713 // GS operations are encoded in bits 5:4
719 // SYS operations are encoded in bits 6:4
725};
726
736
737} // namespace SendMsg
738
739namespace WaitEvent { // Encoding of SIMM16 used in s_wait_event
740enum Id {
741 DONT_WAIT_EXPORT_READY = 1 << 0, // Only used in gfx11
742 EXPORT_READY = 1 << 1, // gfx12+
743};
744
745} // namespace WaitEvent
746
747namespace Hwreg { // Encoding of SIMM16 used in s_setreg/getreg* insns.
748
802
803enum Offset : unsigned { // Offset, (5) [10:6]
805 OFFSET_ME_ID = 8, // in HW_ID2
806};
807
809 FP_ROUND_MASK = 0xf << 0, // Bits 0..3
810 FP_DENORM_MASK = 0xf << 4, // Bits 4..7
813 LOD_CLAMP_MASK = 1 << 10,
814 DEBUG_MASK = 1 << 11,
815
816 // EXCP_EN fields.
824
826 VSKIP_MASK = 1 << 28,
827 CSP_MASK = 0x7u << 29, // Bits 29..31
828
829 // GFX1250
830 DST_VGPR_MSB = 0x3 << 12,
831 SRC0_VGPR_MSB = 0x3 << 14,
832 SRC1_VGPR_MSB = 0x3 << 16,
833 SRC2_VGPR_MSB = 0x3 << 18,
834 VGPR_MSB_MASK = 0xff << 12, // Bits 12..19
835
836 REPLAY_MODE = 1 << 25,
838};
839
840} // namespace Hwreg
841
911
912namespace UfmtGFX10 {
913enum UnifiedFormat : int64_t {
915
922
930
937
941
949
957
965
972
979
986
990
998
1005
1008};
1009
1010} // namespace UfmtGFX10
1011
1012namespace UfmtGFX11 {
1013enum UnifiedFormat : int64_t {
1015
1022
1030
1037
1041
1049
1051
1053
1058
1065
1072
1076
1084
1091
1094};
1095
1096} // namespace UfmtGFX11
1097
1098namespace Swizzle { // Encoding of swizzle macro used in ds_swizzle_b32.
1099
1109
1110// clang-format off
1111enum EncBits : unsigned {
1112
1113 // swizzle mode encodings
1114
1117
1120
1122
1125
1127 FFT_MODE_LO = 0xE000,
1128
1129 // QUAD_PERM encodings
1130
1135
1136 // BITMASK_PERM encodings
1137
1141
1145
1146 // FFT encodings
1147
1150
1151 // ROTATE encodings
1153 ROTATE_DIR_SHIFT = 10, // bit position of rotate direction
1155 ROTATE_SIZE_SHIFT = 5, // bit position of rotate size
1157};
1158// clang-format on
1159
1160} // namespace Swizzle
1161
1162namespace SDWA {
1163
1164enum SdwaSel : unsigned {
1172};
1173
1174enum DstUnused : unsigned {
1178};
1179
1194
1195} // namespace SDWA
1196
1197namespace DPP {
1198
1199// clang-format off
1244// clang-format on
1245
1252
1253} // namespace DPP
1254
1255namespace Exp {
1256
1257enum Target : unsigned {
1261 ET_NULL = 9, // Pre-GFX11
1264 ET_POS4 = 16, // GFX10+
1265 ET_POS_LAST = ET_POS4, // Highest pos used on any subtarget
1266 ET_PRIM = 20, // GFX10+
1267 ET_DUAL_SRC_BLEND0 = 21, // GFX11+
1268 ET_DUAL_SRC_BLEND1 = 22, // GFX11+
1269 ET_PARAM0 = 32, // Pre-GFX11
1270 ET_PARAM31 = 63, // Pre-GFX11
1271
1279
1281};
1282
1283} // namespace Exp
1284
1305
1306namespace VOP3PEncoding {
1307
1309 OP_SEL_HI_0 = UINT64_C(1) << 59,
1310 OP_SEL_HI_1 = UINT64_C(1) << 60,
1311 OP_SEL_HI_2 = UINT64_C(1) << 14,
1312};
1313
1314} // namespace VOP3PEncoding
1315
1316namespace ImplicitArg {
1317// Implicit kernel argument offset for code object version 5.
1330
1331} // namespace ImplicitArg
1332
1334// Enum value used in cbsz/blgp for F8F6F4 MFMA operations to select the matrix
1335// format.
1343} // namespace MFMAScaleFormats
1344
1345namespace VirtRegFlag {
1346// Virtual register flags used for various target specific handlings during
1347// codegen.
1349 // Register operand in a whole-wave mode operation.
1350 WWM_REG = 1 << 0,
1351};
1352
1353} // namespace VirtRegFlag
1354
1355} // namespace AMDGPU
1356
1357namespace AMDGPU {
1358namespace Barrier {
1359
1368
1369} // namespace Barrier
1370
1372/// Synthetic aperture numbers. This is OR'd with the high
1373/// bits of the LDS aperture pointer.
1374///
1375/// NOTE: This is also documented in AMDGPUUsage.
1377 None = 0x00000000,
1378
1379 BARRIER = 0x00000001,
1380};
1381} // namespace SyntheticAperture
1382
1383} // namespace AMDGPU
1384
1385// clang-format off
1386
1387#define R_00B028_SPI_SHADER_PGM_RSRC1_PS 0x00B028
1388#define S_00B028_VGPRS(x) (((x) & 0x3F) << 0)
1389#define S_00B028_SGPRS(x) (((x) & 0x0F) << 6)
1390#define S_00B028_MEM_ORDERED(x) (((x) & 0x1) << 25)
1391#define G_00B028_MEM_ORDERED(x) (((x) >> 25) & 0x1)
1392#define C_00B028_MEM_ORDERED 0xFDFFFFFF
1393
1394#define R_00B02C_SPI_SHADER_PGM_RSRC2_PS 0x00B02C
1395#define S_00B02C_EXTRA_LDS_SIZE(x) (((x) & 0xFF) << 8)
1396#define R_00B128_SPI_SHADER_PGM_RSRC1_VS 0x00B128
1397#define S_00B128_MEM_ORDERED(x) (((x) & 0x1) << 27)
1398#define G_00B128_MEM_ORDERED(x) (((x) >> 27) & 0x1)
1399#define C_00B128_MEM_ORDERED 0xF7FFFFFF
1400
1401#define R_00B228_SPI_SHADER_PGM_RSRC1_GS 0x00B228
1402#define S_00B228_WGP_MODE(x) (((x) & 0x1) << 27)
1403#define G_00B228_WGP_MODE(x) (((x) >> 27) & 0x1)
1404#define C_00B228_WGP_MODE 0xF7FFFFFF
1405#define S_00B228_MEM_ORDERED(x) (((x) & 0x1) << 25)
1406#define G_00B228_MEM_ORDERED(x) (((x) >> 25) & 0x1)
1407#define C_00B228_MEM_ORDERED 0xFDFFFFFF
1408
1409#define R_00B328_SPI_SHADER_PGM_RSRC1_ES 0x00B328
1410#define R_00B428_SPI_SHADER_PGM_RSRC1_HS 0x00B428
1411#define S_00B428_WGP_MODE(x) (((x) & 0x1) << 26)
1412#define G_00B428_WGP_MODE(x) (((x) >> 26) & 0x1)
1413#define C_00B428_WGP_MODE 0xFBFFFFFF
1414#define S_00B428_MEM_ORDERED(x) (((x) & 0x1) << 24)
1415#define G_00B428_MEM_ORDERED(x) (((x) >> 24) & 0x1)
1416#define C_00B428_MEM_ORDERED 0xFEFFFFFF
1417
1418#define R_00B528_SPI_SHADER_PGM_RSRC1_LS 0x00B528
1419
1420#define R_00B84C_COMPUTE_PGM_RSRC2 0x00B84C
1421#define S_00B84C_SCRATCH_EN(x) (((x) & 0x1) << 0)
1422#define G_00B84C_SCRATCH_EN(x) (((x) >> 0) & 0x1)
1423#define C_00B84C_SCRATCH_EN 0xFFFFFFFE
1424#define S_00B84C_USER_SGPR(x) (((x) & 0x1F) << 1)
1425#define G_00B84C_USER_SGPR(x) (((x) >> 1) & 0x1F)
1426#define C_00B84C_USER_SGPR 0xFFFFFFC1
1427#define S_00B84C_TRAP_HANDLER(x) (((x) & 0x1) << 6)
1428#define G_00B84C_TRAP_HANDLER(x) (((x) >> 6) & 0x1)
1429#define C_00B84C_TRAP_HANDLER 0xFFFFFFBF
1430#define S_00B84C_TGID_X_EN(x) (((x) & 0x1) << 7)
1431#define G_00B84C_TGID_X_EN(x) (((x) >> 7) & 0x1)
1432#define C_00B84C_TGID_X_EN 0xFFFFFF7F
1433#define S_00B84C_TGID_Y_EN(x) (((x) & 0x1) << 8)
1434#define G_00B84C_TGID_Y_EN(x) (((x) >> 8) & 0x1)
1435#define C_00B84C_TGID_Y_EN 0xFFFFFEFF
1436#define S_00B84C_TGID_Z_EN(x) (((x) & 0x1) << 9)
1437#define G_00B84C_TGID_Z_EN(x) (((x) >> 9) & 0x1)
1438#define C_00B84C_TGID_Z_EN 0xFFFFFDFF
1439#define S_00B84C_TG_SIZE_EN(x) (((x) & 0x1) << 10)
1440#define G_00B84C_TG_SIZE_EN(x) (((x) >> 10) & 0x1)
1441#define C_00B84C_TG_SIZE_EN 0xFFFFFBFF
1442#define S_00B84C_TIDIG_COMP_CNT(x) (((x) & 0x03) << 11)
1443#define G_00B84C_TIDIG_COMP_CNT(x) (((x) >> 11) & 0x03)
1444#define C_00B84C_TIDIG_COMP_CNT 0xFFFFE7FF
1445/* CIK */
1446#define S_00B84C_EXCP_EN_MSB(x) (((x) & 0x03) << 13)
1447#define G_00B84C_EXCP_EN_MSB(x) (((x) >> 13) & 0x03)
1448#define C_00B84C_EXCP_EN_MSB 0xFFFF9FFF
1449/* */
1450#define S_00B84C_LDS_SIZE(x) (((x) & 0x1FF) << 15)
1451#define G_00B84C_LDS_SIZE(x) (((x) >> 15) & 0x1FF)
1452#define C_00B84C_LDS_SIZE 0xFF007FFF
1453#define S_00B84C_EXCP_EN(x) (((x) & 0x7F) << 24)
1454#define G_00B84C_EXCP_EN(x) (((x) >> 24) & 0x7F)
1455#define C_00B84C_EXCP_EN 0x80FFFFFF
1456
1457#define S_00B84C_USER_SGPR_GFX1250(x) (((x) & 0x3F) << 1)
1458#define G_00B84C_USER_SGPR_GFX1250(x) (((x) >> 1) & 0x3F)
1459#define C_00B84C_USER_SGPR_GFX1250 0xFFFFFF81
1460
1461#define R_0286CC_SPI_PS_INPUT_ENA 0x0286CC
1462#define R_0286D0_SPI_PS_INPUT_ADDR 0x0286D0
1463
1464#define R_00B848_COMPUTE_PGM_RSRC1 0x00B848
1465#define S_00B848_VGPRS(x) (((x) & 0x3F) << 0)
1466#define G_00B848_VGPRS(x) (((x) >> 0) & 0x3F)
1467#define C_00B848_VGPRS 0xFFFFFFC0
1468#define S_00B848_SGPRS(x) (((x) & 0x0F) << 6)
1469#define G_00B848_SGPRS(x) (((x) >> 6) & 0x0F)
1470#define C_00B848_SGPRS 0xFFFFFC3F
1471#define S_00B848_PRIORITY(x) (((x) & 0x03) << 10)
1472#define G_00B848_PRIORITY(x) (((x) >> 10) & 0x03)
1473#define C_00B848_PRIORITY 0xFFFFF3FF
1474#define S_00B848_FLOAT_MODE(x) (((x) & 0xFF) << 12)
1475#define G_00B848_FLOAT_MODE(x) (((x) >> 12) & 0xFF)
1476#define C_00B848_FLOAT_MODE 0xFFF00FFF
1477#define S_00B848_PRIV(x) (((x) & 0x1) << 20)
1478#define G_00B848_PRIV(x) (((x) >> 20) & 0x1)
1479#define C_00B848_PRIV 0xFFEFFFFF
1480#define S_00B848_DX10_CLAMP(x) (((x) & 0x1) << 21)
1481#define G_00B848_DX10_CLAMP(x) (((x) >> 21) & 0x1)
1482#define C_00B848_DX10_CLAMP 0xFFDFFFFF
1483#define S_00B848_RR_WG_MODE(x) (((x) & 0x1) << 21)
1484#define G_00B848_RR_WG_MODE(x) (((x) >> 21) & 0x1)
1485#define C_00B848_RR_WG_MODE 0xFFDFFFFF
1486#define S_00B848_DEBUG_MODE(x) (((x) & 0x1) << 22)
1487#define G_00B848_DEBUG_MODE(x) (((x) >> 22) & 0x1)
1488#define C_00B848_DEBUG_MODE 0xFFBFFFFF
1489#define S_00B848_IEEE_MODE(x) (((x) & 0x1) << 23)
1490#define G_00B848_IEEE_MODE(x) (((x) >> 23) & 0x1)
1491#define C_00B848_IEEE_MODE 0xFF7FFFFF
1492#define S_00B848_WGP_MODE(x) (((x) & 0x1) << 29)
1493#define G_00B848_WGP_MODE(x) (((x) >> 29) & 0x1)
1494#define C_00B848_WGP_MODE 0xDFFFFFFF
1495#define S_00B848_MEM_ORDERED(x) (((x) & 0x1) << 30)
1496#define G_00B848_MEM_ORDERED(x) (((x) >> 30) & 0x1)
1497#define C_00B848_MEM_ORDERED 0xBFFFFFFF
1498#define S_00B848_FWD_PROGRESS(x) (((x) & 0x1) << 31)
1499#define G_00B848_FWD_PROGRESS(x) (((x) >> 31) & 0x1)
1500#define C_00B848_FWD_PROGRESS 0x7FFFFFFF
1501
1502// Helpers for setting FLOAT_MODE
1503#define FP_ROUND_ROUND_TO_NEAREST 0
1504#define FP_ROUND_ROUND_TO_INF 1
1505#define FP_ROUND_ROUND_TO_NEGINF 2
1506#define FP_ROUND_ROUND_TO_ZERO 3
1507
1508// Bits 3:0 control rounding mode. 1:0 control single precision, 3:2 double
1509// precision.
1510#define FP_ROUND_MODE_SP(x) ((x) & 0x3)
1511#define FP_ROUND_MODE_DP(x) (((x) & 0x3) << 2)
1512
1513#define FP_DENORM_FLUSH_IN_FLUSH_OUT 0
1514#define FP_DENORM_FLUSH_OUT 1
1515#define FP_DENORM_FLUSH_IN 2
1516#define FP_DENORM_FLUSH_NONE 3
1517
1518
1519// Bits 7:4 control denormal handling. 5:4 control single precision, 6:7 double
1520// precision.
1521#define FP_DENORM_MODE_SP(x) (((x) & 0x3) << 4)
1522#define FP_DENORM_MODE_DP(x) (((x) & 0x3) << 6)
1523
1524#define R_00B860_COMPUTE_TMPRING_SIZE 0x00B860
1525#define S_00B860_WAVESIZE_PreGFX11(x) (((x) & 0x1FFF) << 12)
1526#define S_00B860_WAVESIZE_GFX11(x) (((x) & 0x7FFF) << 12)
1527#define S_00B860_WAVESIZE_GFX12Plus(x) (((x) & 0x3FFFF) << 12)
1528
1529#define R_0286E8_SPI_TMPRING_SIZE 0x0286E8
1530#define S_0286E8_WAVESIZE_PreGFX11(x) (((x) & 0x1FFF) << 12)
1531#define S_0286E8_WAVESIZE_GFX11(x) (((x) & 0x7FFF) << 12)
1532#define S_0286E8_WAVESIZE_GFX12Plus(x) (((x) & 0x3FFFF) << 12)
1533
1534#define R_028B54_VGT_SHADER_STAGES_EN 0x028B54
1535#define S_028B54_HS_W32_EN(x) (((x) & 0x1) << 21)
1536#define S_028B54_GS_W32_EN(x) (((x) & 0x1) << 22)
1537#define S_028B54_VS_W32_EN(x) (((x) & 0x1) << 23)
1538#define R_0286D8_SPI_PS_IN_CONTROL 0x0286D8
1539#define S_0286D8_PS_W32_EN(x) (((x) & 0x1) << 15)
1540#define R_00B800_COMPUTE_DISPATCH_INITIATOR 0x00B800
1541#define S_00B800_CS_W32_EN(x) (((x) & 0x1) << 15)
1542
1543#define R_SPILLED_SGPRS 0x4
1544#define R_SPILLED_VGPRS 0x8
1545
1546// clang-format on
1547
1548} // End namespace llvm
1549
1550#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: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:1376
@ 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