2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
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:
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
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.
30 #define S_SQ_CF_WORD0_ADDR(x) (((x) & 0xFFFFFFFF) << 0)
31 #define G_SQ_CF_WORD0_ADDR(x) (((x) >> 0) & 0xFFFFFFFF)
32 #define C_SQ_CF_WORD0_ADDR 0x00000000
34 #define S_SQ_CF_WORD1_POP_COUNT(x) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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
147 #define S_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE(x) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((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) (((x) & 0x1FF) << 0)
175 #define G_SQ_ALU_WORD0_SRC0_SEL(x) (((x) >> 0) & 0x1FF)
176 #define C_SQ_ALU_WORD0_SRC0_SEL 0xFFFFFE00
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
192 #define V_SQ_ALU_SRC_0 0x000000F8
193 #define V_SQ_ALU_SRC_1 0x000000F9
194 #define V_SQ_ALU_SRC_1_INT 0x000000FA
195 #define V_SQ_ALU_SRC_M_1_INT 0x000000FB
196 #define V_SQ_ALU_SRC_0_5 0x000000FC
197 #define V_SQ_ALU_SRC_LITERAL 0x000000FD
198 #define V_SQ_ALU_SRC_PV 0x000000FE
199 #define V_SQ_ALU_SRC_PS 0x000000FF
200 #define V_SQ_ALU_SRC_PARAM_BASE 0x000001C0
201 #define S_SQ_ALU_WORD0_SRC0_REL(x) (((x) & 0x1) << 9)
202 #define G_SQ_ALU_WORD0_SRC0_REL(x) (((x) >> 9) & 0x1)
203 #define C_SQ_ALU_WORD0_SRC0_REL 0xFFFFFDFF
204 #define S_SQ_ALU_WORD0_SRC0_CHAN(x) (((x) & 0x3) << 10)
205 #define G_SQ_ALU_WORD0_SRC0_CHAN(x) (((x) >> 10) & 0x3)
206 #define C_SQ_ALU_WORD0_SRC0_CHAN 0xFFFFF3FF
207 #define S_SQ_ALU_WORD0_SRC0_NEG(x) (((x) & 0x1) << 12)
208 #define G_SQ_ALU_WORD0_SRC0_NEG(x) (((x) >> 12) & 0x1)
209 #define C_SQ_ALU_WORD0_SRC0_NEG 0xFFFFEFFF
210 #define S_SQ_ALU_WORD0_SRC1_SEL(x) (((x) & 0x1FF) << 13)
211 #define G_SQ_ALU_WORD0_SRC1_SEL(x) (((x) >> 13) & 0x1FF)
212 #define C_SQ_ALU_WORD0_SRC1_SEL 0xFFC01FFF
213 #define S_SQ_ALU_WORD0_SRC1_REL(x) (((x) & 0x1) << 22)
214 #define G_SQ_ALU_WORD0_SRC1_REL(x) (((x) >> 22) & 0x1)
215 #define C_SQ_ALU_WORD0_SRC1_REL 0xFFBFFFFF
216 #define S_SQ_ALU_WORD0_SRC1_CHAN(x) (((x) & 0x3) << 23)
217 #define G_SQ_ALU_WORD0_SRC1_CHAN(x) (((x) >> 23) & 0x3)
218 #define C_SQ_ALU_WORD0_SRC1_CHAN 0xFE7FFFFF
219 #define S_SQ_ALU_WORD0_SRC1_NEG(x) (((x) & 0x1) << 25)
220 #define G_SQ_ALU_WORD0_SRC1_NEG(x) (((x) >> 25) & 0x1)
221 #define C_SQ_ALU_WORD0_SRC1_NEG 0xFDFFFFFF
222 #define S_SQ_ALU_WORD0_INDEX_MODE(x) (((x) & 0x7) << 26)
223 #define G_SQ_ALU_WORD0_INDEX_MODE(x) (((x) >> 26) & 0x7)
224 #define C_SQ_ALU_WORD0_INDEX_MODE 0xE3FFFFFF
225 #define S_SQ_ALU_WORD0_PRED_SEL(x) (((x) & 0x3) << 29)
226 #define G_SQ_ALU_WORD0_PRED_SEL(x) (((x) >> 29) & 0x3)
227 #define C_SQ_ALU_WORD0_PRED_SEL 0x9FFFFFFF
228 #define S_SQ_ALU_WORD0_LAST(x) (((x) & 0x1) << 31)
229 #define G_SQ_ALU_WORD0_LAST(x) (((x) >> 31) & 0x1)
230 #define C_SQ_ALU_WORD0_LAST 0x7FFFFFFF
231 #define P_SQ_ALU_WORD1
232 #define S_SQ_ALU_WORD1_ENCODING(x) (((x) & 0x7) << 15)
233 #define G_SQ_ALU_WORD1_ENCODING(x) (((x) >> 15) & 0x7)
234 #define C_SQ_ALU_WORD1_ENCODING 0xFFFC7FFF
235 #define S_SQ_ALU_WORD1_BANK_SWIZZLE(x) (((x) & 0x7) << 18)
236 #define G_SQ_ALU_WORD1_BANK_SWIZZLE(x) (((x) >> 18) & 0x7)
237 #define C_SQ_ALU_WORD1_BANK_SWIZZLE 0xFFE3FFFF
238 #define S_SQ_ALU_WORD1_DST_GPR(x) (((x) & 0x7F) << 21)
239 #define G_SQ_ALU_WORD1_DST_GPR(x) (((x) >> 21) & 0x7F)
240 #define C_SQ_ALU_WORD1_DST_GPR 0xF01FFFFF
241 #define S_SQ_ALU_WORD1_DST_REL(x) (((x) & 0x1) << 28)
242 #define G_SQ_ALU_WORD1_DST_REL(x) (((x) >> 28) & 0x1)
243 #define C_SQ_ALU_WORD1_DST_REL 0xEFFFFFFF
244 #define S_SQ_ALU_WORD1_DST_CHAN(x) (((x) & 0x3) << 29)
245 #define G_SQ_ALU_WORD1_DST_CHAN(x) (((x) >> 29) & 0x3)
246 #define C_SQ_ALU_WORD1_DST_CHAN 0x9FFFFFFF
247 #define S_SQ_ALU_WORD1_CLAMP(x) (((x) & 0x1) << 31)
248 #define G_SQ_ALU_WORD1_CLAMP(x) (((x) >> 31) & 0x1)
249 #define C_SQ_ALU_WORD1_CLAMP 0x7FFFFFFF
250 #define P_SQ_ALU_WORD1_OP2
251 #define S_SQ_ALU_WORD1_OP2_SRC0_ABS(x) (((x) & 0x1) << 0)
252 #define G_SQ_ALU_WORD1_OP2_SRC0_ABS(x) (((x) >> 0) & 0x1)
253 #define C_SQ_ALU_WORD1_OP2_SRC0_ABS 0xFFFFFFFE
254 #define S_SQ_ALU_WORD1_OP2_SRC1_ABS(x) (((x) & 0x1) << 1)
255 #define G_SQ_ALU_WORD1_OP2_SRC1_ABS(x) (((x) >> 1) & 0x1)
256 #define C_SQ_ALU_WORD1_OP2_SRC1_ABS 0xFFFFFFFD
257 #define S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x) (((x) & 0x1) << 2)
258 #define G_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x) (((x) >> 2) & 0x1)
259 #define C_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK 0xFFFFFFFB
260 #define S_SQ_ALU_WORD1_OP2_UPDATE_PRED(x) (((x) & 0x1) << 3)
261 #define G_SQ_ALU_WORD1_OP2_UPDATE_PRED(x) (((x) >> 3) & 0x1)
262 #define C_SQ_ALU_WORD1_OP2_UPDATE_PRED 0xFFFFFFF7
263 #define S_SQ_ALU_WORD1_OP2_WRITE_MASK(x) (((x) & 0x1) << 4)
264 #define G_SQ_ALU_WORD1_OP2_WRITE_MASK(x) (((x) >> 4) & 0x1)
265 #define C_SQ_ALU_WORD1_OP2_WRITE_MASK 0xFFFFFFEF
266 #define S_SQ_ALU_WORD1_OP2_FOG_MERGE(x) (((x) & 0x1) << 5)
267 #define G_SQ_ALU_WORD1_OP2_FOG_MERGE(x) (((x) >> 5) & 0x1)
268 #define C_SQ_ALU_WORD1_OP2_FOG_MERGE 0xFFFFFFDF
269 #define S_SQ_ALU_WORD1_OP2_OMOD(x) (((x) & 0x3) << 6)
270 #define G_SQ_ALU_WORD1_OP2_OMOD(x) (((x) >> 6) & 0x3)
271 #define C_SQ_ALU_WORD1_OP2_OMOD 0xFFFFFF3F
272 #define S_SQ_ALU_WORD1_OP2_ALU_INST(x) (((x) & 0x3FF) << 8)
273 #define G_SQ_ALU_WORD1_OP2_ALU_INST(x) (((x) >> 8) & 0x3FF)
274 #define C_SQ_ALU_WORD1_OP2_ALU_INST 0xFFFC00FF
275 #define P_SQ_ALU_WORD1_OP3
276 #define S_SQ_ALU_WORD1_OP3_SRC2_SEL(x) (((x) & 0x1FF) << 0)
277 #define G_SQ_ALU_WORD1_OP3_SRC2_SEL(x) (((x) >> 0) & 0x1FF)
278 #define C_SQ_ALU_WORD1_OP3_SRC2_SEL 0xFFFFFE00
279 #define S_SQ_ALU_WORD1_OP3_SRC2_REL(x) (((x) & 0x1) << 9)
280 #define G_SQ_ALU_WORD1_OP3_SRC2_REL(x) (((x) >> 9) & 0x1)
281 #define C_SQ_ALU_WORD1_OP3_SRC2_REL 0xFFFFFDFF
282 #define S_SQ_ALU_WORD1_OP3_SRC2_CHAN(x) (((x) & 0x3) << 10)
283 #define G_SQ_ALU_WORD1_OP3_SRC2_CHAN(x) (((x) >> 10) & 0x3)
284 #define C_SQ_ALU_WORD1_OP3_SRC2_CHAN 0xFFFFF3FF
285 #define S_SQ_ALU_WORD1_OP3_SRC2_NEG(x) (((x) & 0x1) << 12)
286 #define G_SQ_ALU_WORD1_OP3_SRC2_NEG(x) (((x) >> 12) & 0x1)
287 #define C_SQ_ALU_WORD1_OP3_SRC2_NEG 0xFFFFEFFF
288 #define S_SQ_ALU_WORD1_OP3_ALU_INST(x) (((x) & 0x1F) << 13)
289 #define G_SQ_ALU_WORD1_OP3_ALU_INST(x) (((x) >> 13) & 0x1F)
290 #define C_SQ_ALU_WORD1_OP3_ALU_INST 0xFFFC1FFF
291 #define P_SQ_VTX_WORD0
292 #define S_SQ_VTX_WORD0_VTX_INST(x) (((x) & 0x1F) << 0)
293 #define G_SQ_VTX_WORD0_VTX_INST(x) (((x) >> 0) & 0x1F)
294 #define C_SQ_VTX_WORD0_VTX_INST 0xFFFFFFE0
295 #define S_SQ_VTX_WORD0_FETCH_TYPE(x) (((x) & 0x3) << 5)
296 #define G_SQ_VTX_WORD0_FETCH_TYPE(x) (((x) >> 5) & 0x3)
297 #define C_SQ_VTX_WORD0_FETCH_TYPE 0xFFFFFF9F
298 #define S_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x) (((x) & 0x1) << 7)
299 #define G_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x) (((x) >> 7) & 0x1)
300 #define C_SQ_VTX_WORD0_FETCH_WHOLE_QUAD 0xFFFFFF7F
301 #define S_SQ_VTX_WORD0_BUFFER_ID(x) (((x) & 0xFF) << 8)
302 #define G_SQ_VTX_WORD0_BUFFER_ID(x) (((x) >> 8) & 0xFF)
303 #define C_SQ_VTX_WORD0_BUFFER_ID 0xFFFF00FF
304 #define S_SQ_VTX_WORD0_SRC_GPR(x) (((x) & 0x7F) << 16)
305 #define G_SQ_VTX_WORD0_SRC_GPR(x) (((x) >> 16) & 0x7F)
306 #define C_SQ_VTX_WORD0_SRC_GPR 0xFF80FFFF
307 #define S_SQ_VTX_WORD0_SRC_REL(x) (((x) & 0x1) << 23)
308 #define G_SQ_VTX_WORD0_SRC_REL(x) (((x) >> 23) & 0x1)
309 #define C_SQ_VTX_WORD0_SRC_REL 0xFF7FFFFF
310 #define S_SQ_VTX_WORD0_SRC_SEL_X(x) (((x) & 0x3) << 24)
311 #define G_SQ_VTX_WORD0_SRC_SEL_X(x) (((x) >> 24) & 0x3)
312 #define C_SQ_VTX_WORD0_SRC_SEL_X 0xFCFFFFFF
313 #define S_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x) (((x) & 0x3F) << 26)
314 #define G_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x) (((x) >> 26) & 0x3F)
315 #define C_SQ_VTX_WORD0_MEGA_FETCH_COUNT 0x03FFFFFF
316 #define P_SQ_VTX_WORD1
317 #define S_SQ_VTX_WORD1_DST_SEL_X(x) (((x) & 0x7) << 9)
318 #define G_SQ_VTX_WORD1_DST_SEL_X(x) (((x) >> 9) & 0x7)
319 #define C_SQ_VTX_WORD1_DST_SEL_X 0xFFFFF1FF
320 #define S_SQ_VTX_WORD1_DST_SEL_Y(x) (((x) & 0x7) << 12)
321 #define G_SQ_VTX_WORD1_DST_SEL_Y(x) (((x) >> 12) & 0x7)
322 #define C_SQ_VTX_WORD1_DST_SEL_Y 0xFFFF8FFF
323 #define S_SQ_VTX_WORD1_DST_SEL_Z(x) (((x) & 0x7) << 15)
324 #define G_SQ_VTX_WORD1_DST_SEL_Z(x) (((x) >> 15) & 0x7)
325 #define C_SQ_VTX_WORD1_DST_SEL_Z 0xFFFC7FFF
326 #define S_SQ_VTX_WORD1_DST_SEL_W(x) (((x) & 0x7) << 18)
327 #define G_SQ_VTX_WORD1_DST_SEL_W(x) (((x) >> 18) & 0x7)
328 #define C_SQ_VTX_WORD1_DST_SEL_W 0xFFE3FFFF
329 #define S_SQ_VTX_WORD1_USE_CONST_FIELDS(x) (((x) & 0x1) << 21)
330 #define G_SQ_VTX_WORD1_USE_CONST_FIELDS(x) (((x) >> 21) & 0x1)
331 #define C_SQ_VTX_WORD1_USE_CONST_FIELDS 0xFFDFFFFF
332 #define S_SQ_VTX_WORD1_DATA_FORMAT(x) (((x) & 0x3F) << 22)
333 #define G_SQ_VTX_WORD1_DATA_FORMAT(x) (((x) >> 22) & 0x3F)
334 #define C_SQ_VTX_WORD1_DATA_FORMAT 0xF03FFFFF
335 #define S_SQ_VTX_WORD1_NUM_FORMAT_ALL(x) (((x) & 0x3) << 28)
336 #define G_SQ_VTX_WORD1_NUM_FORMAT_ALL(x) (((x) >> 28) & 0x3)
337 #define C_SQ_VTX_WORD1_NUM_FORMAT_ALL 0xCFFFFFFF
338 #define S_SQ_VTX_WORD1_FORMAT_COMP_ALL(x) (((x) & 0x1) << 30)
339 #define G_SQ_VTX_WORD1_FORMAT_COMP_ALL(x) (((x) >> 30) & 0x1)
340 #define C_SQ_VTX_WORD1_FORMAT_COMP_ALL 0xBFFFFFFF
341 #define S_SQ_VTX_WORD1_SRF_MODE_ALL(x) (((x) & 0x1) << 31)
342 #define G_SQ_VTX_WORD1_SRF_MODE_ALL(x) (((x) >> 31) & 0x1)
343 #define C_SQ_VTX_WORD1_SRF_MODE_ALL 0x7FFFFFFF
344 #define P_SQ_VTX_WORD1_GPR
345 #define S_SQ_VTX_WORD1_GPR_DST_GPR(x) (((x) & 0x7F) << 0)
346 #define G_SQ_VTX_WORD1_GPR_DST_GPR(x) (((x) >> 0) & 0x7F)
347 #define C_SQ_VTX_WORD1_GPR_DST_GPR 0xFFFFFF80
348 #define S_SQ_VTX_WORD1_GPR_DST_REL(x) (((x) & 0x1) << 7)
349 #define G_SQ_VTX_WORD1_GPR_DST_REL(x) (((x) >> 7) & 0x1)
350 #define C_SQ_VTX_WORD1_GPR_DST_REL 0xFFFFFF7F
351 #define P_SQ_VTX_WORD1_SEM
352 #define S_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x) (((x) & 0xFF) << 0)
353 #define G_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x) (((x) >> 0) & 0xFF)
354 #define C_SQ_VTX_WORD1_SEM_SEMANTIC_ID 0xFFFFFF00
355 #define P_SQ_VTX_WORD2
356 #define S_SQ_VTX_WORD2_OFFSET(x) (((x) & 0xFFFF) << 0)
357 #define G_SQ_VTX_WORD2_OFFSET(x) (((x) >> 0) & 0xFFFF)
358 #define C_SQ_VTX_WORD2_OFFSET 0xFFFF0000
359 #define S_SQ_VTX_WORD2_ENDIAN_SWAP(x) (((x) & 0x3) << 16)
360 #define G_SQ_VTX_WORD2_ENDIAN_SWAP(x) (((x) >> 16) & 0x3)
361 #define C_SQ_VTX_WORD2_ENDIAN_SWAP 0xFFFCFFFF
362 #define S_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x) (((x) & 0x1) << 18)
363 #define G_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x) (((x) >> 18) & 0x1)
364 #define C_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE 0xFFFBFFFF
365 #define S_SQ_VTX_WORD2_MEGA_FETCH(x) (((x) & 0x1) << 19)
366 #define G_SQ_VTX_WORD2_MEGA_FETCH(x) (((x) >> 19) & 0x1)
367 #define C_SQ_VTX_WORD2_MEGA_FETCH 0xFFF7FFFF
368 #define S_SQ_VTX_WORD2_ALT_CONST(x) (((x) & 0x1) << 20)
369 #define G_SQ_VTX_WORD2_ALT_CONST(x) (((x) >> 20) & 0x1)
370 #define C_SQ_VTX_WORD2_ALT_CONST 0xFFEFFFFF
371 #define P_SQ_TEX_WORD0
372 #define S_SQ_TEX_WORD0_TEX_INST(x) (((x) & 0x1F) << 0)
373 #define G_SQ_TEX_WORD0_TEX_INST(x) (((x) >> 0) & 0x1F)
374 #define C_SQ_TEX_WORD0_TEX_INST 0xFFFFFFE0
375 #define S_SQ_TEX_WORD0_BC_FRAC_MODE(x) (((x) & 0x1) << 5)
376 #define G_SQ_TEX_WORD0_BC_FRAC_MODE(x) (((x) >> 5) & 0x1)
377 #define C_SQ_TEX_WORD0_BC_FRAC_MODE 0xFFFFFFDF
378 #define EG_S_SQ_TEX_WORD0_INST_MOD(x) (((x) & 0x3) << 5)
379 #define EG_G_SQ_TEX_WORD0_INST_MOD(x) (((x) >> 5) & 0x3)
380 #define EG_C_SQ_TEX_WORD0_INST_MOD 0xFFFFFF9F
381 #define S_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x) (((x) & 0x1) << 7)
382 #define G_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x) (((x) >> 7) & 0x1)
383 #define C_SQ_TEX_WORD0_FETCH_WHOLE_QUAD 0xFFFFFF7F
384 #define S_SQ_TEX_WORD0_RESOURCE_ID(x) (((x) & 0xFF) << 8)
385 #define G_SQ_TEX_WORD0_RESOURCE_ID(x) (((x) >> 8) & 0xFF)
386 #define C_SQ_TEX_WORD0_RESOURCE_ID 0xFFFF00FF
387 #define S_SQ_TEX_WORD0_SRC_GPR(x) (((x) & 0x7F) << 16)
388 #define G_SQ_TEX_WORD0_SRC_GPR(x) (((x) >> 16) & 0x7F)
389 #define C_SQ_TEX_WORD0_SRC_GPR 0xFF80FFFF
390 #define S_SQ_TEX_WORD0_SRC_REL(x) (((x) & 0x1) << 23)
391 #define G_SQ_TEX_WORD0_SRC_REL(x) (((x) >> 23) & 0x1)
392 #define C_SQ_TEX_WORD0_SRC_REL 0xFF7FFFFF
393 #define S_SQ_TEX_WORD0_ALT_CONST(x) (((x) & 0x1) << 24)
394 #define G_SQ_TEX_WORD0_ALT_CONST(x) (((x) >> 24) & 0x1)
395 #define C_SQ_TEX_WORD0_ALT_CONST 0xFEFFFFFF
396 #define P_SQ_TEX_WORD1
397 #define S_SQ_TEX_WORD1_DST_GPR(x) (((x) & 0x7F) << 0)
398 #define G_SQ_TEX_WORD1_DST_GPR(x) (((x) >> 0) & 0x7F)
399 #define C_SQ_TEX_WORD1_DST_GPR 0xFFFFFF80
400 #define S_SQ_TEX_WORD1_DST_REL(x) (((x) & 0x1) << 7)
401 #define G_SQ_TEX_WORD1_DST_REL(x) (((x) >> 7) & 0x1)
402 #define C_SQ_TEX_WORD1_DST_REL 0xFFFFFF7F
403 #define S_SQ_TEX_WORD1_DST_SEL_X(x) (((x) & 0x7) << 9)
404 #define G_SQ_TEX_WORD1_DST_SEL_X(x) (((x) >> 9) & 0x7)
405 #define C_SQ_TEX_WORD1_DST_SEL_X 0xFFFFF1FF
406 #define S_SQ_TEX_WORD1_DST_SEL_Y(x) (((x) & 0x7) << 12)
407 #define G_SQ_TEX_WORD1_DST_SEL_Y(x) (((x) >> 12) & 0x7)
408 #define C_SQ_TEX_WORD1_DST_SEL_Y 0xFFFF8FFF
409 #define S_SQ_TEX_WORD1_DST_SEL_Z(x) (((x) & 0x7) << 15)
410 #define G_SQ_TEX_WORD1_DST_SEL_Z(x) (((x) >> 15) & 0x7)
411 #define C_SQ_TEX_WORD1_DST_SEL_Z 0xFFFC7FFF
412 #define S_SQ_TEX_WORD1_DST_SEL_W(x) (((x) & 0x7) << 18)
413 #define G_SQ_TEX_WORD1_DST_SEL_W(x) (((x) >> 18) & 0x7)
414 #define C_SQ_TEX_WORD1_DST_SEL_W 0xFFE3FFFF
415 #define S_SQ_TEX_WORD1_LOD_BIAS(x) (((x) & 0x7F) << 21)
416 #define G_SQ_TEX_WORD1_LOD_BIAS(x) (((x) >> 21) & 0x7F)
417 #define C_SQ_TEX_WORD1_LOD_BIAS 0xF01FFFFF
418 #define S_SQ_TEX_WORD1_COORD_TYPE_X(x) (((x) & 0x1) << 28)
419 #define G_SQ_TEX_WORD1_COORD_TYPE_X(x) (((x) >> 28) & 0x1)
420 #define C_SQ_TEX_WORD1_COORD_TYPE_X 0xEFFFFFFF
421 #define V_SQ_TEX_WORD1_COORD_UNNORMALIZED 0x00000000
422 #define V_SQ_TEX_WORD1_COORD_NORMALIZED 0x00000001
423 #define S_SQ_TEX_WORD1_COORD_TYPE_Y(x) (((x) & 0x1) << 29)
424 #define G_SQ_TEX_WORD1_COORD_TYPE_Y(x) (((x) >> 29) & 0x1)
425 #define C_SQ_TEX_WORD1_COORD_TYPE_Y 0xDFFFFFFF
426 #define S_SQ_TEX_WORD1_COORD_TYPE_Z(x) (((x) & 0x1) << 30)
427 #define G_SQ_TEX_WORD1_COORD_TYPE_Z(x) (((x) >> 30) & 0x1)
428 #define C_SQ_TEX_WORD1_COORD_TYPE_Z 0xBFFFFFFF
429 #define S_SQ_TEX_WORD1_COORD_TYPE_W(x) (((x) & 0x1) << 31)
430 #define G_SQ_TEX_WORD1_COORD_TYPE_W(x) (((x) >> 31) & 0x1)
431 #define C_SQ_TEX_WORD1_COORD_TYPE_W 0x7FFFFFFF
432 #define P_SQ_TEX_WORD2
433 #define S_SQ_TEX_WORD2_OFFSET_X(x) (((x) & 0x1F) << 0)
434 #define G_SQ_TEX_WORD2_OFFSET_X(x) (((x) >> 0) & 0x1F)
435 #define C_SQ_TEX_WORD2_OFFSET_X 0xFFFFFFE0
436 #define S_SQ_TEX_WORD2_OFFSET_Y(x) (((x) & 0x1F) << 5)
437 #define G_SQ_TEX_WORD2_OFFSET_Y(x) (((x) >> 5) & 0x1F)
438 #define C_SQ_TEX_WORD2_OFFSET_Y 0xFFFFFC1F
439 #define S_SQ_TEX_WORD2_OFFSET_Z(x) (((x) & 0x1F) << 10)
440 #define G_SQ_TEX_WORD2_OFFSET_Z(x) (((x) >> 10) & 0x1F)
441 #define C_SQ_TEX_WORD2_OFFSET_Z 0xFFFF83FF
442 #define S_SQ_TEX_WORD2_SAMPLER_ID(x) (((x) & 0x1F) << 15)
443 #define G_SQ_TEX_WORD2_SAMPLER_ID(x) (((x) >> 15) & 0x1F)
444 #define C_SQ_TEX_WORD2_SAMPLER_ID 0xFFF07FFF
445 #define S_SQ_TEX_WORD2_SRC_SEL_X(x) (((x) & 0x7) << 20)
446 #define G_SQ_TEX_WORD2_SRC_SEL_X(x) (((x) >> 20) & 0x7)
447 #define C_SQ_TEX_WORD2_SRC_SEL_X 0xFF8FFFFF
448 #define S_SQ_TEX_WORD2_SRC_SEL_Y(x) (((x) & 0x7) << 23)
449 #define G_SQ_TEX_WORD2_SRC_SEL_Y(x) (((x) >> 23) & 0x7)
450 #define C_SQ_TEX_WORD2_SRC_SEL_Y 0xFC7FFFFF
451 #define S_SQ_TEX_WORD2_SRC_SEL_Z(x) (((x) & 0x7) << 26)
452 #define G_SQ_TEX_WORD2_SRC_SEL_Z(x) (((x) >> 26) & 0x7)
453 #define C_SQ_TEX_WORD2_SRC_SEL_Z 0xE3FFFFFF
454 #define S_SQ_TEX_WORD2_SRC_SEL_W(x) (((x) & 0x7) << 29)
455 #define G_SQ_TEX_WORD2_SRC_SEL_W(x) (((x) >> 29) & 0x7)
456 #define C_SQ_TEX_WORD2_SRC_SEL_W 0x1FFFFFFF
458 #define V_SQ_CF_COND_ACTIVE 0x00
459 #define V_SQ_CF_COND_FALSE 0x01
460 #define V_SQ_CF_COND_BOOL 0x02
461 #define V_SQ_CF_COND_NOT_BOOL 0x03
463 #define V_SQ_REL_ABSOLUTE 0
464 #define V_SQ_REL_RELATIVE 1
466 #define SQ_ALU_VEC_012 0x00
467 #define SQ_ALU_VEC_021 0x01
468 #define SQ_ALU_VEC_120 0x02
469 #define SQ_ALU_VEC_102 0x03
470 #define SQ_ALU_VEC_201 0x04
471 #define SQ_ALU_VEC_210 0x05
473 #define SQ_ALU_SCL_210 0x00000000
474 #define SQ_ALU_SCL_122 0x00000001
475 #define SQ_ALU_SCL_212 0x00000002
476 #define SQ_ALU_SCL_221 0x00000003
478 #define INDEX_MODE_AR_X 0
479 #define INDEX_MODE_AR_Y 1
480 #define INDEX_MODE_AR_Z 2
481 #define INDEX_MODE_AR_W 3
482 #define INDEX_MODE_LOOP 4
484 #define SQ_VTX_FETCH_VERTEX_DATA 0
485 #define SQ_VTX_FETCH_INSTANCE_DATA 1
486 #define SQ_VTX_FETCH_NO_INDEX_OFFSET 2