1 /*
2  * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * on the rights to use, copy, modify, merge, publish, distribute, sub
8  * license, and/or sell copies of the Software, and to permit persons to whom
9  * the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21  * USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  * Authors:
24  *      Jerome Glisse
25  */
26 #ifndef R600_SQ_H
27 #define R600_SQ_H
28 
29 #define P_SQ_CF_WORD0
30 #define   S_SQ_CF_WORD0_ADDR(x)                                      (((unsigned)(x) & 0xFFFFFFFF) << 0)
31 #define   G_SQ_CF_WORD0_ADDR(x)                                      (((x) >> 0) & 0xFFFFFFFF)
32 #define   C_SQ_CF_WORD0_ADDR                                         0x00000000
33 #define P_SQ_CF_WORD1
34 #define   S_SQ_CF_WORD1_POP_COUNT(x)                                 (((unsigned)(x) & 0x7) << 0)
35 #define   G_SQ_CF_WORD1_POP_COUNT(x)                                 (((x) >> 0) & 0x7)
36 #define   C_SQ_CF_WORD1_POP_COUNT                                    0xFFFFFFF8
37 #define   S_SQ_CF_WORD1_CF_CONST(x)                                  (((unsigned)(x) & 0x1F) << 3)
38 #define   G_SQ_CF_WORD1_CF_CONST(x)                                  (((x) >> 3) & 0x1F)
39 #define   C_SQ_CF_WORD1_CF_CONST                                     0xFFFFFF07
40 #define   S_SQ_CF_WORD1_COND(x)                                      (((unsigned)(x) & 0x3) << 8)
41 #define   G_SQ_CF_WORD1_COND(x)                                      (((x) >> 8) & 0x3)
42 #define   C_SQ_CF_WORD1_COND                                         0xFFFFFCFF
43 #define   S_SQ_CF_WORD1_COUNT(x)                                     (((unsigned)(x) & 0x7) << 10)
44 #define   G_SQ_CF_WORD1_COUNT(x)                                     (((x) >> 10) & 0x7)
45 #define   C_SQ_CF_WORD1_COUNT                                        0xFFFFE3FF
46 #define   S_SQ_CF_WORD1_CALL_COUNT(x)                                (((unsigned)(x) & 0x3F) << 13)
47 #define   G_SQ_CF_WORD1_CALL_COUNT(x)                                (((x) >> 13) & 0x3F)
48 #define   C_SQ_CF_WORD1_CALL_COUNT                                   0xFFF81FFF
49 #define   S_SQ_CF_WORD1_END_OF_PROGRAM(x)                            (((unsigned)(x) & 0x1) << 21)
50 #define   G_SQ_CF_WORD1_END_OF_PROGRAM(x)                            (((x) >> 21) & 0x1)
51 #define   C_SQ_CF_WORD1_END_OF_PROGRAM                               0xFFDFFFFF
52 #define   S_SQ_CF_WORD1_VALID_PIXEL_MODE(x)                          (((unsigned)(x) & 0x1) << 22)
53 #define   G_SQ_CF_WORD1_VALID_PIXEL_MODE(x)                          (((x) >> 22) & 0x1)
54 #define   C_SQ_CF_WORD1_VALID_PIXEL_MODE                             0xFFBFFFFF
55 #define   S_SQ_CF_WORD1_CF_INST(x)                                   (((unsigned)(x) & 0x7F) << 23)
56 #define   G_SQ_CF_WORD1_CF_INST(x)                                   (((x) >> 23) & 0x7F)
57 #define   C_SQ_CF_WORD1_CF_INST                                      0xC07FFFFF
58 #define   S_SQ_CF_WORD1_WHOLE_QUAD_MODE(x)                           (((unsigned)(x) & 0x1) << 30)
59 #define   G_SQ_CF_WORD1_WHOLE_QUAD_MODE(x)                           (((x) >> 30) & 0x1)
60 #define   C_SQ_CF_WORD1_WHOLE_QUAD_MODE                              0xBFFFFFFF
61 #define   S_SQ_CF_WORD1_BARRIER(x)                                   (((unsigned)(x) & 0x1) << 31)
62 #define   G_SQ_CF_WORD1_BARRIER(x)                                   (((x) >> 31) & 0x1)
63 #define   C_SQ_CF_WORD1_BARRIER                                      0x7FFFFFFF
64 #define P_SQ_CF_ALU_WORD0
65 #define   S_SQ_CF_ALU_WORD0_ADDR(x)                                  (((unsigned)(x) & 0x3FFFFF) << 0)
66 #define   G_SQ_CF_ALU_WORD0_ADDR(x)                                  (((x) >> 0) & 0x3FFFFF)
67 #define   C_SQ_CF_ALU_WORD0_ADDR                                     0xFFC00000
68 #define   S_SQ_CF_ALU_WORD0_KCACHE_BANK0(x)                          (((unsigned)(x) & 0xF) << 22)
69 #define   G_SQ_CF_ALU_WORD0_KCACHE_BANK0(x)                          (((x) >> 22) & 0xF)
70 #define   C_SQ_CF_ALU_WORD0_KCACHE_BANK0                             0xFC3FFFFF
71 #define   S_SQ_CF_ALU_WORD0_KCACHE_BANK1(x)                          (((unsigned)(x) & 0xF) << 26)
72 #define   G_SQ_CF_ALU_WORD0_KCACHE_BANK1(x)                          (((x) >> 26) & 0xF)
73 #define   C_SQ_CF_ALU_WORD0_KCACHE_BANK1                             0xC3FFFFFF
74 #define   S_SQ_CF_ALU_WORD0_KCACHE_MODE0(x)                          (((unsigned)(x) & 0x3) << 30)
75 #define   G_SQ_CF_ALU_WORD0_KCACHE_MODE0(x)                          (((x) >> 30) & 0x3)
76 #define   C_SQ_CF_ALU_WORD0_KCACHE_MODE0                             0x3FFFFFFF
77 #define     V_SQ_CF_KCACHE_NOP                                       0x00000000
78 #define     V_SQ_CF_KCACHE_LOCK_1                                    0x00000001
79 #define     V_SQ_CF_KCACHE_LOCK_2                                    0x00000002
80 #define     V_SQ_CF_KCACHE_LOCK_LOOP_INDEX                           0x00000003
81 #define P_SQ_CF_ALU_WORD1
82 #define   S_SQ_CF_ALU_WORD1_KCACHE_MODE1(x)                          (((unsigned)(x) & 0x3) << 0)
83 #define   G_SQ_CF_ALU_WORD1_KCACHE_MODE1(x)                          (((x) >> 0) & 0x3)
84 #define   C_SQ_CF_ALU_WORD1_KCACHE_MODE1                             0xFFFFFFFC
85 #define   S_SQ_CF_ALU_WORD1_KCACHE_ADDR0(x)                          (((unsigned)(x) & 0xFF) << 2)
86 #define   G_SQ_CF_ALU_WORD1_KCACHE_ADDR0(x)                          (((x) >> 2) & 0xFF)
87 #define   C_SQ_CF_ALU_WORD1_KCACHE_ADDR0                             0xFFFFFC03
88 #define   S_SQ_CF_ALU_WORD1_KCACHE_ADDR1(x)                          (((unsigned)(x) & 0xFF) << 10)
89 #define   G_SQ_CF_ALU_WORD1_KCACHE_ADDR1(x)                          (((x) >> 10) & 0xFF)
90 #define   C_SQ_CF_ALU_WORD1_KCACHE_ADDR1                             0xFFFC03FF
91 #define   S_SQ_CF_ALU_WORD1_COUNT(x)                                 (((unsigned)(x) & 0x7F) << 18)
92 #define   G_SQ_CF_ALU_WORD1_COUNT(x)                                 (((x) >> 18) & 0x7F)
93 #define   C_SQ_CF_ALU_WORD1_COUNT                                    0xFE03FFFF
94 #define   S_SQ_CF_ALU_WORD1_USES_WATERFALL(x)                        (((unsigned)(x) & 0x1) << 25)
95 #define   G_SQ_CF_ALU_WORD1_USES_WATERFALL(x)                        (((x) >> 25) & 0x1)
96 #define   C_SQ_CF_ALU_WORD1_USES_WATERFALL                           0xFDFFFFFF
97 #define   S_SQ_CF_ALU_WORD1_CF_INST(x)                               (((unsigned)(x) & 0xF) << 26)
98 #define   G_SQ_CF_ALU_WORD1_CF_INST(x)                               (((x) >> 26) & 0xF)
99 #define   C_SQ_CF_ALU_WORD1_CF_INST                                  0xC3FFFFFF
100 #define   S_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE(x)                       (((unsigned)(x) & 0x1) << 30)
101 #define   G_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE(x)                       (((x) >> 30) & 0x1)
102 #define   C_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE                          0xBFFFFFFF
103 #define   S_SQ_CF_ALU_WORD1_BARRIER(x)                               (((unsigned)(x) & 0x1) << 31)
104 #define   G_SQ_CF_ALU_WORD1_BARRIER(x)                               (((x) >> 31) & 0x1)
105 #define   C_SQ_CF_ALU_WORD1_BARRIER                                  0x7FFFFFFF
106 #define P_SQ_CF_ALLOC_EXPORT_WORD0
107 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(x)                   (((unsigned)(x) & 0x1FFF) << 0)
108 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(x)                   (((x) >> 0) & 0x1FFF)
109 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE                      0xFFFFE000
110 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(x)                         (((unsigned)(x) & 0x3) << 13)
111 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(x)                         (((x) >> 13) & 0x3)
112 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_TYPE                            0xFFFF9FFF
113 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL               0x00000000
114 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS                 0x00000001
115 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM               0x00000002
116 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_SX                  0x00000003
117 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE               0x00000000
118 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_IND           0x00000001
119 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_READ                0x00000002
120 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_READ_IND            0x00000003
121 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(x)                       (((unsigned)(x) & 0x7F) << 15)
122 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(x)                       (((x) >> 15) & 0x7F)
123 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR                          0xFFC07FFF
124 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL(x)                       (((unsigned)(x) & 0x1) << 22)
125 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL(x)                       (((x) >> 22) & 0x1)
126 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL                          0xFFBFFFFF
127 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(x)                    (((unsigned)(x) & 0x7F) << 23)
128 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(x)                    (((x) >> 23) & 0x7F)
129 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR                       0xC07FFFFF
130 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(x)                    (((unsigned)(x) & 0x3) << 30)
131 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(x)                    (((x) >> 30) & 0x3)
132 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE                       0x3FFFFFFF
133 #define P_SQ_CF_ALLOC_EXPORT_WORD1
134 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(x)                  (((unsigned)(x) & 0xF) << 17)
135 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(x)                  (((x) >> 17) & 0xF)
136 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT                     0xFFE1FFFF
137 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(x)               (((unsigned)(x) & 0x1) << 21)
138 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(x)               (((x) >> 21) & 0x1)
139 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM                  0xFFDFFFFF
140 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(x)             (((unsigned)(x) & 0x1) << 22)
141 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(x)             (((x) >> 22) & 0x1)
142 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE                0xFFBFFFFF
143 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x)                      (((unsigned)(x) & 0x7F) << 23)
144 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x)                      (((x) >> 23) & 0x7F)
145 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST                         0xC07FFFFF
146 
147 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE(x)              (((unsigned)(x) & 0x1) << 30)
148 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE(x)              (((x) >> 30) & 0x1)
149 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE                 0xBFFFFFFF
150 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(x)                      (((unsigned)(x) & 0x1) << 31)
151 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(x)                      (((x) >> 31) & 0x1)
152 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER                         0x7FFFFFFF
153 #define P_SQ_CF_ALLOC_EXPORT_WORD1_BUF
154 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(x)               (((unsigned)(x) & 0xFFF) << 0)
155 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(x)               (((x) >> 0) & 0xFFF)
156 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE                  0xFFFFF000
157 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(x)                (((unsigned)(x) & 0xF) << 12)
158 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(x)                (((x) >> 12) & 0xF)
159 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK                   0xFFFF0FFF
160 #define P_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ
161 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(x)                   (((unsigned)(x) & 0x7) << 0)
162 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(x)                   (((x) >> 0) & 0x7)
163 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X                      0xFFFFFFF8
164 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(x)                   (((unsigned)(x) & 0x7) << 3)
165 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(x)                   (((x) >> 3) & 0x7)
166 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y                      0xFFFFFFC7
167 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(x)                   (((unsigned)(x) & 0x7) << 6)
168 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(x)                   (((x) >> 6) & 0x7)
169 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z                      0xFFFFFE3F
170 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(x)                   (((unsigned)(x) & 0x7) << 9)
171 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(x)                   (((x) >> 9) & 0x7)
172 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W                      0xFFFFF1FF
173 #define P_SQ_ALU_WORD0
174 #define   S_SQ_ALU_WORD0_SRC0_SEL(x)                                 (((unsigned)(x) & 0x1FF) << 0)
175 #define   G_SQ_ALU_WORD0_SRC0_SEL(x)                                 (((x) >> 0) & 0x1FF)
176 #define   C_SQ_ALU_WORD0_SRC0_SEL                                    0xFFFFFE00
177 /*
178  * 244  ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
179  * 245  ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
180  * 246  ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
181  * 247  ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
182  * 248  SQ_ALU_SRC_0: special constant 0.0.
183  * 249  SQ_ALU_SRC_1: special constant 1.0 float.
184  * 250  SQ_ALU_SRC_1_INT: special constant 1 integer.
185  * 251  SQ_ALU_SRC_M_1_INT: special constant -1 integer.
186  * 252  SQ_ALU_SRC_0_5: special constant 0.5 float.
187  * 253  SQ_ALU_SRC_LITERAL: literal constant.
188  * 254  SQ_ALU_SRC_PV: previous vector result.
189  * 255  SQ_ALU_SRC_PS: previous scalar result.
190  * 448  EG - INTERP SRC BASE
191  */
192 /* LDS are Evergreen/Cayman only */
193 #define     EG_V_SQ_ALU_SRC_LDS_OQ_A                                 0x000000DB
194 #define     EG_V_SQ_ALU_SRC_LDS_OQ_B                                 0x000000DC
195 #define     EG_V_SQ_ALU_SRC_LDS_OQ_A_POP                             0x000000DD
196 #define     EG_V_SQ_ALU_SRC_LDS_OQ_B_POP                             0x000000DE
197 #define     EG_V_SQ_ALU_SRC_LDS_DIRECT_A                             0x000000DF
198 #define     EG_V_SQ_ALU_SRC_LDS_DIRECT_B                             0x000000E0
199 #define     EG_V_SQ_ALU_SRC_TIME_HI                                  0x000000E3
200 #define     EG_V_SQ_ALU_SRC_TIME_LO                                  0x000000E4
201 #define     EG_V_SQ_ALU_SRC_MASK_HI                                  0x000000E5
202 #define     EG_V_SQ_ALU_SRC_MASK_LO                                  0x000000E6
203 #define     EG_V_SQ_ALU_SRC_HW_WAVE_ID                               0x000000E7
204 #define     EG_V_SQ_ALU_SRC_SIMD_ID                                  0x000000E8
205 #define     EG_V_SQ_ALU_SRC_SE_ID                                    0x000000E9
206 
207 #define     V_SQ_ALU_SRC_0                                           0x000000F8
208 #define     V_SQ_ALU_SRC_1                                           0x000000F9
209 #define     V_SQ_ALU_SRC_1_INT                                       0x000000FA
210 #define     V_SQ_ALU_SRC_M_1_INT                                     0x000000FB
211 #define     V_SQ_ALU_SRC_0_5                                         0x000000FC
212 #define     V_SQ_ALU_SRC_LITERAL                                     0x000000FD
213 #define     V_SQ_ALU_SRC_PV                                          0x000000FE
214 #define     V_SQ_ALU_SRC_PS                                          0x000000FF
215 #define     V_SQ_ALU_SRC_PARAM_BASE                                  0x000001C0
216 #define   S_SQ_ALU_WORD0_SRC0_REL(x)                                 (((unsigned)(x) & 0x1) << 9)
217 #define   G_SQ_ALU_WORD0_SRC0_REL(x)                                 (((x) >> 9) & 0x1)
218 #define   C_SQ_ALU_WORD0_SRC0_REL                                    0xFFFFFDFF
219 #define   S_SQ_ALU_WORD0_SRC0_CHAN(x)                                (((unsigned)(x) & 0x3) << 10)
220 #define   G_SQ_ALU_WORD0_SRC0_CHAN(x)                                (((x) >> 10) & 0x3)
221 #define   C_SQ_ALU_WORD0_SRC0_CHAN                                   0xFFFFF3FF
222 #define   S_SQ_ALU_WORD0_SRC0_NEG(x)                                 (((unsigned)(x) & 0x1) << 12)
223 #define   G_SQ_ALU_WORD0_SRC0_NEG(x)                                 (((x) >> 12) & 0x1)
224 #define   C_SQ_ALU_WORD0_SRC0_NEG                                    0xFFFFEFFF
225 #define   S_SQ_ALU_WORD0_SRC1_SEL(x)                                 (((unsigned)(x) & 0x1FF) << 13)
226 #define   G_SQ_ALU_WORD0_SRC1_SEL(x)                                 (((x) >> 13) & 0x1FF)
227 #define   C_SQ_ALU_WORD0_SRC1_SEL                                    0xFFC01FFF
228 #define   S_SQ_ALU_WORD0_SRC1_REL(x)                                 (((unsigned)(x) & 0x1) << 22)
229 #define   G_SQ_ALU_WORD0_SRC1_REL(x)                                 (((x) >> 22) & 0x1)
230 #define   C_SQ_ALU_WORD0_SRC1_REL                                    0xFFBFFFFF
231 #define   S_SQ_ALU_WORD0_SRC1_CHAN(x)                                (((unsigned)(x) & 0x3) << 23)
232 #define   G_SQ_ALU_WORD0_SRC1_CHAN(x)                                (((x) >> 23) & 0x3)
233 #define   C_SQ_ALU_WORD0_SRC1_CHAN                                   0xFE7FFFFF
234 #define   S_SQ_ALU_WORD0_SRC1_NEG(x)                                 (((unsigned)(x) & 0x1) << 25)
235 #define   G_SQ_ALU_WORD0_SRC1_NEG(x)                                 (((x) >> 25) & 0x1)
236 #define   C_SQ_ALU_WORD0_SRC1_NEG                                    0xFDFFFFFF
237 #define   S_SQ_ALU_WORD0_INDEX_MODE(x)                               (((unsigned)(x) & 0x7) << 26)
238 #define   G_SQ_ALU_WORD0_INDEX_MODE(x)                               (((x) >> 26) & 0x7)
239 #define   C_SQ_ALU_WORD0_INDEX_MODE                                  0xE3FFFFFF
240 #define   S_SQ_ALU_WORD0_PRED_SEL(x)                                 (((unsigned)(x) & 0x3) << 29)
241 #define   G_SQ_ALU_WORD0_PRED_SEL(x)                                 (((x) >> 29) & 0x3)
242 #define   C_SQ_ALU_WORD0_PRED_SEL                                    0x9FFFFFFF
243 #define   S_SQ_ALU_WORD0_LAST(x)                                     (((unsigned)(x) & 0x1) << 31)
244 #define   G_SQ_ALU_WORD0_LAST(x)                                     (((x) >> 31) & 0x1)
245 #define   C_SQ_ALU_WORD0_LAST                                        0x7FFFFFFF
246 #define P_SQ_ALU_WORD1
247 #define   S_SQ_ALU_WORD1_ENCODING(x)                                 (((unsigned)(x) & 0x7) << 15)
248 #define   G_SQ_ALU_WORD1_ENCODING(x)                                 (((x) >> 15) & 0x7)
249 #define   C_SQ_ALU_WORD1_ENCODING                                    0xFFFC7FFF
250 #define   S_SQ_ALU_WORD1_BANK_SWIZZLE(x)                             (((unsigned)(x) & 0x7) << 18)
251 #define   G_SQ_ALU_WORD1_BANK_SWIZZLE(x)                             (((x) >> 18) & 0x7)
252 #define   C_SQ_ALU_WORD1_BANK_SWIZZLE                                0xFFE3FFFF
253 #define   S_SQ_ALU_WORD1_DST_GPR(x)                                  (((unsigned)(x) & 0x7F) << 21)
254 #define   G_SQ_ALU_WORD1_DST_GPR(x)                                  (((x) >> 21) & 0x7F)
255 #define   C_SQ_ALU_WORD1_DST_GPR                                     0xF01FFFFF
256 #define   S_SQ_ALU_WORD1_DST_REL(x)                                  (((unsigned)(x) & 0x1) << 28)
257 #define   G_SQ_ALU_WORD1_DST_REL(x)                                  (((x) >> 28) & 0x1)
258 #define   C_SQ_ALU_WORD1_DST_REL                                     0xEFFFFFFF
259 #define   S_SQ_ALU_WORD1_DST_CHAN(x)                                 (((unsigned)(x) & 0x3) << 29)
260 #define   G_SQ_ALU_WORD1_DST_CHAN(x)                                 (((x) >> 29) & 0x3)
261 #define   C_SQ_ALU_WORD1_DST_CHAN                                    0x9FFFFFFF
262 #define   S_SQ_ALU_WORD1_CLAMP(x)                                    (((unsigned)(x) & 0x1) << 31)
263 #define   G_SQ_ALU_WORD1_CLAMP(x)                                    (((x) >> 31) & 0x1)
264 #define   C_SQ_ALU_WORD1_CLAMP                                       0x7FFFFFFF
265 #define P_SQ_ALU_WORD1_OP2
266 #define   S_SQ_ALU_WORD1_OP2_SRC0_ABS(x)                             (((unsigned)(x) & 0x1) << 0)
267 #define   G_SQ_ALU_WORD1_OP2_SRC0_ABS(x)                             (((x) >> 0) & 0x1)
268 #define   C_SQ_ALU_WORD1_OP2_SRC0_ABS                                0xFFFFFFFE
269 #define   S_SQ_ALU_WORD1_OP2_SRC1_ABS(x)                             (((unsigned)(x) & 0x1) << 1)
270 #define   G_SQ_ALU_WORD1_OP2_SRC1_ABS(x)                             (((x) >> 1) & 0x1)
271 #define   C_SQ_ALU_WORD1_OP2_SRC1_ABS                                0xFFFFFFFD
272 #define   S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x)                  (((unsigned)(x) & 0x1) << 2)
273 #define   G_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x)                  (((x) >> 2) & 0x1)
274 #define   C_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK                     0xFFFFFFFB
275 #define   S_SQ_ALU_WORD1_OP2_UPDATE_PRED(x)                          (((unsigned)(x) & 0x1) << 3)
276 #define   G_SQ_ALU_WORD1_OP2_UPDATE_PRED(x)                          (((x) >> 3) & 0x1)
277 #define   C_SQ_ALU_WORD1_OP2_UPDATE_PRED                             0xFFFFFFF7
278 #define   S_SQ_ALU_WORD1_OP2_WRITE_MASK(x)                           (((unsigned)(x) & 0x1) << 4)
279 #define   G_SQ_ALU_WORD1_OP2_WRITE_MASK(x)                           (((x) >> 4) & 0x1)
280 #define   C_SQ_ALU_WORD1_OP2_WRITE_MASK                              0xFFFFFFEF
281 #define   S_SQ_ALU_WORD1_OP2_FOG_MERGE(x)                            (((unsigned)(x) & 0x1) << 5)
282 #define   G_SQ_ALU_WORD1_OP2_FOG_MERGE(x)                            (((x) >> 5) & 0x1)
283 #define   C_SQ_ALU_WORD1_OP2_FOG_MERGE                               0xFFFFFFDF
284 #define   S_SQ_ALU_WORD1_OP2_OMOD(x)                                 (((unsigned)(x) & 0x3) << 6)
285 #define   G_SQ_ALU_WORD1_OP2_OMOD(x)                                 (((x) >> 6) & 0x3)
286 #define   C_SQ_ALU_WORD1_OP2_OMOD                                    0xFFFFFF3F
287 #define   S_SQ_ALU_WORD1_OP2_ALU_INST(x)                             (((unsigned)(x) & 0x3FF) << 8)
288 #define   G_SQ_ALU_WORD1_OP2_ALU_INST(x)                             (((x) >> 8) & 0x3FF)
289 #define   C_SQ_ALU_WORD1_OP2_ALU_INST                                0xFFFC00FF
290 #define P_SQ_ALU_WORD1_OP3
291 #define   S_SQ_ALU_WORD1_OP3_SRC2_SEL(x)                             (((unsigned)(x) & 0x1FF) << 0)
292 #define   G_SQ_ALU_WORD1_OP3_SRC2_SEL(x)                             (((x) >> 0) & 0x1FF)
293 #define   C_SQ_ALU_WORD1_OP3_SRC2_SEL                                0xFFFFFE00
294 #define   S_SQ_ALU_WORD1_OP3_SRC2_REL(x)                             (((unsigned)(x) & 0x1) << 9)
295 #define   G_SQ_ALU_WORD1_OP3_SRC2_REL(x)                             (((x) >> 9) & 0x1)
296 #define   C_SQ_ALU_WORD1_OP3_SRC2_REL                                0xFFFFFDFF
297 #define   S_SQ_ALU_WORD1_OP3_SRC2_CHAN(x)                            (((unsigned)(x) & 0x3) << 10)
298 #define   G_SQ_ALU_WORD1_OP3_SRC2_CHAN(x)                            (((x) >> 10) & 0x3)
299 #define   C_SQ_ALU_WORD1_OP3_SRC2_CHAN                               0xFFFFF3FF
300 #define   S_SQ_ALU_WORD1_OP3_SRC2_NEG(x)                             (((unsigned)(x) & 0x1) << 12)
301 #define   G_SQ_ALU_WORD1_OP3_SRC2_NEG(x)                             (((x) >> 12) & 0x1)
302 #define   C_SQ_ALU_WORD1_OP3_SRC2_NEG                                0xFFFFEFFF
303 #define   S_SQ_ALU_WORD1_OP3_ALU_INST(x)                             (((unsigned)(x) & 0x1F) << 13)
304 #define   G_SQ_ALU_WORD1_OP3_ALU_INST(x)                             (((x) >> 13) & 0x1F)
305 #define   C_SQ_ALU_WORD1_OP3_ALU_INST                                0xFFFC1FFF
306 #define P_SQ_VTX_WORD0
307 #define   S_SQ_VTX_WORD0_VTX_INST(x)                                 (((unsigned)(x) & 0x1F) << 0)
308 #define   G_SQ_VTX_WORD0_VTX_INST(x)                                 (((x) >> 0) & 0x1F)
309 #define   C_SQ_VTX_WORD0_VTX_INST                                    0xFFFFFFE0
310 #define   S_SQ_VTX_WORD0_FETCH_TYPE(x)                               (((unsigned)(x) & 0x3) << 5)
311 #define   G_SQ_VTX_WORD0_FETCH_TYPE(x)                               (((x) >> 5) & 0x3)
312 #define   C_SQ_VTX_WORD0_FETCH_TYPE                                  0xFFFFFF9F
313 #define   S_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x)                         (((unsigned)(x) & 0x1) << 7)
314 #define   G_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x)                         (((x) >> 7) & 0x1)
315 #define   C_SQ_VTX_WORD0_FETCH_WHOLE_QUAD                            0xFFFFFF7F
316 #define   S_SQ_VTX_WORD0_BUFFER_ID(x)                                (((unsigned)(x) & 0xFF) << 8)
317 #define   G_SQ_VTX_WORD0_BUFFER_ID(x)                                (((x) >> 8) & 0xFF)
318 #define   C_SQ_VTX_WORD0_BUFFER_ID                                   0xFFFF00FF
319 #define   S_SQ_VTX_WORD0_SRC_GPR(x)                                  (((unsigned)(x) & 0x7F) << 16)
320 #define   G_SQ_VTX_WORD0_SRC_GPR(x)                                  (((x) >> 16) & 0x7F)
321 #define   C_SQ_VTX_WORD0_SRC_GPR                                     0xFF80FFFF
322 #define   S_SQ_VTX_WORD0_SRC_REL(x)                                  (((unsigned)(x) & 0x1) << 23)
323 #define   G_SQ_VTX_WORD0_SRC_REL(x)                                  (((x) >> 23) & 0x1)
324 #define   C_SQ_VTX_WORD0_SRC_REL                                     0xFF7FFFFF
325 #define   S_SQ_VTX_WORD0_SRC_SEL_X(x)                                (((unsigned)(x) & 0x3) << 24)
326 #define   G_SQ_VTX_WORD0_SRC_SEL_X(x)                                (((x) >> 24) & 0x3)
327 #define   C_SQ_VTX_WORD0_SRC_SEL_X                                   0xFCFFFFFF
328 #define   S_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x)                         (((unsigned)(x) & 0x3F) << 26)
329 #define   G_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x)                         (((x) >> 26) & 0x3F)
330 #define   C_SQ_VTX_WORD0_MEGA_FETCH_COUNT                            0x03FFFFFF
331 #define P_SQ_VTX_WORD1
332 #define   S_SQ_VTX_WORD1_DST_SEL_X(x)                                (((unsigned)(x) & 0x7) << 9)
333 #define   G_SQ_VTX_WORD1_DST_SEL_X(x)                                (((x) >> 9) & 0x7)
334 #define   C_SQ_VTX_WORD1_DST_SEL_X                                   0xFFFFF1FF
335 #define   S_SQ_VTX_WORD1_DST_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 12)
336 #define   G_SQ_VTX_WORD1_DST_SEL_Y(x)                                (((x) >> 12) & 0x7)
337 #define   C_SQ_VTX_WORD1_DST_SEL_Y                                   0xFFFF8FFF
338 #define   S_SQ_VTX_WORD1_DST_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 15)
339 #define   G_SQ_VTX_WORD1_DST_SEL_Z(x)                                (((x) >> 15) & 0x7)
340 #define   C_SQ_VTX_WORD1_DST_SEL_Z                                   0xFFFC7FFF
341 #define   S_SQ_VTX_WORD1_DST_SEL_W(x)                                (((unsigned)(x) & 0x7) << 18)
342 #define   G_SQ_VTX_WORD1_DST_SEL_W(x)                                (((x) >> 18) & 0x7)
343 #define   C_SQ_VTX_WORD1_DST_SEL_W                                   0xFFE3FFFF
344 #define   S_SQ_VTX_WORD1_USE_CONST_FIELDS(x)                         (((unsigned)(x) & 0x1) << 21)
345 #define   G_SQ_VTX_WORD1_USE_CONST_FIELDS(x)                         (((x) >> 21) & 0x1)
346 #define   C_SQ_VTX_WORD1_USE_CONST_FIELDS                            0xFFDFFFFF
347 #define   S_SQ_VTX_WORD1_DATA_FORMAT(x)                              (((unsigned)(x) & 0x3F) << 22)
348 #define   G_SQ_VTX_WORD1_DATA_FORMAT(x)                              (((x) >> 22) & 0x3F)
349 #define   C_SQ_VTX_WORD1_DATA_FORMAT                                 0xF03FFFFF
350 #define   S_SQ_VTX_WORD1_NUM_FORMAT_ALL(x)                           (((unsigned)(x) & 0x3) << 28)
351 #define   G_SQ_VTX_WORD1_NUM_FORMAT_ALL(x)                           (((x) >> 28) & 0x3)
352 #define   C_SQ_VTX_WORD1_NUM_FORMAT_ALL                              0xCFFFFFFF
353 #define   S_SQ_VTX_WORD1_FORMAT_COMP_ALL(x)                          (((unsigned)(x) & 0x1) << 30)
354 #define   G_SQ_VTX_WORD1_FORMAT_COMP_ALL(x)                          (((x) >> 30) & 0x1)
355 #define   C_SQ_VTX_WORD1_FORMAT_COMP_ALL                             0xBFFFFFFF
356 #define   S_SQ_VTX_WORD1_SRF_MODE_ALL(x)                             (((unsigned)(x) & 0x1) << 31)
357 #define   G_SQ_VTX_WORD1_SRF_MODE_ALL(x)                             (((x) >> 31) & 0x1)
358 #define   C_SQ_VTX_WORD1_SRF_MODE_ALL                                0x7FFFFFFF
359 #define P_SQ_VTX_WORD1_GPR
360 #define   S_SQ_VTX_WORD1_GPR_DST_GPR(x)                              (((unsigned)(x) & 0x7F) << 0)
361 #define   G_SQ_VTX_WORD1_GPR_DST_GPR(x)                              (((x) >> 0) & 0x7F)
362 #define   C_SQ_VTX_WORD1_GPR_DST_GPR                                 0xFFFFFF80
363 #define   S_SQ_VTX_WORD1_GPR_DST_REL(x)                              (((unsigned)(x) & 0x1) << 7)
364 #define   G_SQ_VTX_WORD1_GPR_DST_REL(x)                              (((x) >> 7) & 0x1)
365 #define   C_SQ_VTX_WORD1_GPR_DST_REL                                 0xFFFFFF7F
366 #define P_SQ_VTX_WORD1_SEM
367 #define   S_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x)                          (((unsigned)(x) & 0xFF) << 0)
368 #define   G_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x)                          (((x) >> 0) & 0xFF)
369 #define   C_SQ_VTX_WORD1_SEM_SEMANTIC_ID                             0xFFFFFF00
370 #define P_SQ_VTX_WORD2
371 #define   S_SQ_VTX_WORD2_OFFSET(x)                                   (((unsigned)(x) & 0xFFFF) << 0)
372 #define   G_SQ_VTX_WORD2_OFFSET(x)                                   (((x) >> 0) & 0xFFFF)
373 #define   C_SQ_VTX_WORD2_OFFSET                                      0xFFFF0000
374 #define   S_SQ_VTX_WORD2_ENDIAN_SWAP(x)                              (((unsigned)(x) & 0x3) << 16)
375 #define   G_SQ_VTX_WORD2_ENDIAN_SWAP(x)                              (((x) >> 16) & 0x3)
376 #define   C_SQ_VTX_WORD2_ENDIAN_SWAP                                 0xFFFCFFFF
377 #define   S_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x)                      (((unsigned)(x) & 0x1) << 18)
378 #define   G_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x)                      (((x) >> 18) & 0x1)
379 #define   C_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE                         0xFFFBFFFF
380 #define   S_SQ_VTX_WORD2_MEGA_FETCH(x)                               (((unsigned)(x) & 0x1) << 19)
381 #define   G_SQ_VTX_WORD2_MEGA_FETCH(x)                               (((x) >> 19) & 0x1)
382 #define   C_SQ_VTX_WORD2_MEGA_FETCH                                  0xFFF7FFFF
383 #define   S_SQ_VTX_WORD2_ALT_CONST(x)                                (((unsigned)(x) & 0x1) << 20)
384 #define   G_SQ_VTX_WORD2_ALT_CONST(x)                                (((x) >> 20) & 0x1)
385 #define   C_SQ_VTX_WORD2_ALT_CONST                                   0xFFEFFFFF
386 #define P_SQ_TEX_WORD0
387 #define   S_SQ_TEX_WORD0_TEX_INST(x)                                 (((unsigned)(x) & 0x1F) << 0)
388 #define   G_SQ_TEX_WORD0_TEX_INST(x)                                 (((x) >> 0) & 0x1F)
389 #define   C_SQ_TEX_WORD0_TEX_INST                                    0xFFFFFFE0
390 #define   S_SQ_TEX_WORD0_BC_FRAC_MODE(x)                             (((unsigned)(x) & 0x1) << 5)
391 #define   G_SQ_TEX_WORD0_BC_FRAC_MODE(x)                             (((x) >> 5) & 0x1)
392 #define   C_SQ_TEX_WORD0_BC_FRAC_MODE                                0xFFFFFFDF
393 #define   EG_S_SQ_TEX_WORD0_INST_MOD(x)                                 (((unsigned)(x) & 0x3) << 5)
394 #define   EG_G_SQ_TEX_WORD0_INST_MOD(x)                                 (((x) >> 5) & 0x3)
395 #define   EG_C_SQ_TEX_WORD0_INST_MOD                                    0xFFFFFF9F
396 #define   S_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x)                         (((unsigned)(x) & 0x1) << 7)
397 #define   G_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x)                         (((x) >> 7) & 0x1)
398 #define   C_SQ_TEX_WORD0_FETCH_WHOLE_QUAD                            0xFFFFFF7F
399 #define   S_SQ_TEX_WORD0_RESOURCE_ID(x)                              (((unsigned)(x) & 0xFF) << 8)
400 #define   G_SQ_TEX_WORD0_RESOURCE_ID(x)                              (((x) >> 8) & 0xFF)
401 #define   C_SQ_TEX_WORD0_RESOURCE_ID                                 0xFFFF00FF
402 #define   S_SQ_TEX_WORD0_SRC_GPR(x)                                  (((unsigned)(x) & 0x7F) << 16)
403 #define   G_SQ_TEX_WORD0_SRC_GPR(x)                                  (((x) >> 16) & 0x7F)
404 #define   C_SQ_TEX_WORD0_SRC_GPR                                     0xFF80FFFF
405 #define   S_SQ_TEX_WORD0_SRC_REL(x)                                  (((unsigned)(x) & 0x1) << 23)
406 #define   G_SQ_TEX_WORD0_SRC_REL(x)                                  (((x) >> 23) & 0x1)
407 #define   C_SQ_TEX_WORD0_SRC_REL                                     0xFF7FFFFF
408 #define   S_SQ_TEX_WORD0_ALT_CONST(x)                                (((unsigned)(x) & 0x1) << 24)
409 #define   G_SQ_TEX_WORD0_ALT_CONST(x)                                (((x) >> 24) & 0x1)
410 #define   C_SQ_TEX_WORD0_ALT_CONST                                   0xFEFFFFFF
411 #define P_SQ_TEX_WORD1
412 #define   S_SQ_TEX_WORD1_DST_GPR(x)                                  (((unsigned)(x) & 0x7F) << 0)
413 #define   G_SQ_TEX_WORD1_DST_GPR(x)                                  (((x) >> 0) & 0x7F)
414 #define   C_SQ_TEX_WORD1_DST_GPR                                     0xFFFFFF80
415 #define   S_SQ_TEX_WORD1_DST_REL(x)                                  (((unsigned)(x) & 0x1) << 7)
416 #define   G_SQ_TEX_WORD1_DST_REL(x)                                  (((x) >> 7) & 0x1)
417 #define   C_SQ_TEX_WORD1_DST_REL                                     0xFFFFFF7F
418 #define   S_SQ_TEX_WORD1_DST_SEL_X(x)                                (((unsigned)(x) & 0x7) << 9)
419 #define   G_SQ_TEX_WORD1_DST_SEL_X(x)                                (((x) >> 9) & 0x7)
420 #define   C_SQ_TEX_WORD1_DST_SEL_X                                   0xFFFFF1FF
421 #define   S_SQ_TEX_WORD1_DST_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 12)
422 #define   G_SQ_TEX_WORD1_DST_SEL_Y(x)                                (((x) >> 12) & 0x7)
423 #define   C_SQ_TEX_WORD1_DST_SEL_Y                                   0xFFFF8FFF
424 #define   S_SQ_TEX_WORD1_DST_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 15)
425 #define   G_SQ_TEX_WORD1_DST_SEL_Z(x)                                (((x) >> 15) & 0x7)
426 #define   C_SQ_TEX_WORD1_DST_SEL_Z                                   0xFFFC7FFF
427 #define   S_SQ_TEX_WORD1_DST_SEL_W(x)                                (((unsigned)(x) & 0x7) << 18)
428 #define   G_SQ_TEX_WORD1_DST_SEL_W(x)                                (((x) >> 18) & 0x7)
429 #define   C_SQ_TEX_WORD1_DST_SEL_W                                   0xFFE3FFFF
430 #define   S_SQ_TEX_WORD1_LOD_BIAS(x)                                 (((unsigned)(x) & 0x7F) << 21)
431 #define   G_SQ_TEX_WORD1_LOD_BIAS(x)                                 (((x) >> 21) & 0x7F)
432 #define   C_SQ_TEX_WORD1_LOD_BIAS                                    0xF01FFFFF
433 #define   S_SQ_TEX_WORD1_COORD_TYPE_X(x)                             (((unsigned)(x) & 0x1) << 28)
434 #define   G_SQ_TEX_WORD1_COORD_TYPE_X(x)                             (((x) >> 28) & 0x1)
435 #define   C_SQ_TEX_WORD1_COORD_TYPE_X                                0xEFFFFFFF
436 #define     V_SQ_TEX_WORD1_COORD_UNNORMALIZED                        0x00000000
437 #define     V_SQ_TEX_WORD1_COORD_NORMALIZED                          0x00000001
438 #define   S_SQ_TEX_WORD1_COORD_TYPE_Y(x)                             (((unsigned)(x) & 0x1) << 29)
439 #define   G_SQ_TEX_WORD1_COORD_TYPE_Y(x)                             (((x) >> 29) & 0x1)
440 #define   C_SQ_TEX_WORD1_COORD_TYPE_Y                                0xDFFFFFFF
441 #define   S_SQ_TEX_WORD1_COORD_TYPE_Z(x)                             (((unsigned)(x) & 0x1) << 30)
442 #define   G_SQ_TEX_WORD1_COORD_TYPE_Z(x)                             (((x) >> 30) & 0x1)
443 #define   C_SQ_TEX_WORD1_COORD_TYPE_Z                                0xBFFFFFFF
444 #define   S_SQ_TEX_WORD1_COORD_TYPE_W(x)                             (((unsigned)(x) & 0x1) << 31)
445 #define   G_SQ_TEX_WORD1_COORD_TYPE_W(x)                             (((x) >> 31) & 0x1)
446 #define   C_SQ_TEX_WORD1_COORD_TYPE_W                                0x7FFFFFFF
447 #define P_SQ_TEX_WORD2
448 #define   S_SQ_TEX_WORD2_OFFSET_X(x)                                 (((unsigned)(x) & 0x1F) << 0)
449 #define   G_SQ_TEX_WORD2_OFFSET_X(x)                                 (((x) >> 0) & 0x1F)
450 #define   C_SQ_TEX_WORD2_OFFSET_X                                    0xFFFFFFE0
451 #define   S_SQ_TEX_WORD2_OFFSET_Y(x)                                 (((unsigned)(x) & 0x1F) << 5)
452 #define   G_SQ_TEX_WORD2_OFFSET_Y(x)                                 (((x) >> 5) & 0x1F)
453 #define   C_SQ_TEX_WORD2_OFFSET_Y                                    0xFFFFFC1F
454 #define   S_SQ_TEX_WORD2_OFFSET_Z(x)                                 (((unsigned)(x) & 0x1F) << 10)
455 #define   G_SQ_TEX_WORD2_OFFSET_Z(x)                                 (((x) >> 10) & 0x1F)
456 #define   C_SQ_TEX_WORD2_OFFSET_Z                                    0xFFFF83FF
457 #define   S_SQ_TEX_WORD2_SAMPLER_ID(x)                               (((unsigned)(x) & 0x1F) << 15)
458 #define   G_SQ_TEX_WORD2_SAMPLER_ID(x)                               (((x) >> 15) & 0x1F)
459 #define   C_SQ_TEX_WORD2_SAMPLER_ID                                  0xFFF07FFF
460 #define   S_SQ_TEX_WORD2_SRC_SEL_X(x)                                (((unsigned)(x) & 0x7) << 20)
461 #define   G_SQ_TEX_WORD2_SRC_SEL_X(x)                                (((x) >> 20) & 0x7)
462 #define   C_SQ_TEX_WORD2_SRC_SEL_X                                   0xFF8FFFFF
463 #define   S_SQ_TEX_WORD2_SRC_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 23)
464 #define   G_SQ_TEX_WORD2_SRC_SEL_Y(x)                                (((x) >> 23) & 0x7)
465 #define   C_SQ_TEX_WORD2_SRC_SEL_Y                                   0xFC7FFFFF
466 #define   S_SQ_TEX_WORD2_SRC_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 26)
467 #define   G_SQ_TEX_WORD2_SRC_SEL_Z(x)                                (((x) >> 26) & 0x7)
468 #define   C_SQ_TEX_WORD2_SRC_SEL_Z                                   0xE3FFFFFF
469 #define   S_SQ_TEX_WORD2_SRC_SEL_W(x)                                (((unsigned)(x) & 0x7) << 29)
470 #define   G_SQ_TEX_WORD2_SRC_SEL_W(x)                                (((x) >> 29) & 0x7)
471 #define   C_SQ_TEX_WORD2_SRC_SEL_W                                   0x1FFFFFFF
472 
473 #define V_SQ_CF_COND_ACTIVE                             0x00
474 #define V_SQ_CF_COND_FALSE                              0x01
475 #define V_SQ_CF_COND_BOOL                               0x02
476 #define V_SQ_CF_COND_NOT_BOOL                           0x03
477 
478 #define V_SQ_REL_ABSOLUTE 0
479 #define V_SQ_REL_RELATIVE 1
480 
481 #define SQ_ALU_VEC_012                                0x00
482 #define SQ_ALU_VEC_021                                0x01
483 #define SQ_ALU_VEC_120                                0x02
484 #define SQ_ALU_VEC_102                                0x03
485 #define SQ_ALU_VEC_201                                0x04
486 #define SQ_ALU_VEC_210                                0x05
487 
488 #define SQ_ALU_SCL_210                           0x00000000
489 #define SQ_ALU_SCL_122                           0x00000001
490 #define SQ_ALU_SCL_212                           0x00000002
491 #define SQ_ALU_SCL_221                           0x00000003
492 
493 #define   INDEX_MODE_AR_X 0
494 #define   INDEX_MODE_AR_Y 1
495 #define   INDEX_MODE_AR_Z 2
496 #define   INDEX_MODE_AR_W 3
497 #define   INDEX_MODE_LOOP 4
498 
499 #define SQ_VTX_FETCH_VERTEX_DATA 0
500 #define SQ_VTX_FETCH_INSTANCE_DATA 1
501 #define SQ_VTX_FETCH_NO_INDEX_OFFSET 2
502 
503 /* EG RAT functions */
504 #define       V_RAT_INST_NOP                                         0
505 #define       V_RAT_INST_STORE_TYPED                                 1
506 #define       V_RAT_INST_CMPXCHG_INT                                 4
507 #define       V_RAT_INST_ADD                                         7
508 #define       V_RAT_INST_SUB                                         8
509 #define       V_RAT_INST_RSUB                                        9
510 #define       V_RAT_INST_MIN_INT                                     10
511 #define       V_RAT_INST_MIN_UINT                                    11
512 #define       V_RAT_INST_MAX_INT                                     12
513 #define       V_RAT_INST_MAX_UINT                                    13
514 #define       V_RAT_INST_AND                                         14
515 #define       V_RAT_INST_OR                                          15
516 #define       V_RAT_INST_XOR                                         16
517 #define       V_RAT_INST_INC_UINT                                    18
518 #define       V_RAT_INST_DEC_UINT                                    19
519 #define       V_RAT_INST_STORE_DWORD                                 20
520 #define       V_RAT_INST_STORE_SHORT                                 21
521 #define       V_RAT_INST_STORE_BYTE                                  22
522 #define       V_RAT_INST_NOP_RTN                                     32
523 #define       V_RAT_INST_XCHG_RTN                                    34
524 #define       V_RAT_INST_CMPXCHG_INT_RTN                             36
525 #define       V_RAT_INST_ADD_RTN                                     39
526 #define       V_RAT_INST_SUB_RTN                                     40
527 #define       V_RAT_INST_RSUB_RTN                                    41
528 #define       V_RAT_INST_MIN_INT_RTN                                 42
529 #define       V_RAT_INST_MIN_UINT_RTN                                43
530 #define       V_RAT_INST_MAX_INT_RTN                                 44
531 #define       V_RAT_INST_MAX_UINT_RTN                                45
532 #define       V_RAT_INST_AND_RTN                                     46
533 #define       V_RAT_INST_OR_RTN                                      47
534 #define       V_RAT_INST_XOR_RTN                                     48
535 #define       V_RAT_INST_INC_UINT_RTN                                50
536 #define       V_RAT_INST_DEC_UINT_RTN                                51
537 
538 #endif
539