1 //===-- SIDefines.h - SI Helper Macros ----------------------*- C++ -*-===//
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
8 //===----------------------------------------------------------------------===//
10 #include "llvm/MC/MCInstrDesc.h"
12 #ifndef LLVM_LIB_TARGET_AMDGPU_SIDEFINES_H
13 #define LLVM_LIB_TARGET_AMDGPU_SIDEFINES_H
17 namespace SIInstrFlags
{
18 // This needs to be kept in sync with the field bits in InstSI.
20 // Low bits - basic encoding information.
24 // SALU instruction formats.
31 // VALU instruction formats.
36 // TODO: Should this be spilt into VOP3 a and b?
45 // Memory instruction formats.
54 // Pseudo instruction formats.
58 // High bits - other information.
59 VM_CNT
= UINT64_C(1) << 32,
60 EXP_CNT
= UINT64_C(1) << 33,
61 LGKM_CNT
= UINT64_C(1) << 34,
63 WQM
= UINT64_C(1) << 35,
64 DisableWQM
= UINT64_C(1) << 36,
65 Gather4
= UINT64_C(1) << 37,
66 SOPK_ZEXT
= UINT64_C(1) << 38,
67 SCALAR_STORE
= UINT64_C(1) << 39,
68 FIXED_SIZE
= UINT64_C(1) << 40,
69 VOPAsmPrefer32Bit
= UINT64_C(1) << 41,
70 VOP3_OPSEL
= UINT64_C(1) << 42,
71 maybeAtomic
= UINT64_C(1) << 43,
72 renamedInGFX9
= UINT64_C(1) << 44,
74 // Is a clamp on FP type.
75 FPClamp
= UINT64_C(1) << 45,
77 // Is an integer clamp
78 IntClamp
= UINT64_C(1) << 46,
80 // Clamps lo component of register.
81 ClampLo
= UINT64_C(1) << 47,
83 // Clamps hi component of register.
84 // ClampLo and ClampHi set for packed clamp.
85 ClampHi
= UINT64_C(1) << 48,
87 // Is a packed VOP3P instruction.
88 IsPacked
= UINT64_C(1) << 49,
90 // Is a D16 buffer instruction.
91 D16Buf
= UINT64_C(1) << 50,
93 // FLAT instruction accesses FLAT_GLBL segment.
94 FlatGlobal
= UINT64_C(1) << 51,
96 // Uses floating point double precision rounding mode
97 FPDPRounding
= UINT64_C(1) << 52,
99 // Instruction is FP atomic.
100 FPAtomic
= UINT64_C(1) << 53,
102 // Is a MFMA instruction.
103 IsMAI
= UINT64_C(1) << 54,
105 // Is a DOT instruction.
106 IsDOT
= UINT64_C(1) << 55,
108 // FLAT instruction accesses FLAT_SCRATCH segment.
109 FlatScratch
= UINT64_C(1) << 56,
111 // Atomic without return.
112 IsAtomicNoRet
= UINT64_C(1) << 57,
114 // Atomic with return.
115 IsAtomicRet
= UINT64_C(1) << 58
118 // v_cmp_class_* etc. use a 10-bit mask for what operation is checked.
119 // The result is true if any of these tests are true.
120 enum ClassFlags
: unsigned {
121 S_NAN
= 1 << 0, // Signaling NaN
122 Q_NAN
= 1 << 1, // Quiet NaN
123 N_INFINITY
= 1 << 2, // Negative infinity
124 N_NORMAL
= 1 << 3, // Negative normal
125 N_SUBNORMAL
= 1 << 4, // Negative subnormal
126 N_ZERO
= 1 << 5, // Negative zero
127 P_ZERO
= 1 << 6, // Positive zero
128 P_SUBNORMAL
= 1 << 7, // Positive subnormal
129 P_NORMAL
= 1 << 8, // Positive normal
130 P_INFINITY
= 1 << 9 // Positive infinity
135 enum OperandType
: unsigned {
136 /// Operands with register or 32-bit immediate
137 OPERAND_REG_IMM_INT32
= MCOI::OPERAND_FIRST_TARGET
,
138 OPERAND_REG_IMM_INT64
,
139 OPERAND_REG_IMM_INT16
,
140 OPERAND_REG_IMM_FP32
,
141 OPERAND_REG_IMM_FP64
,
142 OPERAND_REG_IMM_FP16
,
143 OPERAND_REG_IMM_V2FP16
,
144 OPERAND_REG_IMM_V2INT16
,
145 OPERAND_REG_IMM_V2INT32
,
146 OPERAND_REG_IMM_V2FP32
,
148 /// Operands with register or inline constant
149 OPERAND_REG_INLINE_C_INT16
,
150 OPERAND_REG_INLINE_C_INT32
,
151 OPERAND_REG_INLINE_C_INT64
,
152 OPERAND_REG_INLINE_C_FP16
,
153 OPERAND_REG_INLINE_C_FP32
,
154 OPERAND_REG_INLINE_C_FP64
,
155 OPERAND_REG_INLINE_C_V2INT16
,
156 OPERAND_REG_INLINE_C_V2FP16
,
157 OPERAND_REG_INLINE_C_V2INT32
,
158 OPERAND_REG_INLINE_C_V2FP32
,
160 /// Operands with an AccVGPR register or inline constant
161 OPERAND_REG_INLINE_AC_INT16
,
162 OPERAND_REG_INLINE_AC_INT32
,
163 OPERAND_REG_INLINE_AC_FP16
,
164 OPERAND_REG_INLINE_AC_FP32
,
165 OPERAND_REG_INLINE_AC_FP64
,
166 OPERAND_REG_INLINE_AC_V2INT16
,
167 OPERAND_REG_INLINE_AC_V2FP16
,
168 OPERAND_REG_INLINE_AC_V2INT32
,
169 OPERAND_REG_INLINE_AC_V2FP32
,
171 OPERAND_REG_IMM_FIRST
= OPERAND_REG_IMM_INT32
,
172 OPERAND_REG_IMM_LAST
= OPERAND_REG_IMM_V2FP32
,
174 OPERAND_REG_INLINE_C_FIRST
= OPERAND_REG_INLINE_C_INT16
,
175 OPERAND_REG_INLINE_C_LAST
= OPERAND_REG_INLINE_AC_V2FP32
,
177 OPERAND_REG_INLINE_AC_FIRST
= OPERAND_REG_INLINE_AC_INT16
,
178 OPERAND_REG_INLINE_AC_LAST
= OPERAND_REG_INLINE_AC_V2FP32
,
180 OPERAND_SRC_FIRST
= OPERAND_REG_IMM_INT32
,
181 OPERAND_SRC_LAST
= OPERAND_REG_INLINE_C_LAST
,
183 // Operand for source modifiers for VOP instructions
186 // Operand for SDWA instructions
187 OPERAND_SDWA_VOPC_DST
,
189 /// Operand with 32-bit immediate that uses the constant bus.
195 // Input operand modifiers bit-masks
196 // NEG and SEXT share same bit-mask because they can't be set simultaneously.
197 namespace SISrcMods
{
199 NEG
= 1 << 0, // Floating-point negate modifier
200 ABS
= 1 << 1, // Floating-point absolute modifier
201 SEXT
= 1 << 0, // Integer sign-extend modifier
202 NEG_HI
= ABS
, // Floating-point negate high packed component modifier.
205 DST_OP_SEL
= 1 << 3 // VOP3 dst op_sel (share mask with OP_SEL_1)
209 namespace SIOutMods
{
219 namespace VGPRIndexMode
{
221 enum Id
: unsigned { // id of symbolic names
231 enum EncBits
: unsigned {
233 SRC0_ENABLE
= 1 << ID_SRC0
,
234 SRC1_ENABLE
= 1 << ID_SRC1
,
235 SRC2_ENABLE
= 1 << ID_SRC2
,
236 DST_ENABLE
= 1 << ID_DST
,
237 ENABLE_MASK
= SRC0_ENABLE
| SRC1_ENABLE
| SRC2_ENABLE
| DST_ENABLE
,
241 } // namespace VGPRIndexMode
242 } // namespace AMDGPU
244 namespace AMDGPUAsmVariants
{
255 namespace EncValues
{ // Encoding values of enum9/8/7 operands
260 SGPR_MAX_GFX10
= 105,
263 TTMP_GFX9PLUS_MIN
= 108,
264 TTMP_GFX9PLUS_MAX
= 123,
265 INLINE_INTEGER_C_MIN
= 128,
266 INLINE_INTEGER_C_POSITIVE_MAX
= 192, // 64
267 INLINE_INTEGER_C_MAX
= 208,
268 INLINE_FLOATING_C_MIN
= 240,
269 INLINE_FLOATING_C_MAX
= 248,
275 } // namespace EncValues
276 } // namespace AMDGPU
286 ALL
= GLC
| SLC
| DLC
| SCC
291 namespace SendMsg
{ // Encoding of SIMM16 used in s_sendmsg* insns.
293 enum Id
{ // Message ID, width(4) [3:0].
298 ID_SAVEWAVE
= 4, // added in GFX8
299 ID_STALL_WAVE_GEN
= 5, // added in GFX9
300 ID_HALT_WAVES
= 6, // added in GFX9
301 ID_ORDERED_PS_DONE
= 7, // added in GFX9
302 ID_EARLY_PRIM_DEALLOC
= 8, // added in GFX9, removed in GFX10
303 ID_GS_ALLOC_REQ
= 9, // added in GFX9
304 ID_GET_DOORBELL
= 10, // added in GFX9
305 ID_GET_DDID
= 11, // added in GFX10
307 ID_GAPS_LAST_
, // Indicate that sequence has gaps.
308 ID_GAPS_FIRST_
= ID_INTERRUPT
,
311 ID_MASK_
= (((1 << ID_WIDTH_
) - 1) << ID_SHIFT_
)
314 enum Op
{ // Both GS and SYS operation IDs.
318 // Bits used for operation encoding
320 OP_MASK_
= (((1 << OP_WIDTH_
) - 1) << OP_SHIFT_
),
321 // GS operations are encoded in bits 5:4
327 OP_GS_FIRST_
= OP_GS_NOP
,
328 // SYS operations are encoded in bits 6:4
329 OP_SYS_ECC_ERR_INTERRUPT
= 1,
331 OP_SYS_HOST_TRAP_ACK
= 3,
332 OP_SYS_TTRACE_PC
= 4,
334 OP_SYS_FIRST_
= OP_SYS_ECC_ERR_INTERRUPT
,
337 enum StreamId
: unsigned { // Stream ID, (2) [9:8].
339 STREAM_ID_DEFAULT_
= 0,
341 STREAM_ID_FIRST_
= STREAM_ID_DEFAULT_
,
342 STREAM_ID_SHIFT_
= 8,
344 STREAM_ID_MASK_
= (((1 << STREAM_ID_WIDTH_
) - 1) << STREAM_ID_SHIFT_
)
347 } // namespace SendMsg
349 namespace Hwreg
{ // Encoding of SIMM16 used in s_setreg/getreg* insns.
351 enum Id
{ // HwRegCode, (6) [5:0]
353 ID_SYMBOLIC_FIRST_
= 1, // There are corresponding symbolic names defined.
362 ID_SYMBOLIC_FIRST_GFX9_
= ID_MEM_BASES
,
364 ID_SYMBOLIC_FIRST_GFX10_
= ID_TBA_LO
,
372 ID_SHADER_CYCLES
= 29,
373 ID_SYMBOLIC_FIRST_GFX1030_
= ID_SHADER_CYCLES
,
374 ID_SYMBOLIC_LAST_
= 30,
377 ID_MASK_
= (((1 << ID_WIDTH_
) - 1) << ID_SHIFT_
)
380 enum Offset
: unsigned { // Offset, (5) [10:6]
384 OFFSET_MASK_
= (((1 << OFFSET_WIDTH_
) - 1) << OFFSET_SHIFT_
),
388 OFFSET_SRC_SHARED_BASE
= 16,
389 OFFSET_SRC_PRIVATE_BASE
= 0
392 enum WidthMinusOne
: unsigned { // WidthMinusOne, (5) [15:11]
393 WIDTH_M1_DEFAULT_
= 31,
394 WIDTH_M1_SHIFT_
= 11,
396 WIDTH_M1_MASK_
= (((1 << WIDTH_M1_WIDTH_
) - 1) << WIDTH_M1_SHIFT_
),
398 WIDTH_M1_SRC_SHARED_BASE
= 15,
399 WIDTH_M1_SRC_PRIVATE_BASE
= 15
402 // Some values from WidthMinusOne mapped into Width domain.
403 enum Width
: unsigned {
404 WIDTH_DEFAULT_
= WIDTH_M1_DEFAULT_
+ 1,
407 enum ModeRegisterMasks
: uint32_t {
408 FP_ROUND_MASK
= 0xf << 0, // Bits 0..3
409 FP_DENORM_MASK
= 0xf << 4, // Bits 4..7
410 DX10_CLAMP_MASK
= 1 << 8,
411 IEEE_MODE_MASK
= 1 << 9,
412 LOD_CLAMP_MASK
= 1 << 10,
413 DEBUG_MASK
= 1 << 11,
416 EXCP_EN_INVALID_MASK
= 1 << 12,
417 EXCP_EN_INPUT_DENORMAL_MASK
= 1 << 13,
418 EXCP_EN_FLOAT_DIV0_MASK
= 1 << 14,
419 EXCP_EN_OVERFLOW_MASK
= 1 << 15,
420 EXCP_EN_UNDERFLOW_MASK
= 1 << 16,
421 EXCP_EN_INEXACT_MASK
= 1 << 17,
422 EXCP_EN_INT_DIV0_MASK
= 1 << 18,
424 GPR_IDX_EN_MASK
= 1 << 27,
425 VSKIP_MASK
= 1 << 28,
426 CSP_MASK
= 0x7u
<< 29 // Bits 29..31
431 namespace MTBUFFormat
{
433 enum DataFormat
: int64_t {
451 DFMT_MIN
= DFMT_INVALID
,
452 DFMT_MAX
= DFMT_RESERVED_15
,
455 DFMT_DEFAULT
= DFMT_8
,
461 enum NumFormat
: int64_t {
468 NFMT_RESERVED_6
, // VI and GFX9
469 NFMT_SNORM_OGL
= NFMT_RESERVED_6
, // SI and CI only
472 NFMT_MIN
= NFMT_UNORM
,
473 NFMT_MAX
= NFMT_FLOAT
,
476 NFMT_DEFAULT
= NFMT_UNORM
,
482 enum MergedFormat
: int64_t {
483 DFMT_NFMT_UNDEF
= -1,
484 DFMT_NFMT_DEFAULT
= ((DFMT_DEFAULT
& DFMT_MASK
) << DFMT_SHIFT
) |
485 ((NFMT_DEFAULT
& NFMT_MASK
) << NFMT_SHIFT
),
488 DFMT_NFMT_MASK
= (DFMT_MASK
<< DFMT_SHIFT
) | (NFMT_MASK
<< NFMT_SHIFT
),
490 DFMT_NFMT_MAX
= DFMT_NFMT_MASK
493 enum UnifiedFormat
: int64_t {
532 UFMT_10_11_11_USCALED
,
533 UFMT_10_11_11_SSCALED
,
540 UFMT_11_11_10_USCALED
,
541 UFMT_11_11_10_SSCALED
,
546 UFMT_10_10_10_2_UNORM
,
547 UFMT_10_10_10_2_SNORM
,
548 UFMT_10_10_10_2_USCALED
,
549 UFMT_10_10_10_2_SSCALED
,
550 UFMT_10_10_10_2_UINT
,
551 UFMT_10_10_10_2_SINT
,
553 UFMT_2_10_10_10_UNORM
,
554 UFMT_2_10_10_10_SNORM
,
555 UFMT_2_10_10_10_USCALED
,
556 UFMT_2_10_10_10_SSCALED
,
557 UFMT_2_10_10_10_UINT
,
558 UFMT_2_10_10_10_SINT
,
562 UFMT_8_8_8_8_USCALED
,
563 UFMT_8_8_8_8_SSCALED
,
571 UFMT_16_16_16_16_UNORM
,
572 UFMT_16_16_16_16_SNORM
,
573 UFMT_16_16_16_16_USCALED
,
574 UFMT_16_16_16_16_SSCALED
,
575 UFMT_16_16_16_16_UINT
,
576 UFMT_16_16_16_16_SINT
,
577 UFMT_16_16_16_16_FLOAT
,
582 UFMT_32_32_32_32_UINT
,
583 UFMT_32_32_32_32_SINT
,
584 UFMT_32_32_32_32_FLOAT
,
586 UFMT_FIRST
= UFMT_INVALID
,
587 UFMT_LAST
= UFMT_32_32_32_32_FLOAT
,
592 UFMT_DEFAULT
= UFMT_8_UNORM
595 } // namespace MTBUFFormat
597 namespace Swizzle
{ // Encoding of swizzle macro used in ds_swizzle_b32.
599 enum Id
: unsigned { // id of symbolic names
607 enum EncBits
: unsigned {
609 // swizzle mode encodings
611 QUAD_PERM_ENC
= 0x8000,
612 QUAD_PERM_ENC_MASK
= 0xFF00,
614 BITMASK_PERM_ENC
= 0x0000,
615 BITMASK_PERM_ENC_MASK
= 0x8000,
617 // QUAD_PERM encodings
620 LANE_MAX
= LANE_MASK
,
624 // BITMASK_PERM encodings
627 BITMASK_MAX
= BITMASK_MASK
,
630 BITMASK_AND_SHIFT
= 0,
631 BITMASK_OR_SHIFT
= 5,
632 BITMASK_XOR_SHIFT
= 10
635 } // namespace Swizzle
639 enum SdwaSel
: unsigned {
649 enum DstUnused
: unsigned {
655 enum SDWA9EncValues
: unsigned {
656 SRC_SGPR_MASK
= 0x100,
657 SRC_VGPR_MASK
= 0xFF,
658 VOPC_DST_VCC_MASK
= 0x80,
659 VOPC_DST_SGPR_MASK
= 0x7F,
664 SRC_SGPR_MAX_SI
= 357,
665 SRC_SGPR_MAX_GFX10
= 361,
675 enum DppCtrl
: unsigned {
677 QUAD_PERM_ID
= 0xE4, // identity permutation
678 QUAD_PERM_LAST
= 0xFF,
681 ROW_SHL_FIRST
= 0x101,
682 ROW_SHL_LAST
= 0x10F,
685 ROW_SHR_FIRST
= 0x111,
686 ROW_SHR_LAST
= 0x11F,
689 ROW_ROR_FIRST
= 0x121,
690 ROW_ROR_LAST
= 0x12F,
692 DPP_UNUSED4_FIRST
= 0x131,
693 DPP_UNUSED4_LAST
= 0x133,
695 DPP_UNUSED5_FIRST
= 0x135,
696 DPP_UNUSED5_LAST
= 0x137,
698 DPP_UNUSED6_FIRST
= 0x139,
699 DPP_UNUSED6_LAST
= 0x13B,
701 DPP_UNUSED7_FIRST
= 0x13D,
702 DPP_UNUSED7_LAST
= 0x13F,
704 ROW_HALF_MIRROR
= 0x141,
707 DPP_UNUSED8_FIRST
= 0x144,
708 DPP_UNUSED8_LAST
= 0x14F,
709 ROW_NEWBCAST_FIRST
= 0x150,
710 ROW_NEWBCAST_LAST
= 0x15F,
712 ROW_SHARE_FIRST
= 0x150,
713 ROW_SHARE_LAST
= 0x15F,
715 ROW_XMASK_FIRST
= 0x160,
716 ROW_XMASK_LAST
= 0x16F,
717 DPP_LAST
= ROW_XMASK_LAST
732 enum Target
: unsigned {
739 ET_POS4
= 16, // GFX10+
740 ET_POS_LAST
= ET_POS4
, // Highest pos used on any subtarget
741 ET_PRIM
= 20, // GFX10+
750 ET_PARAM_MAX_IDX
= 31,
757 namespace VOP3PEncoding
{
759 enum OpSel
: uint64_t {
760 OP_SEL_HI_0
= UINT64_C(1) << 59,
761 OP_SEL_HI_1
= UINT64_C(1) << 60,
762 OP_SEL_HI_2
= UINT64_C(1) << 14,
765 } // namespace VOP3PEncoding
767 } // namespace AMDGPU
769 #define R_00B028_SPI_SHADER_PGM_RSRC1_PS 0x00B028
770 #define S_00B028_VGPRS(x) (((x) & 0x3F) << 0)
771 #define S_00B028_SGPRS(x) (((x) & 0x0F) << 6)
772 #define S_00B028_MEM_ORDERED(x) (((x) & 0x1) << 25)
773 #define G_00B028_MEM_ORDERED(x) (((x) >> 25) & 0x1)
774 #define C_00B028_MEM_ORDERED 0xFDFFFFFF
776 #define R_00B02C_SPI_SHADER_PGM_RSRC2_PS 0x00B02C
777 #define S_00B02C_EXTRA_LDS_SIZE(x) (((x) & 0xFF) << 8)
778 #define R_00B128_SPI_SHADER_PGM_RSRC1_VS 0x00B128
779 #define S_00B128_MEM_ORDERED(x) (((x) & 0x1) << 27)
780 #define G_00B128_MEM_ORDERED(x) (((x) >> 27) & 0x1)
781 #define C_00B128_MEM_ORDERED 0xF7FFFFFF
783 #define R_00B228_SPI_SHADER_PGM_RSRC1_GS 0x00B228
784 #define S_00B228_WGP_MODE(x) (((x) & 0x1) << 27)
785 #define G_00B228_WGP_MODE(x) (((x) >> 27) & 0x1)
786 #define C_00B228_WGP_MODE 0xF7FFFFFF
787 #define S_00B228_MEM_ORDERED(x) (((x) & 0x1) << 25)
788 #define G_00B228_MEM_ORDERED(x) (((x) >> 25) & 0x1)
789 #define C_00B228_MEM_ORDERED 0xFDFFFFFF
791 #define R_00B328_SPI_SHADER_PGM_RSRC1_ES 0x00B328
792 #define R_00B428_SPI_SHADER_PGM_RSRC1_HS 0x00B428
793 #define S_00B428_WGP_MODE(x) (((x) & 0x1) << 26)
794 #define G_00B428_WGP_MODE(x) (((x) >> 26) & 0x1)
795 #define C_00B428_WGP_MODE 0xFBFFFFFF
796 #define S_00B428_MEM_ORDERED(x) (((x) & 0x1) << 24)
797 #define G_00B428_MEM_ORDERED(x) (((x) >> 24) & 0x1)
798 #define C_00B428_MEM_ORDERED 0xFEFFFFFF
800 #define R_00B528_SPI_SHADER_PGM_RSRC1_LS 0x00B528
802 #define R_00B84C_COMPUTE_PGM_RSRC2 0x00B84C
803 #define S_00B84C_SCRATCH_EN(x) (((x) & 0x1) << 0)
804 #define G_00B84C_SCRATCH_EN(x) (((x) >> 0) & 0x1)
805 #define C_00B84C_SCRATCH_EN 0xFFFFFFFE
806 #define S_00B84C_USER_SGPR(x) (((x) & 0x1F) << 1)
807 #define G_00B84C_USER_SGPR(x) (((x) >> 1) & 0x1F)
808 #define C_00B84C_USER_SGPR 0xFFFFFFC1
809 #define S_00B84C_TRAP_HANDLER(x) (((x) & 0x1) << 6)
810 #define G_00B84C_TRAP_HANDLER(x) (((x) >> 6) & 0x1)
811 #define C_00B84C_TRAP_HANDLER 0xFFFFFFBF
812 #define S_00B84C_TGID_X_EN(x) (((x) & 0x1) << 7)
813 #define G_00B84C_TGID_X_EN(x) (((x) >> 7) & 0x1)
814 #define C_00B84C_TGID_X_EN 0xFFFFFF7F
815 #define S_00B84C_TGID_Y_EN(x) (((x) & 0x1) << 8)
816 #define G_00B84C_TGID_Y_EN(x) (((x) >> 8) & 0x1)
817 #define C_00B84C_TGID_Y_EN 0xFFFFFEFF
818 #define S_00B84C_TGID_Z_EN(x) (((x) & 0x1) << 9)
819 #define G_00B84C_TGID_Z_EN(x) (((x) >> 9) & 0x1)
820 #define C_00B84C_TGID_Z_EN 0xFFFFFDFF
821 #define S_00B84C_TG_SIZE_EN(x) (((x) & 0x1) << 10)
822 #define G_00B84C_TG_SIZE_EN(x) (((x) >> 10) & 0x1)
823 #define C_00B84C_TG_SIZE_EN 0xFFFFFBFF
824 #define S_00B84C_TIDIG_COMP_CNT(x) (((x) & 0x03) << 11)
825 #define G_00B84C_TIDIG_COMP_CNT(x) (((x) >> 11) & 0x03)
826 #define C_00B84C_TIDIG_COMP_CNT 0xFFFFE7FF
828 #define S_00B84C_EXCP_EN_MSB(x) (((x) & 0x03) << 13)
829 #define G_00B84C_EXCP_EN_MSB(x) (((x) >> 13) & 0x03)
830 #define C_00B84C_EXCP_EN_MSB 0xFFFF9FFF
832 #define S_00B84C_LDS_SIZE(x) (((x) & 0x1FF) << 15)
833 #define G_00B84C_LDS_SIZE(x) (((x) >> 15) & 0x1FF)
834 #define C_00B84C_LDS_SIZE 0xFF007FFF
835 #define S_00B84C_EXCP_EN(x) (((x) & 0x7F) << 24)
836 #define G_00B84C_EXCP_EN(x) (((x) >> 24) & 0x7F)
837 #define C_00B84C_EXCP_EN
839 #define R_0286CC_SPI_PS_INPUT_ENA 0x0286CC
840 #define R_0286D0_SPI_PS_INPUT_ADDR 0x0286D0
842 #define R_00B848_COMPUTE_PGM_RSRC1 0x00B848
843 #define S_00B848_VGPRS(x) (((x) & 0x3F) << 0)
844 #define G_00B848_VGPRS(x) (((x) >> 0) & 0x3F)
845 #define C_00B848_VGPRS 0xFFFFFFC0
846 #define S_00B848_SGPRS(x) (((x) & 0x0F) << 6)
847 #define G_00B848_SGPRS(x) (((x) >> 6) & 0x0F)
848 #define C_00B848_SGPRS 0xFFFFFC3F
849 #define S_00B848_PRIORITY(x) (((x) & 0x03) << 10)
850 #define G_00B848_PRIORITY(x) (((x) >> 10) & 0x03)
851 #define C_00B848_PRIORITY 0xFFFFF3FF
852 #define S_00B848_FLOAT_MODE(x) (((x) & 0xFF) << 12)
853 #define G_00B848_FLOAT_MODE(x) (((x) >> 12) & 0xFF)
854 #define C_00B848_FLOAT_MODE 0xFFF00FFF
855 #define S_00B848_PRIV(x) (((x) & 0x1) << 20)
856 #define G_00B848_PRIV(x) (((x) >> 20) & 0x1)
857 #define C_00B848_PRIV 0xFFEFFFFF
858 #define S_00B848_DX10_CLAMP(x) (((x) & 0x1) << 21)
859 #define G_00B848_DX10_CLAMP(x) (((x) >> 21) & 0x1)
860 #define C_00B848_DX10_CLAMP 0xFFDFFFFF
861 #define S_00B848_DEBUG_MODE(x) (((x) & 0x1) << 22)
862 #define G_00B848_DEBUG_MODE(x) (((x) >> 22) & 0x1)
863 #define C_00B848_DEBUG_MODE 0xFFBFFFFF
864 #define S_00B848_IEEE_MODE(x) (((x) & 0x1) << 23)
865 #define G_00B848_IEEE_MODE(x) (((x) >> 23) & 0x1)
866 #define C_00B848_IEEE_MODE 0xFF7FFFFF
867 #define S_00B848_WGP_MODE(x) (((x) & 0x1) << 29)
868 #define G_00B848_WGP_MODE(x) (((x) >> 29) & 0x1)
869 #define C_00B848_WGP_MODE 0xDFFFFFFF
870 #define S_00B848_MEM_ORDERED(x) (((x) & 0x1) << 30)
871 #define G_00B848_MEM_ORDERED(x) (((x) >> 30) & 0x1)
872 #define C_00B848_MEM_ORDERED 0xBFFFFFFF
873 #define S_00B848_FWD_PROGRESS(x) (((x) & 0x1) << 31)
874 #define G_00B848_FWD_PROGRESS(x) (((x) >> 31) & 0x1)
875 #define C_00B848_FWD_PROGRESS 0x7FFFFFFF
878 // Helpers for setting FLOAT_MODE
879 #define FP_ROUND_ROUND_TO_NEAREST 0
880 #define FP_ROUND_ROUND_TO_INF 1
881 #define FP_ROUND_ROUND_TO_NEGINF 2
882 #define FP_ROUND_ROUND_TO_ZERO 3
884 // Bits 3:0 control rounding mode. 1:0 control single precision, 3:2 double
886 #define FP_ROUND_MODE_SP(x) ((x) & 0x3)
887 #define FP_ROUND_MODE_DP(x) (((x) & 0x3) << 2)
889 #define FP_DENORM_FLUSH_IN_FLUSH_OUT 0
890 #define FP_DENORM_FLUSH_OUT 1
891 #define FP_DENORM_FLUSH_IN 2
892 #define FP_DENORM_FLUSH_NONE 3
895 // Bits 7:4 control denormal handling. 5:4 control single precision, 6:7 double
897 #define FP_DENORM_MODE_SP(x) (((x) & 0x3) << 4)
898 #define FP_DENORM_MODE_DP(x) (((x) & 0x3) << 6)
900 #define R_00B860_COMPUTE_TMPRING_SIZE 0x00B860
901 #define S_00B860_WAVESIZE(x) (((x) & 0x1FFF) << 12)
903 #define R_0286E8_SPI_TMPRING_SIZE 0x0286E8
904 #define S_0286E8_WAVESIZE(x) (((x) & 0x1FFF) << 12)
906 #define R_028B54_VGT_SHADER_STAGES_EN 0x028B54
907 #define S_028B54_HS_W32_EN(x) (((x) & 0x1) << 21)
908 #define S_028B54_GS_W32_EN(x) (((x) & 0x1) << 22)
909 #define S_028B54_VS_W32_EN(x) (((x) & 0x1) << 23)
910 #define R_0286D8_SPI_PS_IN_CONTROL 0x0286D8
911 #define S_0286D8_PS_W32_EN(x) (((x) & 0x1) << 15)
912 #define R_00B800_COMPUTE_DISPATCH_INITIATOR 0x00B800
913 #define S_00B800_CS_W32_EN(x) (((x) & 0x1) << 15)
915 #define R_SPILLED_SGPRS 0x4
916 #define R_SPILLED_VGPRS 0x8
917 } // End namespace llvm