1 //===-- R600Defines.h - R600 Helper Macros ----------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 /// \file 9 //===----------------------------------------------------------------------===// 10 11 #ifndef R600DEFINES_H_ 12 #define R600DEFINES_H_ 13 14 #include "llvm/MC/MCRegisterInfo.h" 15 16 // Operand Flags 17 #define MO_FLAG_CLAMP (1 << 0) 18 #define MO_FLAG_NEG (1 << 1) 19 #define MO_FLAG_ABS (1 << 2) 20 #define MO_FLAG_MASK (1 << 3) 21 #define MO_FLAG_PUSH (1 << 4) 22 #define MO_FLAG_NOT_LAST (1 << 5) 23 #define MO_FLAG_LAST (1 << 6) 24 #define NUM_MO_FLAGS 7 25 26 /// \brief Helper for getting the operand index for the instruction flags 27 /// operand. 28 #define GET_FLAG_OPERAND_IDX(Flags) (((Flags) >> 7) & 0x3) 29 30 namespace R600_InstFlag { 31 enum TIF { 32 TRANS_ONLY = (1 << 0), 33 TEX = (1 << 1), 34 REDUCTION = (1 << 2), 35 FC = (1 << 3), 36 TRIG = (1 << 4), 37 OP3 = (1 << 5), 38 VECTOR = (1 << 6), 39 //FlagOperand bits 7, 8 40 NATIVE_OPERANDS = (1 << 9), 41 OP1 = (1 << 10), 42 OP2 = (1 << 11), 43 VTX_INST = (1 << 12), 44 TEX_INST = (1 << 13), 45 ALU_INST = (1 << 14), 46 LDS_1A = (1 << 15), 47 LDS_1A1D = (1 << 16) 48 }; 49 } 50 51 #define HAS_NATIVE_OPERANDS(Flags) ((Flags) & R600_InstFlag::NATIVE_OPERANDS) 52 53 /// \brief Defines for extracting register infomation from register encoding 54 #define HW_REG_MASK 0x1ff 55 #define HW_CHAN_SHIFT 9 56 57 #define GET_REG_CHAN(reg) ((reg) >> HW_CHAN_SHIFT) 58 #define GET_REG_INDEX(reg) ((reg) & HW_REG_MASK) 59 60 #define IS_VTX(desc) ((desc).TSFlags & R600_InstFlag::VTX_INST) 61 #define IS_TEX(desc) ((desc).TSFlags & R600_InstFlag::TEX_INST) 62 63 namespace OpName { 64 65 enum VecOps { 66 UPDATE_EXEC_MASK_X, 67 UPDATE_PREDICATE_X, 68 WRITE_X, 69 OMOD_X, 70 DST_REL_X, 71 CLAMP_X, 72 SRC0_X, 73 SRC0_NEG_X, 74 SRC0_REL_X, 75 SRC0_ABS_X, 76 SRC0_SEL_X, 77 SRC1_X, 78 SRC1_NEG_X, 79 SRC1_REL_X, 80 SRC1_ABS_X, 81 SRC1_SEL_X, 82 PRED_SEL_X, 83 UPDATE_EXEC_MASK_Y, 84 UPDATE_PREDICATE_Y, 85 WRITE_Y, 86 OMOD_Y, 87 DST_REL_Y, 88 CLAMP_Y, 89 SRC0_Y, 90 SRC0_NEG_Y, 91 SRC0_REL_Y, 92 SRC0_ABS_Y, 93 SRC0_SEL_Y, 94 SRC1_Y, 95 SRC1_NEG_Y, 96 SRC1_REL_Y, 97 SRC1_ABS_Y, 98 SRC1_SEL_Y, 99 PRED_SEL_Y, 100 UPDATE_EXEC_MASK_Z, 101 UPDATE_PREDICATE_Z, 102 WRITE_Z, 103 OMOD_Z, 104 DST_REL_Z, 105 CLAMP_Z, 106 SRC0_Z, 107 SRC0_NEG_Z, 108 SRC0_REL_Z, 109 SRC0_ABS_Z, 110 SRC0_SEL_Z, 111 SRC1_Z, 112 SRC1_NEG_Z, 113 SRC1_REL_Z, 114 SRC1_ABS_Z, 115 SRC1_SEL_Z, 116 PRED_SEL_Z, 117 UPDATE_EXEC_MASK_W, 118 UPDATE_PREDICATE_W, 119 WRITE_W, 120 OMOD_W, 121 DST_REL_W, 122 CLAMP_W, 123 SRC0_W, 124 SRC0_NEG_W, 125 SRC0_REL_W, 126 SRC0_ABS_W, 127 SRC0_SEL_W, 128 SRC1_W, 129 SRC1_NEG_W, 130 SRC1_REL_W, 131 SRC1_ABS_W, 132 SRC1_SEL_W, 133 PRED_SEL_W, 134 IMM_0, 135 IMM_1, 136 VEC_COUNT 137 }; 138 139 } 140 141 //===----------------------------------------------------------------------===// 142 // Config register definitions 143 //===----------------------------------------------------------------------===// 144 145 #define R_02880C_DB_SHADER_CONTROL 0x02880C 146 #define S_02880C_KILL_ENABLE(x) (((x) & 0x1) << 6) 147 148 // These fields are the same for all shader types and families. 149 #define S_NUM_GPRS(x) (((x) & 0xFF) << 0) 150 #define S_STACK_SIZE(x) (((x) & 0xFF) << 8) 151 //===----------------------------------------------------------------------===// 152 // R600, R700 Registers 153 //===----------------------------------------------------------------------===// 154 155 #define R_028850_SQ_PGM_RESOURCES_PS 0x028850 156 #define R_028868_SQ_PGM_RESOURCES_VS 0x028868 157 158 //===----------------------------------------------------------------------===// 159 // Evergreen, Northern Islands Registers 160 //===----------------------------------------------------------------------===// 161 162 #define R_028844_SQ_PGM_RESOURCES_PS 0x028844 163 #define R_028860_SQ_PGM_RESOURCES_VS 0x028860 164 #define R_028878_SQ_PGM_RESOURCES_GS 0x028878 165 #define R_0288D4_SQ_PGM_RESOURCES_LS 0x0288d4 166 167 #define R_0288E8_SQ_LDS_ALLOC 0x0288E8 168 169 #endif // R600DEFINES_H_ 170