diff options
Diffstat (limited to 'contrib/llvm/lib/Target/AMDGPU/SIDefines.h')
-rw-r--r-- | contrib/llvm/lib/Target/AMDGPU/SIDefines.h | 196 |
1 files changed, 137 insertions, 59 deletions
diff --git a/contrib/llvm/lib/Target/AMDGPU/SIDefines.h b/contrib/llvm/lib/Target/AMDGPU/SIDefines.h index f4b04e3..ff4e321 100644 --- a/contrib/llvm/lib/Target/AMDGPU/SIDefines.h +++ b/contrib/llvm/lib/Target/AMDGPU/SIDefines.h @@ -13,76 +13,111 @@ #ifndef LLVM_LIB_TARGET_AMDGPU_SIDEFINES_H #define LLVM_LIB_TARGET_AMDGPU_SIDEFINES_H +namespace llvm { + namespace SIInstrFlags { // This needs to be kept in sync with the field bits in InstSI. -enum { - SALU = 1 << 3, - VALU = 1 << 4, - - SOP1 = 1 << 5, - SOP2 = 1 << 6, - SOPC = 1 << 7, - SOPK = 1 << 8, - SOPP = 1 << 9, - - VOP1 = 1 << 10, - VOP2 = 1 << 11, - VOP3 = 1 << 12, - VOPC = 1 << 13, +enum : uint64_t { + // Low bits - basic encoding information. + SALU = 1 << 0, + VALU = 1 << 1, + + // SALU instruction formats. + SOP1 = 1 << 2, + SOP2 = 1 << 3, + SOPC = 1 << 4, + SOPK = 1 << 5, + SOPP = 1 << 6, + + // VALU instruction formats. + VOP1 = 1 << 7, + VOP2 = 1 << 8, + VOPC = 1 << 9, + + // TODO: Should this be spilt into VOP3 a and b? + VOP3 = 1 << 10, + + VINTRP = 1 << 13, SDWA = 1 << 14, DPP = 1 << 15, + // Memory instruction formats. MUBUF = 1 << 16, MTBUF = 1 << 17, SMRD = 1 << 18, - DS = 1 << 19, - MIMG = 1 << 20, + MIMG = 1 << 19, + EXP = 1 << 20, FLAT = 1 << 21, - WQM = 1 << 22, + DS = 1 << 22, + + // Pseudo instruction formats. VGPRSpill = 1 << 23, - VOPAsmPrefer32Bit = 1 << 24, - Gather4 = 1 << 25, - DisableWQM = 1 << 26 + SGPRSpill = 1 << 24, + + // High bits - other information. + VM_CNT = UINT64_C(1) << 32, + EXP_CNT = UINT64_C(1) << 33, + LGKM_CNT = UINT64_C(1) << 34, + + WQM = UINT64_C(1) << 35, + DisableWQM = UINT64_C(1) << 36, + Gather4 = UINT64_C(1) << 37, + SOPK_ZEXT = UINT64_C(1) << 38, + SCALAR_STORE = UINT64_C(1) << 39, + FIXED_SIZE = UINT64_C(1) << 40, + VOPAsmPrefer32Bit = UINT64_C(1) << 41 + +}; + +// v_cmp_class_* etc. use a 10-bit mask for what operation is checked. +// The result is true if any of these tests are true. +enum ClassFlags { + S_NAN = 1 << 0, // Signaling NaN + Q_NAN = 1 << 1, // Quiet NaN + N_INFINITY = 1 << 2, // Negative infinity + N_NORMAL = 1 << 3, // Negative normal + N_SUBNORMAL = 1 << 4, // Negative subnormal + N_ZERO = 1 << 5, // Negative zero + P_ZERO = 1 << 6, // Positive zero + P_SUBNORMAL = 1 << 7, // Positive subnormal + P_NORMAL = 1 << 8, // Positive normal + P_INFINITY = 1 << 9 // Positive infinity }; } -namespace llvm { namespace AMDGPU { enum OperandType { - /// Operand with register or 32-bit immediate - OPERAND_REG_IMM32 = MCOI::OPERAND_FIRST_TARGET, - /// Operand with register or inline constant - OPERAND_REG_INLINE_C, - - /// Operand with 32-bit immediate that uses the constant bus. The standard - /// OPERAND_IMMEDIATE should be used for special immediates such as source - /// modifiers. - OPERAND_KIMM32 - }; -} -} - -namespace SIInstrFlags { - enum Flags { - // First 4 bits are the instruction encoding - VM_CNT = 1 << 0, - EXP_CNT = 1 << 1, - LGKM_CNT = 1 << 2 - }; - - // v_cmp_class_* etc. use a 10-bit mask for what operation is checked. - // The result is true if any of these tests are true. - enum ClassFlags { - S_NAN = 1 << 0, // Signaling NaN - Q_NAN = 1 << 1, // Quiet NaN - N_INFINITY = 1 << 2, // Negative infinity - N_NORMAL = 1 << 3, // Negative normal - N_SUBNORMAL = 1 << 4, // Negative subnormal - N_ZERO = 1 << 5, // Negative zero - P_ZERO = 1 << 6, // Positive zero - P_SUBNORMAL = 1 << 7, // Positive subnormal - P_NORMAL = 1 << 8, // Positive normal - P_INFINITY = 1 << 9 // Positive infinity + /// Operands with register or 32-bit immediate + OPERAND_REG_IMM_INT32 = MCOI::OPERAND_FIRST_TARGET, + OPERAND_REG_IMM_INT64, + OPERAND_REG_IMM_INT16, + OPERAND_REG_IMM_FP32, + OPERAND_REG_IMM_FP64, + OPERAND_REG_IMM_FP16, + + /// Operands with register or inline constant + OPERAND_REG_INLINE_C_INT16, + OPERAND_REG_INLINE_C_INT32, + OPERAND_REG_INLINE_C_INT64, + OPERAND_REG_INLINE_C_FP16, + OPERAND_REG_INLINE_C_FP32, + OPERAND_REG_INLINE_C_FP64, + + OPERAND_REG_IMM_FIRST = OPERAND_REG_IMM_INT32, + OPERAND_REG_IMM_LAST = OPERAND_REG_IMM_FP16, + + OPERAND_REG_INLINE_C_FIRST = OPERAND_REG_INLINE_C_INT16, + OPERAND_REG_INLINE_C_LAST = OPERAND_REG_INLINE_C_FP64, + + OPERAND_SRC_FIRST = OPERAND_REG_IMM_INT32, + OPERAND_SRC_LAST = OPERAND_REG_INLINE_C_LAST, + + // Operand for source modifiers for VOP instructions + OPERAND_INPUT_MODS, + + /// Operand with 32-bit immediate that uses the constant bus. + OPERAND_KIMM32, + OPERAND_KIMM16 }; } @@ -105,7 +140,24 @@ namespace SIOutMods { }; } -namespace llvm { +namespace VGPRIndexMode { + enum { + SRC0_ENABLE = 1 << 0, + SRC1_ENABLE = 1 << 1, + SRC2_ENABLE = 1 << 2, + DST_ENABLE = 1 << 3 + }; +} + +namespace AMDGPUAsmVariants { + enum { + DEFAULT = 0, + VOP3 = 1, + SDWA = 2, + DPP = 3 + }; +} + namespace AMDGPU { namespace EncValues { // Encoding values of enum9/8/7 operands @@ -126,9 +178,7 @@ enum { } // namespace EncValues } // namespace AMDGPU -} // namespace llvm -namespace llvm { namespace AMDGPU { namespace SendMsg { // Encoding of SIMM16 used in s_sendmsg* insns. @@ -184,6 +234,13 @@ namespace Hwreg { // Encoding of SIMM16 used in s_setreg/getreg* insns. enum Id { // HwRegCode, (6) [5:0] ID_UNKNOWN_ = -1, ID_SYMBOLIC_FIRST_ = 1, // There are corresponding symbolic names defined. + ID_MODE = 1, + ID_STATUS = 2, + ID_TRAPSTS = 3, + ID_HW_ID = 4, + ID_GPR_ALLOC = 5, + ID_LDS_ALLOC = 6, + ID_IB_STS = 7, ID_SYMBOLIC_LAST_ = 8, ID_SHIFT_ = 0, ID_WIDTH_ = 6, @@ -205,8 +262,27 @@ enum WidthMinusOne { // WidthMinusOne, (5) [15:11] }; } // namespace Hwreg + +namespace SDWA { + +enum SdwaSel { + BYTE_0 = 0, + BYTE_1 = 1, + BYTE_2 = 2, + BYTE_3 = 3, + WORD_0 = 4, + WORD_1 = 5, + DWORD = 6, +}; + +enum DstUnused { + UNUSED_PAD = 0, + UNUSED_SEXT = 1, + UNUSED_PRESERVE = 2, +}; + +} // namespace SDWA } // namespace AMDGPU -} // namespace llvm #define R_00B028_SPI_SHADER_PGM_RSRC1_PS 0x00B028 #define R_00B02C_SPI_SHADER_PGM_RSRC2_PS 0x00B02C @@ -312,4 +388,6 @@ enum WidthMinusOne { // WidthMinusOne, (5) [15:11] #define R_SPILLED_SGPRS 0x4 #define R_SPILLED_VGPRS 0x8 +} // End namespace llvm + #endif |