• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "sfn_test_shaders.h"
2 #include "../sfn_shader_fs.h"
3 #include "../sfn_shader_gs.h"
4 #include "../sfn_shader_tess.h"
5 #include "../sfn_shader_vs.h"
6 #include "../sfn_memorypool.h"
7 
8 namespace r600 {
9 
10 using std::istringstream;
11 using std::string;
12 
13 const char *red_triangle_fs_nir  =
14 R"(shader: MESA_SHADER_FRAGMENT
15 name: TTN
16 inputs: 0
17 outputs: 1
18 uniforms: 0
19 shared: 0
20 decl_function main (0 params)
21 
22 impl main {
23    decl_var  INTERP_MODE_FLAT vec4 out@out_0-temp
24    block block_0:
25    /* preds: */
26    vec4 32 ssa_0 = load_const (0x3f800000 /* 1.000000 */, 0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */, 0x3f800000 /* 1.000000 */)
27    vec1 32 ssa_1 = load_const (0x00000000 /* 0.000000 */)
28    intrinsic store_output (ssa_0, ssa_1) (0, 15, 0, 160, 132) /* base=0 */ /* wrmask=xyz */ /* component=0 */ /* src_type=float32 */ /* location=4 slots=1 */
29    /* succs: block_1 */
30    block block_1:
31 })";
32 
33 const char *red_triangle_fs_expect_from_nir = R"(
34 FS
35 CHIPCLASS EVERGREEN
36 PROP MAX_COLOR_EXPORTS:1
37 PROP COLOR_EXPORTS:1
38 PROP COLOR_EXPORT_MASK:15
39 OUTPUT LOC:0 NAME:1 MASK:15
40 SHADER
41 ALU MOV S0.x@group : I[1.0] {W}
42 ALU MOV S0.y@group : I[0] {W}
43 ALU MOV S0.z@group : I[0] {W}
44 ALU MOV S0.w@group : I[1.0] {WL}
45 ALU MOV S1.x@free : I[0] {WL}
46 EXPORT_DONE PIXEL 0 S0.xyzw
47 )";
48 
49 const char *red_triangle_fs_expect_from_nir_dce = R"(FS
50 CHIPCLASS EVERGREEN
51 PROP MAX_COLOR_EXPORTS:1
52 PROP COLOR_EXPORTS:1
53 PROP COLOR_EXPORT_MASK:15
54 OUTPUT LOC:0 NAME:1 MASK:15
55 SHADER
56 ALU MOV S0.x@group : I[1.0] {W}
57 ALU MOV S0.y@group : I[0] {W}
58 ALU MOV S0.z@group : I[0] {W}
59 ALU MOV S0.w@group : I[1.0] {WL}
60 EXPORT_DONE PIXEL 0 S0.xyzw
61 )";
62 
63 
64 const char *add_add_1_nir =
65 R"(shader: MESA_SHADER_FRAGMENT
66 name: GLSL3
67 inputs: 0
68 outputs: 1
69 uniforms: 1
70 shared: 0
71 decl_var uniform INTERP_MODE_NONE vec4 color (0, 0, 0)
72 decl_function main (0 params)
73 
74 impl main {
75      decl_var  INTERP_MODE_NONE vec4 out@gl_FragColor-temp
76      block block_0:
77      /* preds: */
78      vec1 32 ssa_0 = load_const (0xbf000000 /* -0.500000 */)
79      vec1 32 ssa_1 = load_const (0x00000000 /* 0.000000 */)
80      vec4 32 ssa_2 = intrinsic load_uniform (ssa_1) (0, 1, 160) /* base=0 */ /* range=1 */ /* dest_type=float32 */   /* color */
81      vec1 32 ssa_3 = fadd ssa_0, ssa_2.x
82      vec4 32 ssa_4 = vec4 ssa_3, ssa_2.y, ssa_2.z, ssa_2.w
83      intrinsic store_output (ssa_4, ssa_1) (0, 15, 0, 160, 130) /* base=0 */ /* wrmask=xyzw */ /* component=0 */ /* src_type=float32 */ /* location=2 slots=1 */
84      /* succs: block_1 */
85      block block_1:
86 })";
87 
88 const char *add_add_1_expect_from_nir =
89 R"(FS
90 CHIPCLASS EVERGREEN
91 PROP MAX_COLOR_EXPORTS:1
92 PROP COLOR_EXPORTS:1
93 PROP WRITE_ALL_COLORS:1
94 PROP COLOR_EXPORT_MASK:15
95 OUTPUT LOC:0 NAME:1 MASK:15
96 SHADER
97 ALU MOV S0.x@free : L[0xbf000000] {WL}
98 ALU MOV S1.x@free : I[0] {WL}
99 ALU MOV S2.x : KC0[0].x {W}
100 ALU MOV S2.y : KC0[0].y {W}
101 ALU MOV S2.z : KC0[0].z {W}
102 ALU MOV S2.w : KC0[0].w {WL}
103 ALU ADD S3.x@free : S0.x@free S2.x {WL}
104 ALU MOV S4.x@group : S3.x@free {W}
105 ALU MOV S4.y@group : S2.y {W}
106 ALU MOV S4.z@group : S2.z {W}
107 ALU MOV S4.w@group : S2.w {WL}
108 EXPORT_DONE PIXEL 0 S4.xyzw
109 )";
110 
111 
112 const char *add_add_1_expect_from_nir_copy_prop_fwd =
113 R"(
114 FS
115 CHIPCLASS EVERGREEN
116 PROP MAX_COLOR_EXPORTS:1
117 PROP COLOR_EXPORTS:1
118 PROP WRITE_ALL_COLORS:1
119 PROP COLOR_EXPORT_MASK:15
120 OUTPUT LOC:0 NAME:1 MASK:15
121 SHADER
122 ALU MOV S0.x@free : L[0xbf000000] {WL}
123 ALU MOV S1.x@free : I[0] {WL}
124 ALU MOV S2.x : KC0[0].x {W}
125 ALU MOV S2.y : KC0[0].y {W}
126 ALU MOV S2.z : KC0[0].z {W}
127 ALU MOV S2.w : KC0[0].w {WL}
128 ALU ADD S3.x@free : L[0xbf000000] KC0[0].x {WL}
129 ALU MOV S4.x@group : S3.x@free {W}
130 ALU MOV S4.y@group : KC0[0].y {W}
131 ALU MOV S4.z@group : KC0[0].z {W}
132 ALU MOV S4.w@group : KC0[0].w {WL}
133 EXPORT_DONE PIXEL 0 S4.xyzw
134 )";
135 
136 const char *add_add_1_expect_from_nir_copy_prop_fwd_dce =
137 R"(
138 FS
139 CHIPCLASS EVERGREEN
140 PROP MAX_COLOR_EXPORTS:1
141 PROP COLOR_EXPORTS:1
142 PROP WRITE_ALL_COLORS:1
143 PROP COLOR_EXPORT_MASK:15
144 OUTPUT LOC:0 NAME:1 MASK:15
145 SHADER
146 ALU ADD S3.x@free : L[0xbf000000] KC0[0].x {WL}
147 ALU MOV S4.x@group : S3.x@free {W}
148 ALU MOV S4.y@group : KC0[0].y {W}
149 ALU MOV S4.z@group : KC0[0].z {W}
150 ALU MOV S4.w@group : KC0[0].w {WL}
151 EXPORT_DONE PIXEL 0 S4.xyzw
152 )";
153 
154 
155 const char *add_add_1_expect_from_nir_copy_prop_fwd_dce_bwd =
156 R"(
157 FS
158 CHIPCLASS EVERGREEN
159 PROP MAX_COLOR_EXPORTS:1
160 PROP COLOR_EXPORTS:1
161 PROP WRITE_ALL_COLORS:1
162 PROP COLOR_EXPORT_MASK:15
163 OUTPUT LOC:0 NAME:1 MASK:15
164 SYSVALUES R0.xy__
165 SHADER
166 ALU ADD S4.x@group : L[0xbf000000] KC0[0].x {W}
167 ALU MOV S4.y@group : KC0[0].y {W}
168 ALU MOV S4.z@group : KC0[0].z {W}
169 ALU MOV S4.w@group : KC0[0].w {WL}
170 EXPORT_DONE PIXEL 0 S4.xyzw
171 )";
172 
173 
174 const char *basic_interpolation_nir =
175 R"(shader: MESA_SHADER_FRAGMENT
176 name: TTN
177 inputs: 1
178 outputs: 1
179 uniforms: 0
180 shared: 0
181 decl_var uniform INTERP_MODE_NONE sampler2D sampler (0, 0, 0)
182 decl_function main (0 params)
183 
184 impl main {
185         decl_var  INTERP_MODE_NOPERSPECTIVE vec4 in@in_0-temp
186         decl_var  INTERP_MODE_FLAT vec4 out@out_0-temp
187         block block_0:
188         /* preds: */
189         vec2 32 ssa_0 = intrinsic load_barycentric_pixel () (3) /* interp_mode=3 */
190         vec1 32 ssa_1 = load_const (0x00000000 /* 0.000000 */)
191         vec4 32 ssa_2 = intrinsic load_interpolated_input (ssa_0, ssa_1) (0, 0, 160, 160) /* base=0 */ /* component=0 */ /* dest_type=float32 */ /* location=32 slots=1 */
192         vec3 32 ssa_3 = f2i32 ssa_2.xyw
193         vec1 32 ssa_4 = mov ssa_3.z
194         vec2 32 ssa_5 = vec2 ssa_3.x, ssa_3.y
195         vec4 32 ssa_6 = (float32)txf ssa_5 (coord), ssa_4 (lod), 0 (texture), 0 (sampler)
196         intrinsic store_output (ssa_6, ssa_1) (0, 15, 0, 160, 132) /* base=0 */ /* wrmask=xyzw */ /* component=0 */ /* src_type=float32 */ /* location=4 slots=1 */
197         /* succs: block_1 */
198         block block_1:
199 })";
200 
201 const char *basic_interpolation_expect_from_nir =
202 R"(FS
203 CHIPCLASS EVERGREEN
204 PROP MAX_COLOR_EXPORTS:1
205 PROP COLOR_EXPORTS:1
206 PROP COLOR_EXPORT_MASK:15
207 #PROP RAT_BASE:1
208 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10 INTERP:1
209 OUTPUT LOC:0 NAME:1 MASK:15
210 SYSVALUES R0.xy__
211 SHADER
212 ALU MOV S1.x@free : I[0] {WL}
213 ALU_GROUP_BEGIN
214 ALU INTERP_ZW  __.x@chan : R0.y@fully Param0.x VEC_210 {}
215 ALU INTERP_ZW  __.y@chan : R0.x@fully Param0.y VEC_210 {}
216 ALU INTERP_ZW  S2.z@chan : R0.y@fully Param0.z VEC_210 {W}
217 ALU INTERP_ZW  S2.w@chan : R0.x@fully Param0.w VEC_210 {WL}
218 ALU_GROUP_END
219 ALU_GROUP_BEGIN
220 ALU INTERP_XY  S2.x@chan : R0.y@fully Param0.x VEC_210 {W}
221 ALU INTERP_XY  S2.y@chan : R0.x@fully Param0.y VEC_210 {W}
222 ALU INTERP_XY  __.z@chan : R0.y@fully Param0.z VEC_210 {}
223 ALU INTERP_XY  __.w@chan : R0.x@fully Param0.w VEC_210 {L}
224 ALU_GROUP_END
225 
226 ALU TRUNC S3.x@free : S2.x@chan {WL}
227 ALU TRUNC S4.y@free : S2.y@chan {WL}
228 ALU TRUNC S5.z@free : S2.w@chan {WL}
229 
230 ALU FLT_TO_INT S6.x : S3.x@free {W}
231 ALU FLT_TO_INT S6.y : S4.y@free {W}
232 ALU FLT_TO_INT S6.z : S5.z@free {WL}
233 
234 ALU MOV S7.x@free : S6.z {WL}
235 ALU MOV S8.x : S6.x {W}
236 ALU MOV S8.y : S6.y {WL}
237 ALU MOV S9.x@group : S8.x {W}
238 ALU MOV S9.y@group : S8.y {W}
239 ALU MOV S9.w@group : S7.x@free {WL}
240 TEX LD S10.xyzw : S9.xy_w RID:18 SID:0 NNNN
241 EXPORT_DONE PIXEL 0 S10.xyzw)";
242 
243 
244 const char *basic_interpolation_translated_1 =
245 R"(FS
246 CHIPCLASS EVERGREEN
247 PROP MAX_COLOR_EXPORTS:1
248 PROP COLOR_EXPORTS:1
249 PROP COLOR_EXPORT_MASK:15
250 #PROP RAT_BASE:1
251 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10 INTERP:1
252 OUTPUT LOC:0 NAME:1 MASK:15
253 SYSVALUES R0.xy__
254 SHADER
255 ALU MOV S1.x@free : I[0] {WL}
256 ALU_GROUP_BEGIN
257 ALU INTERP_ZW  __.x@chan : R0.y@fully Param0.x VEC_210 {}
258 ALU INTERP_ZW  __.y@chan : R0.x@fully Param0.y VEC_210 {}
259 ALU INTERP_ZW  S2.z@chan : R0.y@fully Param0.z VEC_210 {W}
260 ALU INTERP_ZW  S2.w@chan : R0.x@fully Param0.w VEC_210 {WL}
261 ALU_GROUP_END
262 ALU_GROUP_BEGIN
263 ALU INTERP_XY  S2.x@chan : R0.y@fully Param0.x VEC_210 {W}
264 ALU INTERP_XY  S2.y@chan : R0.x@fully Param0.y VEC_210 {W}
265 ALU INTERP_XY  __.z@chan : R0.y@fully Param0.z VEC_210 {}
266 ALU INTERP_XY  __.w@chan : R0.x@fully Param0.w VEC_210 {L}
267 ALU_GROUP_END
268 
269 ALU FLT_TO_INT S3.x : S2.x@free {W}
270 ALU FLT_TO_INT S3.y : S2.y@free {W}
271 ALU FLT_TO_INT S3.z : S2.w@free {WL}
272 ALU MOV S4.x : S3.x {W}
273 ALU MOV S4.y : S3.y {WL}
274 ALU MOV S5.x@group : S4.x {W}
275 ALU MOV S5.y@group : S4.y {W}
276 ALU MOV S5.w@group : S3.z {WL}
277 TEX LD S6.xyzw : S5.xy_w RID:18 SID:0 NNNN
278 EXPORT_DONE PIXEL 0 S6.xyzw)";
279 
280 
281 
282 const char *basic_interpolation_2 =
283 R"(FS
284 CHIPCLASS EVERGREEN
285 PROP MAX_COLOR_EXPORTS:1
286 PROP COLOR_EXPORTS:1
287 PROP COLOR_EXPORT_MASK:15
288 #PROP RAT_BASE:1
289 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10 INTERP:1
290 OUTPUT LOC:0 NAME:1 MASK:15
291 SYSVALUES R0.xy__
292 SHADER
293 ALU_GROUP_BEGIN
294 ALU INTERP_ZW  __.x@chan : R0.y@fully Param0.x VEC_210 {}
295 ALU INTERP_ZW  __.y@chan : R0.x@fully Param0.y VEC_210 {}
296 ALU INTERP_ZW  S2.z@chan : R0.y@fully Param0.z VEC_210 {W}
297 ALU INTERP_ZW  S2.w@chan : R0.x@fully Param0.w VEC_210 {WL}
298 ALU_GROUP_END
299 ALU_GROUP_BEGIN
300 ALU INTERP_XY  S2.x@chan : R0.y@fully Param0.x VEC_210 {W}
301 ALU INTERP_XY  S2.y@chan : R0.x@fully Param0.y VEC_210 {W}
302 ALU INTERP_XY  __.z@chan : R0.y@fully Param0.z VEC_210 {}
303 ALU INTERP_XY  __.w@chan : R0.x@fully Param0.w VEC_210 {L}
304 ALU_GROUP_END
305 EXPORT_DONE PIXEL 0 S2.xyzw
306 )";
307 
308 
309 const char *basic_interpolation_orig =
310 R"(FS
311 CHIPCLASS EVERGREEN
312 PROP MAX_COLOR_EXPORTS:1
313 PROP COLOR_EXPORTS:1
314 PROP COLOR_EXPORT_MASK:15
315 #PROP RAT_BASE:1
316 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10 INTERP:1
317 OUTPUT LOC:0 NAME:1 MASK:15
318 SYSVALUES R0.xy__
319 SHADER
320 ALU MOV S1024.x : I[0] {WL}
321 ALU_GROUP_BEGIN
322 ALU INTERP_ZW  __.x@chan : R0.y@fully Param0.x VEC_210 {}
323 ALU INTERP_ZW  __.y@chan : R0.x@fully Param0.y VEC_210 {}
324 ALU INTERP_ZW  S1025.z@chan : R0.y@fully Param0.z VEC_210 {W}
325 ALU INTERP_ZW  S1025.w@chan : R0.x@fully Param0.w VEC_210 {WL}
326 ALU_GROUP_END
327 ALU_GROUP_BEGIN
328 ALU INTERP_XY  S1025.x@chan : R0.y@fully Param0.x VEC_210 {W}
329 ALU INTERP_XY  S1025.y@chan : R0.x@fully Param0.y VEC_210 {W}
330 ALU INTERP_XY  __.z@chan : R0.y@fully Param0.z VEC_210 {}
331 ALU INTERP_XY  __.w@chan : R0.x@fully Param0.w VEC_210 {L}
332 ALU_GROUP_END
333 
334 ALU FLT_TO_INT S1026.x : S1025.x@chan {W}
335 ALU FLT_TO_INT S1026.y : S1025.y@chan {W}
336 ALU FLT_TO_INT S1026.z : S1025.w@chan {WL}
337 ALU MOV S1027.x : S1026.x {W}
338 ALU MOV S1027.y : S1026.y {WL}
339 ALU MOV S1028.x@group : S1027.x {W}
340 ALU MOV S1028.y@group : S1027.y {W}
341 ALU MOV S1028.w@group : S1026.z {WL}
342 TEX LD S1029.xyzw : S1028.xy_w RID:0 SID:18 NNNN
343 EXPORT_DONE PIXEL 0 S1029.xyzw
344 )";
345 
346 const char *basic_interpolation_expect_from_nir_sched =
347 R"(FS
348 CHIPCLASS EVERGREEN
349 PROP MAX_COLOR_EXPORTS:1
350 PROP COLOR_EXPORTS:1
351 PROP COLOR_EXPORT_MASK:15
352 #PROP RAT_BASE:1
353 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10 INTERP:1
354 OUTPUT LOC:0 NAME:1 MASK:15
355 SYSVALUES R0.xy__
356 SHADER
357 BLOCK_START
358 ALU_GROUP_BEGIN
359 ALU INTERP_ZW  __.x@chan : R0.y@fully Param0.x VEC_210 {}
360 ALU INTERP_ZW  __.y@chan : R0.x@fully Param0.y VEC_210 {}
361 ALU INTERP_ZW  S1025.z@chan : R0.y@fully Param0.z VEC_210 {W}
362 ALU INTERP_ZW  S1025.w@chan : R0.x@fully Param0.w VEC_210 {W}
363 ALU MOV S1024.x : I[0] {WL}
364 ALU_GROUP_END
365 ALU_GROUP_BEGIN
366 ALU INTERP_XY  S1025.x@chan : R0.y@fully Param0.x VEC_210 {W}
367 ALU INTERP_XY  S1025.y@chan : R0.x@fully Param0.y VEC_210 {W}
368 ALU INTERP_XY  __.z@chan : R0.y@fully Param0.z VEC_210 {}
369 ALU INTERP_XY  __.w@chan : R0.x@fully Param0.w VEC_210 {L}
370 ALU_GROUP_END
371 ALU_GROUP_BEGIN
372 ALU FLT_TO_INT S1026.x : S1025.x@chan {W}
373 ALU FLT_TO_INT S1026.y : S1025.y@chan {W}
374 ALU FLT_TO_INT S1026.z : S1025.w@chan {WL}
375 ALU_GROUP_END
376 ALU_GROUP_BEGIN
377 ALU MOV S1027.x : S1026.x {W}
378 ALU MOV S1027.y : S1026.y {W}
379 ALU MOV S1028.w@group : S1026.z {WL}
380 ALU_GROUP_END
381 ALU_GROUP_BEGIN
382 ALU MOV S1028.x@group : S1027.x {W}
383 ALU MOV S1028.y@group : S1027.y {WL}
384 ALU_GROUP_END
385 BLOCK_END
386 BLOCK_START
387 TEX LD S1029.xyzw : S1028.xy_w RID:0 SID:18 NNNN
388 BLOCK_END
389 BLOCK_START
390 EXPORT_DONE PIXEL 0 S1029.xyzw
391 BLOCK_END
392 )";
393 
394 
395 const char *basic_interpolation_orig_cayman =
396 R"(FS
397 CHIPCLASS CAYMAN
398 PROP MAX_COLOR_EXPORTS:1
399 PROP COLOR_EXPORTS:1
400 PROP COLOR_EXPORT_MASK:15
401 #PROP RAT_BASE:1
402 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10 INTERP:1
403 OUTPUT LOC:0 NAME:1 MASK:15
404 SYSVALUES R0.xy__
405 SHADER
406 ALU MOV S1024.x : I[0] {WL}
407 ALU_GROUP_BEGIN
408 ALU INTERP_ZW  __.x@chan : R0.y@fully Param0.x VEC_210 {}
409 ALU INTERP_ZW  __.y@chan : R0.x@fully Param0.y VEC_210 {}
410 ALU INTERP_ZW  S1025.z@chan : R0.y@fully Param0.z VEC_210 {W}
411 ALU INTERP_ZW  S1025.w@chan : R0.x@fully Param0.w VEC_210 {WL}
412 ALU_GROUP_END
413 ALU_GROUP_BEGIN
414 ALU INTERP_XY  S1025.x@chan : R0.y@fully Param0.x VEC_210 {W}
415 ALU INTERP_XY  S1025.y@chan : R0.x@fully Param0.y VEC_210 {W}
416 ALU INTERP_XY  __.z@chan : R0.y@fully Param0.z VEC_210 {}
417 ALU INTERP_XY  __.w@chan : R0.x@fully Param0.w VEC_210 {L}
418 ALU_GROUP_END
419 
420 ALU FLT_TO_INT S1026.x : S1025.x@chan {W}
421 ALU FLT_TO_INT S1026.y : S1025.y@chan {W}
422 ALU FLT_TO_INT S1026.z : S1025.w@chan {WL}
423 ALU MOV S1027.x : S1026.x {W}
424 ALU MOV S1027.y : S1026.y {WL}
425 ALU MOV S1028.x@group : S1027.x {W}
426 ALU MOV S1028.y@group : S1027.y {W}
427 ALU MOV S1028.w@group : S1026.z {WL}
428 TEX LD S1029.xyzw : S1028.xy_w RID:0 SID:18 NNNN
429 EXPORT_DONE PIXEL 0 S1029.xyzw
430 )";
431 
432 const char *basic_interpolation_expect_from_nir_sched_cayman =
433 R"(FS
434 CHIPCLASS CAYMAN
435 PROP MAX_COLOR_EXPORTS:1
436 PROP COLOR_EXPORTS:1
437 PROP COLOR_EXPORT_MASK:15
438 #PROP RAT_BASE:1
439 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10 INTERP:1
440 OUTPUT LOC:0 NAME:1 MASK:15
441 SYSVALUES R0.xy__
442 SHADER
443 BLOCK_START
444 ALU_GROUP_BEGIN
445 ALU INTERP_ZW __.x@chan : R0.y@fully Param0.x {} VEC_210
446 ALU INTERP_ZW __.y@chan : R0.x@fully Param0.y {} VEC_210
447 ALU INTERP_ZW S1025.z@chan : R0.y@fully Param0.z {W} VEC_210
448 ALU INTERP_ZW S1025.w@chan : R0.x@fully Param0.w {WL} VEC_210
449 ALU_GROUP_END
450 ALU_GROUP_BEGIN
451 ALU INTERP_XY S1025.x@chan : R0.y@fully Param0.x {W} VEC_210
452 ALU INTERP_XY S1025.y@chan : R0.x@fully Param0.y {W} VEC_210
453 ALU INTERP_XY __.z@chan : R0.y@fully Param0.z {} VEC_210
454 ALU INTERP_XY __.w@chan : R0.x@fully Param0.w {L} VEC_210
455 ALU_GROUP_END
456 ALU_GROUP_BEGIN
457 ALU FLT_TO_INT S1026.x : S1025.x@chan {W}
458 ALU FLT_TO_INT S1026.y : S1025.y@chan {W}
459 ALU FLT_TO_INT S1026.z : S1025.w@chan {WL}
460 ALU_GROUP_END
461 ALU_GROUP_BEGIN
462 ALU MOV S1027.x : S1026.x {W}
463 ALU MOV S1027.y : S1026.y {W}
464 ALU MOV S1028.w@group : S1026.z {WL}
465 ALU_GROUP_END
466 ALU_GROUP_BEGIN
467 ALU MOV S1028.x@group : S1027.x {W}
468 ALU MOV S1028.y@group : S1027.y {WL}
469 ALU_GROUP_END
470 ALU_GROUP_BEGIN
471 ALU MOV S1024.x : I[0] {WL}
472 ALU_GROUP_END
473 BLOCK_START
474 BLOCK_END
475 TEX LD S1029.xyzw : S1028.xy_w RID:0 SID:18 NNNN
476 BLOCK_START
477 BLOCK_END
478 EXPORT_DONE PIXEL 0 S1029.xyzw
479 BLOCK_END
480 )";
481 
482 const char *basic_interpolation_expect_opt_sched_cayman =
483 R"(FS
484 CHIPCLASS CAYMAN
485 PROP MAX_COLOR_EXPORTS:1
486 PROP COLOR_EXPORTS:1
487 PROP COLOR_EXPORT_MASK:15
488 #PROP RAT_BASE:1
489 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10 INTERP:1
490 OUTPUT LOC:0 NAME:1 MASK:15
491 SYSVALUES R0.xy__
492 SHADER
493 BLOCK_START
494 ALU_GROUP_BEGIN
495 ALU INTERP_ZW __.x@chan : R0.y@fully Param0.x {} VEC_210
496 ALU INTERP_ZW __.y@chan : R0.x@fully Param0.y {} VEC_210
497 ALU INTERP_ZW S1025.z@chan : R0.y@fully Param0.z {W} VEC_210
498 ALU INTERP_ZW S1025.w@chan : R0.x@fully Param0.w {WL} VEC_210
499 ALU_GROUP_END
500 ALU_GROUP_BEGIN
501 ALU INTERP_XY S1025.x@chan : R0.y@fully Param0.x {W} VEC_210
502 ALU INTERP_XY S1025.y@chan : R0.x@fully Param0.y {W} VEC_210
503 ALU INTERP_XY __.z@chan : R0.y@fully Param0.z {} VEC_210
504 ALU INTERP_XY __.w@chan : R0.x@fully Param0.w {L} VEC_210
505 ALU_GROUP_END
506 ALU_GROUP_BEGIN
507 ALU FLT_TO_INT S1028.x@group : S1025.x@chan {W}
508 ALU FLT_TO_INT S1028.y@group : S1025.y@chan {W}
509 ALU FLT_TO_INT S1028.w@group : S1025.w@chan {WL}
510 ALU_GROUP_END
511 BLOCK_END
512 BLOCK_START
513 TEX LD S1029.xyzw : S1028.xy_w RID:0 SID:18 NNNN
514 BLOCK_END
515 BLOCK_START
516 EXPORT_DONE PIXEL 0 S1029.xyzw
517 BLOCK_END
518 )";
519 
520 const char *basic_interpolation_expect_from_nir_opt =
521 R"(FS
522 CHIPCLASS EVERGREEN
523 PROP MAX_COLOR_EXPORTS:1
524 PROP COLOR_EXPORTS:1
525 PROP COLOR_EXPORT_MASK:15
526 #PROP RAT_BASE:1
527 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10 INTERP:1
528 OUTPUT LOC:0 NAME:1 MASK:15
529 SYSVALUES R0.xy__
530 SHADER
531 ALU_GROUP_BEGIN
532 ALU INTERP_ZW  __.x@chan : R0.y@fully Param0.x VEC_210 {}
533 ALU INTERP_ZW  __.y@chan : R0.x@fully Param0.y VEC_210 {}
534 ALU INTERP_ZW  S1025.z@chan : R0.y@fully Param0.z VEC_210 {W}
535 ALU INTERP_ZW  S1025.w@chan : R0.x@fully Param0.w VEC_210 {WL}
536 ALU_GROUP_END
537 ALU_GROUP_BEGIN
538 ALU INTERP_XY  S1025.x@chan : R0.y@fully Param0.x VEC_210 {W}
539 ALU INTERP_XY  S1025.y@chan : R0.x@fully Param0.y VEC_210 {W}
540 ALU INTERP_XY  __.z@chan : R0.y@fully Param0.z VEC_210 {}
541 ALU INTERP_XY  __.w@chan : R0.x@fully Param0.w VEC_210 {L}
542 ALU_GROUP_END
543 ALU FLT_TO_INT S1028.x@group : S1025.x@chan {W}
544 ALU FLT_TO_INT S1028.y@group : S1025.y@chan {W}
545 ALU FLT_TO_INT S1028.w@group : S1025.w@chan {WL}
546 TEX LD S1029.xyzw : S1028.xy_w RID:0 SID:18 NNNN
547 EXPORT_DONE PIXEL 0 S1029.xyzw
548 )";
549 
550 const char *dot4_pre =
551 R"(FS
552 CHIPCLASS EVERGREEN
553 PROP MAX_COLOR_EXPORTS:1
554 PROP COLOR_EXPORTS:1
555 PROP COLOR_EXPORT_MASK:15
556 #PROP RAT_BASE:1
557 OUTPUT LOC:0 NAME:1 MASK:15
558 SHADER
559 ALU MOV S1.x : KC0[0].x  {W}
560 ALU MOV S1.y : KC0[0].y  {W}
561 ALU MOV S1.z : KC0[0].z  {W}
562 ALU MOV S1.w : KC0[0].w  {WL}
563 ALU MOV S2.x : KC0[1].x  {W}
564 ALU MOV S2.y : KC0[1].y  {W}
565 ALU MOV S2.z : KC0[1].z  {W}
566 ALU MOV S2.w : KC0[1].w  {WL}
567 ALU DOT4_IEEE S3.x@free : S1.x S2.x + S1.y S2.y + S1.z S2.z + S1.w S2.w  {WL}
568 ALU MOV S4.x : S3.x@free {W}
569 ALU MOV S4.y : S3.x@free {W}
570 ALU MOV S4.z : S3.x@free {W}
571 ALU MOV S4.w : S3.x@free {W}
572 EXPORT_DONE PIXEL 0 S4.xyzw
573 )";
574 
575 const char *dot4_copy_prop_dce =
576 R"(FS
577 CHIPCLASS EVERGREEN
578 PROP MAX_COLOR_EXPORTS:1
579 PROP COLOR_EXPORTS:1
580 PROP COLOR_EXPORT_MASK:15
581 #PROP RAT_BASE:1
582 OUTPUT LOC:0 NAME:1 MASK:15
583 SHADER
584 ALU MOV S2.x : KC0[1].x  {W}
585 ALU MOV S2.y : KC0[1].y  {W}
586 ALU MOV S2.z : KC0[1].z  {W}
587 ALU MOV S2.w : KC0[1].w  {WL}
588 ALU DOT4_IEEE S3.x@free : KC0[0].x S2.x + KC0[0].y S2.y + KC0[0].z S2.z + KC0[0].w S2.w  {WL}
589 ALU MOV S4.x : S3.x@free {W}
590 ALU MOV S4.y : S3.x@free {W}
591 ALU MOV S4.z : S3.x@free {W}
592 ALU MOV S4.w : S3.x@free {W}
593 EXPORT_DONE PIXEL 0 S4.xyzw
594 )";
595 
596 const char *glxgears_vs2_nir =
597 R"(shader: MESA_SHADER_VERTEX
598 name: ARB0
599 inputs: 2
600 outputs: 2
601 uniforms: 11
602 shared: 0
603 decl_var uniform INTERP_MODE_NONE vec4[11] name (0, 0, 0)
604 decl_function main (0 params)
605 
606 impl main {
607         block block_0:
608         /* preds: */
609         vec1 32 ssa_0 = load_const (0x00000000 /* 0.000000 */)
610         vec4 32 ssa_1 = intrinsic load_input (ssa_0) (0, 0, 160, 128) /* base=0 */ /* component=0 */ /* dest_type=float32 */ /* location=0 slots=1 */
611         vec1 32 ssa_2 = load_const (0x00000006 /* 0.000000 */)
612         vec4 32 ssa_3 = intrinsic load_uniform (ssa_2) (0, 11, 160) /* base=0 */ /* range=11 */ /* dest_type=float32 */ /*  */
613         vec4 32 ssa_4 = fmul ssa_1.xxxx, ssa_3
614         vec1 32 ssa_5 = load_const (0x00000007 /* 0.000000 */)
615         vec4 32 ssa_6 = intrinsic load_uniform (ssa_5) (0, 11, 160) /* base=0 */ /* range=11 */ /* dest_type=float32 */ /*  */
616         vec4 32 ssa_7 = ffma ssa_1.yyyy, ssa_6, ssa_4
617         vec1 32 ssa_8 = load_const (0x00000008 /* 0.000000 */)
618         vec4 32 ssa_9 = intrinsic load_uniform (ssa_8) (0, 11, 160) /* base=0 */ /* range=11 */ /* dest_type=float32 */ /*  */
619         vec4 32 ssa_10 = ffma ssa_1.zzzz, ssa_9, ssa_7
620         vec1 32 ssa_11 = load_const (0x00000009 /* 0.000000 */)
621         vec4 32 ssa_12 = intrinsic load_uniform (ssa_11) (0, 11, 160) /* base=0 */ /* range=11 */ /* dest_type=float32 */       /*  */
622         vec4 32 ssa_13 = ffma ssa_1.wwww, ssa_12, ssa_10
623         vec4 32 ssa_14 = intrinsic load_input (ssa_0) (1, 0, 160, 129) /* base=1 */ /* component=0 */ /* dest_type=float32 */ /* location=1 slots=1 */
624         vec1 32 ssa_15 = fdot3 ssa_14.xyz, ssa_14.xyz
625         vec1 32 ssa_16 = frsq abs(ssa_15)
626         vec4 32 ssa_17 = fmul ssa_14, ssa_16.xxxx
627         vec1 32 ssa_18 = load_const (0x00000002 /* 0.000000 */)
628         vec4 32 ssa_19 = intrinsic load_uniform (ssa_18) (0, 11, 160) /* base=0 */ /* range=11 */ /* dest_type=float32 */       /*  */
629         vec1 32 ssa_20 = load_const (0x0000000a /* 0.000000 */)
630         vec4 32 ssa_21 = intrinsic load_uniform (ssa_20) (0, 11, 160) /* base=0 */ /* range=11 */ /* dest_type=float32 */       /*  */
631         vec1 32 ssa_22 = fdot3 ssa_17.xyz, ssa_21.xyz
632         vec4 32 ssa_23 = load_const (0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */, 0x3f800000 /* 1.000000 */)
633         vec1 32 ssa_24 = fmax ssa_23.y, ssa_22
634         vec4 32 ssa_25 = load_const (0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */)
635         vec1 32 ssa_26 = slt ssa_25.z, ssa_22
636         vec1 32 ssa_27 = load_const (0x00000003 /* 0.000000 */)
637         vec4 32 ssa_28 = intrinsic load_uniform (ssa_27) (0, 11, 160) /* base=0 */ /* range=11 */ /* dest_type=float32 */       /*  */
638         vec3 32 ssa_29 = fadd ssa_28.xyz, ssa_19.xyz
639         vec1 32 ssa_30 = load_const (0x00000004 /* 0.000000 */)
640         vec4 32 ssa_31 = intrinsic load_uniform (ssa_30) (0, 11, 160) /* base=0 */ /* range=11 */ /* dest_type=float32 */       /*  */
641         vec3 32 ssa_32 = ffma ssa_24.xxx, ssa_31.xyz, ssa_29
642         vec1 32 ssa_33 = load_const (0x00000005 /* 0.000000 */)
643         vec4 32 ssa_34 = intrinsic load_uniform (ssa_33) (0, 11, 160) /* base=0 */ /* range=11 */ /* dest_type=float32 */       /*  */
644         vec3 32 ssa_35 = ffma.sat ssa_26.xxx, ssa_34.xyz, ssa_32
645         intrinsic store_output (ssa_13, ssa_0) (0, 15, 0, 160, 128) /* base=0 */ /* wrmask=xyzw */ /* component=0 */ /* src_type=float32 */ /* location=0 slots=1 */
646         vec3 32 ssa_36 = mov ssa_35
647         vec1 32 ssa_37 = fsat ssa_19.w
648         vec4 32 ssa_38 = vec4 ssa_36.x, ssa_36.y, ssa_36.z, ssa_37
649         intrinsic store_output (ssa_38, ssa_0) (1, 15, 0, 160, 129) /* base=1 */ /* wrmask=xyzw */ /* component=0 */ /* src_type=float32 */ /* location=1 slots=1 */
650         /* succs: block_1 */
651         block block_1:
652 })";
653 
654 const char *glxgears_vs2_from_nir_expect =
655 R"(VS
656 CHIPCLASS EVERGREEN
657 INPUT LOC:0 NAME:0
658 INPUT LOC:1 NAME:1
659 OUTPUT LOC:0 NAME:0 MASK:15 SID:0 SPI_SID:0
660 OUTPUT LOC:1 NAME:1 MASK:15 SID:0 SPI_SID:137
661 SYSVALUES R1.xyzw R2.xyzw
662 SHADER
663 ALU MOV S3.x@free : I[0] {WL}
664 ALU MOV S4.x@free : L[0x6] {WL}
665 ALU MOV S5.x : KC0[6].x {W}
666 ALU MOV S5.y : KC0[6].y {W}
667 ALU MOV S5.z : KC0[6].z {W}
668 ALU MOV S5.w : KC0[6].w {WL}
669 ALU MUL_IEEE S6.x : R1.x@fully S5.x {W}
670 ALU MUL_IEEE S6.y : R1.x@fully S5.y {W}
671 ALU MUL_IEEE S6.z : R1.x@fully S5.z {W}
672 ALU MUL_IEEE S6.w : R1.x@fully S5.w {WL}
673 ALU MOV S7.x@free : L[0x7] {WL}
674 ALU MOV S8.x : KC0[7].x {W}
675 ALU MOV S8.y : KC0[7].y {W}
676 ALU MOV S8.z : KC0[7].z {W}
677 ALU MOV S8.w : KC0[7].w {WL}
678 ALU MULADD_IEEE S9.x : R1.y@fully S8.x S6.x {W}
679 ALU MULADD_IEEE S9.y : R1.y@fully S8.y S6.y {W}
680 ALU MULADD_IEEE S9.z : R1.y@fully S8.z S6.z {W}
681 ALU MULADD_IEEE S9.w : R1.y@fully S8.w S6.w {WL}
682 ALU MOV S10.x@free : L[0x8] {WL}
683 ALU MOV S11.x : KC0[8].x {W}
684 ALU MOV S11.y : KC0[8].y {W}
685 ALU MOV S11.z : KC0[8].z {W}
686 ALU MOV S11.w : KC0[8].w {WL}
687 ALU MULADD_IEEE S12.x : R1.z@fully S11.x S9.x {W}
688 ALU MULADD_IEEE S12.y : R1.z@fully S11.y S9.y {W}
689 ALU MULADD_IEEE S12.z : R1.z@fully S11.z S9.z {W}
690 ALU MULADD_IEEE S12.w : R1.z@fully S11.w S9.w {WL}
691 ALU MOV S13.x@free : L[0x9] {WL}
692 ALU MOV S14.x : KC0[9].x {W}
693 ALU MOV S14.y : KC0[9].y {W}
694 ALU MOV S14.z : KC0[9].z {W}
695 ALU MOV S14.w : KC0[9].w {WL}
696 ALU MULADD_IEEE S15.x@group : R1.w@fully S14.x S12.x {W}
697 ALU MULADD_IEEE S15.y@group : R1.w@fully S14.y S12.y {W}
698 ALU MULADD_IEEE S15.z@group : R1.w@fully S14.z S12.z {W}
699 ALU MULADD_IEEE S15.w@group : R1.w@fully S14.w S12.w {WL}
700 ALU DOT4_IEEE S16.x@free : R2.x@fully R2.x@fully + R2.y@fully R2.y@fully + R2.z@fully R2.z@fully + I[0].x I[0].x {WL}
701 ALU RECIPSQRT_IEEE S17.x@free : |S16.x@free| {WL}
702 ALU MUL_IEEE S18.x : R2.x@fully S17.x@free {W}
703 ALU MUL_IEEE S18.y : R2.y@fully S17.x@free {W}
704 ALU MUL_IEEE S18.z : R2.z@fully S17.x@free {W}
705 ALU MUL_IEEE S18.w : R2.w@fully S17.x@free {WL}
706 ALU MOV S19.x@free : L[0x2] {WL}
707 ALU MOV S20.x : KC0[2].x {W}
708 ALU MOV S20.y : KC0[2].y {W}
709 ALU MOV S20.z : KC0[2].z {W}
710 ALU MOV S20.w : KC0[2].w {WL}
711 ALU MOV S21.x@free : L[0xa] {WL}
712 ALU MOV S22.x : KC0[10].x {W}
713 ALU MOV S22.y : KC0[10].y {W}
714 ALU MOV S22.z : KC0[10].z {W}
715 ALU MOV S22.w : KC0[10].w {WL}
716 ALU DOT4_IEEE S23.x@free : S18.x S22.x + S18.y S22.y + S18.z S22.z + I[0].x I[0].x {WL}
717 ALU MOV S24.x : I[0] {W}
718 ALU MOV S24.y : I[0] {W}
719 ALU MOV S24.z : I[0] {W}
720 ALU MOV S24.w : I[1.0] {WL}
721 ALU MAX_DX10 S25.x@free : S24.y S23.x@free {WL}
722 ALU MOV S26.x : I[0] {W}
723 ALU MOV S26.y : I[0] {W}
724 ALU MOV S26.z : I[0] {W}
725 ALU MOV S26.w : I[0] {WL}
726 ALU SETGT S27.x@free : S23.x@free S26.z {WL}
727 ALU MOV S28.x@free : L[0x3] {WL}
728 ALU MOV S29.x : KC0[3].x {W}
729 ALU MOV S29.y : KC0[3].y {W}
730 ALU MOV S29.z : KC0[3].z {W}
731 ALU MOV S29.w : KC0[3].w {WL}
732 ALU ADD S30.x : S29.x S20.x {W}
733 ALU ADD S30.y : S29.y S20.y {W}
734 ALU ADD S30.z : S29.z S20.z {WL}
735 ALU MOV S31.x@free : L[0x4] {WL}
736 ALU MOV S32.x : KC0[4].x {W}
737 ALU MOV S32.y : KC0[4].y {W}
738 ALU MOV S32.z : KC0[4].z {W}
739 ALU MOV S32.w : KC0[4].w {WL}
740 ALU MULADD_IEEE S33.x : S25.x@free S32.x S30.x {W}
741 ALU MULADD_IEEE S33.y : S25.x@free S32.y S30.y {W}
742 ALU MULADD_IEEE S33.z : S25.x@free S32.z S30.z {WL}
743 ALU MOV S34.x@free : L[0x5] {WL}
744 ALU MOV S35.x : KC0[5].x {W}
745 ALU MOV S35.y : KC0[5].y {W}
746 ALU MOV S35.z : KC0[5].z {W}
747 ALU MOV S35.w : KC0[5].w {WL}
748 ALU MULADD_IEEE CLAMP S36.x : S27.x@free S35.x S33.x {W}
749 ALU MULADD_IEEE CLAMP S36.y : S27.x@free S35.y S33.y {W}
750 ALU MULADD_IEEE CLAMP S36.z : S27.x@free S35.z S33.z {WL}
751 EXPORT_DONE POS 0 S15.xyzw
752 ALU MOV S38.x : S36.x {W}
753 ALU MOV S38.y : S36.y {W}
754 ALU MOV S38.z : S36.z {WL}
755 ALU MOV CLAMP S39.x@free : S20.w {WL}
756 ALU MOV S40.x@group : S38.x {W}
757 ALU MOV S40.y@group : S38.y {W}
758 ALU MOV S40.z@group : S38.z {W}
759 ALU MOV S40.w@group : S39.x@free {WL}
760 EXPORT_DONE PARAM 0 S40.xyzw)";
761 
762 
763 const char *glxgears_vs2_from_nir_expect_cayman =
764 R"(VS
765 CHIPCLASS CAYMAN
766 INPUT LOC:0 NAME:0
767 INPUT LOC:1 NAME:1
768 OUTPUT LOC:0 NAME:0 MASK:15 SID:0 SPI_SID:0
769 OUTPUT LOC:1 NAME:1 MASK:15 SID:0 SPI_SID:137
770 SYSVALUES R1.xyzw R2.xyzw
771 SHADER
772 ALU MOV S3.x@free : I[0] {WL}
773 ALU MOV S4.x@free : L[0x6] {WL}
774 ALU MOV S5.x : KC0[6].x {W}
775 ALU MOV S5.y : KC0[6].y {W}
776 ALU MOV S5.z : KC0[6].z {W}
777 ALU MOV S5.w : KC0[6].w {WL}
778 ALU MUL_IEEE S6.x : R1.x@fully S5.x {W}
779 ALU MUL_IEEE S6.y : R1.x@fully S5.y {W}
780 ALU MUL_IEEE S6.z : R1.x@fully S5.z {W}
781 ALU MUL_IEEE S6.w : R1.x@fully S5.w {WL}
782 ALU MOV S7.x@free : L[0x7] {WL}
783 ALU MOV S8.x : KC0[7].x {W}
784 ALU MOV S8.y : KC0[7].y {W}
785 ALU MOV S8.z : KC0[7].z {W}
786 ALU MOV S8.w : KC0[7].w {WL}
787 ALU MULADD_IEEE S9.x : R1.y@fully S8.x S6.x {W}
788 ALU MULADD_IEEE S9.y : R1.y@fully S8.y S6.y {W}
789 ALU MULADD_IEEE S9.z : R1.y@fully S8.z S6.z {W}
790 ALU MULADD_IEEE S9.w : R1.y@fully S8.w S6.w {WL}
791 ALU MOV S10.x@free : L[0x8] {WL}
792 ALU MOV S11.x : KC0[8].x {W}
793 ALU MOV S11.y : KC0[8].y {W}
794 ALU MOV S11.z : KC0[8].z {W}
795 ALU MOV S11.w : KC0[8].w {WL}
796 ALU MULADD_IEEE S12.x : R1.z@fully S11.x S9.x {W}
797 ALU MULADD_IEEE S12.y : R1.z@fully S11.y S9.y {W}
798 ALU MULADD_IEEE S12.z : R1.z@fully S11.z S9.z {W}
799 ALU MULADD_IEEE S12.w : R1.z@fully S11.w S9.w {WL}
800 ALU MOV S13.x@free : L[0x9] {WL}
801 ALU MOV S14.x : KC0[9].x {W}
802 ALU MOV S14.y : KC0[9].y {W}
803 ALU MOV S14.z : KC0[9].z {W}
804 ALU MOV S14.w : KC0[9].w {WL}
805 ALU MULADD_IEEE S15.x@group : R1.w@fully S14.x S12.x {W}
806 ALU MULADD_IEEE S15.y@group : R1.w@fully S14.y S12.y {W}
807 ALU MULADD_IEEE S15.z@group : R1.w@fully S14.z S12.z {W}
808 ALU MULADD_IEEE S15.w@group : R1.w@fully S14.w S12.w {WL}
809 ALU DOT4_IEEE S16.x@free : R2.x@fully R2.x@fully + R2.y@fully R2.y@fully + R2.z@fully R2.z@fully + I[0].x I[0].x {WL}
810 ALU RECIPSQRT_IEEE S17.x@chan : |S16.x@free| + |S16.x@free| + S16.x@free {WL}
811 ALU MUL_IEEE S18.x : R2.x@fully S17.x@free {W}
812 ALU MUL_IEEE S18.y : R2.y@fully S17.x@free {W}
813 ALU MUL_IEEE S18.z : R2.z@fully S17.x@free {W}
814 ALU MUL_IEEE S18.w : R2.w@fully S17.x@free {WL}
815 ALU MOV S19.x@free : L[0x2] {WL}
816 ALU MOV S20.x : KC0[2].x {W}
817 ALU MOV S20.y : KC0[2].y {W}
818 ALU MOV S20.z : KC0[2].z {W}
819 ALU MOV S20.w : KC0[2].w {WL}
820 ALU MOV S21.x@free : L[0xa] {WL}
821 ALU MOV S22.x : KC0[10].x {W}
822 ALU MOV S22.y : KC0[10].y {W}
823 ALU MOV S22.z : KC0[10].z {W}
824 ALU MOV S22.w : KC0[10].w {WL}
825 ALU DOT4_IEEE S23.x@free : S18.x S22.x + S18.y S22.y + S18.z S22.z + I[0].x I[0].x {WL}
826 ALU MOV S24.x : I[0] {W}
827 ALU MOV S24.y : I[0] {W}
828 ALU MOV S24.z : I[0] {W}
829 ALU MOV S24.w : I[1.0] {WL}
830 ALU MAX_DX10 S25.x@free : S24.y S23.x@free {WL}
831 ALU MOV S26.x : I[0] {W}
832 ALU MOV S26.y : I[0] {W}
833 ALU MOV S26.z : I[0] {W}
834 ALU MOV S26.w : I[0] {WL}
835 ALU SETGT S27.x@free : S23.x@free S26.z {WL}
836 ALU MOV S28.x@free : L[0x3] {WL}
837 ALU MOV S29.x : KC0[3].x {W}
838 ALU MOV S29.y : KC0[3].y {W}
839 ALU MOV S29.z : KC0[3].z {W}
840 ALU MOV S29.w : KC0[3].w {WL}
841 ALU ADD S30.x : S29.x S20.x {W}
842 ALU ADD S30.y : S29.y S20.y {W}
843 ALU ADD S30.z : S29.z S20.z {WL}
844 ALU MOV S31.x@free : L[0x4] {WL}
845 ALU MOV S32.x : KC0[4].x {W}
846 ALU MOV S32.y : KC0[4].y {W}
847 ALU MOV S32.z : KC0[4].z {W}
848 ALU MOV S32.w : KC0[4].w {WL}
849 ALU MULADD_IEEE S33.x : S25.x@free S32.x S30.x {W}
850 ALU MULADD_IEEE S33.y : S25.x@free S32.y S30.y {W}
851 ALU MULADD_IEEE S33.z : S25.x@free S32.z S30.z {WL}
852 ALU MOV S34.x@free : L[0x5] {WL}
853 ALU MOV S35.x : KC0[5].x {W}
854 ALU MOV S35.y : KC0[5].y {W}
855 ALU MOV S35.z : KC0[5].z {W}
856 ALU MOV S35.w : KC0[5].w {WL}
857 ALU MULADD_IEEE CLAMP S36.x : S27.x@free S35.x S33.x {W}
858 ALU MULADD_IEEE CLAMP S36.y : S27.x@free S35.y S33.y {W}
859 ALU MULADD_IEEE CLAMP S36.z : S27.x@free S35.z S33.z {WL}
860 EXPORT_DONE POS 0 S15.xyzw
861 ALU MOV S38.x : S36.x {W}
862 ALU MOV S38.y : S36.y {W}
863 ALU MOV S38.z : S36.z {WL}
864 ALU MOV CLAMP S39.x@free : S20.w {WL}
865 ALU MOV S40.x@group : S38.x {W}
866 ALU MOV S40.y@group : S38.y {W}
867 ALU MOV S40.z@group : S38.z {W}
868 ALU MOV S40.w@group : S39.x@free {WL}
869 EXPORT_DONE PARAM 0 S40.xyzw)";
870 
871 
872 const char *glxgears_vs2_from_nir_expect_optimized =
873 R"(VS
874 CHIPCLASS EVERGREEN
875 INPUT LOC:0 NAME:0
876 INPUT LOC:1 NAME:1
877 OUTPUT LOC:0 NAME:0 MASK:15 SID:0 SPI_SID:0
878 OUTPUT LOC:1 NAME:1 MASK:15 SID:0 SPI_SID:137
879 SYSVALUES R1.xyzw R2.xyzw
880 SHADER
881 ALU MUL_IEEE S6.x : R1.x@fully KC0[6].x {W}
882 ALU MUL_IEEE S6.y : R1.x@fully KC0[6].y {W}
883 ALU MUL_IEEE S6.z : R1.x@fully KC0[6].z {W}
884 ALU MUL_IEEE S6.w : R1.x@fully KC0[6].w {WL}
885 ALU MULADD_IEEE S9.x : R1.y@fully KC0[7].x S6.x {W}
886 ALU MULADD_IEEE S9.y : R1.y@fully KC0[7].y S6.y {W}
887 ALU MULADD_IEEE S9.z : R1.y@fully KC0[7].z S6.z {W}
888 ALU MULADD_IEEE S9.w : R1.y@fully KC0[7].w S6.w {WL}
889 ALU MULADD_IEEE S12.x : R1.z@fully KC0[8].x S9.x {W}
890 ALU MULADD_IEEE S12.y : R1.z@fully KC0[8].y S9.y {W}
891 ALU MULADD_IEEE S12.z : R1.z@fully KC0[8].z S9.z {W}
892 ALU MULADD_IEEE S12.w : R1.z@fully KC0[8].w S9.w {WL}
893 ALU MULADD_IEEE S15.x@group : R1.w@fully KC0[9].x S12.x {W}
894 ALU MULADD_IEEE S15.y@group : R1.w@fully KC0[9].y S12.y {W}
895 ALU MULADD_IEEE S15.z@group : R1.w@fully KC0[9].z S12.z {W}
896 ALU MULADD_IEEE S15.w@group : R1.w@fully KC0[9].w S12.w {WL}
897 ALU DOT4_IEEE S16.x@free : R2.x@fully R2.x@fully + R2.y@fully R2.y@fully + R2.z@fully R2.z@fully + I[0].x I[0].x {WL}
898 ALU RECIPSQRT_IEEE S17.x@free : |S16.x@free| {WL}
899 ALU MUL_IEEE S18.x : R2.x@fully S17.x@free {W}
900 ALU MUL_IEEE S18.y : R2.y@fully S17.x@free {W}
901 ALU MUL_IEEE S18.z : R2.z@fully S17.x@free {W}
902 ALU DOT4_IEEE S23.x@free : S18.x KC0[10].x + S18.y KC0[10].y + S18.z KC0[10].z + I[0].x I[0].x {WL}
903 ALU MAX_DX10 S25.x@free : I[0] S23.x@free {WL}
904 ALU SETGT S27.x@free : S23.x@free I[0] {WL}
905 ALU ADD S30.x : KC0[3].x KC0[2].x {W}
906 ALU ADD S30.y : KC0[3].y KC0[2].y {W}
907 ALU ADD S30.z : KC0[3].z KC0[2].z {WL}
908 ALU MULADD_IEEE S33.x : S25.x@free KC0[4].x S30.x {W}
909 ALU MULADD_IEEE S33.y : S25.x@free KC0[4].y S30.y {W}
910 ALU MULADD_IEEE S33.z : S25.x@free KC0[4].z S30.z {WL}
911 ALU MULADD_IEEE CLAMP S40.x@group : S27.x@free KC0[5].x S33.x {W}
912 ALU MULADD_IEEE CLAMP S40.y@group : S27.x@free KC0[5].y S33.y {W}
913 ALU MULADD_IEEE CLAMP S40.z@group : S27.x@free KC0[5].z S33.z {W}
914 EXPORT_DONE POS 0 S15.xyzw
915 ALU MOV CLAMP S40.w@group : KC0[2].w {WL}
916 EXPORT_DONE PARAM 0 S40.xyzw)";
917 
918 
919 
920 const char *vs_nexted_loop_nir =
921 R"(shader: MESA_SHADER_VERTEX
922 name: GLSL3
923 inputs: 1
924 outputs: 2
925 uniforms: 3
926 shared: 0
927 decl_var uniform INTERP_MODE_NONE int a (0, 0, 0)
928 decl_var uniform INTERP_MODE_NONE int b (1, 1, 0)
929 decl_var uniform INTERP_MODE_NONE int c (2, 2, 0)
930 decl_function main (0 params)
931 
932 impl main {
933    decl_var  INTERP_MODE_NONE vec4 out@gl_Position-temp
934    decl_var  INTERP_MODE_NONE vec4 out@gl_FrontColor-temp
935    decl_reg vec1 32 r2
936    decl_reg vec1 32 r3
937    decl_reg vec1 32 r4
938    decl_reg vec1 32 r5
939    decl_reg vec1 32 r6
940    decl_reg vec1 32 r7
941    decl_reg vec1 32 r8
942    block block_0:
943    /* preds: */
944    vec1 32 ssa_0 = load_const (0x00000000 /* 0.000000 */)
945    vec4 32 ssa_1 = intrinsic load_input (ssa_0) (0, 0, 160, 128) /* base=0 */ /* component=0 */ /* dest_type=float32 */ /* location=0 slots=1 */
946    vec1 32 ssa_2 = load_const (0xffffffff /* -nan */)
947    vec1 32 ssa_3 = load_const (0x00000000 /* 0.000000 */)
948    vec1 32 ssa_4 = load_const (0x00000001 /* 0.000000 */)
949    vec4 32 ssa_5 = load_const (0x3f800000 /* 1.000000 */, 0x3f800000 /* 1.000000 */, 0x00000000 /* 0.000000 */, 0x3f800000 /* 1.000000 */)
950    vec1 32 ssa_6 = load_const (0x00000002 /* 0.000000 */)
951    vec1 32 ssa_7 = intrinsic load_uniform (ssa_0) (0, 1, 34) /* base=0 */ /* range=1 */ /* dest_type=int32 */	/* a */
952    vec1 32 ssa_8 = ieq32 ssa_7, ssa_4
953    /* succs: block_1 block_10 */
954    if ssa_8 {
955       block block_1:
956       /* preds: block_0 */
957       vec1 32 ssa_9 = intrinsic load_uniform (ssa_0) (2, 1, 34) /* base=2 */ /* range=1 */ /* dest_type=int32 */	/* c */
958       vec1 32 ssa_10 = ine32 ssa_9, ssa_4
959       /* succs: block_2 block_8 */
960       if ssa_10 {
961          block block_2:
962          /* preds: block_1 */
963          r3 = mov ssa_4
964          r2 = mov ssa_0
965          /* succs: block_3 */
966          loop {
967             block block_3:
968             /* preds: block_2 block_6 */
969             r4 = i2f32 r2
970             vec1 32 ssa_11 = intrinsic load_uniform (ssa_0) (1, 1, 34) /* base=1 */ /* range=1 */ /* dest_type=int32 */	/* b */
971             vec1 32 ssa_12 = ine32 ssa_11, ssa_6
972             /* succs: block_4 block_5 */
973             if ssa_12 {
974                block block_4:
975                /* preds: block_3 */
976                break
977                /* succs: block_7 */
978             } else {
979                block block_5:
980                /* preds: block_3 */
981                /* succs: block_6 */
982             }
983             block block_6:
984             /* preds: block_5 */
985             r5 = iadd r3, ssa_4
986             r2 = mov r3
987             r3 = mov r5
988             /* succs: block_3 */
989          }
990          block block_7:
991          /* preds: block_4 */
992          vec1 32 ssa_13 = load_const (0x3f800000 /* 1.000000 */)
993          r8 = mov ssa_13
994          r7 = mov r8
995          r6 = mov ssa_2
996          /* succs: block_9 */
997       } else {
998          block block_8:
999          /* preds: block_1 */
1000          vec1 32 ssa_14 = load_const (0x3f800000 /* 1.000000 */)
1001          r8 = mov ssa_14
1002          r7 = mov ssa_0
1003          r4 = mov r8
1004          r6 = mov ssa_3
1005          /* succs: block_9 */
1006       }
1007       block block_9:
1008       /* preds: block_7 block_8 */
1009       /* succs: block_11 */
1010    } else {
1011       block block_10:
1012       /* preds: block_0 */
1013       vec1 32 ssa_15 = load_const (0x3f800000 /* 1.000000 */)
1014       r8 = mov ssa_15
1015       r7 = mov ssa_0
1016       r4 = mov r8
1017       r6 = mov ssa_2
1018       /* succs: block_11 */
1019    }
1020    block block_11:
1021    /* preds: block_9 block_10 */
1022    vec1 32 ssa_16 = b32csel r6, r4, ssa_5.x
1023    vec1 32 ssa_17 = b32csel r6, r7, ssa_5.y
1024    vec1 32 ssa_18 = b32csel r6, r8, ssa_5.w
1025    intrinsic store_output (ssa_1, ssa_0) (0, 15, 0, 160, 128) /* base=0 */ /* wrmask=xyzw */ /* component=0 */ /* src_type=float32 */ /* location=0 slots=1 */
1026    vec1 32 ssa_19 = fsat ssa_16
1027    vec1 32 ssa_20 = fsat ssa_17
1028    vec1 32 ssa_21 = fsat ssa_18
1029    vec4 32 ssa_22 = vec4 ssa_19, ssa_20, ssa_0, ssa_21
1030    intrinsic store_output (ssa_22, ssa_0) (1, 15, 0, 160, 129) /* base=1 */ /* wrmask=xyzw */ /* component=0 */ /* src_type=float32 */ /* location=1 slots=1 */
1031    /* succs: block_12 */
1032    block block_12:
1033 })";
1034 
1035 const char *vs_nexted_loop_from_nir_expect =
1036 R"(VS
1037 CHIPCLASS EVERGREEN
1038 INPUT LOC:0 NAME:0
1039 OUTPUT LOC:0 NAME:0 MASK:15 SID:0 SPI_SID:0
1040 OUTPUT LOC:1 NAME:1 MASK:15 SID:0 SPI_SID:137
1041 SYSVALUES R1.xyzw
1042 REGISTERS R2.x R3.x R4.x R5.x R6.x R7.x R8.x
1043 SHADER
1044 ALU MOV S9.x@free : I[0] {WL}
1045 ALU MOV S10.x@free : I[-1] {WL}
1046 ALU MOV S11.x@free : I[0] {WL}
1047 ALU MOV S12.x@free : I[1] {WL}
1048 ALU MOV S13.x : I[1.0] {W}
1049 ALU MOV S13.y : I[1.0] {W}
1050 ALU MOV S13.z : I[0] {W}
1051 ALU MOV S13.w : I[1.0] {WL}
1052 ALU MOV S14.x@free : L[0x2] {WL}
1053 ALU MOV S15.x@free : KC0[0].x {WL}
1054 ALU SETE_INT S16.x@free : S15.x@free S12.x@free {WL}
1055 IF (( ALU PRED_SETNE_INT __.x@free : S16.x@free I[0] {LEP} PUSH_BEFORE ))
1056   ALU MOV S18.x@free : KC0[2].x {WL}
1057   ALU SETNE_INT S19.x@free : S18.x@free S12.x {WL}
1058   IF (( ALU PRED_SETNE_INT __.y@free : S19.x@free I[0] {LEP} PUSH_BEFORE ))
1059     ALU MOV R3.x : S12.x@free {WL}
1060     ALU MOV R2.x : S9.x@free {WL}
1061     LOOP_BEGIN
1062       ALU INT_TO_FLT R4.x : R2.x {WL}
1063       ALU MOV S21.x@free : KC0[1].x {WL}
1064       ALU SETNE_INT S22.x@free : S21.x@free S14.x@free {WL}
1065       IF (( ALU PRED_SETNE_INT __.z@free : S22.x@free I[0] {LEP} PUSH_BEFORE ))
1066         BREAK
1067       ENDIF
1068       ALU ADD_INT R5.x@free : R3.x S12.x@free {WL}
1069       ALU MOV R2.x : R3.x {WL}
1070       ALU MOV R3.x : R5.x {WL}
1071     LOOP_END
1072     ALU MOV S24.x@free : I[1.0] {WL}
1073     ALU MOV R8.x : S24.x@free {WL}
1074     ALU MOV R7.x : R8.x {WL}
1075     ALU MOV R6.x : S10.x@free {WL}
1076   ELSE
1077     ALU MOV S25.x@free : I[1.0] {WL}
1078     ALU MOV R8.x : S25.x@free {WL}
1079     ALU MOV R7.x : S9.x {WL}
1080     ALU MOV R4.x : R8.x {WL}
1081     ALU MOV R6.x : S11.x@free {WL}
1082   ENDIF
1083 ELSE
1084   ALU MOV S26.x@free : I[1.0] {WL}
1085   ALU MOV R8.x : S26.x@free {WL}
1086   ALU MOV R7.x : S9.x {WL}
1087   ALU MOV R4.x : R8.x {WL}
1088   ALU MOV R6.x : S10.x@free {WL}
1089 ENDIF
1090 ALU CNDE_INT S27.x@free : R6.x S13.x R4.x {WL}
1091 ALU CNDE_INT S28.x@free : R6.x S13.y R7.x {WL}
1092 ALU CNDE_INT S29.x@free : R6.x S13.w R8.x {WL}
1093 EXPORT_DONE POS 0 R1.xyzw
1094 ALU MOV CLAMP S31.x@free : S27.x@free {WL}
1095 ALU MOV CLAMP S32.x@free : S28.x@free {WL}
1096 ALU MOV CLAMP S33.x@free : S29.x@free {WL}
1097 ALU MOV S34.x@group : S31.x@free {W}
1098 ALU MOV S34.y@group : S32.x@free {W}
1099 ALU MOV S34.z@group : S9.x@free {W}
1100 ALU MOV S34.w@group : S33.x@free {WL}
1101 EXPORT_DONE PARAM 0 S34.xyzw
1102 )";
1103 
1104 const char *vs_nexted_loop_from_nir_expect_opt =
1105 R"(
1106 VS
1107 CHIPCLASS EVERGREEN
1108 INPUT LOC:0 NAME:0
1109 OUTPUT LOC:0 NAME:0 MASK:15 SID:0 SPI_SID:0
1110 OUTPUT LOC:1 NAME:1 MASK:15 SID:0 SPI_SID:137
1111 SYSVALUES R1.xyzw
1112 REGISTERS R2.x@free R3.x@free R4.x@free R5.x@free R6.x@free R7.x@free R8.x@free
1113 SHADER
1114 IF (( ALU PREDE_INT __.x@free : KC0[0].x I[1] {LEP} PUSH_BEFORE ))
1115   IF (( ALU PRED_SETNE_INT __.y@free : KC0[2].x I[1]  {LEP} PUSH_BEFORE ))
1116     ALU MOV R3.x : I[1] {WL}
1117     ALU MOV R2.x : I[0] {WL}
1118     LOOP_BEGIN
1119       ALU INT_TO_FLT R4.x : R2.x {WL}
1120       IF (( ALU PRED_SETNE_INT __.z@free : KC0[1].x L[0x2] {LEP} PUSH_BEFORE ))
1121         BREAK
1122       ENDIF
1123       ALU ADD_INT R5.x : R3.x I[1] {WL}
1124       ALU MOV R2.x : R3.x {WL}
1125       ALU MOV R3.x : R5.x {WL}
1126     LOOP_END
1127     ALU MOV R8.x : I[1.0] {WL}
1128     ALU MOV R7.x : R8.x {WL}
1129     ALU MOV R6.x : I[-1] {WL}
1130   ELSE
1131     ALU MOV R8.x : I[1.0] {WL}
1132     ALU MOV R7.x : I[0] {WL}
1133     ALU MOV R4.x : R8.x {WL}
1134     ALU MOV R6.x : I[0] {WL}
1135   ENDIF
1136 ELSE
1137   ALU MOV R8.x : I[1.0] {WL}
1138   ALU MOV R7.x : I[0] {WL}
1139   ALU MOV R4.x : R8.x {WL}
1140   ALU MOV R6.x : I[-1] {WL}
1141 ENDIF
1142 ALU CNDE_INT S27.x@free : R6.x I[1.0] R4.x {WL}
1143 ALU CNDE_INT S28.x@free : R6.x I[1.0] R7.x {WL}
1144 ALU CNDE_INT S29.x@free : R6.x I[1.0] R8.x {WL}
1145 EXPORT_DONE POS 0 R1.xyzw
1146 ALU MOV CLAMP S34.x@group : S27.x@free {W}
1147 ALU MOV CLAMP S34.y@group : S28.x@free {W}
1148 ALU MOV CLAMP S34.w@group : S29.x@free {WL}
1149 EXPORT_DONE PARAM 0 S34.xy0w
1150 )";
1151 
1152 const char *shader_with_local_array_nir =
1153 R"(
1154 shader: MESA_SHADER_FRAGMENT
1155 name: GLSL3
1156 inputs: 2
1157 outputs: 1
1158 uniforms: 2
1159 shared: 0
1160 decl_var uniform INTERP_MODE_NONE int index (1, 0, 0)
1161 decl_var uniform INTERP_MODE_NONE float expect (2, 1, 0)
1162 decl_function main (0 params)
1163 
1164 impl main {
1165 	decl_var  INTERP_MODE_NONE float[4] m1
1166 	decl_var  INTERP_MODE_NONE float[4] m2
1167 	decl_var  INTERP_MODE_NONE vec4 in@packed:m1[0],m1[1],m1[2],m1[3]-temp
1168 	decl_var  INTERP_MODE_NONE vec4 in@packed:m2[0],m2[1],m2[2],m2[3]-temp
1169 	decl_var  INTERP_MODE_NONE vec4 out@gl_FragColor-temp
1170 	decl_reg vec1 32 r0[4]
1171 	decl_reg vec1 32 r1[4]
1172 	decl_reg vec1 32 r2
1173 	block block_0:
1174 	/* preds: */
1175 	vec2 32 ssa_0 = intrinsic load_barycentric_pixel () (0) /* interp_mode=0 */
1176 	vec1 32 ssa_1 = load_const (0x00000000 /* 0.000000 */)
1177 	vec4 32 ssa_2 = intrinsic load_interpolated_input (ssa_0, ssa_1) (0, 0, 160, 160) /* base=0 */ /* component=0 */ /* location=32 slots=1 */
1178 	vec4 32 ssa_3 = intrinsic load_interpolated_input (ssa_0, ssa_1) (1, 0, 160, 161) /* base=1 */ /* component=0 */ /* location=33 slots=1 */
1179 	vec1 32 ssa_4 = load_const (0x00000004 /* 0.000000 */)
1180 	vec1 32 ssa_5 = load_const (0xfffffffc /* -nan */)
1181 	vec4 32 ssa_6 = load_const (0x00000000 /* 0.000000 */, 0x3f800000 /* 1.000000 */, 0x00000000 /* 0.000000 */, 0x3f800000 /* 1.000000 */)
1182 	vec4 32 ssa_7 = load_const (0x3f800000 /* 1.000000 */, 0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */, 0x3f800000 /* 1.000000 */)
1183 	vec1 32 ssa_8 = mov ssa_2.x
1184 	r0[0] = mov ssa_8
1185 	vec1 32 ssa_9 = mov ssa_2.y
1186 	r0[1] = mov ssa_9
1187 	vec1 32 ssa_10 = mov ssa_2.z
1188 	r0[2] = mov ssa_10
1189 	vec1 32 ssa_11 = mov ssa_2.w
1190 	r0[3] = mov ssa_11
1191 	vec1 32 ssa_12 = mov ssa_3.x
1192 	r1[0] = mov ssa_12
1193 	vec1 32 ssa_13 = mov ssa_3.y
1194 	r1[1] = mov ssa_13
1195 	vec1 32 ssa_14 = mov ssa_3.z
1196 	r1[2] = mov ssa_14
1197 	vec1 32 ssa_15 = mov ssa_3.w
1198 	r1[3] = mov ssa_15
1199 	vec1 32 ssa_16 = intrinsic load_uniform (ssa_1) (0, 1, 34) /* base=0 */ /* range=1 */ /* dest_type=int32 */	/* index */
1200 	vec1 32 ssa_17 = ige32 ssa_16, ssa_4
1201 	/* succs: block_1 block_2 */
1202 	if ssa_17 {
1203 		block block_1:
1204 		/* preds: block_0 */
1205 		vec1 32 ssa_18 = iadd ssa_16, ssa_5
1206 		vec1 32 ssa_19 = load_const (0x00000000 /* 0.000000 */)
1207 		vec1 32 ssa_20 = iadd ssa_19, ssa_18
1208 		r2 = mov r1[0 + ssa_20]
1209 		/* succs: block_3 */
1210 	} else {
1211 		block block_2:
1212 		/* preds: block_0 */
1213 		vec1 32 ssa_21 = load_const (0x00000000 /* 0.000000 */)
1214 		vec1 32 ssa_22 = iadd ssa_21, ssa_16
1215 		r2 = mov r0[0 + ssa_22]
1216 		/* succs: block_3 */
1217 	}
1218 	block block_3:
1219 	/* preds: block_1 block_2 */
1220 	vec1 32 ssa_23 = intrinsic load_uniform (ssa_1) (1, 1, 160) /* base=1 */ /* range=1 */ /* dest_type=float32 */	/* expect */
1221 	vec1 32 ssa_24 = feq32 r2, ssa_23
1222 	vec1 32 ssa_25 = fneu32 r2, ssa_23
1223 	vec1 32 ssa_26 = b2f32 ssa_25
1224 	vec1 32 ssa_27 = b2f32 ssa_24
1225 	vec2 32 ssa_28 = b32csel ssa_24.xx, ssa_6.zw, ssa_7.zw
1226 	vec4 32 ssa_29 = vec4 ssa_26, ssa_27, ssa_28.x, ssa_28.y
1227 	intrinsic store_output (ssa_29, ssa_1) (0, 15, 0, 160, 130) /* base=0 */ /* wrmask=xyzw */ /* component=0 */ /* src_type=float32 */ /* location=2 slots=1 */
1228 	/* succs: block_4 */
1229 	block block_4:
1230 }
1231 )";
1232 
1233 const char *shader_with_local_array_expect =
1234 R"(FS
1235 CHIPCLASS EVERGREEN
1236 CHIPCLASS EVERGREEN
1237 PROP MAX_COLOR_EXPORTS:1
1238 PROP COLOR_EXPORTS:1
1239 PROP COLOR_EXPORT_MASK:15
1240 PROP WRITE_ALL_COLORS:1
1241 #PROP RAT_BASE:1
1242 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10 INTERP:2
1243 INPUT LOC:1 NAME:5 SID:10 SPI_SID:11 INTERP:2
1244 OUTPUT LOC:0 NAME:1 MASK:15
1245 REGISTERS R0.x@fully R0.y@fully R1.x
1246 ARRAYS A1[4].x A1[4].y
1247 SHADER
1248 ALU MOV S6.x@free : I[0] {WL}
1249 ALU_GROUP_BEGIN
1250   ALU INTERP_ZW __.x@chan : R0.y@fully Param0.x {} VEC_210
1251   ALU INTERP_ZW __.y@chan : R0.x@fully Param0.y {} VEC_210
1252   ALU INTERP_ZW S7.z@chan : R0.y@fully Param0.z {W} VEC_210
1253   ALU INTERP_ZW S7.w@chan : R0.x@fully Param0.w {WL} VEC_210
1254 ALU_GROUP_END
1255 ALU_GROUP_BEGIN
1256   ALU INTERP_XY S7.x@chan : R0.y@fully Param0.x {W} VEC_210
1257   ALU INTERP_XY S7.y@chan : R0.x@fully Param0.y {W} VEC_210
1258   ALU INTERP_XY __.z@chan : R0.y@fully Param0.z {} VEC_210
1259   ALU INTERP_XY __.w@chan : R0.x@fully Param0.w {L} VEC_210
1260 ALU_GROUP_END
1261 ALU_GROUP_BEGIN
1262   ALU INTERP_ZW __.x@chan : R0.y@fully Param1.x {} VEC_210
1263   ALU INTERP_ZW __.y@chan : R0.x@fully Param1.y {} VEC_210
1264   ALU INTERP_ZW S8.z@chan : R0.y@fully Param1.z {W} VEC_210
1265   ALU INTERP_ZW S8.w@chan : R0.x@fully Param1.w {WL} VEC_210
1266 ALU_GROUP_END
1267 ALU_GROUP_BEGIN
1268   ALU INTERP_XY S8.x@chan : R0.y@fully Param1.x {W} VEC_210
1269   ALU INTERP_XY S8.y@chan : R0.x@fully Param1.y {W} VEC_210
1270   ALU INTERP_XY __.z@chan : R0.y@fully Param1.z {} VEC_210
1271   ALU INTERP_XY __.w@chan : R0.x@fully Param1.w {L} VEC_210
1272 ALU_GROUP_END
1273 ALU MOV S9.x@free : L[0x4] {WL}
1274 ALU MOV S10.x@free : L[0xfffffffc] {WL}
1275 ALU MOV S11.x : I[0] {W}
1276 ALU MOV S11.y : I[1.0] {W}
1277 ALU MOV S11.z : I[0] {W}
1278 ALU MOV S11.w : I[1.0] {WL}
1279 ALU MOV S12.x : I[1.0] {W}
1280 ALU MOV S12.y : I[0] {W}
1281 ALU MOV S12.z : I[0] {W}
1282 ALU MOV S12.w : I[1.0] {WL}
1283 ALU MOV S13.x@free : S7.x@chan {WL}
1284 ALU MOV A1[0].x : S13.x@free {WL}
1285 ALU MOV S14.x@free : S7.y@chan {WL}
1286 ALU MOV A1[1].x : S14.x@free {WL}
1287 ALU MOV S15.x@free : S7.z@chan {WL}
1288 ALU MOV A1[2].x : S15.x@free {WL}
1289 ALU MOV S16.x@free : S7.w@chan {WL}
1290 ALU MOV A1[3].x : S16.x@free {WL}
1291 ALU MOV S17.x@free : S8.x@chan {WL}
1292 ALU MOV A1[0].y : S17.x@free {WL}
1293 ALU MOV S18.x@free : S8.y@chan {WL}
1294 ALU MOV A1[1].y : S18.x@free {WL}
1295 ALU MOV S19.x@free : S8.z@chan {WL}
1296 ALU MOV A1[2].y : S19.x@free {WL}
1297 ALU MOV S20.x@free : S8.w@chan {WL}
1298 ALU MOV A1[3].y : S20.x@free {WL}
1299 ALU MOV S21.x@free : KC0[0].x {WL}
1300 ALU SETGE_INT S22.x@free : S21.x@free S9.x@free {WL}
1301 IF (( ALU PRED_SETNE_INT __.x@free : S22.x@free I[0] {LEP} PUSH_BEFORE ))
1302   ALU ADD_INT S24.x@free : S21.x@free S10.x@free {WL}
1303   ALU MOV S25.x@free : I[0] {WL}
1304   ALU ADD_INT S26.x@free : S25.x@free S24.x@free {WL}
1305   ALU MOV R5.x@free : A1[S26.x@free].y {WL}
1306 ELSE
1307   ALU MOV S27.x@free : I[0] {WL}
1308   ALU ADD_INT S28.x@free : S27.x@free S21.x@free {WL}
1309   ALU MOV R5.x@free : A1[S28.x@free].x {WL}
1310 ENDIF
1311 ALU MOV S29.x@free : KC0[1].x {WL}
1312 ALU SETE_DX10 S30.x@free : R5.x@free S29.x@free {WL}
1313 ALU SETNE_DX10 S31.x@free : R5.x@free S29.x@free {WL}
1314 ALU AND_INT S32.x@free : S31.x@free I[1.0] {WL}
1315 ALU AND_INT S33.x@free : S30.x@free I[1.0] {WL}
1316 ALU CNDE_INT S34.x : S30.x@free S12.z S11.z {W}
1317 ALU CNDE_INT S34.y : S30.x@free S12.w S11.w {WL}
1318 ALU MOV S35.x@group : S32.x@free {W}
1319 ALU MOV S35.y@group : S33.x@free {W}
1320 ALU MOV S35.z@group : S34.x {W}
1321 ALU MOV S35.w@group : S34.y {WL}
1322 EXPORT_DONE PIXEL 0 S35.xyzw)";
1323 
1324 const char *test_schedule_group =
1325 R"(FS
1326 CHIPCLASS EVERGREEN
1327 PROP MAX_COLOR_EXPORTS:1
1328 PROP COLOR_EXPORTS:1
1329 PROP COLOR_EXPORT_MASK:15
1330 PROP WRITE_ALL_COLORS:1
1331 OUTPUT LOC:0 NAME:1 MASK:15
1332 SHADER
1333 ALU MOV S0.x : I[0] {WL}
1334 ALU MOV S1.x : I[1.0] {WL}
1335 ALU MOV S2.x : KC0[0].x {W}
1336 ALU MOV S2.y : KC0[0].y {WL}
1337 ALU MOV S3.x : KC0[2].x {W}
1338 ALU MOV S3.y : KC0[2].y {WL}
1339 ALU ADD S4.x : |S2.x| -S3.x {W}
1340 ALU ADD S4.y : |S2.y| -S3.y {WL}
1341 ALU DOT4_IEEE S5.x : S4.x S4.x + S4.y S4.y + I[0] I[0] + I[0] I[0] {WL}
1342 ALU SQRT_IEEE S6.x : S5.x {WL}
1343 ALU MOV S7.x : KC0[1].x {WL}
1344 ALU SETGE_DX10 S8.x : S7.x S6.x {WL}
1345 ALU NOT_INT S9.x : S8.x {WL}
1346 ALU AND_INT S10.x : S9.x I[1.0] {WL}
1347 ALU AND_INT S11.x : S8.x I[1.0] {WL}
1348 ALU MOV S12.x@group : S10.x {W}
1349 ALU MOV S12.y@group : S11.x {W}
1350 ALU MOV S12.z@group : S0.x {W}
1351 ALU MOV S12.w@group : S1.x {WL}
1352 EXPORT_DONE PIXEL 0 S12.xyzw
1353 )";
1354 
1355 const char *test_schedule_group_expect =
1356 R"(FS
1357 CHIPCLASS EVERGREEN
1358 PROP MAX_COLOR_EXPORTS:1
1359 PROP COLOR_EXPORTS:1
1360 PROP COLOR_EXPORT_MASK:15
1361 PROP WRITE_ALL_COLORS:1
1362 OUTPUT LOC:0 NAME:1 MASK:15
1363 SHADER
1364 BLOCK_START
1365 ALU_GROUP_BEGIN
1366   ALU ADD S4.x@chan : |KC0[0].x| -KC0[2].x {W}
1367   ALU ADD S4.y@chan : |KC0[0].y| -KC0[2].y {WL}
1368 ALU_GROUP_END
1369 ALU_GROUP_BEGIN
1370   ALU DOT4_IEEE S5.x@chan : S4.x@chan S4.x@chan {W}
1371   ALU DOT4_IEEE __.y@chan : S4.y@chan S4.y@chan {}
1372   ALU DOT4_IEEE __.z@chan : I[0] I[0] {}
1373   ALU DOT4_IEEE __.w@chan : I[0] I[0] {L}
1374 ALU_GROUP_END
1375 ALU_GROUP_BEGIN
1376   ALU SQRT_IEEE S6.x : S5.x@chan {WL}
1377 ALU_GROUP_END
1378 ALU_GROUP_BEGIN
1379   ALU SETGE_DX10 S8.x : KC0[1].x S6.x {WL}
1380 ALU_GROUP_END
1381 ALU_GROUP_BEGIN
1382   ALU NOT_INT S9.x : S8.x {W}
1383   ALU AND_INT S12.y@group : S8.x I[1.0] {WL}
1384 ALU_GROUP_END
1385 ALU_GROUP_BEGIN
1386   ALU AND_INT S12.x@group : S9.x I[1.0] {WL}
1387 ALU_GROUP_END
1388 BLOCK_END
1389 BLOCK_START
1390 EXPORT_DONE PIXEL 0 S12.xy01
1391 BLOCK_END
1392 )";
1393 
1394 
1395 const char *shader_with_bany_nir =
1396 R"(shader: MESA_SHADER_FRAGMENT
1397 source_sha1: {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}
1398 name: GLSL3
1399 inputs: 0
1400 outputs: 1
1401 uniforms: 8
1402 shared: 0
1403 ray queries: 0
1404 decl_var uniform INTERP_MODE_NONE mat4 arg0 (0, 0, 0)
1405 decl_var uniform INTERP_MODE_NONE mat4 arg1 (1, 4, 0)
1406 decl_function main (0 params)
1407 
1408 impl main {
1409 	decl_var  INTERP_MODE_NONE vec4 out@gl_FragColor-temp
1410 	block block_0:
1411 	/* preds: */
1412 	vec1 32 ssa_0 = load_const (0x00000000 /* 0.000000 */)
1413 	vec1 32 ssa_1 = load_const (0x00000001 /* 0.000000 */)
1414 	vec1 32 ssa_2 = load_const (0x00000002 /* 0.000000 */)
1415 	vec1 32 ssa_3 = load_const (0x00000003 /* 0.000000 */)
1416 	vec4 32 ssa_4 = intrinsic load_uniform (ssa_0) (4, 4, 160) /* base=4 */ /* range=4 */ /* dest_type=float32 */	/* arg1 */
1417 	vec4 32 ssa_5 = intrinsic load_uniform (ssa_0) (0, 4, 160) /* base=0 */ /* range=4 */ /* dest_type=float32 */	/* arg0 */
1418 	vec1 32 ssa_6 = b32any_fnequal4 ssa_4, ssa_5
1419 	vec4 32 ssa_7 = intrinsic load_uniform (ssa_1) (4, 4, 160) /* base=4 */ /* range=4 */ /* dest_type=float32 */	/* arg1 */
1420 	vec4 32 ssa_8 = intrinsic load_uniform (ssa_1) (0, 4, 160) /* base=0 */ /* range=4 */ /* dest_type=float32 */	/* arg0 */
1421 	vec1 32 ssa_9 = b32any_fnequal4 ssa_7, ssa_8
1422 	vec4 32 ssa_10 = intrinsic load_uniform (ssa_2) (4, 4, 160) /* base=4 */ /* range=4 */ /* dest_type=float32 */	/* arg1 */
1423 	vec4 32 ssa_11 = intrinsic load_uniform (ssa_2) (0, 4, 160) /* base=0 */ /* range=4 */ /* dest_type=float32 */	/* arg0 */
1424 	vec1 32 ssa_12 = b32any_fnequal4 ssa_10, ssa_11
1425 	vec4 32 ssa_13 = intrinsic load_uniform (ssa_3) (4, 4, 160) /* base=4 */ /* range=4 */ /* dest_type=float32 */	/* arg1 */
1426 	vec4 32 ssa_14 = intrinsic load_uniform (ssa_3) (0, 4, 160) /* base=0 */ /* range=4 */ /* dest_type=float32 */	/* arg0 */
1427 	vec1 32 ssa_15 = b32any_fnequal4 ssa_13, ssa_14
1428 	vec4 32 ssa_16 = vec4 ssa_6, ssa_9, ssa_12, ssa_15
1429 	vec4 32 ssa_17 = load_const (0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */)
1430 	vec1 32 ssa_18 = b32any_inequal4 ssa_16, ssa_17
1431 	vec1 32 ssa_19 = inot ssa_18
1432 	vec1 32 ssa_20 = b2f32 ssa_19
1433 	vec4 32 ssa_21 = vec4 ssa_20, ssa_0, ssa_0, ssa_0
1434 	intrinsic store_output (ssa_21, ssa_0) (0, 15, 0, 160, 130) /* base=0 */ /* wrmask=xyzw */ /* component=0 */ /* src_type=float32 */ /* location=2 slots=1 */
1435 	/* succs: block_1 */
1436 	block block_1:
1437 })";
1438 
1439 
1440 const char *shader_with_bany_expect_eg =
1441 R"(FS
1442 CHIPCLASS EVERGREEN
1443 PROP MAX_COLOR_EXPORTS:1
1444 PROP COLOR_EXPORTS:1
1445 PROP COLOR_EXPORT_MASK:15
1446 PROP WRITE_ALL_COLORS:1
1447 OUTPUT LOC:0 NAME:1 MASK:15
1448 SHADER
1449 ALU MOV S0.x@free : I[0] {WL}
1450 ALU MOV S1.x@free : I[1] {WL}
1451 ALU MOV S2.x@free : L[0x2] {WL}
1452 ALU MOV S3.x@free : L[0x3] {WL}
1453 ALU MOV S4.x : KC0[4].x {W}
1454 ALU MOV S4.y : KC0[4].y {W}
1455 ALU MOV S4.z : KC0[4].z {W}
1456 ALU MOV S4.w : KC0[4].w {WL}
1457 ALU MOV S5.x : KC0[0].x {W}
1458 ALU MOV S5.y : KC0[0].y {W}
1459 ALU MOV S5.z : KC0[0].z {W}
1460 ALU MOV S5.w : KC0[0].w {WL}
1461 ALU SETNE S6.x@group : S4.x S5.x {W}
1462 ALU SETNE S6.y@group : S4.y S5.y {W}
1463 ALU SETNE S6.z@group : S4.z S5.z {W}
1464 ALU SETNE S6.w@group : S4.w S5.w {WL}
1465 ALU MAX4 S7.x@free : S6.x@group + S6.y@group + S6.z@group + S6.w@group {WL}
1466 ALU SETE_DX10 S8.x@free : S7.x@free I[1.0] {WL}
1467 ALU MOV S9.x : KC0[5].x {W}
1468 ALU MOV S9.y : KC0[5].y {W}
1469 ALU MOV S9.z : KC0[5].z {W}
1470 ALU MOV S9.w : KC0[5].w {WL}
1471 ALU MOV S10.x : KC0[1].x {W}
1472 ALU MOV S10.y : KC0[1].y {W}
1473 ALU MOV S10.z : KC0[1].z {W}
1474 ALU MOV S10.w : KC0[1].w {WL}
1475 ALU SETNE S11.x@group : S9.x S10.x {W}
1476 ALU SETNE S11.y@group : S9.y S10.y {W}
1477 ALU SETNE S11.z@group : S9.z S10.z {W}
1478 ALU SETNE S11.w@group : S9.w S10.w {WL}
1479 ALU MAX4 S12.y@free : S11.x@group + S11.y@group + S11.z@group + S11.w@group {WL}
1480 ALU SETE_DX10 S13.x@free : S12.y@free I[1.0] {WL}
1481 ALU MOV S14.x : KC0[6].x {W}
1482 ALU MOV S14.y : KC0[6].y {W}
1483 ALU MOV S14.z : KC0[6].z {W}
1484 ALU MOV S14.w : KC0[6].w {WL}
1485 ALU MOV S15.x : KC0[2].x {W}
1486 ALU MOV S15.y : KC0[2].y {W}
1487 ALU MOV S15.z : KC0[2].z {W}
1488 ALU MOV S15.w : KC0[2].w {WL}
1489 ALU SETNE S16.x@group : S14.x S15.x {W}
1490 ALU SETNE S16.y@group : S14.y S15.y {W}
1491 ALU SETNE S16.z@group : S14.z S15.z {W}
1492 ALU SETNE S16.w@group : S14.w S15.w {WL}
1493 ALU MAX4 S17.z@free : S16.x@group + S16.y@group + S16.z@group + S16.w@group {WL}
1494 ALU SETE_DX10 S18.x@free : S17.z@free I[1.0] {WL}
1495 ALU MOV S19.x : KC0[7].x {W}
1496 ALU MOV S19.y : KC0[7].y {W}
1497 ALU MOV S19.z : KC0[7].z {W}
1498 ALU MOV S19.w : KC0[7].w {WL}
1499 ALU MOV S20.x : KC0[3].x {W}
1500 ALU MOV S20.y : KC0[3].y {W}
1501 ALU MOV S20.z : KC0[3].z {W}
1502 ALU MOV S20.w : KC0[3].w {WL}
1503 ALU SETNE S21.x@group : S19.x S20.x {W}
1504 ALU SETNE S21.y@group : S19.y S20.y {W}
1505 ALU SETNE S21.z@group : S19.z S20.z {W}
1506 ALU SETNE S21.w@group : S19.w S20.w {WL}
1507 ALU MAX4 S22.w@free : S21.x@group + S21.y@group + S21.z@group + S21.w@group {WL}
1508 ALU SETE_DX10 S23.x@free : S22.w@free I[1.0] {WL}
1509 ALU MOV S24.x : S8.x@free {W}
1510 ALU MOV S24.y : S13.x@free {W}
1511 ALU MOV S24.z : S18.x@free {W}
1512 ALU MOV S24.w : S23.x@free {WL}
1513 ALU MOV S25.x : I[0] {W}
1514 ALU MOV S25.y : I[0] {W}
1515 ALU MOV S25.z : I[0] {W}
1516 ALU MOV S25.w : I[0] {WL}
1517 ALU SETNE_INT S27.x@free : S24.x S25.x {W}
1518 ALU SETNE_INT S28.y@free : S24.y S25.y {W}
1519 ALU SETNE_INT S29.z@free : S24.z S25.z {W}
1520 ALU SETNE_INT S30.w@free : S24.w S25.w {WL}
1521 ALU OR_INT S31.x@free : S27.x@free S28.y@free {W}
1522 ALU OR_INT S32.y@free : S29.z@free S30.w@free {WL}
1523 ALU OR_INT S26.x@free : S31.x@free S32.y@free {WL}
1524 ALU NOT_INT S33.x@free : S26.x@free {WL}
1525 ALU AND_INT S34.x@free : S33.x@free I[1.0] {WL}
1526 ALU MOV S35.x@group : S34.x@free {W}
1527 ALU MOV S35.y@group : S0.x@free {W}
1528 ALU MOV S35.z@group : S0.x@free {W}
1529 ALU MOV S35.w@group : S0.x@free {WL}
1530 EXPORT_DONE PIXEL 0 S35.xyzw
1531 )";
1532 
1533 const char *shader_with_bany_expect_opt_sched_eg =
1534 R"(FS
1535 CHIPCLASS EVERGREEN
1536 PROP MAX_COLOR_EXPORTS:1
1537 PROP COLOR_EXPORTS:1
1538 PROP COLOR_EXPORT_MASK:15
1539 PROP WRITE_ALL_COLORS:1
1540 OUTPUT LOC:0 NAME:1 MASK:15
1541 SHADER
1542 BLOCK_START
1543 ALU_GROUP_BEGIN
1544   ALU SETNE S6.x@chgr : KC0[4].x KC0[0].x {W}
1545   ALU SETNE S6.y@chgr : KC0[4].y KC0[0].y {WL}
1546 ALU_GROUP_END
1547 ALU_GROUP_BEGIN
1548   ALU SETNE S6.z@chgr : KC0[4].z KC0[0].z {W}
1549   ALU SETNE S6.w@chgr : KC0[4].w KC0[0].w {WL}
1550 ALU_GROUP_END
1551 ALU_GROUP_BEGIN
1552   ALU MAX4 S7.x@chan : S6.x@chgr {W}
1553   ALU MAX4 __.y@chan : S6.y@chgr {}
1554   ALU MAX4 __.z@chan : S6.z@chgr {}
1555   ALU MAX4 __.w@chan : S6.w@chgr {}
1556   ALU SETNE S11.x@chgr : KC0[5].x KC0[1].x {WL}
1557 ALU_GROUP_END
1558 ALU_GROUP_BEGIN
1559   ALU SETE_DX10 S8.x@free : S7.x@chan I[1.0] {W}
1560   ALU SETNE S11.y@chgr : KC0[5].y KC0[1].y {WL}
1561 ALU_GROUP_END
1562 ALU_GROUP_BEGIN
1563   ALU SETNE_INT S27.x@chan : S8.x@free I[0] {W}
1564   ALU SETNE S11.z@chgr : KC0[5].z KC0[1].z {W}
1565   ALU SETNE S11.w@chgr : KC0[5].w KC0[1].w {WL}
1566 ALU_GROUP_END
1567 ALU_GROUP_BEGIN
1568   ALU MAX4 __.x@chan : S11.x@chgr {}
1569   ALU MAX4 S12.y@chan : S11.y@chgr {W}
1570   ALU MAX4 __.z@chan : S11.z@chgr {}
1571   ALU MAX4 __.w@chan : S11.w@chgr {}
1572   ALU SETNE S16.x@chgr : KC0[6].x KC0[2].x {WL}
1573 ALU_GROUP_END
1574 ALU_GROUP_BEGIN
1575   ALU SETE_DX10 S13.x@free : S12.y@chan I[1.0] {W}
1576   ALU SETNE S16.y@chgr : KC0[6].y KC0[2].y {WL}
1577 ALU_GROUP_END
1578 ALU_GROUP_BEGIN
1579   ALU SETNE_INT S28.y@chan : S13.x@free I[0] {W}
1580   ALU SETNE S16.z@chgr : KC0[6].z KC0[2].z {W}
1581   ALU SETNE S16.w@chgr : KC0[6].w KC0[2].w {WL}
1582 ALU_GROUP_END
1583 ALU_GROUP_BEGIN
1584   ALU MAX4 __.x@chan : S16.x@chgr {}
1585   ALU MAX4 __.y@chan : S16.y@chgr {}
1586   ALU MAX4 S17.z@chan : S16.z@chgr {W}
1587   ALU MAX4 __.w@chan : S16.w@chgr {}
1588   ALU OR_INT S31.x@chan : S27.x@chan S28.y@chan {WL}
1589 ALU_GROUP_END
1590 ALU_GROUP_BEGIN
1591   ALU SETNE S21.x@chgr : KC0[7].x KC0[3].x {W}
1592   ALU SETNE S21.y@chgr : KC0[7].y KC0[3].y {W}
1593   ALU SETE_DX10 S18.z@chan : S17.z@chan I[1.0] {WL}
1594 ALU_GROUP_END
1595 ALU_GROUP_BEGIN
1596   ALU SETNE_INT S29.x@chan : S18.z@chan I[0] {W}
1597   ALU SETNE S21.z@chgr : KC0[7].z KC0[3].z {W}
1598   ALU SETNE S21.w@chgr : KC0[7].w KC0[3].w {WL}
1599 ALU_GROUP_END
1600 ALU_GROUP_BEGIN
1601   ALU MAX4 __.x@chan : S21.x@chgr {}
1602   ALU MAX4 __.y@chan : S21.y@chgr {}
1603   ALU MAX4 __.z@chan : S21.z@chgr {}
1604   ALU MAX4 S22.w@chan : S21.w@chgr {WL}
1605 ALU_GROUP_END
1606 ALU_GROUP_BEGIN
1607   ALU SETE_DX10 S23.x@free : S22.w@chan I[1.0] {WL}
1608 ALU_GROUP_END
1609 ALU_GROUP_BEGIN
1610   ALU SETNE_INT S30.w@chan : S23.x@free I[0] {WL}
1611 ALU_GROUP_END
1612 ALU_GROUP_BEGIN
1613   ALU OR_INT S32.y@chan : S29.x@chan S30.w@chan {WL}
1614 ALU_GROUP_END
1615 ALU_GROUP_BEGIN
1616   ALU OR_INT S26.x@chan : S31.x@chan S32.y@chan {WL}
1617 ALU_GROUP_END
1618 ALU_GROUP_BEGIN
1619   ALU NOT_INT S33.x@free : S26.x@chan {WL}
1620 ALU_GROUP_END
1621 ALU_GROUP_BEGIN
1622   ALU AND_INT S35.x@group : S33.x@free I[1.0] {WL}
1623 ALU_GROUP_END
1624 BLOCK_END
1625 BLOCK_START
1626 EXPORT_DONE PIXEL 0 S35.x000
1627 BLOCK_END
1628 )";
1629 
1630 const char *shader_copy_prop_dont_kill_double_use =
1631 R"(FS
1632 CHIPCLASS EVERGREEN
1633 PROP MAX_COLOR_EXPORTS:1
1634 PROP COLOR_EXPORTS:1
1635 PROP COLOR_EXPORT_MASK:15
1636 PROP WRITE_ALL_COLORS:1
1637 OUTPUT LOC:0 NAME:1 MASK:15
1638 SHADER
1639 ALU MOV S0.x : I[0] {WL}
1640 ALU MOV S1.x : I[1] {WL}
1641 ALU MOV S2.x : I[1.0] {WL}
1642 ALU MOV S3.x : KC0[2].x {W}
1643 ALU MOV S3.y : KC0[2].y {WL}
1644 ALU MOV S4.x : KC0[0].x {W}
1645 ALU MOV S4.y : KC0[0].y {WL}
1646 ALU SETNE_DX10 S5.x : S3.y S4.y {W}
1647 ALU SETNE_DX10 S5.y : S3.x S4.x {WL}
1648 ALU OR_INT S6.x : S5.x S5.y {WL}
1649 ALU MOV S7.x : KC0[3].x {W}
1650 ALU MOV S7.y : KC0[3].y {WL}
1651 ALU MOV S8.x : KC0[1].x {W}
1652 ALU MOV S8.y : KC0[1].y {WL}
1653 ALU SETNE_DX10 S9.x : S7.y S8.y {W}
1654 ALU SETNE_DX10 S9.y : S7.x S8.x {WL}
1655 ALU OR_INT S10.x : S9.x S9.y {WL}
1656 ALU OR_INT S11.x : S10.x S6.x {WL}
1657 ALU NOT_INT S12.x : S11.x {WL}
1658 ALU AND_INT S13.x : S12.x I[1.0] {WL}
1659 ALU AND_INT S14.x : S11.x I[1.0] {WL}
1660 ALU MOV S15.x@group : S13.x {W}
1661 ALU MOV S15.y@group : S13.x {W}
1662 ALU MOV S15.z@group : S14.x {W}
1663 ALU MOV S15.w@group : S2.x {WL}
1664 EXPORT_DONE PIXEL 0 S15.xyzw
1665 )";
1666 
1667 
1668 const char *shader_copy_prop_dont_kill_double_use_expect =
1669 R"(
1670 FS
1671 CHIPCLASS EVERGREEN
1672 PROP MAX_COLOR_EXPORTS:1
1673 PROP COLOR_EXPORTS:1
1674 PROP COLOR_EXPORT_MASK:15
1675 PROP WRITE_ALL_COLORS:1
1676 OUTPUT LOC:0 NAME:1 MASK:15
1677 SHADER
1678 BLOCK_START
1679 ALU_GROUP_BEGIN
1680   ALU SETNE_DX10 S5.x : KC0[2].y KC0[0].y {W}
1681   ALU SETNE_DX10 S5.y : KC0[2].x KC0[0].x {WL}
1682 ALU_GROUP_END
1683 ALU_GROUP_BEGIN
1684   ALU OR_INT S6.x : S5.x S5.y {W}
1685   ALU SETNE_DX10 S9.y : KC0[3].x KC0[1].x {W}
1686   ALU SETNE_DX10 S9.x : KC0[3].y KC0[1].y {WL}
1687 ALU_GROUP_END
1688 ALU_GROUP_BEGIN
1689   ALU OR_INT S10.x : S9.x S9.y {WL}
1690 ALU_GROUP_END
1691 ALU_GROUP_BEGIN
1692   ALU OR_INT S11.x : S10.x S6.x {WL}
1693 ALU_GROUP_END
1694 ALU_GROUP_BEGIN
1695   ALU NOT_INT S12.x : S11.x {W}
1696   ALU AND_INT S15.z@group : S11.x I[1.0] {WL}
1697 ALU_GROUP_END
1698 ALU_GROUP_BEGIN
1699   ALU AND_INT S13.x : S12.x I[1.0] {WL}
1700 ALU_GROUP_END
1701 ALU_GROUP_BEGIN
1702   ALU MOV S15.x@group : S13.x {W}
1703   ALU MOV S15.y@group : S13.x {WL}
1704 ALU_GROUP_END
1705 BLOCK_END
1706 BLOCK_START
1707 EXPORT_DONE PIXEL 0 S15.xyz1
1708 BLOCK_END
1709 )";
1710 
1711 
1712 const char *shader_with_dest_array =
1713 R"(VS
1714 CHIPCLASS EVERGREEN
1715 INPUT LOC:0 NAME:0
1716 OUTPUT LOC:0 NAME:0 MASK:15
1717 OUTPUT LOC:1 NAME:5 MASK:15 SID:9 SPI_SID:10
1718 OUTPUT LOC:2 NAME:5 MASK:15 SID:10 SPI_SID:11
1719 OUTPUT LOC:3 NAME:5 MASK:15 SID:11 SPI_SID:12
1720 OUTPUT LOC:4 NAME:5 MASK:15 SID:12 SPI_SID:13
1721 REGISTERS R1.xyzw
1722 ARRAYS A2[4].xy A2[4].zw
1723 SHADER
1724 ALU MOV S6.x : I[0] {WL}
1725 ALU MOV S7.x : I[1] {WL}
1726 ALU MOV S8.x : L[0x2] {WL}
1727 ALU MOV S9.x : L[0x3] {WL}
1728 ALU MOV S10.x : L[0x4] {WL}
1729 ALU MOV S11.x : L[0xfffffffc] {WL}
1730 ALU MOV S12.x : KC0[1].x {W}
1731 ALU MOV S12.y : KC0[1].y {W}
1732 ALU MOV S12.z : KC0[1].z {W}
1733 ALU MOV S12.w : KC0[1].w {WL}
1734 ALU MOV S13.x : KC0[2].x {W}
1735 ALU MOV S13.y : KC0[2].y {W}
1736 ALU MOV S13.z : KC0[2].z {W}
1737 ALU MOV S13.w : KC0[2].w {WL}
1738 ALU MUL_IEEE S14.x : S13.x R1.y@fully {W}
1739 ALU MUL_IEEE S14.y : S13.y R1.y@fully {W}
1740 ALU MUL_IEEE S14.z : S13.z R1.y@fully {W}
1741 ALU MUL_IEEE S14.w : S13.w R1.y@fully {WL}
1742 ALU MULADD_IEEE S15.x : S12.x R1.x@fully S14.x {W}
1743 ALU MULADD_IEEE S15.y : S12.y R1.x@fully S14.y {W}
1744 ALU MULADD_IEEE S15.z : S12.z R1.x@fully S14.z {W}
1745 ALU MULADD_IEEE S15.w : S12.w R1.x@fully S14.w {WL}
1746 ALU MOV S16.x : KC0[3].x {W}
1747 ALU MOV S16.y : KC0[3].y {W}
1748 ALU MOV S16.z : KC0[3].z {W}
1749 ALU MOV S16.w : KC0[3].w {WL}
1750 ALU MULADD_IEEE S17.x : S16.x R1.z@fully S15.x {W}
1751 ALU MULADD_IEEE S17.y : S16.y R1.z@fully S15.y {W}
1752 ALU MULADD_IEEE S17.z : S16.z R1.z@fully S15.z {W}
1753 ALU MULADD_IEEE S17.w : S16.w R1.z@fully S15.w {WL}
1754 ALU MOV S18.x : KC0[4].x {W}
1755 ALU MOV S18.y : KC0[4].y {W}
1756 ALU MOV S18.z : KC0[4].z {W}
1757 ALU MOV S18.w : KC0[4].w {WL}
1758 ALU MULADD_IEEE S19.x@group : S18.x R1.w@fully S17.x {W}
1759 ALU MULADD_IEEE S19.y@group : S18.y R1.w@fully S17.y {W}
1760 ALU MULADD_IEEE S19.z@group : S18.z R1.w@fully S17.z {W}
1761 ALU MULADD_IEEE S19.w@group : S18.w R1.w@fully S17.w {WL}
1762 ALU MOV S20.x : I[1.0] {W}
1763 ALU MOV S20.y : L[0x3f8ccccd] {WL}
1764 ALU MOV A2[0].x : S20.x {W}
1765 ALU MOV A2[0].y : S20.y {WL}
1766 ALU MOV S21.x : L[0x40000000] {W}
1767 ALU MOV S21.y : L[0x40066666] {WL}
1768 ALU MOV A2[1].x : S21.x {W}
1769 ALU MOV A2[1].y : S21.y {WL}
1770 ALU MOV S22.x : L[0x40400000] {W}
1771 ALU MOV S22.y : L[0x40466666] {WL}
1772 ALU MOV A2[2].x : S22.x {W}
1773 ALU MOV A2[2].y : S22.y {WL}
1774 ALU MOV S23.x : L[0x40800000] {W}
1775 ALU MOV S23.y : L[0x40833333] {WL}
1776 ALU MOV A2[3].x : S23.x {W}
1777 ALU MOV A2[3].y : S23.y {WL}
1778 ALU MOV S24.x : L[0x40a00000] {W}
1779 ALU MOV S24.y : L[0x40a33333] {WL}
1780 ALU MOV A2[0].z : S24.x {W}
1781 ALU MOV A2[0].w : S24.y {WL}
1782 ALU MOV S25.x : L[0x40c00000] {W}
1783 ALU MOV S25.y : L[0x40c33333] {WL}
1784 ALU MOV A2[1].z : S25.x {W}
1785 ALU MOV A2[1].w : S25.y {WL}
1786 ALU MOV S26.x : L[0x40e00000] {W}
1787 ALU MOV S26.y : L[0x40e33333] {WL}
1788 ALU MOV A2[2].z : S26.x {W}
1789 ALU MOV A2[2].w : S26.y {WL}
1790 ALU MOV S27.x : L[0x41000000] {W}
1791 ALU MOV S27.y : L[0x4101999a] {WL}
1792 ALU MOV A2[3].z : S27.x {W}
1793 ALU MOV A2[3].w : S27.y {WL}
1794 ALU MOV S28.x : KC0[0].x {WL}
1795 ALU SETGE_INT S29.x : S28.x S10.x {WL}
1796 IF (( ALU PRED_SETNE_INT __.x@free : S29.x I[0] {LEP} PUSH_BEFORE ))
1797   ALU ADD_INT S31.x : S28.x S11.x {WL}
1798   ALU MOV S32.x : I[0] {W}
1799   ALU MOV S32.y : L[0x3dcccccd] {WL}
1800   ALU MOV S33.x : I[0] {WL}
1801   ALU ADD_INT S34.x : S33.x S31.x {WL}
1802   ALU MOV A2[S34.x].z : S32.x {W}
1803   ALU MOV A2[S34.x].w : S32.y {WL}
1804 ELSE
1805   ALU MOV S35.x : I[0] {W}
1806   ALU MOV S35.y : L[0x3dcccccd] {WL}
1807   ALU MOV S36.x : I[0] {WL}
1808   ALU ADD_INT S37.x : S36.x S28.x {WL}
1809   ALU MOV A2[S37.x].x : S35.x {W}
1810   ALU MOV A2[S37.x].y : S35.y {WL}
1811 ENDIF
1812 ALU MOV S38.x : A2[0].x {W}
1813 ALU MOV S38.y : A2[0].y {WL}
1814 ALU MOV S39.x : A2[1].x {W}
1815 ALU MOV S39.y : A2[1].y {WL}
1816 ALU MOV S40.x : A2[2].x {W}
1817 ALU MOV S40.y : A2[2].y {WL}
1818 ALU MOV S41.x : A2[3].x {W}
1819 ALU MOV S41.y : A2[3].y {WL}
1820 ALU MOV S42.x : A2[0].z {W}
1821 ALU MOV S42.y : A2[0].w {WL}
1822 ALU MOV S43.x : A2[1].z {W}
1823 ALU MOV S43.y : A2[1].w {WL}
1824 ALU MOV S44.x : A2[2].z {W}
1825 ALU MOV S44.y : A2[2].w {WL}
1826 ALU MOV S45.x : A2[3].z {W}
1827 ALU MOV S45.y : A2[3].w {WL}
1828 EXPORT_DONE POS 0 S19.xyzw
1829 ALU MOV S46.x@group : S38.x {W}
1830 ALU MOV S46.y@group : S38.y {W}
1831 ALU MOV S46.z@group : S39.x {W}
1832 ALU MOV S46.w@group : S39.y {WL}
1833 EXPORT PARAM 0 S46.xyzw
1834 ALU MOV S47.x@group : S40.x {W}
1835 ALU MOV S47.y@group : S40.y {W}
1836 ALU MOV S47.z@group : S41.x {W}
1837 ALU MOV S47.w@group : S41.y {WL}
1838 EXPORT PARAM 1 S47.xyzw
1839 ALU MOV S48.x@group : S42.x {W}
1840 ALU MOV S48.y@group : S42.y {W}
1841 ALU MOV S48.z@group : S43.x {W}
1842 ALU MOV S48.w@group : S43.y {WL}
1843 EXPORT PARAM 2 S48.xyzw
1844 ALU MOV S49.x@group : S44.x {W}
1845 ALU MOV S49.y@group : S44.y {W}
1846 ALU MOV S49.z@group : S45.x {W}
1847 ALU MOV S49.w@group : S45.y {WL}
1848 EXPORT_DONE PARAM 3 S49.xyzw
1849 )";
1850 
1851 const char *shader_with_dest_array_opt_expect =
1852 R"(VS
1853 CHIPCLASS EVERGREEN
1854 INPUT LOC:0 NAME:0
1855 OUTPUT LOC:0 NAME:0 MASK:15
1856 OUTPUT LOC:1 NAME:5 MASK:15 SID:9 SPI_SID:10
1857 OUTPUT LOC:2 NAME:5 MASK:15 SID:10 SPI_SID:11
1858 OUTPUT LOC:3 NAME:5 MASK:15 SID:11 SPI_SID:12
1859 OUTPUT LOC:4 NAME:5 MASK:15 SID:12 SPI_SID:13
1860 REGISTERS R1.xyzw
1861 ARRAYS A2[4].xy A2[4].zw
1862 SHADER
1863 ALU MUL_IEEE S14.x : KC0[2].x R1.y@fully {W}
1864 ALU MUL_IEEE S14.y : KC0[2].y R1.y@fully {W}
1865 ALU MUL_IEEE S14.z : KC0[2].z R1.y@fully {W}
1866 ALU MUL_IEEE S14.w : KC0[2].w R1.y@fully {WL}
1867 ALU MULADD_IEEE S15.x : KC0[1].x R1.x@fully S14.x {W}
1868 ALU MULADD_IEEE S15.y : KC0[1].y R1.x@fully S14.y {W}
1869 ALU MULADD_IEEE S15.z : KC0[1].z R1.x@fully S14.z {W}
1870 ALU MULADD_IEEE S15.w : KC0[1].w R1.x@fully S14.w {WL}
1871 ALU MULADD_IEEE S17.x : KC0[3].x R1.z@fully S15.x {W}
1872 ALU MULADD_IEEE S17.y : KC0[3].y R1.z@fully S15.y {W}
1873 ALU MULADD_IEEE S17.z : KC0[3].z R1.z@fully S15.z {W}
1874 ALU MULADD_IEEE S17.w : KC0[3].w R1.z@fully S15.w {WL}
1875 ALU MULADD_IEEE S19.x@group : KC0[4].x R1.w@fully S17.x {W}
1876 ALU MULADD_IEEE S19.y@group : KC0[4].y R1.w@fully S17.y {W}
1877 ALU MULADD_IEEE S19.z@group : KC0[4].z R1.w@fully S17.z {W}
1878 ALU MULADD_IEEE S19.w@group : KC0[4].w R1.w@fully S17.w {WL}
1879 ALU MOV A2[0].x : I[1.0] {W}
1880 ALU MOV A2[0].y : L[0x3f8ccccd] {WL}
1881 ALU MOV A2[1].x : L[0x40000000] {W}
1882 ALU MOV A2[1].y : L[0x40066666] {WL}
1883 ALU MOV A2[2].x : L[0x40400000] {W}
1884 ALU MOV A2[2].y : L[0x40466666] {WL}
1885 ALU MOV A2[3].x : L[0x40800000] {W}
1886 ALU MOV A2[3].y : L[0x40833333] {WL}
1887 ALU MOV A2[0].z : L[0x40a00000] {W}
1888 ALU MOV A2[0].w : L[0x40a33333] {WL}
1889 ALU MOV A2[1].z : L[0x40c00000] {W}
1890 ALU MOV A2[1].w : L[0x40c33333] {WL}
1891 ALU MOV A2[2].z : L[0x40e00000] {W}
1892 ALU MOV A2[2].w : L[0x40e33333] {WL}
1893 ALU MOV A2[3].z : L[0x41000000] {W}
1894 ALU MOV A2[3].w : L[0x4101999a] {WL}
1895 IF (( ALU PRED_SETGE_INT __.x@free : KC0[0].x L[0x4] {LEP} PUSH_BEFORE ))
1896   ALU ADD_INT S34.x : KC0[0].x L[0xfffffffc]  {WL}
1897   ALU MOV A2[S34.x].z : I[0] {W}
1898   ALU MOV A2[S34.x].w : L[0x3dcccccd] {WL}
1899 ELSE
1900   ALU MOV S37.x : KC0[0].x {WL}
1901   ALU MOV A2[S37.x].x : I[0] {W}
1902   ALU MOV A2[S37.x].y : L[0x3dcccccd] {WL}
1903 ENDIF
1904 EXPORT_DONE POS 0 S19.xyzw
1905 ALU MOV S46.x@group : A2[0].x {W}
1906 ALU MOV S46.y@group : A2[0].y {W}
1907 ALU MOV S46.z@group : A2[1].x {W}
1908 ALU MOV S46.w@group : A2[1].y {WL}
1909 EXPORT PARAM 0 S46.xyzw
1910 ALU MOV S47.x@group : A2[2].x {W}
1911 ALU MOV S47.y@group : A2[2].y {W}
1912 ALU MOV S47.z@group : A2[3].x {W}
1913 ALU MOV S47.w@group : A2[3].y {WL}
1914 EXPORT PARAM 1 S47.xyzw
1915 ALU MOV S48.x@group : A2[0].z {W}
1916 ALU MOV S48.y@group : A2[0].w {W}
1917 ALU MOV S48.z@group : A2[1].z {W}
1918 ALU MOV S48.w@group : A2[1].w {WL}
1919 EXPORT PARAM 2 S48.xyzw
1920 ALU MOV S49.x@group : A2[2].z {W}
1921 ALU MOV S49.y@group : A2[2].w {W}
1922 ALU MOV S49.z@group : A2[3].z {W}
1923 ALU MOV S49.w@group : A2[3].w {WL}
1924 EXPORT_DONE PARAM 3 S49.xyzw
1925 )";
1926 
1927 const char *shader_with_dest_array_opt_scheduled =
1928 R"(VS
1929 CHIPCLASS EVERGREEN
1930 INPUT LOC:0 NAME:0
1931 OUTPUT LOC:0 NAME:0 MASK:15
1932 OUTPUT LOC:1 NAME:5 MASK:15 SID:9 SPI_SID:10
1933 OUTPUT LOC:2 NAME:5 MASK:15 SID:10 SPI_SID:11
1934 OUTPUT LOC:3 NAME:5 MASK:15 SID:11 SPI_SID:12
1935 OUTPUT LOC:4 NAME:5 MASK:15 SID:12 SPI_SID:13
1936 REGISTERS R1.xyzw
1937 ARRAYS A2[4].xy A2[4].zw
1938 SHADER
1939 BLOCK_START
1940 ALU_GROUP_BEGIN
1941   ALU MOV A2[0].x : I[1.0] {W}
1942   ALU MOV A2[0].y : L[0x3f8ccccd] {W}
1943   ALU MOV A2[0].z : L[0x40a00000] {W}
1944   ALU MOV A2[0].w : L[0x40a33333] {W}
1945   ALU MOV A2[1].x : L[0x40000000] {WL}
1946 ALU_GROUP_END
1947 ALU_GROUP_BEGIN
1948   ALU MOV A2[2].x : L[0x40400000] {W}
1949   ALU MOV A2[1].y : L[0x40066666] {W}
1950   ALU MOV A2[1].z : L[0x40c00000] {W}
1951   ALU MOV A2[1].w : L[0x40c33333] {W}
1952   ALU MUL_IEEE S14.x : KC0[2].x R1.y@fully {WL}
1953 ALU_GROUP_END
1954 ALU_GROUP_BEGIN
1955   ALU MOV A2[3].x : L[0x40800000] {W}
1956   ALU MOV A2[2].y : L[0x40466666] {W}
1957   ALU MOV A2[2].z : L[0x40e00000] {W}
1958   ALU MOV A2[2].w : L[0x40e33333] {W}
1959   ALU MULADD_IEEE S15.x : KC0[1].x R1.x@fully S14.x {WL}
1960 ALU_GROUP_END
1961 ALU_GROUP_BEGIN
1962   ALU MULADD_IEEE S17.x : KC0[3].x R1.z@fully S15.x {W}
1963   ALU MOV A2[3].y : L[0x40833333] {W}
1964   ALU MOV A2[3].z : L[0x41000000] {W}
1965   ALU MOV A2[3].w : L[0x4101999a] {W}
1966   ALU MUL_IEEE S14.y : KC0[2].y R1.y@fully {WL}
1967 ALU_GROUP_END
1968 ALU_GROUP_BEGIN
1969   ALU MULADD_IEEE S19.x@group : KC0[4].x R1.w@fully S17.x {W}
1970   ALU MULADD_IEEE S15.y : KC0[1].y R1.x@fully S14.y {WL}
1971 ALU_GROUP_END
1972 ALU_GROUP_BEGIN
1973   ALU MULADD_IEEE S17.y : KC0[3].y R1.z@fully S15.y {W}
1974   ALU MUL_IEEE S14.z : KC0[2].z R1.y@fully {W}
1975   ALU MUL_IEEE S14.w : KC0[2].w R1.y@fully {WL}
1976 ALU_GROUP_END
1977 ALU_GROUP_BEGIN
1978   ALU MULADD_IEEE S19.y@group : KC0[4].y R1.w@fully S17.y {W}
1979   ALU MULADD_IEEE S15.z : KC0[1].z R1.x@fully S14.z {W}
1980   ALU MULADD_IEEE S15.w : KC0[1].w R1.x@fully S14.w {WL}
1981 ALU_GROUP_END
1982 ALU_GROUP_BEGIN
1983   ALU MULADD_IEEE S17.z : KC0[3].z R1.z@fully S15.z {W}
1984   ALU MULADD_IEEE S17.w : KC0[3].w R1.z@fully S15.w {WL}
1985 ALU_GROUP_END
1986 ALU_GROUP_BEGIN
1987   ALU MULADD_IEEE S19.z@group : KC0[4].z R1.w@fully S17.z {W}
1988   ALU MULADD_IEEE S19.w@group : KC0[4].w R1.w@fully S17.w {WL}
1989 ALU_GROUP_END
1990 IF (( ALU PRED_SETGE_INT __.x@free : KC0[0].x L[0x4] {LEP} PUSH_BEFORE ))
1991   ALU_GROUP_BEGIN
1992     ALU ADD_INT S34.x : KC0[0].x L[0xfffffffc] {WL}
1993   ALU_GROUP_END
1994   ALU_GROUP_BEGIN
1995     ALU MOV A2[S34.x].z : I[0] {W}
1996     ALU MOV A2[S34.x].w : L[0x3dcccccd] {WL}
1997   ALU_GROUP_END
1998 ELSE
1999   ALU_GROUP_BEGIN
2000     ALU MOV S37.x : KC0[0].x {WL}
2001   ALU_GROUP_END
2002   ALU_GROUP_BEGIN
2003     ALU MOV A2[S37.x].x : I[0] {W}
2004     ALU MOV A2[S37.x].y : L[0x3dcccccd] {WL}
2005   ALU_GROUP_END
2006 ENDIF
2007 ALU_GROUP_BEGIN
2008   ALU MOV S46.x@group : A2[0].x {W}
2009   ALU MOV S46.y@group : A2[0].y {W}
2010   ALU MOV S46.z@group : A2[1].x {W}
2011   ALU MOV S46.w@group : A2[1].y {W}
2012   ALU MOV S47.x@group : A2[2].x {WL}
2013 ALU_GROUP_END
2014 ALU_GROUP_BEGIN
2015   ALU MOV S48.x@group : A2[0].z {W}
2016   ALU MOV S47.y@group : A2[2].y {W}
2017   ALU MOV S47.z@group : A2[3].x {W}
2018   ALU MOV S47.w@group : A2[3].y {W}
2019   ALU MOV S48.y@group : A2[0].w {WL}
2020 ALU_GROUP_END
2021 ALU_GROUP_BEGIN
2022   ALU MOV S49.x@group : A2[2].z {W}
2023   ALU MOV S49.y@group : A2[2].w {W}
2024   ALU MOV S48.z@group : A2[1].z {W}
2025   ALU MOV S48.w@group : A2[1].w {W}
2026   ALU MOV S49.z@group : A2[3].z {WL}
2027 ALU_GROUP_END
2028 ALU_GROUP_BEGIN
2029   ALU MOV S49.w@group : A2[3].w {WL}
2030 ALU_GROUP_END
2031 BLOCK_END
2032 BLOCK_START
2033 EXPORT_DONE POS 0 S19.xyzw
2034 EXPORT PARAM 0 S46.xyzw
2035 EXPORT PARAM 1 S47.xyzw
2036 EXPORT PARAM 2 S48.xyzw
2037 EXPORT_DONE PARAM 3 S49.xyzw
2038 BLOCK_END
2039 )";
2040 
2041 
2042 const char *shader_with_dest_array2 =
2043 R"(FS
2044 CHIPCLASS EVERGREEN
2045 PROP MAX_COLOR_EXPORTS:1
2046 PROP COLOR_EXPORTS:1
2047 PROP COLOR_EXPORT_MASK:15
2048 PROP WRITE_ALL_COLORS:1
2049 OUTPUT LOC:0 NAME:1 MASK:15
2050 ARRAYS A0[2].xy
2051 SHADER
2052 BLOCK_START
2053 ALU MOV A0[0].x : KC0[0].x {W}
2054 ALU MOV A0[0].y : KC0[0].y {WL}
2055 ALU MOV A0[1].x : KC0[1].x {W}
2056 ALU MOV A0[1].y : KC0[1].y {WL}
2057 ALU MOV S1.x : KC0[2].x {WL}
2058 ALU MOV A0[S1.x].x : I[1.0] {W}
2059 ALU MOV A0[S1.x].y : L[2.0] {WL}
2060 ALU MOV S2.x : A0[0].x {W}
2061 ALU MOV S2.y : A0[0].y {WL}
2062 ALU MUL_IEEE S3.x@group : S2.x KC0[2].y {W}
2063 ALU MUL_IEEE S3.y@group : S2.y KC0[2].y {WL}
2064 BLOCK_END
2065 BLOCK_START
2066 EXPORT_DONE PIXEL 0 S3.xy01
2067 BLOCK_END
2068 )";
2069 
2070 const char *shader_with_dest_array2_scheduled =
2071 R"(FS
2072 CHIPCLASS EVERGREEN
2073 PROP MAX_COLOR_EXPORTS:1
2074 PROP COLOR_EXPORTS:1
2075 PROP COLOR_EXPORT_MASK:15
2076 PROP WRITE_ALL_COLORS:1
2077 OUTPUT LOC:0 NAME:1 MASK:15
2078 ARRAYS A0[2].xy
2079 SHADER
2080 BLOCK_START
2081 ALU_GROUP_BEGIN
2082   ALU MOV A0[0].x : KC0[0].x {W}
2083   ALU MOV A0[0].y : KC0[0].y {W}
2084   ALU MOV A0[1].x : KC0[1].x {WL}
2085 ALU_GROUP_END
2086 ALU_GROUP_BEGIN
2087   ALU MOV S1.x : KC0[2].x {W}
2088   ALU MOV A0[1].y : KC0[1].y {WL}
2089 ALU_GROUP_END
2090 ALU_GROUP_BEGIN
2091   ALU MOV A0[S1.x].x : I[1.0] {W}
2092   ALU MOV A0[S1.x].y : L[2.0] {WL}
2093 ALU_GROUP_END
2094 ALU_GROUP_BEGIN
2095   ALU MOV S2.x : A0[0].x {W}
2096   ALU MOV S2.y : A0[0].y {WL}
2097 ALU_GROUP_END
2098 ALU_GROUP_BEGIN
2099   ALU MUL_IEEE S3.x@group : S2.x KC0[2].y {W}
2100   ALU MUL_IEEE S3.y@group : S2.y KC0[2].y {WL}
2101 ALU_GROUP_END
2102 BLOCK_END
2103 BLOCK_START
2104 EXPORT_DONE PIXEL 0 S3.xy01
2105 BLOCK_END
2106 )";
2107 
2108 const char *shader_with_dest_array2_scheduled_ra =
2109 R"(FS
2110 CHIPCLASS EVERGREEN
2111 PROP MAX_COLOR_EXPORTS:1
2112 PROP COLOR_EXPORTS:1
2113 PROP COLOR_EXPORT_MASK:15
2114 PROP WRITE_ALL_COLORS:1
2115 OUTPUT LOC:0 NAME:1 MASK:15
2116 ARRAYS A0[2].xy
2117 SHADER
2118 BLOCK_START
2119 ALU_GROUP_BEGIN
2120   ALU MOV A0[0].x : KC0[0].x {W}
2121   ALU MOV A0[0].y : KC0[0].y {W}
2122   ALU MOV A0[1].x : KC0[1].x {WL}
2123 ALU_GROUP_END
2124 ALU_GROUP_BEGIN
2125   ALU MOV R2.x : KC0[2].x {W}
2126   ALU MOV A0[1].y : KC0[1].y {WL}
2127 ALU_GROUP_END
2128 ALU_GROUP_BEGIN
2129   ALU MOV A0[R2.x].x : I[1.0] {W}
2130   ALU MOV A0[R2.x].y : L[2.0] {WL}
2131 ALU_GROUP_END
2132 ALU_GROUP_BEGIN
2133   ALU MOV R2.x : A0[0].x {W}
2134   ALU MOV R2.y : A0[0].y {WL}
2135 ALU_GROUP_END
2136 ALU_GROUP_BEGIN
2137   ALU MUL_IEEE R0.x : R2.x KC0[2].y {W}
2138   ALU MUL_IEEE R0.y : R2.y KC0[2].y {WL}
2139 ALU_GROUP_END
2140 BLOCK_END
2141 BLOCK_START
2142 EXPORT_DONE PIXEL 0 R0.xy01
2143 BLOCK_END
2144 )";
2145 
2146 const char *shader_group_chan_pin_to_combine =
2147 R"(FS
2148 CHIPCLASS EVERGREEN
2149 PROP MAX_COLOR_EXPORTS:1
2150 PROP COLOR_EXPORTS:1
2151 PROP COLOR_EXPORT_MASK:15
2152 PROP WRITE_ALL_COLORS:1
2153 INPUT LOC:0 NAME:5 INTERP:2 SID:9 SPI_SID:10
2154 OUTPUT LOC:0 NAME:1 MASK:15
2155 REGISTERS R0.xy__
2156 SHADER
2157 ALU_GROUP_BEGIN
2158 ALU INTERP_ZW __.x@chan : R0.y@fully Param0.x {} VEC_210
2159 ALU INTERP_ZW __.y@chan : R0.x@fully Param0.y {} VEC_210
2160 ALU INTERP_ZW S1.z@chan : R0.y@fully Param0.z {W} VEC_210
2161 ALU INTERP_ZW S1.w@chan : R0.x@fully Param0.w {WL} VEC_210
2162 ALU_GROUP_END
2163 ALU_GROUP_BEGIN
2164 ALU INTERP_XY S1.x@chan : R0.y@fully Param0.x {W} VEC_210
2165 ALU INTERP_XY S1.y@chan : R0.x@fully Param0.y {W} VEC_210
2166 ALU INTERP_XY __.z@chan : R0.y@fully Param0.z {} VEC_210
2167 ALU INTERP_XY __.w@chan : R0.x@fully Param0.w {L} VEC_210
2168 ALU_GROUP_END
2169 ALU MOV S2.x@group : S1.x@chan {W} VEC_210
2170 ALU MOV S2.y@group : S1.y@chan {W} VEC_210
2171 ALU MOV S2.z@group : S1.z@chan {W} VEC_210
2172 ALU MOV S2.w@group : S1.w@chan {WL} VEC_210
2173 EXPORT_DONE PIXEL 0 S2.xyzw
2174 )";
2175 
2176 
2177 const char *shader_group_chan_pin_combined =
2178 R"(FS
2179 CHIPCLASS EVERGREEN
2180 PROP MAX_COLOR_EXPORTS:1
2181 PROP COLOR_EXPORTS:1
2182 PROP COLOR_EXPORT_MASK:15
2183 PROP WRITE_ALL_COLORS:1
2184 INPUT LOC:0 NAME:5 INTERP:2 SID:9 SPI_SID:10
2185 OUTPUT LOC:0 NAME:1 MASK:15
2186 REGISTERS R0.x R0.y
2187 SHADER
2188 ALU_GROUP_BEGIN
2189 ALU INTERP_ZW __.x@chan : R0.y@fully Param0.x {} VEC_210
2190 ALU INTERP_ZW __.y@chan : R0.x@fully Param0.y {} VEC_210
2191 ALU INTERP_ZW S2.z@chgr : R0.y@fully Param0.z {W} VEC_210
2192 ALU INTERP_ZW S2.w@chgr : R0.x@fully Param0.w {WL} VEC_210
2193 ALU_GROUP_END
2194 ALU_GROUP_BEGIN
2195 ALU INTERP_XY S2.x@chgr : R0.y@fully Param0.x {W} VEC_210
2196 ALU INTERP_XY S2.y@chgr : R0.x@fully Param0.y {W} VEC_210
2197 ALU INTERP_XY __.z@chan : R0.y@fully Param0.z {} VEC_210
2198 ALU INTERP_XY __.w@chan : R0.x@fully Param0.w {L} VEC_210
2199 ALU_GROUP_END
2200 EXPORT_DONE PIXEL 0 S2.xyzw
2201 )";
2202 
2203 const char *shader_group_chan_pin_combined_sheduled =
2204 R"(FS
2205 CHIPCLASS EVERGREEN
2206 PROP MAX_COLOR_EXPORTS:1
2207 PROP COLOR_EXPORTS:1
2208 PROP COLOR_EXPORT_MASK:15
2209 PROP WRITE_ALL_COLORS:1
2210 INPUT LOC:0 NAME:5 INTERP:2 SID:9 SPI_SID:10
2211 OUTPUT LOC:0 NAME:1 MASK:15
2212 REGISTERS R0.x@fully R0.y@fully
2213 SHADER
2214 ALU_GROUP_BEGIN
2215 ALU INTERP_ZW __.x@chan : R0.y@fully Param0.x {} VEC_210
2216 ALU INTERP_ZW __.y@chan : R0.x@fully Param0.y {} VEC_210
2217 ALU INTERP_ZW S2.z@chgr : R0.y@fully Param0.z {W} VEC_210
2218 ALU INTERP_ZW S2.w@chgr : R0.x@fully Param0.w {WL} VEC_210
2219 ALU_GROUP_END
2220 ALU_GROUP_BEGIN
2221 ALU INTERP_XY S2.x@chgr : R0.y@fully Param0.x {W} VEC_210
2222 ALU INTERP_XY S2.y@chgr : R0.x@fully Param0.y {W} VEC_210
2223 ALU INTERP_XY __.z@chan : R0.y@fully Param0.z {} VEC_210
2224 ALU INTERP_XY __.w@chan : R0.x@fully Param0.w {L} VEC_210
2225 ALU_GROUP_END
2226 EXPORT_DONE PIXEL 0 S2.xyzw
2227 )";
2228 
2229 const char *shader_group_chan_pin_combined_sheduled_ra =
2230 R"(FS
2231 CHIPCLASS EVERGREEN
2232 PROP MAX_COLOR_EXPORTS:1
2233 PROP COLOR_EXPORTS:1
2234 PROP COLOR_EXPORT_MASK:15
2235 PROP WRITE_ALL_COLORS:1
2236 INPUT LOC:0 NAME:5 INTERP:2 SID:9 SPI_SID:10
2237 OUTPUT LOC:0 NAME:1 MASK:15
2238 REGISTERS R0.x@fully R0.y@fully R1.xyzw
2239 SHADER
2240 ALU_GROUP_BEGIN
2241 ALU INTERP_ZW __.x : R0.y Param0.x {} VEC_210
2242 ALU INTERP_ZW __.y : R0.x Param0.y {} VEC_210
2243 ALU INTERP_ZW R1.z : R0.y Param0.z {W} VEC_210
2244 ALU INTERP_ZW R1.w : R0.x Param0.w {WL} VEC_210
2245 ALU_GROUP_END
2246 ALU_GROUP_BEGIN
2247 ALU INTERP_XY R1.x : R0.y Param0.x {W} VEC_210
2248 ALU INTERP_XY R1.y : R0.x Param0.y {W} VEC_210
2249 ALU INTERP_XY __.z : R0.y Param0.z {} VEC_210
2250 ALU INTERP_XY __.w : R0.x Param0.w {L} VEC_210
2251 ALU_GROUP_END
2252 EXPORT_DONE PIXEL 0 R1.xyzw
2253 )";
2254 
2255 
2256 const char *shader_group_chan_pin_to_combine_2 =
2257 R"(FS
2258 CHIPCLASS EVERGREEN
2259 PROP MAX_COLOR_EXPORTS:1
2260 PROP COLOR_EXPORTS:1
2261 PROP COLOR_EXPORT_MASK:15
2262 PROP WRITE_ALL_COLORS:1
2263 OUTPUT LOC:0 NAME:1 MASK:15
2264 SHADER
2265 ALU MOV S0.x@free : I[0] {WL}
2266 ALU MOV S1.x : KC0[0].x {W}
2267 ALU MOV S1.y : KC0[0].y {W}
2268 ALU MOV S1.z : KC0[0].z {W}
2269 ALU MOV S1.w : KC0[0].w {WL}
2270 ALU DOT4_IEEE S2.x@free : S1.y S1.y + S1.y S1.y + I[0] I[0] + I[0] I[0] {WL}
2271 ALU DOT4_IEEE S3.x@free : S1.x S1.z + S1.x S1.w + I[0] I[0] + I[0] I[0] {WL}
2272 ALU DOT4_IEEE S4.x@free : S1.y S1.w + S1.w S1.y + I[0] I[0] + I[0] I[0] {WL}
2273 ALU MOV S5.x@group : S2.x@free {W}
2274 ALU MOV S5.y@group : S3.x@free {W}
2275 ALU MOV S5.z@group : S3.x@free {W}
2276 ALU MOV S5.w@group : S4.x@free {WL}
2277 EXPORT_DONE PIXEL 0 S5.xyzw
2278 )";
2279 
2280 const char *shader_group_chan_pin_to_combine_2_opt =
2281 R"(FS
2282 CHIPCLASS EVERGREEN
2283 PROP MAX_COLOR_EXPORTS:1
2284 PROP COLOR_EXPORTS:1
2285 PROP COLOR_EXPORT_MASK:15
2286 PROP WRITE_ALL_COLORS:1
2287 OUTPUT LOC:0 NAME:1 MASK:15
2288 SHADER
2289 ALU DOT4_IEEE S5.x@group : KC0[0].y KC0[0].y + KC0[0].y KC0[0].y + I[0] I[0] + I[0] I[0] {W}
2290 ALU DOT4_IEEE S3.x@free : KC0[0].x KC0[0].z + KC0[0].x KC0[0].w + I[0] I[0] + I[0] I[0] {WL}
2291 ALU DOT4_IEEE S5.w@group : KC0[0].y KC0[0].w + KC0[0].w KC0[0].y + I[0] I[0] + I[0] I[0] {WL}
2292 ALU MOV S5.y@group : S3.x@free {W}
2293 ALU MOV S5.z@group : S3.x@free {W}
2294 EXPORT_DONE PIXEL 0 S5.xyzw
2295 )";
2296 
2297 
2298 const char *fs_with_grand_and_abs =
2299 R"(FS
2300 CHIPCLASS EVERGREEN
2301 PROP MAX_COLOR_EXPORTS:1
2302 PROP COLOR_EXPORTS:1
2303 PROP COLOR_EXPORT_MASK:15
2304 PROP WRITE_ALL_COLORS:1
2305 INPUT LOC:0 NAME:5 INTERP:2 SID:9 SPI_SID:10
2306 OUTPUT LOC:0 NAME:1 MASK:15
2307 SHADER
2308 ALU MOV S1.x@free : I[0] {WL}
2309 ALU_GROUP_BEGIN
2310   x: ALU INTERP_XY S2.x@chgr : R0.y@fully Param0.x {W} VEC_210
2311   y: ALU INTERP_XY S2.y@chan : R0.x@fully Param0.y {W} VEC_210
2312   z: ALU INTERP_XY __.z@chan : R0.y@fully Param0.z {} VEC_210
2313   w: ALU INTERP_XY __.w@chan : R0.x@fully Param0.w {L} VEC_210
2314 ALU_GROUP_END
2315 ALU MOV S3.x@free : L[0xbf800000] {WL}
2316 ALU MOV S4.x@free : I[1.0] {WL}
2317 ALU MOV S5.x@free : L[0x41a00000] {WL}
2318 ALU MOV S6.x@free : L[0x41200000] {WL}
2319 ALU SETGT_DX10 S7.x : S2.x@chgr S1.x@free {W}
2320 ALU SETGT_DX10 S7.y : S2.y@chan S1.x@free {WL}
2321 ALU AND_INT S8.x : S7.x I[1.0] {W}
2322 ALU AND_INT S8.y : S7.y I[1.0] {WL}
2323 ALU SETGT_DX10 S9.x : S1.x@free S2.x@chgr {W}
2324 ALU SETGT_DX10 S9.y : S1.x@free S2.y@chan {WL}
2325 ALU AND_INT S10.x : S9.x I[1.0] {W}
2326 ALU AND_INT S10.y : S9.y I[1.0] {WL}
2327 ALU ADD S11.x : S8.x -S10.x {W}
2328 ALU ADD S11.y : S8.y -S10.y {WL}
2329 ALU SETE_DX10 S12.x : S11.x S3.x@free {W}
2330 ALU SETE_DX10 S12.y : S11.y S3.x@free {WL}
2331 ALU MOV S13.x@group : |S2.x@chgr| {WL}
2332 TEX GET_GRADIENTS_H S14.x___ : S2.x___ RID:18 SID:0 NNNN
2333 ALU MUL_IEEE S15.x@free : S14.x@group S5.x@free {WL}
2334 ALU MOV S16.x@free : -S15.x@free {WL}
2335 ALU CNDE_INT S17.x@free : S12.x S15.x@free S16.x@free {WL}
2336 ALU MOV S18.x : KC0[0].x {W}
2337 ALU MOV S18.y : KC0[0].y {W}
2338 ALU MOV S18.z : KC0[0].z {W}
2339 ALU MOV S18.w : KC0[0].w {WL}
2340 ALU MUL_IEEE S19.x@group : |S2.y@chan| S18.x {WL}
2341 ALU MOV S20.x@group : S19.x@group {WL}
2342 TEX GET_GRADIENTS_V S21.x___ : S19.x___ RID:18 SID:0 NNNN
2343 ALU MUL_IEEE S22.x@free : S21.x@group S6.x@free {WL}
2344 ALU MOV S23.x@free : -S22.x@free {WL}
2345 ALU CNDE_INT S24.x@free : S12.y S22.x@free S23.x@free {WL}
2346 ALU MOV S25.x@group : S17.x@free {W}
2347 ALU MOV S25.y@group : S24.x@free {W}
2348 ALU MOV S25.z@group : S1.x@free {W}
2349 ALU MOV S25.w@group : S4.x@free {WL}
2350 EXPORT_DONE PIXEL 0 S25.xyzw
2351 )";
2352 
2353 
2354 const char *fs_with_loop_multislot_reuse =
2355 R"(FS
2356 CHIPCLASS CAYMAN
2357 PROP MAX_COLOR_EXPORTS:1
2358 PROP COLOR_EXPORTS:1
2359 PROP COLOR_EXPORT_MASK:15
2360 PROP WRITE_ALL_COLORS:1
2361 OUTPUT LOC:0 NAME:1 MASK:15
2362 SHADER
2363 ALU MOV R1.x@free : I[0] {WL}
2364 ALU MOV S2.x@free : L[0x38f00000] {WL}
2365 LOOP_BEGIN
2366 ALU RECIPSQRT_IEEE S3.x@free : |R1.x@free| + |R1.x@free| + |R1.x@free| {WL}
2367 ALU SETGT_DX10 S4.x@free : S3.x@free S2.x@free {W}
2368   IF (( ALU PRED_SETNE_INT __.x@free : S4.x@free I[0] {LEP} PUSH_BEFORE ))
2369      BREAK
2370   ENDIF
2371   ALU ADD S5.x@free : S3.x@chan  L[0x38f00000] {WL}
2372   ALU MUL R1.x@free : S5.x@free  L[0x38f00000] {WL}
2373 LOOP_END
2374 EXPORT_DONE PIXEL 0 R1.xxxx
2375 )";
2376 
2377 const char *fs_with_loop_multislot_reuse_scheduled =
2378 R"(FS
2379 CHIPCLASS CAYMAN
2380 PROP MAX_COLOR_EXPORTS:1
2381 PROP COLOR_EXPORTS:1
2382 PROP COLOR_EXPORT_MASK:15
2383 PROP WRITE_ALL_COLORS:1
2384 OUTPUT LOC:0 NAME:1 MASK:15
2385 SHADER
2386 ALU_GROUP_BEGIN
2387   ALU MOV R1.x@free : I[0] {W}
2388   ALU MOV S2.y@chan : L[0x38f00000] {WL}
2389 ALU_GROUP_END
2390 LOOP_BEGIN
2391   ALU_GROUP_BEGIN
2392     ALU RECIPSQRT_IEEE S3.x@chan : |R1.x@free| {W}
2393     ALU RECIPSQRT_IEEE __.y@chan : |R1.x@free| {}
2394     ALU RECIPSQRT_IEEE __.z@chan : |R1.x@free| {L}
2395   ALU_GROUP_END
2396   ALU_GROUP_BEGIN
2397     ALU SETGT_DX10 S4.x@chan : S3.x@chgr S2.y@free {WL}
2398   ALU_GROUP_END
2399   IF (( ALU PRED_SETNE_INT __.x@free : S4.x@chan I[0] {LEP} PUSH_BEFORE ))
2400      BREAK
2401   ENDIF
2402   ALU_GROUP_BEGIN
2403     ALU ADD S5.x@free : S3.x@chan  L[0x38f00000] {WL}
2404   ALU_GROUP_END
2405   ALU_GROUP_BEGIN
2406     ALU MUL R1.x@free : S5.x@free  L[0x38f00000] {WL}
2407   ALU_GROUP_END
2408 LOOP_END
2409 EXPORT_DONE PIXEL 0 R1.xxxx
2410 )";
2411 
2412 
2413 const char *gs_abs_float_nir =
2414 R"(shader: MESA_SHADER_GEOMETRY
2415 source_sha1: {0xdfd2ba73, 0x5eff5b0c, 0x577ee695, 0xb65ae49e, 0xecc34679}
2416 name: GLSL4
2417 inputs: 1
2418 outputs: 2
2419 uniforms: 3
2420 shared: 0
2421 ray queries: 0
2422 invocations: 1
2423 vertices in: 3
2424 vertices out: 3
2425 input primitive: TRIANGLES
2426 output primitive: TRIANGLE_STRIP
2427 active_stream_mask: 0x1
2428 uses_end_primitive: 0
2429 decl_var uniform INTERP_MODE_NONE float arg0 (0, 0, 0)
2430 decl_var uniform INTERP_MODE_NONE float tolerance (1, 1, 0)
2431 decl_var uniform INTERP_MODE_NONE float expected (2, 2, 0)
2432 decl_function main (0 params)
2433 
2434 impl main {
2435 	block block_0:
2436 	/* preds: */
2437 	vec1 32 ssa_0 = load_const (0x00000000 = 0.000000)
2438 	vec4 32 ssa_1 = intrinsic load_per_vertex_input (ssa_0, ssa_0) (0, 0, 160, 160)
2439 	vec1 32 ssa_2 = load_const (0x00000001 = 0.000000)
2440 	vec4 32 ssa_3 = intrinsic load_per_vertex_input (ssa_2, ssa_0) (0, 0, 160, 160)
2441 	vec1 32 ssa_4 = load_const (0x00000002 = 0.000000)
2442 	vec4 32 ssa_5 = intrinsic load_per_vertex_input (ssa_4, ssa_0) (0, 0, 160, 160)
2443 	vec1 32 ssa_6 = load_const (0x3f800000 = 1.000000)
2444 	vec1 32 ssa_7 = intrinsic load_uniform (ssa_0) (0, 1, 160)	/* arg0 */
2445 	vec1 32 ssa_8 = intrinsic load_uniform (ssa_0) (2, 1, 160)	/* expected */
2446 	vec1 32 ssa_9 = fsub abs(ssa_7), ssa_8
2447 	vec1 32 ssa_10 = intrinsic load_uniform (ssa_0) (1, 1, 160)	/* tolerance */
2448 	vec1 32 ssa_11 = fge32 ssa_10, abs(ssa_9)
2449 	vec1 32 ssa_12 = inot ssa_11
2450 	vec1 32 ssa_13 = b2f32 ssa_12
2451 	vec1 32 ssa_14 = b2f32 ssa_11
2452 	intrinsic store_output (ssa_1, ssa_0) (0, 15, 0,  160, 128)
2453 	vec4 32 ssa_15 = vec4 ssa_13, ssa_14, ssa_0, ssa_6
2454 	intrinsic store_output (ssa_15, ssa_0) (1, 15, 0, 160, 160)
2455 	intrinsic emit_vertex () (0)
2456 	intrinsic store_output (ssa_3, ssa_0) (0, 15, 0, 160, 128)
2457 	intrinsic store_output (ssa_15, ssa_0) (1,15, 0, 160, 160)
2458 	intrinsic emit_vertex () (0)
2459 	intrinsic store_output (ssa_5, ssa_0) (0, 15, 0, 160, 128)
2460 	intrinsic store_output (ssa_15, ssa_0) (1,15, 0, 160, 160)
2461 	intrinsic emit_vertex () (0)
2462 	/* succs: block_1 */
2463 	block block_1:
2464 })";
2465 
2466 const char *gs_abs_float_expect =
2467 R"(GS
2468 CHIPCLASS EVERGREEN
2469 INPUT LOC:0 NAME:5 SID:9 SPI_SID:10
2470 OUTPUT LOC:0 NAME:0 MASK:15
2471 OUTPUT LOC:1 NAME:5 MASK:15 SID:9 SPI_SID:10
2472 REGISTERS R0.x@fully R0.y@fully R0.w@fully
2473 SHADER
2474 ALU MOV S2.x@chan : I[0] {WL}
2475 ALU MOV S3.x@chan : I[0] {WL}
2476 ALU MOV S4.x@chan : I[0] {WL}
2477 ALU MOV S5.x@chan : I[0] {WL}
2478 ALU MOV S6.x@free : I[0] {WL}
2479 LOAD_BUF S7.xyzw : R0.x@fully RID:17
2480 ALU MOV S8.x@free : I[1] {WL}
2481 LOAD_BUF S9.xyzw : R0.y@fully RID:17
2482 ALU MOV S10.x@free : L[0x2] {WL}
2483 LOAD_BUF S11.xyzw : R0.w@fully RID:17
2484 ALU MOV S12.x@free : I[1.0] {WL}
2485 ALU MOV S13.x@free : KC0[0].x {WL}
2486 ALU MOV S14.x@free : KC0[2].x {WL}
2487 ALU ADD S15.x@free : |S13.x@free| -S14.x@free {WL}
2488 ALU MOV S16.x@free : KC0[1].x {WL}
2489 ALU SETGE_DX10 S17.x@free : S16.x@free |S15.x@free| {WL}
2490 ALU NOT_INT S18.x@free : S17.x@free {WL}
2491 ALU AND_INT S19.x@free : S18.x@free I[1.0] {WL}
2492 ALU AND_INT S20.x@free : S17.x@free I[1.0] {WL}
2493 ALU MOV S21.x@group : S19.x@free {W}
2494 ALU MOV S21.y@group : S20.x@free {W}
2495 ALU MOV S21.z@group : S6.x@free {W}
2496 ALU MOV S21.w@group : S12.x@free {WL}
2497 MEM_RING 0 WRITE_IDX 0 S7.xyzw @S2.x@chan ES:4
2498 MEM_RING 0 WRITE_IDX 4 S21.xyzw @S2.x@chan ES:4
2499 EMIT_VERTEX @0
2500 ALU ADD_INT S22.x@chan : S2.x@chan L[0x2] {WL}
2501 MEM_RING 0 WRITE_IDX 0 S9.xyzw @S22.x@chan ES:4
2502 MEM_RING 0 WRITE_IDX 4 S21.xyzw @S22.x@chan ES:4
2503 EMIT_VERTEX @0
2504 ALU ADD_INT S23.x@chan : S22.x@chan L[0x2] {WL}
2505 MEM_RING 0 WRITE_IDX 0 S11.xyzw @S23.x@chan ES:4
2506 MEM_RING 0 WRITE_IDX 4 S21.xyzw @S23.x@chan ES:4
2507 EMIT_VERTEX @0
2508 ALU ADD_INT S24.x@chan : S23.x@chan L[0x2] {WL}
2509 )";
2510 
2511 
2512 const char *vtx_for_tcs_nir =
2513 R"(shader: MESA_SHADER_VERTEX
2514 source_sha1: {0xbd6100f2, 0xc71e7b0e, 0x74662024, 0x261073d8, 0xeae01762}
2515 name: GLSL5
2516 inputs: 0
2517 outputs: 1
2518 uniforms: 10
2519 shared: 0
2520 ray queries: 0
2521 decl_var uniform INTERP_MODE_NONE int[6] constarray_1_0 (0, 0, 0) = { { 0x00000000 }, { 0x00000001 }, { 0x00000002 }, { 0x00000000 }, { 0x00000002 }, { 0x00000003 } }
2522 decl_var uniform INTERP_MODE_NONE vec2[4] constarray_0_0 (1, 6, 0) = { { -1.000000, 1.000000 }, { -1.000000, -1.000000 }, { 1.000000, -1.000000 }, { 1.000000, 1.000000 } }
2523 decl_function main (0 params)
2524 
2525 impl main {
2526         block block_0:
2527         /* preds: */
2528         vec1 32 ssa_0 = load_const (0x00000000 = 0.000000)
2529         vec1 32 ssa_1 = load_const (0x3f800000 = 1.000000)
2530         vec1 32 ssa_2 = intrinsic load_vertex_id () ()
2531         vec1 32 ssa_3 = intrinsic load_uniform (ssa_2) (0, 6, 34)
2532         vec2 32 ssa_4 = intrinsic load_uniform (ssa_3) (6, 4, 160)
2533         vec4 32 ssa_5 = vec4 ssa_4.x, ssa_4.y, ssa_0, ssa_1
2534         vec4 32 ssa_6 = intrinsic load_tcs_in_param_base_r600 () ()
2535         vec1 32 ssa_7 = intrinsic load_tcs_rel_patch_id_r600 () ()
2536         vec1 32 ssa_8 = umul24 ssa_6.y, ssa_7
2537         intrinsic store_local_shared_r600 (ssa_5, ssa_8) (3)
2538         vec1 32 ssa_9 = load_const (0x00000008 = 0.000000)
2539         vec1 32 ssa_10 = iadd ssa_9, ssa_8
2540         intrinsic store_local_shared_r600 (ssa_5, ssa_10) (12)
2541         /* succs: block_1 */
2542         block block_1:
2543 })";
2544 
2545 
2546 const char *vtx_for_tcs_from_nir_expect =
2547 R"(VS
2548 CHIPCLASS EVERGREEN
2549 REGISTERS R0.x@fully R0.y@fully
2550 SHADER
2551 ALU MOV S1.x@free : I[0] {WL}
2552 ALU MOV S2.x@free : I[1.0] {WL}
2553 ALU MOV S3.x@free : R0.x@fully {WL}
2554 LOAD_BUF S4.xyzw : S3.x@free RID:0
2555 LOAD_BUF S5.xyzw : S4.x@group + 96b RID:0
2556 ALU MOV S6.x : S5.x@group {W}
2557 ALU MOV S6.y : S5.y@group {W}
2558 ALU MOV S6.z : S1.x@free {W}
2559 ALU MOV S6.w : S2.x@free {WL}
2560 ALU MOV S7.x@free : I[0] {WL}
2561 LOAD_BUF S8.xyzw : S7.x@free RID:16 SRF
2562 ALU MOV S9.x@free : R0.y@fully {WL}
2563 ALU MUL_UINT24 S10.x@free : S8.y@group S9.x@free {WL}
2564 LDS WRITE_REL __.x [ S10.x@free ] : S6.x S6.y
2565 ALU MOV S11.x@free : L[0x8] {WL}
2566 ALU ADD_INT S12.x@free : S11.x@free S10.x@free {WL}
2567 LDS WRITE_REL __.x [ S12.x@free ] : S6.z S6.w)";
2568 
2569 
2570 const char *vtx_for_tcs_inp =
2571 R"(VS
2572 CHIPCLASS EVERGREEN
2573 REGISTERS R0.x@fully R0.y@fully
2574 SHADER
2575 ALU MOV S1.x@free : I[0] {WL}
2576 ALU MOV S2.x@free : I[1.0] {WL}
2577 ALU MOV S3.x@free : R0.x@fully {WL}
2578 LOAD_BUF S4.xyzw : S3.x@free RID:0
2579 LOAD_BUF S5.xyzw : S4.x@group + 96b RID:0
2580 ALU MOV S6.x : S5.x@group {W}
2581 ALU MOV S6.y : S5.y@group {W}
2582 ALU MOV S6.z : S1.x@free {W}
2583 ALU MOV S6.w : S2.x@free {WL}
2584 ALU MOV S7.x@free : I[0] {WL}
2585 LOAD_BUF S8.xyzw : S7.x@free RID:16 SRF
2586 ALU MOV S9.x@free : R0.y@fully {WL}
2587 ALU MUL_UINT24 S10.x@free : S8.y@group S9.x@free {WL}
2588 LDS WRITE_REL __.x [ S10.x@free ] : S6.x S6.y
2589 ALU MOV S11.x@free : L[0x8] {WL}
2590 ALU ADD_INT S12.x@free : S11.x@free S10.x@free {WL}
2591 LDS WRITE_REL __.x [ S12.x@free ] : S6.z S6.w)";
2592 
2593 const char *vtx_for_tcs_opt =
2594 R"(VS
2595 CHIPCLASS EVERGREEN
2596 REGISTERS R0.x@fully R0.y@fully
2597 SHADER
2598 LOAD_BUF S4.x___ : R0.x@fully RID:0
2599 LOAD_BUF S5.xy__ : S4.x@group + 96b RID:0
2600 ALU MOV S7.x@free : I[0] {WL}
2601 LOAD_BUF S8._y__ : S7.x@free RID:16 SRF
2602 ALU MUL_UINT24 S10.x@free : S8.y@group R0.y@fully {WL}
2603 LDS WRITE_REL __.x [ S10.x@free ] : S5.x@group S5.y@group
2604 ALU ADD_INT S12.x@free : L[0x8] S10.x@free {WL}
2605 LDS WRITE_REL __.x [ S12.x@free ] : I[0] I[1.0])";
2606 
2607 const char *vtx_for_tcs_pre_sched =
2608 R"(VS
2609 CHIPCLASS EVERGREEN
2610 REGISTERS R0.x@fully R0.y@fully
2611 SHADER
2612 ALU MOV S3.x@free : R0.x@fully {WL}
2613 LOAD_BUF S4.xyzw : S3.x@free RID:0
2614 LOAD_BUF S5.xyzw : S4.x@group + 96b RID:0
2615 ALU MOV S7.y@free : I[0] {WL}
2616 LOAD_BUF S8.xyzw : S7.y@free RID:16 SRF
2617 ALU MUL_UINT24 S10.x@free : S8.y@group R0.y@fully {WL}
2618 LDS WRITE_REL __.x [ S10.x@free ] : S5.x@group S5.y@group
2619 ALU ADD_INT S12.x@free : L[0x8] S10.x@free {WL}
2620 LDS WRITE_REL __.x [ S12.x@free ] : I[0] I[1.0])";
2621 
2622 const char *vtx_for_tcs_sched =
2623 R"(VS
2624 CHIPCLASS EVERGREEN
2625 REGISTERS R0.x@fully R0.y@fully
2626 SHADER
2627 BLOCK_START
2628 ALU_GROUP_BEGIN
2629   ALU MOV S3.x@free : R0.x@fully {W}
2630   ALU MOV S7.y@free : I[0] {WL}
2631 ALU_GROUP_END
2632 BLOCK_END
2633 BLOCK_START
2634 LOAD_BUF S4.xyzw : S3.x@free RID:0
2635 LOAD_BUF S8.xyzw : S7.y@free RID:16 SRF
2636 BLOCK_END
2637 BLOCK_START
2638 ALU_GROUP_BEGIN
2639   ALU MUL_UINT24 S10.x@free : S8.y@group R0.y@fully {WL}
2640 ALU_GROUP_END
2641 ALU_GROUP_BEGIN
2642   ALU ADD_INT S12.x@chan : L[0x8] S10.x@free {WL}
2643 ALU_GROUP_END
2644 ALU_GROUP_BEGIN
2645   ALU LDS WRITE_REL __.x : S12.x@chan I[0] I[1.0] {L}
2646 ALU_GROUP_END
2647 BLOCK_END
2648 BLOCK_START
2649 LOAD_BUF S5.xyzw : S4.x@group + 96b RID:0
2650 BLOCK_END
2651 BLOCK_START
2652 ALU_GROUP_BEGIN
2653   ALU LDS WRITE_REL __.x : S10.x@free S5.x@group S5.y@group {L}
2654 ALU_GROUP_END
2655 BLOCK_END)";
2656 
2657 const char *tcs_nir =
2658 R"(shader: MESA_SHADER_TESS_CTRL
2659 source_sha1: {0xc83b0de6, 0x36934b97, 0xccddb436, 0xb0952cb0, 0x07a450a1}
2660 name: GLSL5
2661 inputs: 1
2662 outputs: 3
2663 uniforms: 0
2664 shared: 0
2665 ray queries: 0
2666 decl_function main (0 params)
2667 
2668 impl main {
2669    block block_0:
2670    /* preds: */
2671    vec1 32 ssa_0 = undefined
2672    vec2 32 ssa_1 = load_const (0x3f800000, 0x3f800000)
2673    vec1 32 ssa_2 = load_const (0x00000000)
2674    vec4 32 ssa_3 = intrinsic load_tcs_out_param_base_r600 () ()
2675    vec1 32 ssa_4 = intrinsic load_tcs_rel_patch_id_r600 () ()
2676    vec2 32 ssa_5 = umad24 ssa_3.xx, ssa_4.xx, ssa_3.wz
2677    vec1 32 ssa_6 = mov ssa_5.x
2678    vec1 32 ssa_7 = load_const (0x00000010)
2679    vec4 32 ssa_8 = load_const (0x00000010, 0x00000000, 0x00000004, 0x00000008)
2680    vec4 32 ssa_9 = iadd ssa_5.xxxx, ssa_8
2681    vec1 32 ssa_10 = mov ssa_9.x
2682    vec3 32 ssa_11 = mov ssa_9.yzw
2683    intrinsic store_local_shared_r600 (ssa_1, ssa_10) (3)
2684    vec4 32 ssa_12 = load_const (0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000)
2685    vec4 32 ssa_13 = vec4 ssa_12.x, ssa_12.y, ssa_12.z, ssa_0
2686    intrinsic store_local_shared_r600 (ssa_13, ssa_6) (3)
2687    vec1 32 ssa_14 = load_const (0x00000008)
2688    vec1 32 ssa_15 = iadd ssa_14, ssa_5.x
2689    intrinsic store_local_shared_r600 (ssa_13, ssa_15) (12)
2690    vec1 32 ssa_16 = intrinsic load_invocation_id () ()
2691    vec4 32 ssa_17 = intrinsic load_tcs_in_param_base_r600 () ()
2692    vec1 32 ssa_18 = umul24 ssa_17.x, ssa_4
2693    vec1 32 ssa_19 = umad24 ssa_17.y, ssa_16, ssa_18
2694    vec4 32 ssa_20 = load_const (0x00000000, 0x00000004, 0x00000008, 0x0000000c)
2695    vec4 32 ssa_21 = iadd ssa_20, ssa_19.xxxx
2696    vec4 32 ssa_22 = intrinsic load_local_shared_r600 (ssa_21) ()
2697    vec1 32 ssa_23 = umad24 ssa_3.y, ssa_16, ssa_5.y
2698    intrinsic store_local_shared_r600 (ssa_22, ssa_23) (3)
2699    vec1 32 ssa_24 = iadd ssa_14, ssa_23
2700    intrinsic store_local_shared_r600 (ssa_22, ssa_24) (12)
2701    vec1 32 ssa_25 = ieq32 ssa_16, ssa_2
2702    /* succs: block_1 block_2 */
2703    if ssa_25 {
2704       block block_1:
2705       /* preds: block_0 */
2706       vec3 32 ssa_26 = intrinsic load_local_shared_r600 (ssa_11) ()
2707       vec1 32 ssa_27 = intrinsic load_tcs_tess_factor_base_r600 () ()
2708       vec1 32 ssa_28 = umad24 ssa_4, ssa_7, ssa_27
2709       vec3 32 ssa_29 = load_const (0x00000004, 0x00000008, 0x0000000c)
2710       vec3 32 ssa_30 = iadd ssa_28.xxx, ssa_29
2711       vec4 32 ssa_31 = vec4 ssa_28, ssa_26.x, ssa_30.x, ssa_26.y
2712       vec2 32 ssa_32 = vec2 ssa_30.y, ssa_26.z
2713       vec1 32 ssa_33 = intrinsic load_local_shared_r600 (ssa_10) ()
2714       vec2 32 ssa_34 = vec2 ssa_30.z, ssa_33
2715       intrinsic store_tf_r600 (ssa_31) ()
2716       intrinsic store_tf_r600 (ssa_32) ()
2717       intrinsic store_tf_r600 (ssa_34) ()
2718       /* succs: block_3 */
2719    } else {
2720       block block_2:
2721       /* preds: block_0 */
2722       /* succs: block_3 */
2723    }
2724    block block_3:
2725    /* preds: block_1 block_2 */
2726    /* succs: block_4 */
2727    block block_4:
2728 })";
2729 
2730 const char *tcs_from_nir_expect =
2731 R"(TCS
2732 CHIPCLASS EVERGREEN
2733 PROP TCS_PRIM_MODE:4
2734 REGISTERS R0.x@fully R0.y@fully R0.z@fully R0.w@fully
2735 SHADER
2736 ALU MOV S1.x@free : I[0] {WL}
2737 ALU MOV S2.x : I[1.0] {W}
2738 ALU MOV S2.y : I[1.0] {WL}
2739 ALU MOV S3.x@free : I[0] {WL}
2740 ALU MOV S4.x@free : I[0] {WL}
2741 LOAD_BUF S5.xyzw : S4.x@free + 16b RID:16 SRF
2742 ALU MOV S6.x@free : R0.y@fully {WL}
2743 ALU MULADD_UINT24 S7.x : S5.x@group S6.x@free S5.w@group {W}
2744 ALU MULADD_UINT24 S7.y : S5.x@group S6.x@free S5.z@group {WL}
2745 ALU MOV S8.x@free : S7.x {WL}
2746 ALU MOV S9.x@free : L[0x10] {WL}
2747 ALU MOV S10.x : L[0x10] {W}
2748 ALU MOV S10.y : I[0] {W}
2749 ALU MOV S10.z : L[0x4] {W}
2750 ALU MOV S10.w : L[0x8] {WL}
2751 ALU ADD_INT S11.x : S7.x S10.x {W}
2752 ALU ADD_INT S11.y : S7.x S10.y {W}
2753 ALU ADD_INT S11.z : S7.x S10.z {W}
2754 ALU ADD_INT S11.w : S7.x S10.w {WL}
2755 ALU MOV S12.x@free : S11.x {WL}
2756 ALU MOV S13.x : S11.y {W}
2757 ALU MOV S13.y : S11.z {W}
2758 ALU MOV S13.z : S11.w {WL}
2759 LDS WRITE_REL __.x [ S12.x@free ] : S2.x S2.y
2760 ALU MOV S14.x : I[1.0] {W}
2761 ALU MOV S14.y : I[1.0] {W}
2762 ALU MOV S14.z : I[1.0] {W}
2763 ALU MOV S14.w : I[1.0] {WL}
2764 ALU MOV S15.x : S14.x {W}
2765 ALU MOV S15.y : S14.y {W}
2766 ALU MOV S15.z : S14.z {W}
2767 ALU MOV S15.w : S1.x@free {WL}
2768 LDS WRITE_REL __.x [ S8.x@free ] : S15.x S15.y
2769 ALU MOV S16.x@free : L[0x8] {WL}
2770 ALU ADD_INT S17.x@free : S16.x@free S7.x {WL}
2771 LDS WRITE_REL __.x [ S17.x@free ] : S15.z S15.w
2772 ALU MOV S18.x@free : R0.z@fully {WL}
2773 ALU MOV S19.y@free : I[0] {WL}
2774 LOAD_BUF S20.xyzw : S19.y@free RID:16 SRF
2775 ALU MUL_UINT24 S21.x@free : S20.x@group S6.x@free {WL}
2776 ALU MULADD_UINT24 S22.x@free : S20.y@group S18.x@free S21.x@free {WL}
2777 ALU MOV S23.x : I[0] {W}
2778 ALU MOV S23.y : L[0x4] {W}
2779 ALU MOV S23.z : L[0x8] {W}
2780 ALU MOV S23.w : L[0xc] {WL}
2781 ALU ADD_INT S24.x : S23.x S22.x@free {W}
2782 ALU ADD_INT S24.y : S23.y S22.x@free {W}
2783 ALU ADD_INT S24.z : S23.z S22.x@free {W}
2784 ALU ADD_INT S24.w : S23.w S22.x@free {WL}
2785 LDS_READ [ S25.x@free S25.y@free S25.z@free S25.w@free ] : [ S24.x S24.y S24.z S24.w ]
2786 ALU MULADD_UINT24 S26.x@free : S5.y@group S18.x@free S7.y {WL}
2787 LDS WRITE_REL __.x [ S26.x@free ] : S25.x@free S25.y@free
2788 ALU ADD_INT S27.x@free : S16.x@free S26.x@free {WL}
2789 LDS WRITE_REL __.x [ S27.x@free ] : S25.z@free S25.w@free
2790 ALU SETE_INT S28.x@free : S18.x@free S3.x@free {WL}
2791 IF (( ALU PRED_SETNE_INT __.z@free : S28.x@free I[0] {LEP} PUSH_BEFORE ))
2792   LDS_READ [ S30.x@free S30.y@free S30.z@free ] : [ S13.x S13.y S13.z ]
2793   ALU MOV S31.x@free : R0.w@fully {WL}
2794   ALU MULADD_UINT24 S32.x@free : S6.x@free S9.x@free S31.x@free {WL}
2795   ALU MOV S33.x : L[0x4] {W}
2796   ALU MOV S33.y : L[0x8] {W}
2797   ALU MOV S33.z : L[0xc] {WL}
2798   ALU ADD_INT S34.x : S32.x@free S33.x {W}
2799   ALU ADD_INT S34.y : S32.x@free S33.y {W}
2800   ALU ADD_INT S34.z : S32.x@free S33.z {WL}
2801   ALU MOV S35.x : S32.x@free {W}
2802   ALU MOV S35.y : S30.x@free {W}
2803   ALU MOV S35.z : S34.x {W}
2804   ALU MOV S35.w : S30.y@free {WL}
2805   ALU MOV S36.x : S34.y {W}
2806   ALU MOV S36.y : S30.z@free {WL}
2807   LDS_READ [ S37.x@free ] : [ S12.x@free ]
2808   ALU MOV S38.x : S34.z {W}
2809   ALU MOV S38.y : S37.x@free {WL}
2810   ALU MOV S39.x@group : S35.x {W}
2811   ALU MOV S39.y@group : S35.y {W}
2812   ALU MOV S40.z@group : S35.z {W}
2813   ALU MOV S40.w@group : S35.w {WL}
2814   WRITE_TF S40.zw__
2815   WRITE_TF S39.xy__
2816   ALU MOV S41.x@group : S36.x {W}
2817   ALU MOV S41.y@group : S36.y {WL}
2818   WRITE_TF S41.xy__
2819   ALU MOV S42.x@group : S38.x {W}
2820   ALU MOV S42.y@group : S38.y {WL}
2821   WRITE_TF S42.xy__
2822 ENDIF)";
2823 
2824 const char *tes_nir =
2825 R"(shader: MESA_SHADER_TESS_EVAL
2826 source_sha1: {0x2db04154, 0x4884cf59, 0x50e43ee6, 0x4bb239d7, 0x0b502229}
2827 name: GLSL5
2828 inputs: 1
2829 outputs: 1
2830 uniforms: 0
2831 shared: 0
2832 ray queries: 0
2833 decl_function main (0 params)
2834 
2835 impl main {
2836    block block_0:
2837    /* preds: */
2838    vec1 32 ssa_0 = load_const (0x40000000)
2839    vec2 32 ssa_1 = intrinsic load_tess_coord_r600 () ()
2840    vec1 32 ssa_2 = fadd ssa_1.x, ssa_1.y
2841    vec1 32 ssa_3 = load_const (0x3f800000)
2842    vec1 32 ssa_4 = fsub ssa_3, ssa_2
2843    vec1 32 ssa_5 = ffma ssa_0, ssa_4, ssa_1.y
2844    vec1 32 ssa_6 = f2i32 ssa_5
2845    vec1 32 ssa_7 = load_const (0x00000000)
2846    vec4 32 ssa_8 = intrinsic load_tcs_out_param_base_r600 () ()
2847    vec1 32 ssa_9 = intrinsic load_tcs_rel_patch_id_r600 () ()
2848    vec1 32 ssa_10 = umad24 ssa_8.x, ssa_9, ssa_8.z
2849    vec1 32 ssa_11 = umad24 ssa_8.y, ssa_6, ssa_10
2850    vec4 32 ssa_12 = load_const (0x00000000, 0x00000004, 0x00000008, 0x0000000c)
2851    vec4 32 ssa_13 = iadd ssa_12, ssa_11.xxxx
2852    vec4 32 ssa_14 = intrinsic load_local_shared_r600 (ssa_13) ()
2853    intrinsic store_output (ssa_14, ssa_7) (0, 15, 0, 160, 128)
2854     /* succs: block_1 */
2855     block block_1:
2856 })";
2857 
2858 const char *tes_from_nir_expect =
2859 R"(TES
2860 CHIPCLASS EVERGREEN
2861 OUTPUT LOC:0 NAME:0 MASK:15
2862 REGISTERS R0.x@fully R0.y@fully R0.z@fully
2863 SHADER
2864 ALU MOV S1.x@free : L[0x40000000] {WL}
2865 ALU MOV S2.x@free : R0.x@fully {WL}
2866 ALU MOV S2.y@free : R0.y@fully {WL}
2867 ALU ADD S3.x@free : S2.x@free S2.y@free {WL}
2868 ALU MOV S4.x@free : I[1.0] {WL}
2869 ALU ADD S5.x@free : S4.x@free -S3.x@free {WL}
2870 ALU MULADD_IEEE S6.x@free : S1.x@free S5.x@free S2.y@free {WL}
2871 ALU TRUNC S7.x@free : S6.x@free {WL}
2872 ALU FLT_TO_INT S8.x@free : S7.x@free {WL}
2873 ALU MOV S9.x@free : I[0] {WL}
2874 ALU MOV S10.y@free : I[0] {WL}
2875 LOAD_BUF S11.xyzw : S10.y@free + 16b RID:16 SRF
2876 ALU MOV S12.x@free : R0.z@fully {WL}
2877 ALU MULADD_UINT24 S13.x@free : S11.x@group S12.x@free S11.z@group {WL}
2878 ALU MULADD_UINT24 S14.x@free : S11.y@group S8.x@free S13.x@free {WL}
2879 ALU MOV S15.x : I[0] {W}
2880 ALU MOV S15.y : L[0x4] {W}
2881 ALU MOV S15.z : L[0x8] {W}
2882 ALU MOV S15.w : L[0xc] {WL}
2883 ALU ADD_INT S16.x : S15.x S14.x@free {W}
2884 ALU ADD_INT S16.y : S15.y S14.x@free {W}
2885 ALU ADD_INT S16.z : S15.z S14.x@free {W}
2886 ALU ADD_INT S16.w : S15.w S14.x@free {WL}
2887 LDS_READ [ S17.x@group S17.y@group S17.z@group S17.w@group ] : [ S16.x S16.y S16.z S16.w ]
2888 EXPORT_DONE POS 0 S17.xyzw
2889 EXPORT_DONE PARAM 0 R0.____)";
2890 
2891 
2892 const char *tes_pre_op =
2893 R"(TES
2894 CHIPCLASS EVERGREEN
2895 OUTPUT LOC:0 NAME:0 MASK:15
2896 REGISTERS R0.x@fully R0.y@fully R0.z@fully
2897 SHADER
2898 ALU MOV S1024.x@free : L[0x40000000] {WL}
2899 ALU MOV S1025.x@free : R0.x@fully {WL}
2900 ALU MOV S1025.y@free : R0.y@fully {WL}
2901 ALU ADD S1026.x@free : S1025.x@free S1025.y@free {WL}
2902 ALU MOV S1027.x@free : I[1.0] {WL}
2903 ALU ADD S1028.x@free : S1027.x@free -S1026.x@free {WL}
2904 ALU MULADD_IEEE S1029.x@free : S1024.x@free S1028.x@free S1025.y@free {WL}
2905 ALU TRUNC S1030.x@free : S1029.x@free {WL}
2906 ALU FLT_TO_INT S1031.x@free : S1030.x@free {WL}
2907 ALU MOV S1032.x@free : I[0] {WL}
2908 ALU MOV S1033.y@free : I[0] {WL}
2909 LOAD_BUF S1034.xyzw : S1033.y@free RID:16 SRF
2910 ALU MOV S1035.x@free : R0.z@fully {WL}
2911 ALU MULADD_UINT24 S1036.x@free : S1034.x@group S1035.x@free S1034.z@group {WL}
2912 ALU MULADD_UINT24 S1037.x@free : S1034.y@group S1031.x@free S1036.x@free {WL}
2913 ALU MOV S1038.x : I[0] {W}
2914 ALU MOV S1038.y : L[0x4] {W}
2915 ALU MOV S1038.z : L[0x8] {W}
2916 ALU MOV S1038.w : L[0xc] {WL}
2917 ALU ADD_INT S1039.x : S1038.x S1037.x@free {W}
2918 ALU ADD_INT S1039.y : S1038.y S1037.x@free {W}
2919 ALU ADD_INT S1039.z : S1038.z S1037.x@free {W}
2920 ALU ADD_INT S1039.w : S1038.w S1037.x@free {WL}
2921 LDS_READ [ S1040.x@group S1040.y@group S1040.z@group S1040.w@group ] : [ S1039.x S1039.y S1039.z S1039.w ]
2922 EXPORT_DONE POS 0 S1040.xyzw
2923 EXPORT_DONE PARAM 0 R0.____)";
2924 
2925 const char *tes_optimized =
2926 R"(TES
2927 CHIPCLASS EVERGREEN
2928 OUTPUT LOC:0 NAME:0 MASK:15
2929 REGISTERS R0.x@fully R0.y@fully R0.z@fully
2930 SHADER
2931 ALU ADD S1026.x@free : R0.x@fully R0.y@fully {WL}
2932 ALU ADD S1028.x@free : I[1.0] -S1026.x@free {WL}
2933 ALU MULADD_IEEE S1029.x@free : L[0x40000000] S1028.x@free R0.y@fully {WL}
2934 ALU TRUNC S1030.x@free : S1029.x@free {WL}
2935 ALU FLT_TO_INT S1031.x@free : S1030.x@free {WL}
2936 ALU MOV S1033.y@free : I[0] {WL}
2937 LOAD_BUF S1034.xyz_ : S1033.y@free RID:16 SRF
2938 ALU MULADD_UINT24 S1036.x@free : S1034.x@group R0.z@fully S1034.z@group {WL}
2939 ALU MULADD_UINT24 S1037.x@free : S1034.y@group S1031.x@free S1036.x@free {WL}
2940 ALU MOV S1039.x : S1037.x@free {W}
2941 ALU ADD_INT S1039.y : L[0x4] S1037.x@free {W}
2942 ALU ADD_INT S1039.z : L[0x8] S1037.x@free {W}
2943 ALU ADD_INT S1039.w : L[0xc] S1037.x@free {WL}
2944 LDS_READ [ S1040.x@group S1040.y@group S1040.z@group S1040.w@group ] : [ S1039.x S1039.y S1039.z S1039.w ]
2945 EXPORT_DONE POS 0 S1040.xyzw
2946 EXPORT_DONE PARAM 0 R0.____)";
2947 
2948 const char *tes_optimized_pre_sched =
2949 R"(TES
2950 CHIPCLASS EVERGREEN
2951 OUTPUT LOC:0 NAME:0 MASK:15
2952 REGISTERS R0.x@fully R0.y@fully R0.z@fully
2953 SHADER
2954 ALU ADD S1026.x@free : R0.x@fully R0.y@fully {WL}
2955 ALU ADD S1028.x@free : I[1.0] -S1026.x@free {WL}
2956 ALU MULADD_IEEE S1029.x@free : L[0x40000000] S1028.x@free R0.y@fully {WL}
2957 ALU TRUNC S1030.x@free : S1029.x@free {WL}
2958 ALU FLT_TO_INT S1031.x@free : S1030.x@free {WL}
2959 ALU MOV S1033.y@free : I[0] {WL}
2960 LOAD_BUF S1034.xyzw : S1033.y@free RID:16 SRF
2961 ALU MULADD_UINT24 S1036.x@free : S1034.x@group R0.z@fully S1034.z@group {WL}
2962 ALU MULADD_UINT24 S1037.x@free : S1034.y@group S1031.x@free S1036.x@free {WL}
2963 ALU ADD_INT S1039.x : I[0] S1037.x@free {W}
2964 ALU ADD_INT S1039.y : L[0x4] S1037.x@free {W}
2965 ALU ADD_INT S1039.z : L[0x8] S1037.x@free {W}
2966 ALU ADD_INT S1039.w : L[0xc] S1037.x@free {WL}
2967 LDS_READ [ S1040.x@group S1040.y@group S1040.z@group S1040.w@group ] : [ S1039.x S1039.y S1039.z S1039.w ]
2968 EXPORT_DONE POS 0 S1040.xyzw
2969 EXPORT_DONE PARAM 0 R0.____)";
2970 
2971 const char *tes_optimized_sched =
2972 R"(TES
2973 CHIPCLASS EVERGREEN
2974 OUTPUT LOC:0 NAME:0 MASK:15
2975 REGISTERS R0.x@fully R0.y@fully R0.z@fully
2976 SHADER
2977 BLOCK_START
2978 ALU_GROUP_BEGIN
2979   ALU ADD S1026.x@chan : R0.x@fully R0.y@fully {W}
2980    ALU MOV S1033.y@chan : I[0] {WL}
2981 ALU_GROUP_END
2982 ALU_GROUP_BEGIN
2983    ALU ADD S1028.x@chan : I[1.0] -S1026.x@chan {WL}
2984 ALU_GROUP_END
2985 ALU_GROUP_BEGIN
2986    ALU MULADD_IEEE S1029.x@chan : L[0x40000000] S1028.x@chan R0.y@fully {WL}
2987 ALU_GROUP_END
2988 ALU_GROUP_BEGIN
2989    ALU TRUNC S1030.x@chan : S1029.x@chan {WL}
2990 ALU_GROUP_END
2991 ALU_GROUP_BEGIN
2992    ALU FLT_TO_INT S1031.x@chan : S1030.x@chan {WL}
2993 ALU_GROUP_END
2994 BLOCK_START
2995 BLOCK_END
2996 LOAD_BUF S1034.xyzw : S1033.y@chan RID:16 SRF
2997 BLOCK_START
2998 BLOCK_END
2999 ALU_GROUP_BEGIN
3000    ALU MULADD_UINT24 S1036.x@chan : S1034.x@group R0.z@fully S1034.z@group {WL}
3001 ALU_GROUP_END
3002 ALU_GROUP_BEGIN
3003    ALU MULADD_UINT24 S1037.x@chan : S1034.y@group S1031.x@chan S1036.x@chan {WL}
3004 ALU_GROUP_END
3005 ALU_GROUP_BEGIN
3006    ALU ADD_INT S1039.x : I[0] S1037.x@chan {W}
3007    ALU ADD_INT S1039.y : L[0x4] S1037.x@chan {W}
3008    ALU ADD_INT S1039.z : L[0x8] S1037.x@chan {W}
3009    ALU ADD_INT S1039.w : L[0xc] S1037.x@chan {WL}
3010 ALU_GROUP_END
3011 ALU_GROUP_BEGIN
3012    ALU LDS READ_RET __.x@chan : S1039.x {L}
3013 ALU_GROUP_END
3014 ALU_GROUP_BEGIN
3015    ALU LDS READ_RET __.x@chan : S1039.y {L}
3016 ALU_GROUP_END
3017 ALU_GROUP_BEGIN
3018    ALU LDS READ_RET __.x@chan : S1039.z {L}
3019 ALU_GROUP_END
3020 ALU_GROUP_BEGIN
3021    ALU LDS READ_RET __.x@chan : S1039.w {L}
3022 ALU_GROUP_END
3023 ALU_GROUP_BEGIN
3024    ALU MOV S1040.x@group : I[LDS_OQ_A_POP] {WL}
3025 ALU_GROUP_END
3026 ALU_GROUP_BEGIN
3027    ALU MOV S1040.y@group : I[LDS_OQ_A_POP] {WL}
3028 ALU_GROUP_END
3029 ALU_GROUP_BEGIN
3030    ALU MOV S1040.z@group : I[LDS_OQ_A_POP] {WL}
3031 ALU_GROUP_END
3032 ALU_GROUP_BEGIN
3033    ALU MOV S1040.w@group : I[LDS_OQ_A_POP] {WL}
3034 ALU_GROUP_END
3035 BLOCK_START
3036 BLOCK_END
3037 EXPORT_DONE POS 0 S1040.xyzw
3038 EXPORT_DONE PARAM 0 R0.____
3039 BLOCK_END)";
3040 
SetUp()3041 void TestShader::SetUp()
3042 {
3043    init_pool();
3044    SetUpMore();
3045 }
3046 
TearDown()3047 void TestShader::TearDown()
3048 {
3049    TearDownMore();
3050    release_pool();
3051 }
3052 
SetUpMore()3053 void TestShader::SetUpMore()
3054 {
3055 }
3056 
TearDownMore()3057 void TestShader::TearDownMore()
3058 {
3059 }
3060 
from_string(const std::string & s)3061 Shader *TestShader::from_string(const std::string& s)
3062 {
3063    istringstream is(s);
3064    string line;
3065 
3066    r600_shader_key key = {0};
3067    key.ps.nr_cbufs = 1;
3068 
3069    do {
3070       std::getline(is, line);
3071    } while (line.empty());
3072 
3073    Shader *shader = nullptr;
3074 
3075    if (line.substr(0,2) == "FS")
3076       shader = new FragmentShaderEG(key);
3077    else if (line.substr(0,2) == "VS")
3078       shader = new VertexShader(nullptr, nullptr,  key);
3079    else if (line.substr(0,2) == "GS")
3080       shader = new GeometryShader(key);
3081    else if (line.substr(0,3) == "TCS")
3082       shader = new TCSShader(key);
3083    else if (line.substr(0,3) == "TES")
3084       shader = new TESShader(nullptr, nullptr, key);
3085    else
3086       return nullptr;
3087 
3088    while (std::getline(is, line)) {
3089       if (line.find_first_not_of(" \t") == std::string::npos)
3090          continue;
3091       if (line[0] == '#')
3092          continue;
3093 
3094       if (line.substr(0,6) == "SHADER")
3095          break;
3096 
3097       istringstream ls(line);
3098       if (!shader->add_info_from_string(ls)) {
3099          std::cerr << "Don't understand '" << line << "\n";
3100          return nullptr;
3101       }
3102    }
3103 
3104    while (std::getline(is, line)) {
3105       if (line.find_first_not_of(" \t") == std::string::npos)
3106          continue;
3107       if (line[0] == '#')
3108          continue;
3109 
3110       shader->emit_instruction_from_string(line);
3111    }
3112 
3113    return shader;
3114 }
3115 
3116 }
3117