2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
23 #include "pipe/p_shader_tokens.h"
24 #include "tgsi/tgsi_parse.h"
25 #include "tgsi/tgsi_scan.h"
26 #include "tgsi/tgsi_dump.h"
27 #include "util/u_format.h"
28 #include "r600_pipe.h"
31 #include "r600_formats.h"
32 #include "r600_opcodes.h"
38 int r600_find_vs_semantic_index(struct r600_shader
*vs
,
39 struct r600_shader
*ps
, int id
)
41 struct r600_shader_io
*input
= &ps
->input
[id
];
43 for (int i
= 0; i
< vs
->noutput
; i
++) {
44 if (input
->name
== vs
->output
[i
].name
&&
45 input
->sid
== vs
->output
[i
].sid
) {
52 static int r600_pipe_shader(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
54 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
55 struct r600_shader
*rshader
= &shader
->shader
;
60 if (shader
->bo
== NULL
) {
61 shader
->bo
= r600_bo(rctx
->radeon
, rshader
->bc
.ndw
* 4, 4096, 0, 0);
62 if (shader
->bo
== NULL
) {
65 ptr
= (uint32_t*)r600_bo_map(rctx
->radeon
, shader
->bo
, 0, NULL
);
66 if (R600_BIG_ENDIAN
) {
67 for (i
= 0; i
< rshader
->bc
.ndw
; ++i
) {
68 ptr
[i
] = bswap_32(rshader
->bc
.bytecode
[i
]);
71 memcpy(ptr
, rshader
->bc
.bytecode
, rshader
->bc
.ndw
* sizeof(*ptr
));
73 r600_bo_unmap(rctx
->radeon
, shader
->bo
);
76 switch (rshader
->processor_type
) {
77 case TGSI_PROCESSOR_VERTEX
:
78 if (rshader
->family
>= CHIP_CEDAR
) {
79 evergreen_pipe_shader_vs(ctx
, shader
);
81 r600_pipe_shader_vs(ctx
, shader
);
84 case TGSI_PROCESSOR_FRAGMENT
:
85 if (rshader
->family
>= CHIP_CEDAR
) {
86 evergreen_pipe_shader_ps(ctx
, shader
);
88 r600_pipe_shader_ps(ctx
, shader
);
97 static int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
);
99 int r600_pipe_shader_create(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
, const struct tgsi_token
*tokens
)
101 static int dump_shaders
= -1;
102 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
105 /* Would like some magic "get_bool_option_once" routine.
107 if (dump_shaders
== -1)
108 dump_shaders
= debug_get_bool_option("R600_DUMP_SHADERS", FALSE
);
111 fprintf(stderr
, "--------------------------------------------------------------\n");
112 tgsi_dump(tokens
, 0);
114 shader
->shader
.family
= r600_get_family(rctx
->radeon
);
115 r
= r600_shader_from_tgsi(tokens
, &shader
->shader
);
117 R600_ERR("translation from TGSI failed !\n");
120 r
= r600_bc_build(&shader
->shader
.bc
);
122 R600_ERR("building bytecode failed !\n");
126 r600_bc_dump(&shader
->shader
.bc
);
127 fprintf(stderr
, "______________________________________________________________\n");
129 return r600_pipe_shader(ctx
, shader
);
132 void r600_pipe_shader_destroy(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
134 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
136 r600_bo_reference(rctx
->radeon
, &shader
->bo
, NULL
);
137 r600_bc_clear(&shader
->shader
.bc
);
141 * tgsi -> r600 shader
143 struct r600_shader_tgsi_instruction
;
145 struct r600_shader_src
{
154 struct r600_shader_ctx
{
155 struct tgsi_shader_info info
;
156 struct tgsi_parse_context parse
;
157 const struct tgsi_token
*tokens
;
159 unsigned file_offset
[TGSI_FILE_COUNT
];
162 struct r600_shader_tgsi_instruction
*inst_info
;
164 struct r600_shader
*shader
;
165 struct r600_shader_src src
[3];
168 u32 max_driver_temp_used
;
169 /* needed for evergreen interpolation */
170 boolean input_centroid
;
171 boolean input_linear
;
172 boolean input_perspective
;
176 struct r600_shader_tgsi_instruction
{
177 unsigned tgsi_opcode
;
179 unsigned r600_opcode
;
180 int (*process
)(struct r600_shader_ctx
*ctx
);
183 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[], eg_shader_tgsi_instruction
[];
184 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
);
186 static int tgsi_is_supported(struct r600_shader_ctx
*ctx
)
188 struct tgsi_full_instruction
*i
= &ctx
->parse
.FullToken
.FullInstruction
;
191 if (i
->Instruction
.NumDstRegs
> 1) {
192 R600_ERR("too many dst (%d)\n", i
->Instruction
.NumDstRegs
);
195 if (i
->Instruction
.Predicate
) {
196 R600_ERR("predicate unsupported\n");
200 if (i
->Instruction
.Label
) {
201 R600_ERR("label unsupported\n");
205 for (j
= 0; j
< i
->Instruction
.NumSrcRegs
; j
++) {
206 if (i
->Src
[j
].Register
.Dimension
) {
207 R600_ERR("unsupported src %d (dimension %d)\n", j
,
208 i
->Src
[j
].Register
.Dimension
);
212 for (j
= 0; j
< i
->Instruction
.NumDstRegs
; j
++) {
213 if (i
->Dst
[j
].Register
.Dimension
) {
214 R600_ERR("unsupported dst (dimension)\n");
221 static int evergreen_interp_alu(struct r600_shader_ctx
*ctx
, int input
)
224 struct r600_bc_alu alu
;
225 int gpr
= 0, base_chan
= 0;
228 if (ctx
->shader
->input
[input
].interpolate
== TGSI_INTERPOLATE_PERSPECTIVE
) {
230 if (ctx
->shader
->input
[input
].centroid
)
232 } else if (ctx
->shader
->input
[input
].interpolate
== TGSI_INTERPOLATE_LINEAR
) {
234 /* if we have perspective add one */
235 if (ctx
->input_perspective
) {
237 /* if we have perspective centroid */
238 if (ctx
->input_centroid
)
241 if (ctx
->shader
->input
[input
].centroid
)
245 /* work out gpr and base_chan from index */
247 base_chan
= (2 * (ij_index
% 2)) + 1;
249 for (i
= 0; i
< 8; i
++) {
250 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
253 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW
;
255 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY
;
257 if ((i
> 1) && (i
< 6)) {
258 alu
.dst
.sel
= ctx
->shader
->input
[input
].gpr
;
262 alu
.dst
.chan
= i
% 4;
264 alu
.src
[0].sel
= gpr
;
265 alu
.src
[0].chan
= (base_chan
- (i
% 2));
267 alu
.src
[1].sel
= V_SQ_ALU_SRC_PARAM_BASE
+ ctx
->shader
->input
[input
].lds_pos
;
269 alu
.bank_swizzle_force
= SQ_ALU_VEC_210
;
272 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
280 static int tgsi_declaration(struct r600_shader_ctx
*ctx
)
282 struct tgsi_full_declaration
*d
= &ctx
->parse
.FullToken
.FullDeclaration
;
286 switch (d
->Declaration
.File
) {
287 case TGSI_FILE_INPUT
:
288 i
= ctx
->shader
->ninput
++;
289 ctx
->shader
->input
[i
].name
= d
->Semantic
.Name
;
290 ctx
->shader
->input
[i
].sid
= d
->Semantic
.Index
;
291 ctx
->shader
->input
[i
].interpolate
= d
->Declaration
.Interpolate
;
292 ctx
->shader
->input
[i
].centroid
= d
->Declaration
.Centroid
;
293 ctx
->shader
->input
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_INPUT
] + i
;
294 if (ctx
->type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
->bc
->chiprev
== CHIPREV_EVERGREEN
) {
295 /* turn input into interpolate on EG */
296 if (ctx
->shader
->input
[i
].name
!= TGSI_SEMANTIC_POSITION
) {
297 if (ctx
->shader
->input
[i
].interpolate
> 0) {
298 ctx
->shader
->input
[i
].lds_pos
= ctx
->shader
->nlds
++;
299 evergreen_interp_alu(ctx
, i
);
304 case TGSI_FILE_OUTPUT
:
305 i
= ctx
->shader
->noutput
++;
306 ctx
->shader
->output
[i
].name
= d
->Semantic
.Name
;
307 ctx
->shader
->output
[i
].sid
= d
->Semantic
.Index
;
308 ctx
->shader
->output
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_OUTPUT
] + i
;
309 ctx
->shader
->output
[i
].interpolate
= d
->Declaration
.Interpolate
;
311 case TGSI_FILE_CONSTANT
:
312 case TGSI_FILE_TEMPORARY
:
313 case TGSI_FILE_SAMPLER
:
314 case TGSI_FILE_ADDRESS
:
317 case TGSI_FILE_SYSTEM_VALUE
:
318 if (d
->Semantic
.Name
== TGSI_SEMANTIC_INSTANCEID
) {
319 struct r600_bc_alu alu
;
320 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
322 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT
);
331 if ((r
= r600_bc_add_alu(ctx
->bc
, &alu
)))
337 R600_ERR("unsupported file %d declaration\n", d
->Declaration
.File
);
343 static int r600_get_temp(struct r600_shader_ctx
*ctx
)
345 return ctx
->temp_reg
+ ctx
->max_driver_temp_used
++;
349 * for evergreen we need to scan the shader to find the number of GPRs we need to
350 * reserve for interpolation.
352 * we need to know if we are going to emit
353 * any centroid inputs
354 * if perspective and linear are required
356 static int evergreen_gpr_count(struct r600_shader_ctx
*ctx
)
361 ctx
->input_linear
= FALSE
;
362 ctx
->input_perspective
= FALSE
;
363 ctx
->input_centroid
= FALSE
;
364 ctx
->num_interp_gpr
= 1;
366 /* any centroid inputs */
367 for (i
= 0; i
< ctx
->info
.num_inputs
; i
++) {
368 /* skip position/face */
369 if (ctx
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_POSITION
||
370 ctx
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_FACE
)
372 if (ctx
->info
.input_interpolate
[i
] == TGSI_INTERPOLATE_LINEAR
)
373 ctx
->input_linear
= TRUE
;
374 if (ctx
->info
.input_interpolate
[i
] == TGSI_INTERPOLATE_PERSPECTIVE
)
375 ctx
->input_perspective
= TRUE
;
376 if (ctx
->info
.input_centroid
[i
])
377 ctx
->input_centroid
= TRUE
;
381 /* ignoring sample for now */
382 if (ctx
->input_perspective
)
384 if (ctx
->input_linear
)
386 if (ctx
->input_centroid
)
389 ctx
->num_interp_gpr
+= (num_baryc
+ 1) >> 1;
391 /* TODO PULL MODEL and LINE STIPPLE, FIXED PT POS */
392 return ctx
->num_interp_gpr
;
395 static void tgsi_src(struct r600_shader_ctx
*ctx
,
396 const struct tgsi_full_src_register
*tgsi_src
,
397 struct r600_shader_src
*r600_src
)
399 memset(r600_src
, 0, sizeof(*r600_src
));
400 r600_src
->swizzle
[0] = tgsi_src
->Register
.SwizzleX
;
401 r600_src
->swizzle
[1] = tgsi_src
->Register
.SwizzleY
;
402 r600_src
->swizzle
[2] = tgsi_src
->Register
.SwizzleZ
;
403 r600_src
->swizzle
[3] = tgsi_src
->Register
.SwizzleW
;
404 r600_src
->neg
= tgsi_src
->Register
.Negate
;
405 r600_src
->abs
= tgsi_src
->Register
.Absolute
;
407 if (tgsi_src
->Register
.File
== TGSI_FILE_IMMEDIATE
) {
409 if ((tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleY
) &&
410 (tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleZ
) &&
411 (tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleW
)) {
413 index
= tgsi_src
->Register
.Index
* 4 + tgsi_src
->Register
.SwizzleX
;
414 r600_bc_special_constants(ctx
->literals
[index
], &r600_src
->sel
, &r600_src
->neg
);
415 if (r600_src
->sel
!= V_SQ_ALU_SRC_LITERAL
)
418 index
= tgsi_src
->Register
.Index
;
419 r600_src
->sel
= V_SQ_ALU_SRC_LITERAL
;
420 memcpy(r600_src
->value
, ctx
->literals
+ index
* 4, sizeof(r600_src
->value
));
421 } else if (tgsi_src
->Register
.File
== TGSI_FILE_SYSTEM_VALUE
) {
422 /* assume we wan't TGSI_SEMANTIC_INSTANCEID here */
423 r600_src
->swizzle
[0] = 3;
424 r600_src
->swizzle
[1] = 3;
425 r600_src
->swizzle
[2] = 3;
426 r600_src
->swizzle
[3] = 3;
429 if (tgsi_src
->Register
.Indirect
)
430 r600_src
->rel
= V_SQ_REL_RELATIVE
;
431 r600_src
->sel
= tgsi_src
->Register
.Index
;
432 r600_src
->sel
+= ctx
->file_offset
[tgsi_src
->Register
.File
];
436 static int tgsi_fetch_rel_const(struct r600_shader_ctx
*ctx
, unsigned int offset
, unsigned int dst_reg
)
438 struct r600_bc_vtx vtx
;
443 struct r600_bc_alu alu
;
445 memset(&alu
, 0, sizeof(alu
));
447 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
);
448 alu
.src
[0].sel
= ctx
->ar_reg
;
450 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
451 alu
.src
[1].value
= offset
;
453 alu
.dst
.sel
= dst_reg
;
457 if ((r
= r600_bc_add_alu(ctx
->bc
, &alu
)))
462 ar_reg
= ctx
->ar_reg
;
465 memset(&vtx
, 0, sizeof(vtx
));
466 vtx
.fetch_type
= 2; /* VTX_FETCH_NO_INDEX_OFFSET */
467 vtx
.src_gpr
= ar_reg
;
468 vtx
.mega_fetch_count
= 16;
469 vtx
.dst_gpr
= dst_reg
;
470 vtx
.dst_sel_x
= 0; /* SEL_X */
471 vtx
.dst_sel_y
= 1; /* SEL_Y */
472 vtx
.dst_sel_z
= 2; /* SEL_Z */
473 vtx
.dst_sel_w
= 3; /* SEL_W */
474 vtx
.data_format
= FMT_32_32_32_32_FLOAT
;
475 vtx
.num_format_all
= 2; /* NUM_FORMAT_SCALED */
476 vtx
.format_comp_all
= 1; /* FORMAT_COMP_SIGNED */
477 vtx
.srf_mode_all
= 1; /* SRF_MODE_NO_ZERO */
478 vtx
.endian
= r600_endian_swap(32);
480 if ((r
= r600_bc_add_vtx(ctx
->bc
, &vtx
)))
486 static int tgsi_split_constant(struct r600_shader_ctx
*ctx
)
488 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
489 struct r600_bc_alu alu
;
490 int i
, j
, k
, nconst
, r
;
492 for (i
= 0, nconst
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
493 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
496 tgsi_src(ctx
, &inst
->Src
[i
], &ctx
->src
[i
]);
498 for (i
= 0, j
= nconst
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
499 if (inst
->Src
[i
].Register
.File
!= TGSI_FILE_CONSTANT
) {
503 if (ctx
->src
[i
].rel
) {
504 int treg
= r600_get_temp(ctx
);
505 if ((r
= tgsi_fetch_rel_const(ctx
, ctx
->src
[i
].sel
- 512, treg
)))
508 ctx
->src
[i
].sel
= treg
;
512 int treg
= r600_get_temp(ctx
);
513 for (k
= 0; k
< 4; k
++) {
514 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
515 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
516 alu
.src
[0].sel
= ctx
->src
[i
].sel
;
518 alu
.src
[0].rel
= ctx
->src
[i
].rel
;
524 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
528 ctx
->src
[i
].sel
= treg
;
536 /* need to move any immediate into a temp - for trig functions which use literal for PI stuff */
537 static int tgsi_split_literal_constant(struct r600_shader_ctx
*ctx
)
539 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
540 struct r600_bc_alu alu
;
541 int i
, j
, k
, nliteral
, r
;
543 for (i
= 0, nliteral
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
544 if (ctx
->src
[i
].sel
== V_SQ_ALU_SRC_LITERAL
) {
548 for (i
= 0, j
= nliteral
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
549 if (j
> 0 && ctx
->src
[i
].sel
== V_SQ_ALU_SRC_LITERAL
) {
550 int treg
= r600_get_temp(ctx
);
551 for (k
= 0; k
< 4; k
++) {
552 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
553 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
554 alu
.src
[0].sel
= ctx
->src
[i
].sel
;
556 alu
.src
[0].value
= ctx
->src
[i
].value
[k
];
562 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
566 ctx
->src
[i
].sel
= treg
;
573 static int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
)
575 struct tgsi_full_immediate
*immediate
;
576 struct tgsi_full_property
*property
;
577 struct r600_shader_ctx ctx
;
578 struct r600_bc_output output
[32];
579 unsigned output_done
, noutput
;
583 ctx
.bc
= &shader
->bc
;
585 r
= r600_bc_init(ctx
.bc
, shader
->family
);
589 tgsi_scan_shader(tokens
, &ctx
.info
);
590 tgsi_parse_init(&ctx
.parse
, tokens
);
591 ctx
.type
= ctx
.parse
.FullHeader
.Processor
.Processor
;
592 shader
->processor_type
= ctx
.type
;
593 ctx
.bc
->type
= shader
->processor_type
;
595 /* register allocations */
596 /* Values [0,127] correspond to GPR[0..127].
597 * Values [128,159] correspond to constant buffer bank 0
598 * Values [160,191] correspond to constant buffer bank 1
599 * Values [256,511] correspond to cfile constants c[0..255]. (Gone on EG)
600 * Values [256,287] correspond to constant buffer bank 2 (EG)
601 * Values [288,319] correspond to constant buffer bank 3 (EG)
602 * Other special values are shown in the list below.
603 * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
604 * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
605 * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
606 * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
607 * 248 SQ_ALU_SRC_0: special constant 0.0.
608 * 249 SQ_ALU_SRC_1: special constant 1.0 float.
609 * 250 SQ_ALU_SRC_1_INT: special constant 1 integer.
610 * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer.
611 * 252 SQ_ALU_SRC_0_5: special constant 0.5 float.
612 * 253 SQ_ALU_SRC_LITERAL: literal constant.
613 * 254 SQ_ALU_SRC_PV: previous vector result.
614 * 255 SQ_ALU_SRC_PS: previous scalar result.
616 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
617 ctx
.file_offset
[i
] = 0;
619 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
620 ctx
.file_offset
[TGSI_FILE_INPUT
] = 1;
621 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
) {
622 r600_bc_add_cfinst(ctx
.bc
, EG_V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
624 r600_bc_add_cfinst(ctx
.bc
, V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
627 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
) {
628 ctx
.file_offset
[TGSI_FILE_INPUT
] = evergreen_gpr_count(&ctx
);
630 ctx
.file_offset
[TGSI_FILE_OUTPUT
] = ctx
.file_offset
[TGSI_FILE_INPUT
] +
631 ctx
.info
.file_count
[TGSI_FILE_INPUT
];
632 ctx
.file_offset
[TGSI_FILE_TEMPORARY
] = ctx
.file_offset
[TGSI_FILE_OUTPUT
] +
633 ctx
.info
.file_count
[TGSI_FILE_OUTPUT
];
635 /* Outside the GPR range. This will be translated to one of the
636 * kcache banks later. */
637 ctx
.file_offset
[TGSI_FILE_CONSTANT
] = 512;
639 ctx
.file_offset
[TGSI_FILE_IMMEDIATE
] = V_SQ_ALU_SRC_LITERAL
;
640 ctx
.ar_reg
= ctx
.file_offset
[TGSI_FILE_TEMPORARY
] +
641 ctx
.info
.file_count
[TGSI_FILE_TEMPORARY
];
642 ctx
.temp_reg
= ctx
.ar_reg
+ 1;
646 shader
->fs_write_all
= FALSE
;
647 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
648 tgsi_parse_token(&ctx
.parse
);
649 switch (ctx
.parse
.FullToken
.Token
.Type
) {
650 case TGSI_TOKEN_TYPE_IMMEDIATE
:
651 immediate
= &ctx
.parse
.FullToken
.FullImmediate
;
652 ctx
.literals
= realloc(ctx
.literals
, (ctx
.nliterals
+ 1) * 16);
653 if(ctx
.literals
== NULL
) {
657 ctx
.literals
[ctx
.nliterals
* 4 + 0] = immediate
->u
[0].Uint
;
658 ctx
.literals
[ctx
.nliterals
* 4 + 1] = immediate
->u
[1].Uint
;
659 ctx
.literals
[ctx
.nliterals
* 4 + 2] = immediate
->u
[2].Uint
;
660 ctx
.literals
[ctx
.nliterals
* 4 + 3] = immediate
->u
[3].Uint
;
663 case TGSI_TOKEN_TYPE_DECLARATION
:
664 r
= tgsi_declaration(&ctx
);
668 case TGSI_TOKEN_TYPE_INSTRUCTION
:
669 r
= tgsi_is_supported(&ctx
);
672 ctx
.max_driver_temp_used
= 0;
673 /* reserve first tmp for everyone */
676 opcode
= ctx
.parse
.FullToken
.FullInstruction
.Instruction
.Opcode
;
677 if ((r
= tgsi_split_constant(&ctx
)))
679 if ((r
= tgsi_split_literal_constant(&ctx
)))
681 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
)
682 ctx
.inst_info
= &eg_shader_tgsi_instruction
[opcode
];
684 ctx
.inst_info
= &r600_shader_tgsi_instruction
[opcode
];
685 r
= ctx
.inst_info
->process(&ctx
);
689 case TGSI_TOKEN_TYPE_PROPERTY
:
690 property
= &ctx
.parse
.FullToken
.FullProperty
;
691 if (property
->Property
.PropertyName
== TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS
) {
692 if (property
->u
[0].Data
== 1)
693 shader
->fs_write_all
= TRUE
;
697 R600_ERR("unsupported token type %d\n", ctx
.parse
.FullToken
.Token
.Type
);
703 noutput
= shader
->noutput
;
704 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
705 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
706 output
[i
].gpr
= shader
->output
[i
].gpr
;
707 output
[i
].elem_size
= 3;
708 output
[i
].swizzle_x
= 0;
709 output
[i
].swizzle_y
= 1;
710 output
[i
].swizzle_z
= 2;
711 output
[i
].swizzle_w
= 3;
712 output
[i
].burst_count
= 1;
713 output
[i
].barrier
= 1;
714 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
715 output
[i
].array_base
= i
- pos0
;
716 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
718 case TGSI_PROCESSOR_VERTEX
:
719 if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
720 output
[i
].array_base
= 60;
721 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
722 /* position doesn't count in array_base */
725 if (shader
->output
[i
].name
== TGSI_SEMANTIC_PSIZE
) {
726 output
[i
].array_base
= 61;
727 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
728 /* position doesn't count in array_base */
732 case TGSI_PROCESSOR_FRAGMENT
:
733 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
734 output
[i
].array_base
= shader
->output
[i
].sid
;
735 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
736 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
737 output
[i
].array_base
= 61;
738 output
[i
].swizzle_x
= 2;
739 output
[i
].swizzle_y
= 7;
740 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
741 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
742 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
) {
743 output
[i
].array_base
= 61;
744 output
[i
].swizzle_x
= 7;
745 output
[i
].swizzle_y
= 1;
746 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
747 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
749 R600_ERR("unsupported fragment output name %d\n", shader
->output
[i
].name
);
755 R600_ERR("unsupported processor type %d\n", ctx
.type
);
760 /* add fake param output for vertex shader if no param is exported */
761 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
762 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
763 if (output
[i
].type
== V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
) {
769 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
771 output
[i
].elem_size
= 3;
772 output
[i
].swizzle_x
= 0;
773 output
[i
].swizzle_y
= 1;
774 output
[i
].swizzle_z
= 2;
775 output
[i
].swizzle_w
= 3;
776 output
[i
].burst_count
= 1;
777 output
[i
].barrier
= 1;
778 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
779 output
[i
].array_base
= 0;
780 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
784 /* add fake pixel export */
785 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& !noutput
) {
786 memset(&output
[0], 0, sizeof(struct r600_bc_output
));
788 output
[0].elem_size
= 3;
789 output
[0].swizzle_x
= 7;
790 output
[0].swizzle_y
= 7;
791 output
[0].swizzle_z
= 7;
792 output
[0].swizzle_w
= 7;
793 output
[0].burst_count
= 1;
794 output
[0].barrier
= 1;
795 output
[0].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
796 output
[0].array_base
= 0;
797 output
[0].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
800 /* set export done on last export of each type */
801 for (i
= noutput
- 1, output_done
= 0; i
>= 0; i
--) {
802 if (i
== (noutput
- 1)) {
803 output
[i
].end_of_program
= 1;
805 if (!(output_done
& (1 << output
[i
].type
))) {
806 output_done
|= (1 << output
[i
].type
);
807 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE
);
810 /* add output to bytecode */
811 for (i
= 0; i
< noutput
; i
++) {
812 r
= r600_bc_add_output(ctx
.bc
, &output
[i
]);
817 tgsi_parse_free(&ctx
.parse
);
821 tgsi_parse_free(&ctx
.parse
);
825 static int tgsi_unsupported(struct r600_shader_ctx
*ctx
)
827 R600_ERR("%d tgsi opcode unsupported\n", ctx
->inst_info
->tgsi_opcode
);
831 static int tgsi_end(struct r600_shader_ctx
*ctx
)
836 static void r600_bc_src(struct r600_bc_alu_src
*bc_src
,
837 const struct r600_shader_src
*shader_src
,
840 bc_src
->sel
= shader_src
->sel
;
841 bc_src
->chan
= shader_src
->swizzle
[chan
];
842 bc_src
->neg
= shader_src
->neg
;
843 bc_src
->abs
= shader_src
->abs
;
844 bc_src
->rel
= shader_src
->rel
;
845 bc_src
->value
= shader_src
->value
[bc_src
->chan
];
848 static void tgsi_dst(struct r600_shader_ctx
*ctx
,
849 const struct tgsi_full_dst_register
*tgsi_dst
,
851 struct r600_bc_alu_dst
*r600_dst
)
853 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
855 r600_dst
->sel
= tgsi_dst
->Register
.Index
;
856 r600_dst
->sel
+= ctx
->file_offset
[tgsi_dst
->Register
.File
];
857 r600_dst
->chan
= swizzle
;
859 if (tgsi_dst
->Register
.Indirect
)
860 r600_dst
->rel
= V_SQ_REL_RELATIVE
;
861 if (inst
->Instruction
.Saturate
) {
866 static int tgsi_last_instruction(unsigned writemask
)
870 for (i
= 0; i
< 4; i
++) {
871 if (writemask
& (1 << i
)) {
878 static int tgsi_op2_s(struct r600_shader_ctx
*ctx
, int swap
)
880 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
881 struct r600_bc_alu alu
;
883 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
885 for (i
= 0; i
< lasti
+ 1; i
++) {
886 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
889 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
890 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
892 alu
.inst
= ctx
->inst_info
->r600_opcode
;
894 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
895 r600_bc_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
898 r600_bc_src(&alu
.src
[0], &ctx
->src
[1], i
);
899 r600_bc_src(&alu
.src
[1], &ctx
->src
[0], i
);
901 /* handle some special cases */
902 switch (ctx
->inst_info
->tgsi_opcode
) {
903 case TGSI_OPCODE_SUB
:
906 case TGSI_OPCODE_ABS
:
917 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
924 static int tgsi_op2(struct r600_shader_ctx
*ctx
)
926 return tgsi_op2_s(ctx
, 0);
929 static int tgsi_op2_swap(struct r600_shader_ctx
*ctx
)
931 return tgsi_op2_s(ctx
, 1);
935 * r600 - trunc to -PI..PI range
936 * r700 - normalize by dividing by 2PI
939 static int tgsi_setup_trig(struct r600_shader_ctx
*ctx
)
941 static float half_inv_pi
= 1.0 /(3.1415926535 * 2);
942 static float double_pi
= 3.1415926535 * 2;
943 static float neg_pi
= -3.1415926535;
946 struct r600_bc_alu alu
;
948 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
949 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
953 alu
.dst
.sel
= ctx
->temp_reg
;
956 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
958 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
960 alu
.src
[1].value
= *(uint32_t *)&half_inv_pi
;
961 alu
.src
[2].sel
= V_SQ_ALU_SRC_0_5
;
964 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
968 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
969 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
972 alu
.dst
.sel
= ctx
->temp_reg
;
975 alu
.src
[0].sel
= ctx
->temp_reg
;
978 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
982 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
983 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
987 alu
.dst
.sel
= ctx
->temp_reg
;
990 alu
.src
[0].sel
= ctx
->temp_reg
;
993 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
995 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
998 if (ctx
->bc
->chiprev
== CHIPREV_R600
) {
999 alu
.src
[1].value
= *(uint32_t *)&double_pi
;
1000 alu
.src
[2].value
= *(uint32_t *)&neg_pi
;
1002 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1003 alu
.src
[2].sel
= V_SQ_ALU_SRC_0_5
;
1008 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1014 static int tgsi_trig(struct r600_shader_ctx
*ctx
)
1016 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1017 struct r600_bc_alu alu
;
1019 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1021 r
= tgsi_setup_trig(ctx
);
1025 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1026 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1028 alu
.dst
.sel
= ctx
->temp_reg
;
1031 alu
.src
[0].sel
= ctx
->temp_reg
;
1032 alu
.src
[0].chan
= 0;
1034 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1038 /* replicate result */
1039 for (i
= 0; i
< lasti
+ 1; i
++) {
1040 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1043 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1044 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1046 alu
.src
[0].sel
= ctx
->temp_reg
;
1047 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1050 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1057 static int tgsi_scs(struct r600_shader_ctx
*ctx
)
1059 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1060 struct r600_bc_alu alu
;
1063 /* We'll only need the trig stuff if we are going to write to the
1064 * X or Y components of the destination vector.
1066 if (likely(inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_XY
)) {
1067 r
= tgsi_setup_trig(ctx
);
1073 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_X
) {
1074 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1075 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
);
1076 tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1078 alu
.src
[0].sel
= ctx
->temp_reg
;
1079 alu
.src
[0].chan
= 0;
1081 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1087 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Y
) {
1088 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1089 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
);
1090 tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1092 alu
.src
[0].sel
= ctx
->temp_reg
;
1093 alu
.src
[0].chan
= 0;
1095 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1101 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Z
) {
1102 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1104 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1106 tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1108 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1109 alu
.src
[0].chan
= 0;
1113 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1119 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_W
) {
1120 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1122 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1124 tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1126 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1127 alu
.src
[0].chan
= 0;
1131 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1139 static int tgsi_kill(struct r600_shader_ctx
*ctx
)
1141 struct r600_bc_alu alu
;
1144 for (i
= 0; i
< 4; i
++) {
1145 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1146 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1150 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1152 if (ctx
->inst_info
->tgsi_opcode
== TGSI_OPCODE_KILP
) {
1153 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1156 r600_bc_src(&alu
.src
[1], &ctx
->src
[0], i
);
1161 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1166 /* kill must be last in ALU */
1167 ctx
->bc
->force_add_cf
= 1;
1168 ctx
->shader
->uses_kill
= TRUE
;
1172 static int tgsi_lit(struct r600_shader_ctx
*ctx
)
1174 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1175 struct r600_bc_alu alu
;
1179 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1180 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1181 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
; /*1.0*/
1182 alu
.src
[0].chan
= 0;
1183 tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1184 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 0) & 1;
1185 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1189 /* dst.y = max(src.x, 0.0) */
1190 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1191 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
);
1192 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
1193 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
1194 alu
.src
[1].chan
= 0;
1195 tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1196 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 1) & 1;
1197 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1202 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1203 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1204 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1205 alu
.src
[0].chan
= 0;
1206 tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1207 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 3) & 1;
1209 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1213 if (inst
->Dst
[0].Register
.WriteMask
& (1 << 2))
1218 /* dst.z = log(src.y) */
1219 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1220 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
);
1221 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 1);
1222 tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1224 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1228 chan
= alu
.dst
.chan
;
1231 /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
1232 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1233 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT
);
1234 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 3);
1235 alu
.src
[1].sel
= sel
;
1236 alu
.src
[1].chan
= chan
;
1238 r600_bc_src(&alu
.src
[2], &ctx
->src
[0], 0);
1239 alu
.dst
.sel
= ctx
->temp_reg
;
1244 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1248 /* dst.z = exp(tmp.x) */
1249 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1250 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1251 alu
.src
[0].sel
= ctx
->temp_reg
;
1252 alu
.src
[0].chan
= 0;
1253 tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1255 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1262 static int tgsi_rsq(struct r600_shader_ctx
*ctx
)
1264 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1265 struct r600_bc_alu alu
;
1268 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1271 * For state trackers other than OpenGL, we'll want to use
1272 * _RECIPSQRT_IEEE instead.
1274 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED
);
1276 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1277 r600_bc_src(&alu
.src
[i
], &ctx
->src
[i
], 0);
1280 alu
.dst
.sel
= ctx
->temp_reg
;
1283 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1286 /* replicate result */
1287 return tgsi_helper_tempx_replicate(ctx
);
1290 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
)
1292 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1293 struct r600_bc_alu alu
;
1296 for (i
= 0; i
< 4; i
++) {
1297 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1298 alu
.src
[0].sel
= ctx
->temp_reg
;
1299 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1301 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1302 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1305 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1312 static int tgsi_trans_srcx_replicate(struct r600_shader_ctx
*ctx
)
1314 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1315 struct r600_bc_alu alu
;
1318 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1319 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1320 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1321 r600_bc_src(&alu
.src
[i
], &ctx
->src
[i
], 0);
1323 alu
.dst
.sel
= ctx
->temp_reg
;
1326 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1329 /* replicate result */
1330 return tgsi_helper_tempx_replicate(ctx
);
1333 static int tgsi_pow(struct r600_shader_ctx
*ctx
)
1335 struct r600_bc_alu alu
;
1339 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1340 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
1341 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
1342 alu
.dst
.sel
= ctx
->temp_reg
;
1345 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1349 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1350 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1351 r600_bc_src(&alu
.src
[0], &ctx
->src
[1], 0);
1352 alu
.src
[1].sel
= ctx
->temp_reg
;
1353 alu
.dst
.sel
= ctx
->temp_reg
;
1356 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1359 /* POW(a,b) = EXP2(b * LOG2(a))*/
1360 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1361 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1362 alu
.src
[0].sel
= ctx
->temp_reg
;
1363 alu
.dst
.sel
= ctx
->temp_reg
;
1366 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1369 return tgsi_helper_tempx_replicate(ctx
);
1372 static int tgsi_ssg(struct r600_shader_ctx
*ctx
)
1374 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1375 struct r600_bc_alu alu
;
1378 /* tmp = (src > 0 ? 1 : src) */
1379 for (i
= 0; i
< 4; i
++) {
1380 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1381 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1384 alu
.dst
.sel
= ctx
->temp_reg
;
1387 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], i
);
1388 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1389 r600_bc_src(&alu
.src
[2], &ctx
->src
[0], i
);
1393 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1398 /* dst = (-tmp > 0 ? -1 : tmp) */
1399 for (i
= 0; i
< 4; i
++) {
1400 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1401 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1403 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1405 alu
.src
[0].sel
= ctx
->temp_reg
;
1406 alu
.src
[0].chan
= i
;
1409 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1412 alu
.src
[2].sel
= ctx
->temp_reg
;
1413 alu
.src
[2].chan
= i
;
1417 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1424 static int tgsi_helper_copy(struct r600_shader_ctx
*ctx
, struct tgsi_full_instruction
*inst
)
1426 struct r600_bc_alu alu
;
1429 for (i
= 0; i
< 4; i
++) {
1430 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1431 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
1432 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
);
1435 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1436 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1437 alu
.src
[0].sel
= ctx
->temp_reg
;
1438 alu
.src
[0].chan
= i
;
1443 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1450 static int tgsi_op3(struct r600_shader_ctx
*ctx
)
1452 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1453 struct r600_bc_alu alu
;
1455 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1457 for (i
= 0; i
< lasti
+ 1; i
++) {
1458 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1461 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1462 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1463 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1464 r600_bc_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
1467 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1474 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1481 static int tgsi_dp(struct r600_shader_ctx
*ctx
)
1483 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1484 struct r600_bc_alu alu
;
1487 for (i
= 0; i
< 4; i
++) {
1488 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1489 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1490 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1491 r600_bc_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
1494 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1496 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1497 /* handle some special cases */
1498 switch (ctx
->inst_info
->tgsi_opcode
) {
1499 case TGSI_OPCODE_DP2
:
1501 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1502 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1505 case TGSI_OPCODE_DP3
:
1507 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1508 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1511 case TGSI_OPCODE_DPH
:
1513 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1514 alu
.src
[0].chan
= 0;
1524 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1531 static int tgsi_tex(struct r600_shader_ctx
*ctx
)
1533 static float one_point_five
= 1.5f
;
1534 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1535 struct r600_bc_tex tex
;
1536 struct r600_bc_alu alu
;
1540 /* Texture fetch instructions can only use gprs as source.
1541 * Also they cannot negate the source or take the absolute value */
1542 const boolean src_requires_loading
=
1543 (inst
->Src
[0].Register
.File
!= TGSI_FILE_TEMPORARY
&&
1544 inst
->Src
[0].Register
.File
!= TGSI_FILE_INPUT
) ||
1545 ctx
->src
[0].neg
|| ctx
->src
[0].abs
;
1546 boolean src_loaded
= FALSE
;
1548 src_gpr
= ctx
->file_offset
[inst
->Src
[0].Register
.File
] + inst
->Src
[0].Register
.Index
;
1550 if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXP
) {
1551 /* Add perspective divide */
1552 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1553 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1554 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 3);
1556 alu
.dst
.sel
= ctx
->temp_reg
;
1560 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1564 for (i
= 0; i
< 3; i
++) {
1565 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1566 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1567 alu
.src
[0].sel
= ctx
->temp_reg
;
1568 alu
.src
[0].chan
= 3;
1569 r600_bc_src(&alu
.src
[1], &ctx
->src
[0], i
);
1570 alu
.dst
.sel
= ctx
->temp_reg
;
1573 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1577 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1578 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1579 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1580 alu
.src
[0].chan
= 0;
1581 alu
.dst
.sel
= ctx
->temp_reg
;
1585 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1589 src_gpr
= ctx
->temp_reg
;
1592 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1593 static const unsigned src0_swizzle
[] = {2, 2, 0, 1};
1594 static const unsigned src1_swizzle
[] = {1, 0, 2, 2};
1596 /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
1597 for (i
= 0; i
< 4; i
++) {
1598 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1599 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE
);
1600 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], src0_swizzle
[i
]);
1601 r600_bc_src(&alu
.src
[1], &ctx
->src
[0], src1_swizzle
[i
]);
1602 alu
.dst
.sel
= ctx
->temp_reg
;
1607 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1612 /* tmp1.z = RCP_e(|tmp1.z|) */
1613 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1614 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1615 alu
.src
[0].sel
= ctx
->temp_reg
;
1616 alu
.src
[0].chan
= 2;
1618 alu
.dst
.sel
= ctx
->temp_reg
;
1622 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1626 /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x
1627 * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x
1628 * muladd has no writemask, have to use another temp
1630 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1631 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1634 alu
.src
[0].sel
= ctx
->temp_reg
;
1635 alu
.src
[0].chan
= 0;
1636 alu
.src
[1].sel
= ctx
->temp_reg
;
1637 alu
.src
[1].chan
= 2;
1639 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1640 alu
.src
[2].chan
= 0;
1641 alu
.src
[2].value
= *(uint32_t *)&one_point_five
;
1643 alu
.dst
.sel
= ctx
->temp_reg
;
1647 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1651 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1652 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1655 alu
.src
[0].sel
= ctx
->temp_reg
;
1656 alu
.src
[0].chan
= 1;
1657 alu
.src
[1].sel
= ctx
->temp_reg
;
1658 alu
.src
[1].chan
= 2;
1660 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1661 alu
.src
[2].chan
= 0;
1662 alu
.src
[2].value
= *(uint32_t *)&one_point_five
;
1664 alu
.dst
.sel
= ctx
->temp_reg
;
1669 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1674 src_gpr
= ctx
->temp_reg
;
1677 if (src_requires_loading
&& !src_loaded
) {
1678 for (i
= 0; i
< 4; i
++) {
1679 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1680 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1681 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], i
);
1682 alu
.dst
.sel
= ctx
->temp_reg
;
1687 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1692 src_gpr
= ctx
->temp_reg
;
1695 opcode
= ctx
->inst_info
->r600_opcode
;
1696 if (opcode
== SQ_TEX_INST_SAMPLE
&&
1697 (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
))
1698 opcode
= SQ_TEX_INST_SAMPLE_C
;
1700 memset(&tex
, 0, sizeof(struct r600_bc_tex
));
1702 tex
.sampler_id
= ctx
->file_offset
[inst
->Src
[1].Register
.File
] + inst
->Src
[1].Register
.Index
;
1703 tex
.resource_id
= tex
.sampler_id
+ R600_MAX_CONST_BUFFERS
;
1704 tex
.src_gpr
= src_gpr
;
1705 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
1706 tex
.dst_sel_x
= (inst
->Dst
[0].Register
.WriteMask
& 1) ? 0 : 7;
1707 tex
.dst_sel_y
= (inst
->Dst
[0].Register
.WriteMask
& 2) ? 1 : 7;
1708 tex
.dst_sel_z
= (inst
->Dst
[0].Register
.WriteMask
& 4) ? 2 : 7;
1709 tex
.dst_sel_w
= (inst
->Dst
[0].Register
.WriteMask
& 8) ? 3 : 7;
1716 tex
.src_sel_x
= ctx
->src
[0].swizzle
[0];
1717 tex
.src_sel_y
= ctx
->src
[0].swizzle
[1];
1718 tex
.src_sel_z
= ctx
->src
[0].swizzle
[2];
1719 tex
.src_sel_w
= ctx
->src
[0].swizzle
[3];
1720 tex
.src_rel
= ctx
->src
[0].rel
;
1723 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1730 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
) {
1731 tex
.coord_type_x
= 1;
1732 tex
.coord_type_y
= 1;
1733 tex
.coord_type_z
= 1;
1734 tex
.coord_type_w
= 1;
1737 if (inst
->Texture
.Texture
== TGSI_TEXTURE_1D_ARRAY
) {
1738 tex
.coord_type_z
= 0;
1739 tex
.src_sel_z
= tex
.src_sel_y
;
1740 } else if (inst
->Texture
.Texture
== TGSI_TEXTURE_2D_ARRAY
)
1741 tex
.coord_type_z
= 0;
1743 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
)
1744 tex
.src_sel_w
= tex
.src_sel_z
;
1746 r
= r600_bc_add_tex(ctx
->bc
, &tex
);
1750 /* add shadow ambient support - gallium doesn't do it yet */
1754 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
1756 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1757 struct r600_bc_alu alu
;
1758 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1762 /* optimize if it's just an equal balance */
1763 if (ctx
->src
[0].sel
== V_SQ_ALU_SRC_0_5
) {
1764 for (i
= 0; i
< lasti
+ 1; i
++) {
1765 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1768 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1769 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1770 r600_bc_src(&alu
.src
[0], &ctx
->src
[1], i
);
1771 r600_bc_src(&alu
.src
[1], &ctx
->src
[2], i
);
1773 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1778 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1786 for (i
= 0; i
< lasti
+ 1; i
++) {
1787 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1790 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1791 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1792 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1793 alu
.src
[0].chan
= 0;
1794 r600_bc_src(&alu
.src
[1], &ctx
->src
[0], i
);
1796 alu
.dst
.sel
= ctx
->temp_reg
;
1802 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1807 /* (1 - src0) * src2 */
1808 for (i
= 0; i
< lasti
+ 1; i
++) {
1809 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1812 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1813 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1814 alu
.src
[0].sel
= ctx
->temp_reg
;
1815 alu
.src
[0].chan
= i
;
1816 r600_bc_src(&alu
.src
[1], &ctx
->src
[2], i
);
1817 alu
.dst
.sel
= ctx
->temp_reg
;
1823 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1828 /* src0 * src1 + (1 - src0) * src2 */
1829 for (i
= 0; i
< lasti
+ 1; i
++) {
1830 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1833 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1834 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1836 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], i
);
1837 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], i
);
1838 alu
.src
[2].sel
= ctx
->temp_reg
;
1839 alu
.src
[2].chan
= i
;
1841 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1846 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1853 static int tgsi_cmp(struct r600_shader_ctx
*ctx
)
1855 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1856 struct r600_bc_alu alu
;
1858 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1860 for (i
= 0; i
< lasti
+ 1; i
++) {
1861 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1864 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1865 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE
);
1866 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], i
);
1867 r600_bc_src(&alu
.src
[1], &ctx
->src
[2], i
);
1868 r600_bc_src(&alu
.src
[2], &ctx
->src
[1], i
);
1869 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1875 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1882 static int tgsi_xpd(struct r600_shader_ctx
*ctx
)
1884 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1885 static const unsigned int src0_swizzle
[] = {2, 0, 1};
1886 static const unsigned int src1_swizzle
[] = {1, 2, 0};
1887 struct r600_bc_alu alu
;
1888 uint32_t use_temp
= 0;
1891 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
1894 for (i
= 0; i
< 4; i
++) {
1895 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1896 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1898 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], src0_swizzle
[i
]);
1899 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], src1_swizzle
[i
]);
1901 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1902 alu
.src
[0].chan
= i
;
1903 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1904 alu
.src
[1].chan
= i
;
1907 alu
.dst
.sel
= ctx
->temp_reg
;
1913 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1918 for (i
= 0; i
< 4; i
++) {
1919 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1920 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1923 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], src1_swizzle
[i
]);
1924 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], src0_swizzle
[i
]);
1926 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1927 alu
.src
[0].chan
= i
;
1928 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1929 alu
.src
[1].chan
= i
;
1932 alu
.src
[2].sel
= ctx
->temp_reg
;
1934 alu
.src
[2].chan
= i
;
1937 alu
.dst
.sel
= ctx
->temp_reg
;
1939 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1945 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1950 return tgsi_helper_copy(ctx
, inst
);
1954 static int tgsi_exp(struct r600_shader_ctx
*ctx
)
1956 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1957 struct r600_bc_alu alu
;
1960 /* result.x = 2^floor(src); */
1961 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
1962 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1964 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
1965 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
1967 alu
.dst
.sel
= ctx
->temp_reg
;
1971 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1975 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1976 alu
.src
[0].sel
= ctx
->temp_reg
;
1977 alu
.src
[0].chan
= 0;
1979 alu
.dst
.sel
= ctx
->temp_reg
;
1983 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1988 /* result.y = tmp - floor(tmp); */
1989 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
1990 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1992 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
1993 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
1995 alu
.dst
.sel
= ctx
->temp_reg
;
1997 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2006 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2011 /* result.z = RoughApprox2ToX(tmp);*/
2012 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 0x1) {
2013 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2014 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2015 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2017 alu
.dst
.sel
= ctx
->temp_reg
;
2023 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2028 /* result.w = 1.0;*/
2029 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 0x1) {
2030 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2032 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2033 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2034 alu
.src
[0].chan
= 0;
2036 alu
.dst
.sel
= ctx
->temp_reg
;
2040 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2044 return tgsi_helper_copy(ctx
, inst
);
2047 static int tgsi_log(struct r600_shader_ctx
*ctx
)
2049 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2050 struct r600_bc_alu alu
;
2053 /* result.x = floor(log2(src)); */
2054 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2055 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2057 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2058 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2060 alu
.dst
.sel
= ctx
->temp_reg
;
2064 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2068 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2069 alu
.src
[0].sel
= ctx
->temp_reg
;
2070 alu
.src
[0].chan
= 0;
2072 alu
.dst
.sel
= ctx
->temp_reg
;
2077 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2082 /* result.y = src.x / (2 ^ floor(log2(src.x))); */
2083 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2084 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2086 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2087 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2089 alu
.dst
.sel
= ctx
->temp_reg
;
2094 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2098 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2100 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2101 alu
.src
[0].sel
= ctx
->temp_reg
;
2102 alu
.src
[0].chan
= 1;
2104 alu
.dst
.sel
= ctx
->temp_reg
;
2109 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2113 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2115 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2116 alu
.src
[0].sel
= ctx
->temp_reg
;
2117 alu
.src
[0].chan
= 1;
2119 alu
.dst
.sel
= ctx
->temp_reg
;
2124 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2128 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2130 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
2131 alu
.src
[0].sel
= ctx
->temp_reg
;
2132 alu
.src
[0].chan
= 1;
2134 alu
.dst
.sel
= ctx
->temp_reg
;
2139 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2143 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2145 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2147 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2149 alu
.src
[1].sel
= ctx
->temp_reg
;
2150 alu
.src
[1].chan
= 1;
2152 alu
.dst
.sel
= ctx
->temp_reg
;
2157 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2162 /* result.z = log2(src);*/
2163 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 1) {
2164 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2166 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2167 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2169 alu
.dst
.sel
= ctx
->temp_reg
;
2174 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2179 /* result.w = 1.0; */
2180 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 1) {
2181 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2183 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2184 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2185 alu
.src
[0].chan
= 0;
2187 alu
.dst
.sel
= ctx
->temp_reg
;
2192 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2197 return tgsi_helper_copy(ctx
, inst
);
2200 static int tgsi_eg_arl(struct r600_shader_ctx
*ctx
)
2202 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2203 struct r600_bc_alu alu
;
2206 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2208 switch (inst
->Instruction
.Opcode
) {
2209 case TGSI_OPCODE_ARL
:
2210 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR
;
2212 case TGSI_OPCODE_ARR
:
2213 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
2220 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2222 alu
.dst
.sel
= ctx
->ar_reg
;
2224 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2228 /* TODO: Note that the MOVA can be avoided if we never use AR for
2229 * indexing non-CB registers in the current ALU clause. Similarly, we
2230 * need to load AR from ar_reg again if we started a new clause
2231 * between ARL and AR usage. The easy way to do that is to remove
2232 * the MOVA here, and load it for the first AR access after ar_reg
2233 * has been modified in each clause. */
2234 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2235 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
;
2236 alu
.src
[0].sel
= ctx
->ar_reg
;
2237 alu
.src
[0].chan
= 0;
2239 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2244 static int tgsi_r600_arl(struct r600_shader_ctx
*ctx
)
2246 /* TODO from r600c, ar values don't persist between clauses */
2247 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2248 struct r600_bc_alu alu
;
2251 switch (inst
->Instruction
.Opcode
) {
2252 case TGSI_OPCODE_ARL
:
2253 memset(&alu
, 0, sizeof(alu
));
2254 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
;
2255 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2256 alu
.dst
.sel
= ctx
->ar_reg
;
2260 if ((r
= r600_bc_add_alu(ctx
->bc
, &alu
)))
2263 memset(&alu
, 0, sizeof(alu
));
2264 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
2265 alu
.src
[0].sel
= ctx
->ar_reg
;
2266 alu
.dst
.sel
= ctx
->ar_reg
;
2270 if ((r
= r600_bc_add_alu(ctx
->bc
, &alu
)))
2273 case TGSI_OPCODE_ARR
:
2274 memset(&alu
, 0, sizeof(alu
));
2275 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
2276 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2277 alu
.dst
.sel
= ctx
->ar_reg
;
2281 if ((r
= r600_bc_add_alu(ctx
->bc
, &alu
)))
2289 memset(&alu
, 0, sizeof(alu
));
2290 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
;
2291 alu
.src
[0].sel
= ctx
->ar_reg
;
2294 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2297 ctx
->bc
->cf_last
->r6xx_uses_waterfall
= 1;
2301 static int tgsi_opdst(struct r600_shader_ctx
*ctx
)
2303 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2304 struct r600_bc_alu alu
;
2307 for (i
= 0; i
< 4; i
++) {
2308 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2310 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2311 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2313 if (i
== 0 || i
== 3) {
2314 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2316 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], i
);
2319 if (i
== 0 || i
== 2) {
2320 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
2322 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], i
);
2326 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2333 static int emit_logic_pred(struct r600_shader_ctx
*ctx
, int opcode
)
2335 struct r600_bc_alu alu
;
2338 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2342 alu
.dst
.sel
= ctx
->temp_reg
;
2346 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2347 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2348 alu
.src
[1].chan
= 0;
2352 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE
));
2358 static int pops(struct r600_shader_ctx
*ctx
, int pops
)
2361 if (ctx
->bc
->cf_last
) {
2362 if (ctx
->bc
->cf_last
->inst
== CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
) << 3)
2364 else if (ctx
->bc
->cf_last
->inst
== CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER
) << 3)
2369 ctx
->bc
->cf_last
->inst
= CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER
) << 3;
2370 ctx
->bc
->force_add_cf
= 1;
2371 } else if (alu_pop
== 2) {
2372 ctx
->bc
->cf_last
->inst
= CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER
) << 3;
2373 ctx
->bc
->force_add_cf
= 1;
2375 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP
));
2376 ctx
->bc
->cf_last
->pop_count
= pops
;
2377 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2382 static inline void callstack_decrease_current(struct r600_shader_ctx
*ctx
, unsigned reason
)
2386 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2390 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
-= 4;
2393 /* TOODO : for 16 vp asic should -= 2; */
2394 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2399 static inline void callstack_check_depth(struct r600_shader_ctx
*ctx
, unsigned reason
, unsigned check_max_only
)
2401 if (check_max_only
) {
2414 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
) >
2415 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2416 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2417 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
;
2423 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2427 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+= 4;
2430 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2434 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
) >
2435 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2436 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2437 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
;
2441 static void fc_set_mid(struct r600_shader_ctx
*ctx
, int fc_sp
)
2443 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[fc_sp
];
2445 sp
->mid
= (struct r600_bc_cf
**)realloc((void *)sp
->mid
,
2446 sizeof(struct r600_bc_cf
*) * (sp
->num_mid
+ 1));
2447 sp
->mid
[sp
->num_mid
] = ctx
->bc
->cf_last
;
2451 static void fc_pushlevel(struct r600_shader_ctx
*ctx
, int type
)
2454 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
= type
;
2455 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
= ctx
->bc
->cf_last
;
2458 static void fc_poplevel(struct r600_shader_ctx
*ctx
)
2460 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
];
2472 static int emit_return(struct r600_shader_ctx
*ctx
)
2474 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_RETURN
);
2478 static int emit_jump_to_offset(struct r600_shader_ctx
*ctx
, int pops
, int offset
)
2481 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_JUMP
);
2482 ctx
->bc
->cf_last
->pop_count
= pops
;
2483 /* TODO work out offset */
2487 static int emit_setret_in_loop_flag(struct r600_shader_ctx
*ctx
, unsigned flag_value
)
2492 static void emit_testflag(struct r600_shader_ctx
*ctx
)
2497 static void emit_return_on_flag(struct r600_shader_ctx
*ctx
, unsigned ifidx
)
2500 emit_jump_to_offset(ctx
, 1, 4);
2501 emit_setret_in_loop_flag(ctx
, V_SQ_ALU_SRC_0
);
2502 pops(ctx
, ifidx
+ 1);
2506 static void break_loop_on_flag(struct r600_shader_ctx
*ctx
, unsigned fc_sp
)
2510 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2511 ctx
->bc
->cf_last
->pop_count
= 1;
2513 fc_set_mid(ctx
, fc_sp
);
2519 static int tgsi_if(struct r600_shader_ctx
*ctx
)
2521 emit_logic_pred(ctx
, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE
));
2523 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
2525 fc_pushlevel(ctx
, FC_IF
);
2527 callstack_check_depth(ctx
, FC_PUSH_VPM
, 0);
2531 static int tgsi_else(struct r600_shader_ctx
*ctx
)
2533 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE
));
2534 ctx
->bc
->cf_last
->pop_count
= 1;
2536 fc_set_mid(ctx
, ctx
->bc
->fc_sp
);
2537 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
;
2541 static int tgsi_endif(struct r600_shader_ctx
*ctx
)
2544 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_IF
) {
2545 R600_ERR("if/endif unbalanced in shader\n");
2549 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
== NULL
) {
2550 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2551 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->pop_count
= 1;
2553 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[0]->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2557 callstack_decrease_current(ctx
, FC_PUSH_VPM
);
2561 static int tgsi_bgnloop(struct r600_shader_ctx
*ctx
)
2563 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL
));
2565 fc_pushlevel(ctx
, FC_LOOP
);
2567 /* check stack depth */
2568 callstack_check_depth(ctx
, FC_LOOP
, 0);
2572 static int tgsi_endloop(struct r600_shader_ctx
*ctx
)
2576 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END
));
2578 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_LOOP
) {
2579 R600_ERR("loop/endloop in shader code are not paired.\n");
2583 /* fixup loop pointers - from r600isa
2584 LOOP END points to CF after LOOP START,
2585 LOOP START point to CF after LOOP END
2586 BRK/CONT point to LOOP END CF
2588 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->id
+ 2;
2590 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2592 for (i
= 0; i
< ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].num_mid
; i
++) {
2593 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[i
]->cf_addr
= ctx
->bc
->cf_last
->id
;
2595 /* TODO add LOOPRET support */
2597 callstack_decrease_current(ctx
, FC_LOOP
);
2601 static int tgsi_loop_brk_cont(struct r600_shader_ctx
*ctx
)
2605 for (fscp
= ctx
->bc
->fc_sp
; fscp
> 0; fscp
--)
2607 if (FC_LOOP
== ctx
->bc
->fc_stack
[fscp
].type
)
2612 R600_ERR("Break not inside loop/endloop pair\n");
2616 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2617 ctx
->bc
->cf_last
->pop_count
= 1;
2619 fc_set_mid(ctx
, fscp
);
2622 callstack_check_depth(ctx
, FC_PUSH_VPM
, 1);
2626 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
2627 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2628 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2629 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
2632 * For state trackers other than OpenGL, we'll want to use
2633 * _RECIP_IEEE instead.
2635 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED
, tgsi_trans_srcx_replicate
},
2637 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_rsq
},
2638 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
2639 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
2640 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
2641 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2642 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2643 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2644 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
2645 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
2646 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
2647 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
2648 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
2649 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
2650 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2651 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
2652 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2654 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2655 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2657 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2658 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2659 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
2660 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2661 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
2662 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2663 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
2664 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
2665 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
2666 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
2668 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2669 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2670 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2671 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2672 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
2673 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
2674 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
2675 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
2676 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2677 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2678 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2679 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2680 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2681 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
2682 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2683 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
2684 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
2685 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
2686 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
2687 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2688 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2689 {TGSI_OPCODE_TXD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2690 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2691 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2692 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2693 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2694 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2695 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2696 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2697 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2698 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2699 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2700 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2701 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
2702 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
2703 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
2704 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2705 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2706 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2707 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2708 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2709 {TGSI_OPCODE_BRK
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
2710 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
2712 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2713 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2714 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
2715 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
2717 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2718 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2719 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2720 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2721 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2722 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2723 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2724 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_op2
},
2725 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2727 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2728 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2729 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2730 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2731 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2732 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2733 {TGSI_OPCODE_TXF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2734 {TGSI_OPCODE_TXQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2735 {TGSI_OPCODE_CONT
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
2736 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2737 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2738 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
2739 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2740 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
2741 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2743 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2744 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2745 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2746 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2747 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2749 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2750 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2751 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2752 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2753 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2754 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2755 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2756 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2757 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
2758 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
2760 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2761 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2762 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2763 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2764 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2765 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2766 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2767 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2768 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2769 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2770 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2771 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2772 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2773 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2774 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2775 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2776 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2777 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2778 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2779 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2780 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2781 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2782 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2783 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2784 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2785 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2786 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2787 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2790 static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction
[] = {
2791 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
2792 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2793 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
2794 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
2795 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_trans_srcx_replicate
},
2796 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
2797 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
2798 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
2799 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2800 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2801 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2802 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
2803 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
2804 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
2805 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
2806 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
2807 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
2808 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2809 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
2810 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2812 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2813 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2815 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2816 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2817 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
2818 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2819 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
2820 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2821 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
2822 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
2823 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
2824 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
2826 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2827 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2828 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2829 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2830 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
2831 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
2832 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
2833 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
2834 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2835 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2836 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2837 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2838 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2839 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
2840 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2841 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
2842 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
2843 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
2844 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
2845 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2846 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2847 {TGSI_OPCODE_TXD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2848 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2849 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2850 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2851 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2852 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2853 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2854 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2855 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
2856 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2857 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2858 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2859 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
2860 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
2861 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
2862 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2863 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2864 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2865 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2866 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2867 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
2868 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
2870 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2871 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2872 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
2873 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
2875 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2876 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2877 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2878 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2879 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2880 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2881 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2882 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_op2
},
2883 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2885 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2886 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2887 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2888 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2889 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2890 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2891 {TGSI_OPCODE_TXF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2892 {TGSI_OPCODE_TXQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2893 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
2894 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2895 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2896 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
2897 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2898 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
2899 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2901 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2902 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2903 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2904 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2905 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2907 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2908 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2909 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2910 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2911 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2912 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2913 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2914 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2915 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
2916 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
2918 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2919 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2920 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2921 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2922 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2923 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2924 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2925 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2926 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2927 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2928 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2929 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2930 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2931 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2932 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2933 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2934 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2935 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2936 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2937 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2938 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2939 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2940 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2941 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2942 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2943 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2944 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2945 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},