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_opcodes.h"
36 static void r600_pipe_shader_vs(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
38 struct r600_pipe_state
*rstate
= &shader
->rstate
;
39 struct r600_shader
*rshader
= &shader
->shader
;
40 unsigned spi_vs_out_id
[10];
43 /* clear previous register */
46 /* so far never got proper semantic id from tgsi */
47 /* FIXME better to move this in config things so they get emited
48 * only one time per cs
50 for (i
= 0; i
< 10; i
++) {
53 for (i
= 0; i
< 32; i
++) {
54 tmp
= i
<< ((i
& 3) * 8);
55 spi_vs_out_id
[i
/ 4] |= tmp
;
57 for (i
= 0; i
< 10; i
++) {
58 r600_pipe_state_add_reg(rstate
,
59 R_028614_SPI_VS_OUT_ID_0
+ i
* 4,
60 spi_vs_out_id
[i
], 0xFFFFFFFF, NULL
);
63 r600_pipe_state_add_reg(rstate
,
64 R_0286C4_SPI_VS_OUT_CONFIG
,
65 S_0286C4_VS_EXPORT_COUNT(rshader
->noutput
- 2),
67 r600_pipe_state_add_reg(rstate
,
68 R_028868_SQ_PGM_RESOURCES_VS
,
69 S_028868_NUM_GPRS(rshader
->bc
.ngpr
) |
70 S_028868_STACK_SIZE(rshader
->bc
.nstack
),
72 r600_pipe_state_add_reg(rstate
,
73 R_0288D0_SQ_PGM_CF_OFFSET_VS
,
74 0x00000000, 0xFFFFFFFF, NULL
);
75 r600_pipe_state_add_reg(rstate
,
76 R_028858_SQ_PGM_START_VS
,
77 r600_bo_offset(shader
->bo
) >> 8, 0xFFFFFFFF, shader
->bo
);
79 r600_pipe_state_add_reg(rstate
,
80 R_03E200_SQ_LOOP_CONST_0
+ (32 * 4), 0x01000FFF,
85 int r600_find_vs_semantic_index(struct r600_shader
*vs
,
86 struct r600_shader
*ps
, int id
)
88 struct r600_shader_io
*input
= &ps
->input
[id
];
90 for (int i
= 0; i
< vs
->noutput
; i
++) {
91 if (input
->name
== vs
->output
[i
].name
&&
92 input
->sid
== vs
->output
[i
].sid
) {
99 static void r600_pipe_shader_ps(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
101 struct r600_pipe_state
*rstate
= &shader
->rstate
;
102 struct r600_shader
*rshader
= &shader
->shader
;
103 unsigned i
, exports_ps
, num_cout
, spi_ps_in_control_0
, spi_input_z
, spi_ps_in_control_1
;
104 int pos_index
= -1, face_index
= -1;
108 for (i
= 0; i
< rshader
->ninput
; i
++) {
109 if (rshader
->input
[i
].name
== TGSI_SEMANTIC_POSITION
)
111 if (rshader
->input
[i
].name
== TGSI_SEMANTIC_FACE
)
115 for (i
= 0; i
< rshader
->noutput
; i
++) {
116 if (rshader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
)
117 r600_pipe_state_add_reg(rstate
,
118 R_02880C_DB_SHADER_CONTROL
,
119 S_02880C_Z_EXPORT_ENABLE(1),
120 S_02880C_Z_EXPORT_ENABLE(1), NULL
);
121 if (rshader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
)
122 r600_pipe_state_add_reg(rstate
,
123 R_02880C_DB_SHADER_CONTROL
,
124 S_02880C_STENCIL_REF_EXPORT_ENABLE(1),
125 S_02880C_STENCIL_REF_EXPORT_ENABLE(1), NULL
);
130 for (i
= 0; i
< rshader
->noutput
; i
++) {
131 if (rshader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
|| rshader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
)
133 else if (rshader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
137 exports_ps
|= S_028854_EXPORT_COLORS(num_cout
);
139 /* always at least export 1 component per pixel */
143 spi_ps_in_control_0
= S_0286CC_NUM_INTERP(rshader
->ninput
) |
144 S_0286CC_PERSP_GRADIENT_ENA(1);
146 if (pos_index
!= -1) {
147 spi_ps_in_control_0
|= (S_0286CC_POSITION_ENA(1) |
148 S_0286CC_POSITION_CENTROID(rshader
->input
[pos_index
].centroid
) |
149 S_0286CC_POSITION_ADDR(rshader
->input
[pos_index
].gpr
) |
150 S_0286CC_BARYC_SAMPLE_CNTL(1));
154 spi_ps_in_control_1
= 0;
155 if (face_index
!= -1) {
156 spi_ps_in_control_1
|= S_0286D0_FRONT_FACE_ENA(1) |
157 S_0286D0_FRONT_FACE_ADDR(rshader
->input
[face_index
].gpr
);
160 r600_pipe_state_add_reg(rstate
, R_0286CC_SPI_PS_IN_CONTROL_0
, spi_ps_in_control_0
, 0xFFFFFFFF, NULL
);
161 r600_pipe_state_add_reg(rstate
, R_0286D0_SPI_PS_IN_CONTROL_1
, spi_ps_in_control_1
, 0xFFFFFFFF, NULL
);
162 r600_pipe_state_add_reg(rstate
, R_0286D8_SPI_INPUT_Z
, spi_input_z
, 0xFFFFFFFF, NULL
);
163 r600_pipe_state_add_reg(rstate
,
164 R_028840_SQ_PGM_START_PS
,
165 r600_bo_offset(shader
->bo
) >> 8, 0xFFFFFFFF, shader
->bo
);
166 r600_pipe_state_add_reg(rstate
,
167 R_028850_SQ_PGM_RESOURCES_PS
,
168 S_028868_NUM_GPRS(rshader
->bc
.ngpr
) |
169 S_028868_STACK_SIZE(rshader
->bc
.nstack
),
171 r600_pipe_state_add_reg(rstate
,
172 R_028854_SQ_PGM_EXPORTS_PS
,
173 exports_ps
, 0xFFFFFFFF, NULL
);
174 r600_pipe_state_add_reg(rstate
,
175 R_0288CC_SQ_PGM_CF_OFFSET_PS
,
176 0x00000000, 0xFFFFFFFF, NULL
);
178 if (rshader
->uses_kill
) {
179 /* only set some bits here, the other bits are set in the dsa state */
180 r600_pipe_state_add_reg(rstate
,
181 R_02880C_DB_SHADER_CONTROL
,
182 S_02880C_KILL_ENABLE(1),
183 S_02880C_KILL_ENABLE(1), NULL
);
185 r600_pipe_state_add_reg(rstate
,
186 R_03E200_SQ_LOOP_CONST_0
, 0x01000FFF,
190 int r600_pipe_shader(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
192 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
193 struct r600_shader
*rshader
= &shader
->shader
;
196 /* copy new shader */
197 if (shader
->bo
== NULL
) {
198 shader
->bo
= r600_bo(rctx
->radeon
, rshader
->bc
.ndw
* 4, 4096, 0, 0);
199 if (shader
->bo
== NULL
) {
202 ptr
= r600_bo_map(rctx
->radeon
, shader
->bo
, 0, NULL
);
203 memcpy(ptr
, rshader
->bc
.bytecode
, rshader
->bc
.ndw
* 4);
204 r600_bo_unmap(rctx
->radeon
, shader
->bo
);
207 switch (rshader
->processor_type
) {
208 case TGSI_PROCESSOR_VERTEX
:
209 if (rshader
->family
>= CHIP_CEDAR
) {
210 evergreen_pipe_shader_vs(ctx
, shader
);
212 r600_pipe_shader_vs(ctx
, shader
);
215 case TGSI_PROCESSOR_FRAGMENT
:
216 if (rshader
->family
>= CHIP_CEDAR
) {
217 evergreen_pipe_shader_ps(ctx
, shader
);
219 r600_pipe_shader_ps(ctx
, shader
);
228 int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
);
229 int r600_pipe_shader_create(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
, const struct tgsi_token
*tokens
)
231 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
234 //fprintf(stderr, "--------------------------------------------------------------\n");
235 //tgsi_dump(tokens, 0);
236 shader
->shader
.family
= r600_get_family(rctx
->radeon
);
237 r
= r600_shader_from_tgsi(tokens
, &shader
->shader
);
239 R600_ERR("translation from TGSI failed !\n");
242 r
= r600_bc_build(&shader
->shader
.bc
);
244 R600_ERR("building bytecode failed !\n");
247 //r600_bc_dump(&shader->shader.bc);
248 //fprintf(stderr, "______________________________________________________________\n");
249 return r600_pipe_shader(ctx
, shader
);
252 void r600_pipe_shader_destroy(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
254 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
256 r600_bo_reference(rctx
->radeon
, &shader
->bo
, NULL
);
257 r600_bc_clear(&shader
->shader
.bc
);
261 * tgsi -> r600 shader
263 struct r600_shader_tgsi_instruction
;
265 struct r600_shader_ctx
{
266 struct tgsi_shader_info info
;
267 struct tgsi_parse_context parse
;
268 const struct tgsi_token
*tokens
;
270 unsigned file_offset
[TGSI_FILE_COUNT
];
272 struct r600_shader_tgsi_instruction
*inst_info
;
274 struct r600_shader
*shader
;
278 u32 max_driver_temp_used
;
279 /* needed for evergreen interpolation */
280 boolean input_centroid
;
281 boolean input_linear
;
282 boolean input_perspective
;
286 struct r600_shader_tgsi_instruction
{
287 unsigned tgsi_opcode
;
289 unsigned r600_opcode
;
290 int (*process
)(struct r600_shader_ctx
*ctx
);
293 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[], eg_shader_tgsi_instruction
[];
294 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
);
296 static int tgsi_is_supported(struct r600_shader_ctx
*ctx
)
298 struct tgsi_full_instruction
*i
= &ctx
->parse
.FullToken
.FullInstruction
;
301 if (i
->Instruction
.NumDstRegs
> 1) {
302 R600_ERR("too many dst (%d)\n", i
->Instruction
.NumDstRegs
);
305 if (i
->Instruction
.Predicate
) {
306 R600_ERR("predicate unsupported\n");
310 if (i
->Instruction
.Label
) {
311 R600_ERR("label unsupported\n");
315 for (j
= 0; j
< i
->Instruction
.NumSrcRegs
; j
++) {
316 if (i
->Src
[j
].Register
.Dimension
) {
317 R600_ERR("unsupported src %d (dimension %d)\n", j
,
318 i
->Src
[j
].Register
.Dimension
);
322 for (j
= 0; j
< i
->Instruction
.NumDstRegs
; j
++) {
323 if (i
->Dst
[j
].Register
.Dimension
) {
324 R600_ERR("unsupported dst (dimension)\n");
331 static int evergreen_interp_alu(struct r600_shader_ctx
*ctx
, int input
)
334 struct r600_bc_alu alu
;
335 int gpr
= 0, base_chan
= 0;
338 if (ctx
->shader
->input
[input
].interpolate
== TGSI_INTERPOLATE_PERSPECTIVE
) {
340 if (ctx
->shader
->input
[input
].centroid
)
342 } else if (ctx
->shader
->input
[input
].interpolate
== TGSI_INTERPOLATE_LINEAR
) {
344 /* if we have perspective add one */
345 if (ctx
->input_perspective
) {
347 /* if we have perspective centroid */
348 if (ctx
->input_centroid
)
351 if (ctx
->shader
->input
[input
].centroid
)
355 /* work out gpr and base_chan from index */
357 base_chan
= (2 * (ij_index
% 2)) + 1;
359 for (i
= 0; i
< 8; i
++) {
360 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
363 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW
;
365 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY
;
367 if ((i
> 1) && (i
< 6)) {
368 alu
.dst
.sel
= ctx
->shader
->input
[input
].gpr
;
372 alu
.dst
.chan
= i
% 4;
374 alu
.src
[0].sel
= gpr
;
375 alu
.src
[0].chan
= (base_chan
- (i
% 2));
377 alu
.src
[1].sel
= V_SQ_ALU_SRC_PARAM_BASE
+ ctx
->shader
->input
[input
].lds_pos
;
379 alu
.bank_swizzle_force
= SQ_ALU_VEC_210
;
382 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
390 static int tgsi_declaration(struct r600_shader_ctx
*ctx
)
392 struct tgsi_full_declaration
*d
= &ctx
->parse
.FullToken
.FullDeclaration
;
395 switch (d
->Declaration
.File
) {
396 case TGSI_FILE_INPUT
:
397 i
= ctx
->shader
->ninput
++;
398 ctx
->shader
->input
[i
].name
= d
->Semantic
.Name
;
399 ctx
->shader
->input
[i
].sid
= d
->Semantic
.Index
;
400 ctx
->shader
->input
[i
].interpolate
= d
->Declaration
.Interpolate
;
401 ctx
->shader
->input
[i
].centroid
= d
->Declaration
.Centroid
;
402 ctx
->shader
->input
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_INPUT
] + i
;
403 if (ctx
->type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
->bc
->chiprev
== CHIPREV_EVERGREEN
) {
404 /* turn input into interpolate on EG */
405 if (ctx
->shader
->input
[i
].name
!= TGSI_SEMANTIC_POSITION
) {
406 if (ctx
->shader
->input
[i
].interpolate
> 0) {
407 ctx
->shader
->input
[i
].lds_pos
= ctx
->shader
->nlds
++;
408 evergreen_interp_alu(ctx
, i
);
413 case TGSI_FILE_OUTPUT
:
414 i
= ctx
->shader
->noutput
++;
415 ctx
->shader
->output
[i
].name
= d
->Semantic
.Name
;
416 ctx
->shader
->output
[i
].sid
= d
->Semantic
.Index
;
417 ctx
->shader
->output
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_OUTPUT
] + i
;
418 ctx
->shader
->output
[i
].interpolate
= d
->Declaration
.Interpolate
;
420 case TGSI_FILE_CONSTANT
:
421 case TGSI_FILE_TEMPORARY
:
422 case TGSI_FILE_SAMPLER
:
423 case TGSI_FILE_ADDRESS
:
426 R600_ERR("unsupported file %d declaration\n", d
->Declaration
.File
);
432 static int r600_get_temp(struct r600_shader_ctx
*ctx
)
434 return ctx
->temp_reg
+ ctx
->max_driver_temp_used
++;
438 * for evergreen we need to scan the shader to find the number of GPRs we need to
439 * reserve for interpolation.
441 * we need to know if we are going to emit
442 * any centroid inputs
443 * if perspective and linear are required
445 static int evergreen_gpr_count(struct r600_shader_ctx
*ctx
)
450 ctx
->input_linear
= FALSE
;
451 ctx
->input_perspective
= FALSE
;
452 ctx
->input_centroid
= FALSE
;
453 ctx
->num_interp_gpr
= 1;
455 /* any centroid inputs */
456 for (i
= 0; i
< ctx
->info
.num_inputs
; i
++) {
457 /* skip position/face */
458 if (ctx
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_POSITION
||
459 ctx
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_FACE
)
461 if (ctx
->info
.input_interpolate
[i
] == TGSI_INTERPOLATE_LINEAR
)
462 ctx
->input_linear
= TRUE
;
463 if (ctx
->info
.input_interpolate
[i
] == TGSI_INTERPOLATE_PERSPECTIVE
)
464 ctx
->input_perspective
= TRUE
;
465 if (ctx
->info
.input_centroid
[i
])
466 ctx
->input_centroid
= TRUE
;
470 /* ignoring sample for now */
471 if (ctx
->input_perspective
)
473 if (ctx
->input_linear
)
475 if (ctx
->input_centroid
)
478 ctx
->num_interp_gpr
+= (num_baryc
+ 1) >> 1;
480 /* TODO PULL MODEL and LINE STIPPLE, FIXED PT POS */
481 return ctx
->num_interp_gpr
;
484 int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
)
486 struct tgsi_full_immediate
*immediate
;
487 struct r600_shader_ctx ctx
;
488 struct r600_bc_output output
[32];
489 unsigned output_done
, noutput
;
493 ctx
.bc
= &shader
->bc
;
495 r
= r600_bc_init(ctx
.bc
, shader
->family
);
499 tgsi_scan_shader(tokens
, &ctx
.info
);
500 tgsi_parse_init(&ctx
.parse
, tokens
);
501 ctx
.type
= ctx
.parse
.FullHeader
.Processor
.Processor
;
502 shader
->processor_type
= ctx
.type
;
503 ctx
.bc
->type
= shader
->processor_type
;
505 /* register allocations */
506 /* Values [0,127] correspond to GPR[0..127].
507 * Values [128,159] correspond to constant buffer bank 0
508 * Values [160,191] correspond to constant buffer bank 1
509 * Values [256,511] correspond to cfile constants c[0..255].
510 * Other special values are shown in the list below.
511 * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
512 * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
513 * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
514 * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
515 * 248 SQ_ALU_SRC_0: special constant 0.0.
516 * 249 SQ_ALU_SRC_1: special constant 1.0 float.
517 * 250 SQ_ALU_SRC_1_INT: special constant 1 integer.
518 * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer.
519 * 252 SQ_ALU_SRC_0_5: special constant 0.5 float.
520 * 253 SQ_ALU_SRC_LITERAL: literal constant.
521 * 254 SQ_ALU_SRC_PV: previous vector result.
522 * 255 SQ_ALU_SRC_PS: previous scalar result.
524 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
525 ctx
.file_offset
[i
] = 0;
527 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
528 ctx
.file_offset
[TGSI_FILE_INPUT
] = 1;
529 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
) {
530 r600_bc_add_cfinst(ctx
.bc
, EG_V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
532 r600_bc_add_cfinst(ctx
.bc
, V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
535 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
) {
536 ctx
.file_offset
[TGSI_FILE_INPUT
] = evergreen_gpr_count(&ctx
);
538 ctx
.file_offset
[TGSI_FILE_OUTPUT
] = ctx
.file_offset
[TGSI_FILE_INPUT
] +
539 ctx
.info
.file_count
[TGSI_FILE_INPUT
];
540 ctx
.file_offset
[TGSI_FILE_TEMPORARY
] = ctx
.file_offset
[TGSI_FILE_OUTPUT
] +
541 ctx
.info
.file_count
[TGSI_FILE_OUTPUT
];
543 /* Outside the GPR range. This will be translated to one of the
544 * kcache banks later. */
545 ctx
.file_offset
[TGSI_FILE_CONSTANT
] = 512;
547 ctx
.file_offset
[TGSI_FILE_IMMEDIATE
] = 253;
548 ctx
.temp_reg
= ctx
.file_offset
[TGSI_FILE_TEMPORARY
] +
549 ctx
.info
.file_count
[TGSI_FILE_TEMPORARY
];
554 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
555 tgsi_parse_token(&ctx
.parse
);
556 switch (ctx
.parse
.FullToken
.Token
.Type
) {
557 case TGSI_TOKEN_TYPE_IMMEDIATE
:
558 immediate
= &ctx
.parse
.FullToken
.FullImmediate
;
559 ctx
.literals
= realloc(ctx
.literals
, (ctx
.nliterals
+ 1) * 16);
560 if(ctx
.literals
== NULL
) {
564 ctx
.literals
[ctx
.nliterals
* 4 + 0] = immediate
->u
[0].Uint
;
565 ctx
.literals
[ctx
.nliterals
* 4 + 1] = immediate
->u
[1].Uint
;
566 ctx
.literals
[ctx
.nliterals
* 4 + 2] = immediate
->u
[2].Uint
;
567 ctx
.literals
[ctx
.nliterals
* 4 + 3] = immediate
->u
[3].Uint
;
570 case TGSI_TOKEN_TYPE_DECLARATION
:
571 r
= tgsi_declaration(&ctx
);
575 case TGSI_TOKEN_TYPE_INSTRUCTION
:
576 r
= tgsi_is_supported(&ctx
);
579 ctx
.max_driver_temp_used
= 0;
580 /* reserve first tmp for everyone */
582 opcode
= ctx
.parse
.FullToken
.FullInstruction
.Instruction
.Opcode
;
583 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
)
584 ctx
.inst_info
= &eg_shader_tgsi_instruction
[opcode
];
586 ctx
.inst_info
= &r600_shader_tgsi_instruction
[opcode
];
587 r
= ctx
.inst_info
->process(&ctx
);
590 r
= r600_bc_add_literal(ctx
.bc
, ctx
.value
);
594 case TGSI_TOKEN_TYPE_PROPERTY
:
597 R600_ERR("unsupported token type %d\n", ctx
.parse
.FullToken
.Token
.Type
);
603 noutput
= shader
->noutput
;
604 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
605 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
606 output
[i
].gpr
= shader
->output
[i
].gpr
;
607 output
[i
].elem_size
= 3;
608 output
[i
].swizzle_x
= 0;
609 output
[i
].swizzle_y
= 1;
610 output
[i
].swizzle_z
= 2;
611 output
[i
].swizzle_w
= 3;
612 output
[i
].barrier
= 1;
613 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
614 output
[i
].array_base
= i
- pos0
;
615 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
617 case TGSI_PROCESSOR_VERTEX
:
618 if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
619 output
[i
].array_base
= 60;
620 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
621 /* position doesn't count in array_base */
624 if (shader
->output
[i
].name
== TGSI_SEMANTIC_PSIZE
) {
625 output
[i
].array_base
= 61;
626 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
627 /* position doesn't count in array_base */
631 case TGSI_PROCESSOR_FRAGMENT
:
632 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
633 output
[i
].array_base
= shader
->output
[i
].sid
;
634 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
635 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
636 output
[i
].array_base
= 61;
637 output
[i
].swizzle_x
= 2;
638 output
[i
].swizzle_y
= 7;
639 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
640 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
641 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
) {
642 output
[i
].array_base
= 61;
643 output
[i
].swizzle_x
= 7;
644 output
[i
].swizzle_y
= 1;
645 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
646 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
648 R600_ERR("unsupported fragment output name %d\n", shader
->output
[i
].name
);
654 R600_ERR("unsupported processor type %d\n", ctx
.type
);
659 /* add fake param output for vertex shader if no param is exported */
660 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
661 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
662 if (output
[i
].type
== V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
) {
668 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
670 output
[i
].elem_size
= 3;
671 output
[i
].swizzle_x
= 0;
672 output
[i
].swizzle_y
= 1;
673 output
[i
].swizzle_z
= 2;
674 output
[i
].swizzle_w
= 3;
675 output
[i
].barrier
= 1;
676 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
677 output
[i
].array_base
= 0;
678 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
682 /* add fake pixel export */
683 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& !noutput
) {
684 memset(&output
[0], 0, sizeof(struct r600_bc_output
));
686 output
[0].elem_size
= 3;
687 output
[0].swizzle_x
= 7;
688 output
[0].swizzle_y
= 7;
689 output
[0].swizzle_z
= 7;
690 output
[0].swizzle_w
= 7;
691 output
[0].barrier
= 1;
692 output
[0].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
693 output
[0].array_base
= 0;
694 output
[0].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
697 /* set export done on last export of each type */
698 for (i
= noutput
- 1, output_done
= 0; i
>= 0; i
--) {
699 if (i
== (noutput
- 1)) {
700 output
[i
].end_of_program
= 1;
702 if (!(output_done
& (1 << output
[i
].type
))) {
703 output_done
|= (1 << output
[i
].type
);
704 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE
);
707 /* add output to bytecode */
708 for (i
= 0; i
< noutput
; i
++) {
709 r
= r600_bc_add_output(ctx
.bc
, &output
[i
]);
714 tgsi_parse_free(&ctx
.parse
);
718 tgsi_parse_free(&ctx
.parse
);
722 static int tgsi_unsupported(struct r600_shader_ctx
*ctx
)
724 R600_ERR("%d tgsi opcode unsupported\n", ctx
->inst_info
->tgsi_opcode
);
728 static int tgsi_end(struct r600_shader_ctx
*ctx
)
733 static int tgsi_src(struct r600_shader_ctx
*ctx
,
734 const struct tgsi_full_src_register
*tgsi_src
,
735 struct r600_bc_alu_src
*r600_src
)
738 memset(r600_src
, 0, sizeof(struct r600_bc_alu_src
));
739 r600_src
->sel
= tgsi_src
->Register
.Index
;
740 if (tgsi_src
->Register
.File
== TGSI_FILE_IMMEDIATE
) {
742 index
= tgsi_src
->Register
.Index
;
743 ctx
->value
[0] = ctx
->literals
[index
* 4 + 0];
744 ctx
->value
[1] = ctx
->literals
[index
* 4 + 1];
745 ctx
->value
[2] = ctx
->literals
[index
* 4 + 2];
746 ctx
->value
[3] = ctx
->literals
[index
* 4 + 3];
748 if (tgsi_src
->Register
.Indirect
)
749 r600_src
->rel
= V_SQ_REL_RELATIVE
;
750 r600_src
->neg
= tgsi_src
->Register
.Negate
;
751 r600_src
->abs
= tgsi_src
->Register
.Absolute
;
752 r600_src
->sel
+= ctx
->file_offset
[tgsi_src
->Register
.File
];
756 static int tgsi_dst(struct r600_shader_ctx
*ctx
,
757 const struct tgsi_full_dst_register
*tgsi_dst
,
759 struct r600_bc_alu_dst
*r600_dst
)
761 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
763 r600_dst
->sel
= tgsi_dst
->Register
.Index
;
764 r600_dst
->sel
+= ctx
->file_offset
[tgsi_dst
->Register
.File
];
765 r600_dst
->chan
= swizzle
;
767 if (tgsi_dst
->Register
.Indirect
)
768 r600_dst
->rel
= V_SQ_REL_RELATIVE
;
769 if (inst
->Instruction
.Saturate
) {
775 static unsigned tgsi_chan(const struct tgsi_full_src_register
*tgsi_src
, unsigned swizzle
)
779 return tgsi_src
->Register
.SwizzleX
;
781 return tgsi_src
->Register
.SwizzleY
;
783 return tgsi_src
->Register
.SwizzleZ
;
785 return tgsi_src
->Register
.SwizzleW
;
791 static int tgsi_split_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
793 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
794 struct r600_bc_alu alu
;
795 int i
, j
, k
, nconst
, r
;
797 for (i
= 0, nconst
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
798 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
801 r
= tgsi_src(ctx
, &inst
->Src
[i
], &r600_src
[i
]);
806 for (i
= 0, j
= nconst
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
807 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
808 int treg
= r600_get_temp(ctx
);
809 for (k
= 0; k
< 4; k
++) {
810 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
811 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
812 alu
.src
[0].sel
= r600_src
[i
].sel
;
814 alu
.src
[0].rel
= r600_src
[i
].rel
;
820 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
824 r600_src
[i
].sel
= treg
;
832 /* need to move any immediate into a temp - for trig functions which use literal for PI stuff */
833 static int tgsi_split_literal_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
835 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
836 struct r600_bc_alu alu
;
837 int i
, j
, k
, nliteral
, r
;
839 for (i
= 0, nliteral
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
840 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_IMMEDIATE
) {
844 for (i
= 0, j
= nliteral
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
845 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_IMMEDIATE
) {
846 int treg
= r600_get_temp(ctx
);
847 for (k
= 0; k
< 4; k
++) {
848 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
849 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
850 alu
.src
[0].sel
= r600_src
[i
].sel
;
857 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
861 r
= r600_bc_add_literal(ctx
->bc
, &ctx
->literals
[inst
->Src
[i
].Register
.Index
* 4]);
864 r600_src
[i
].sel
= treg
;
871 static int tgsi_op2_s(struct r600_shader_ctx
*ctx
, int swap
)
873 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
874 struct r600_bc_alu_src r600_src
[3];
875 struct r600_bc_alu alu
;
879 for (i
= 0; i
< 4; i
++) {
880 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
)) {
885 r
= tgsi_split_constant(ctx
, r600_src
);
888 r
= tgsi_split_literal_constant(ctx
, r600_src
);
891 for (i
= 0; i
< lasti
+ 1; i
++) {
892 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
895 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
896 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
900 alu
.inst
= ctx
->inst_info
->r600_opcode
;
902 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
903 alu
.src
[j
] = r600_src
[j
];
904 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
907 alu
.src
[0] = r600_src
[1];
908 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], i
);
910 alu
.src
[1] = r600_src
[0];
911 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
913 /* handle some special cases */
914 switch (ctx
->inst_info
->tgsi_opcode
) {
915 case TGSI_OPCODE_SUB
:
918 case TGSI_OPCODE_ABS
:
927 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
934 static int tgsi_op2(struct r600_shader_ctx
*ctx
)
936 return tgsi_op2_s(ctx
, 0);
939 static int tgsi_op2_swap(struct r600_shader_ctx
*ctx
)
941 return tgsi_op2_s(ctx
, 1);
945 * r600 - trunc to -PI..PI range
946 * r700 - normalize by dividing by 2PI
949 static int tgsi_setup_trig(struct r600_shader_ctx
*ctx
,
950 struct r600_bc_alu_src r600_src
[3])
952 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
954 uint32_t lit_vals
[4];
955 struct r600_bc_alu alu
;
957 memset(lit_vals
, 0, 4*4);
958 r
= tgsi_split_constant(ctx
, r600_src
);
961 r
= tgsi_split_literal_constant(ctx
, r600_src
);
965 lit_vals
[0] = fui(1.0 /(3.1415926535 * 2));
966 lit_vals
[1] = fui(0.5f
);
968 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
969 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
973 alu
.dst
.sel
= ctx
->temp_reg
;
976 alu
.src
[0] = r600_src
[0];
977 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
979 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
981 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
984 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
987 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
991 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
992 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
995 alu
.dst
.sel
= ctx
->temp_reg
;
998 alu
.src
[0].sel
= ctx
->temp_reg
;
1001 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1005 if (ctx
->bc
->chiprev
== CHIPREV_R600
) {
1006 lit_vals
[0] = fui(3.1415926535897f
* 2.0f
);
1007 lit_vals
[1] = fui(-3.1415926535897f
);
1009 lit_vals
[0] = fui(1.0f
);
1010 lit_vals
[1] = fui(-0.5f
);
1013 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1014 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1018 alu
.dst
.sel
= ctx
->temp_reg
;
1021 alu
.src
[0].sel
= ctx
->temp_reg
;
1022 alu
.src
[0].chan
= 0;
1024 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
1025 alu
.src
[1].chan
= 0;
1026 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1027 alu
.src
[2].chan
= 1;
1029 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1032 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1038 static int tgsi_trig(struct r600_shader_ctx
*ctx
)
1040 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1041 struct r600_bc_alu_src r600_src
[3];
1042 struct r600_bc_alu alu
;
1046 r
= tgsi_setup_trig(ctx
, r600_src
);
1050 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1051 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1053 alu
.dst
.sel
= ctx
->temp_reg
;
1056 alu
.src
[0].sel
= ctx
->temp_reg
;
1057 alu
.src
[0].chan
= 0;
1059 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1063 /* replicate result */
1064 for (i
= 0; i
< 4; i
++) {
1065 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
))
1068 for (i
= 0; i
< lasti
+ 1; i
++) {
1069 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1072 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1073 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1075 alu
.src
[0].sel
= ctx
->temp_reg
;
1076 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1081 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1088 static int tgsi_scs(struct r600_shader_ctx
*ctx
)
1090 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1091 struct r600_bc_alu_src r600_src
[3];
1092 struct r600_bc_alu alu
;
1095 /* We'll only need the trig stuff if we are going to write to the
1096 * X or Y components of the destination vector.
1098 if (likely(inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_XY
)) {
1099 r
= tgsi_setup_trig(ctx
, r600_src
);
1105 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_X
) {
1106 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1107 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
);
1108 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1112 alu
.src
[0].sel
= ctx
->temp_reg
;
1113 alu
.src
[0].chan
= 0;
1115 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1121 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Y
) {
1122 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1123 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
);
1124 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1128 alu
.src
[0].sel
= ctx
->temp_reg
;
1129 alu
.src
[0].chan
= 0;
1131 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1137 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Z
) {
1138 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1140 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1142 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1146 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1147 alu
.src
[0].chan
= 0;
1151 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1155 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1161 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_W
) {
1162 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1164 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1166 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1170 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1171 alu
.src
[0].chan
= 0;
1175 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1179 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1187 static int tgsi_kill(struct r600_shader_ctx
*ctx
)
1189 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1190 struct r600_bc_alu alu
;
1193 for (i
= 0; i
< 4; i
++) {
1194 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1195 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1199 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1201 if (ctx
->inst_info
->tgsi_opcode
== TGSI_OPCODE_KILP
) {
1202 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1205 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1208 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1213 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1217 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1221 /* kill must be last in ALU */
1222 ctx
->bc
->force_add_cf
= 1;
1223 ctx
->shader
->uses_kill
= TRUE
;
1227 static int tgsi_lit(struct r600_shader_ctx
*ctx
)
1229 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1230 struct r600_bc_alu alu
;
1231 struct r600_bc_alu_src r600_src
[3];
1234 r
= tgsi_split_constant(ctx
, r600_src
);
1237 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1242 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1243 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1244 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
; /*1.0*/
1245 alu
.src
[0].chan
= 0;
1246 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1249 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 0) & 1;
1250 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1254 /* dst.y = max(src.x, 0.0) */
1255 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1256 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
);
1257 alu
.src
[0] = r600_src
[0];
1258 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
1259 alu
.src
[1].chan
= 0;
1260 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1263 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 1) & 1;
1264 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1269 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1270 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1271 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1272 alu
.src
[0].chan
= 0;
1273 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1276 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 3) & 1;
1278 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1282 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1286 if (inst
->Dst
[0].Register
.WriteMask
& (1 << 2))
1291 /* dst.z = log(src.y) */
1292 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1293 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
);
1294 alu
.src
[0] = r600_src
[0];
1295 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
1296 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1300 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1304 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1308 chan
= alu
.dst
.chan
;
1311 /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
1312 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1313 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT
);
1314 alu
.src
[0] = r600_src
[0];
1315 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1316 alu
.src
[1].sel
= sel
;
1317 alu
.src
[1].chan
= chan
;
1319 alu
.src
[2] = r600_src
[0];
1320 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], 0);
1321 alu
.dst
.sel
= ctx
->temp_reg
;
1326 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1330 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1333 /* dst.z = exp(tmp.x) */
1334 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1335 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1336 alu
.src
[0].sel
= ctx
->temp_reg
;
1337 alu
.src
[0].chan
= 0;
1338 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1342 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1349 static int tgsi_rsq(struct r600_shader_ctx
*ctx
)
1351 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1352 struct r600_bc_alu alu
;
1355 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1358 * For state trackers other than OpenGL, we'll want to use
1359 * _RECIPSQRT_IEEE instead.
1361 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED
);
1363 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1364 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1367 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1370 alu
.dst
.sel
= ctx
->temp_reg
;
1373 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1376 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1379 /* replicate result */
1380 return tgsi_helper_tempx_replicate(ctx
);
1383 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
)
1385 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1386 struct r600_bc_alu alu
;
1389 for (i
= 0; i
< 4; i
++) {
1390 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1391 alu
.src
[0].sel
= ctx
->temp_reg
;
1392 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1394 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1397 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1400 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1407 static int tgsi_trans_srcx_replicate(struct r600_shader_ctx
*ctx
)
1409 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1410 struct r600_bc_alu alu
;
1413 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1414 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1415 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1416 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1419 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1421 alu
.dst
.sel
= ctx
->temp_reg
;
1424 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1427 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1430 /* replicate result */
1431 return tgsi_helper_tempx_replicate(ctx
);
1434 static int tgsi_pow(struct r600_shader_ctx
*ctx
)
1436 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1437 struct r600_bc_alu alu
;
1441 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1442 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
1443 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1446 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
1447 alu
.dst
.sel
= ctx
->temp_reg
;
1450 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1453 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1457 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1458 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1459 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[0]);
1462 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], 0);
1463 alu
.src
[1].sel
= ctx
->temp_reg
;
1464 alu
.dst
.sel
= ctx
->temp_reg
;
1467 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1470 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1473 /* POW(a,b) = EXP2(b * LOG2(a))*/
1474 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1475 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1476 alu
.src
[0].sel
= ctx
->temp_reg
;
1477 alu
.dst
.sel
= ctx
->temp_reg
;
1480 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1483 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1486 return tgsi_helper_tempx_replicate(ctx
);
1489 static int tgsi_ssg(struct r600_shader_ctx
*ctx
)
1491 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1492 struct r600_bc_alu alu
;
1493 struct r600_bc_alu_src r600_src
[3];
1496 r
= tgsi_split_constant(ctx
, r600_src
);
1499 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1503 /* tmp = (src > 0 ? 1 : src) */
1504 for (i
= 0; i
< 4; i
++) {
1505 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1506 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1509 alu
.dst
.sel
= ctx
->temp_reg
;
1512 alu
.src
[0] = r600_src
[0];
1513 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1515 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1517 alu
.src
[2] = r600_src
[0];
1518 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], i
);
1521 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1525 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1529 /* dst = (-tmp > 0 ? -1 : tmp) */
1530 for (i
= 0; i
< 4; i
++) {
1531 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1532 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1534 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1538 alu
.src
[0].sel
= ctx
->temp_reg
;
1539 alu
.src
[0].chan
= i
;
1542 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1545 alu
.src
[2].sel
= ctx
->temp_reg
;
1546 alu
.src
[2].chan
= i
;
1550 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1557 static int tgsi_helper_copy(struct r600_shader_ctx
*ctx
, struct tgsi_full_instruction
*inst
)
1559 struct r600_bc_alu alu
;
1562 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1565 for (i
= 0; i
< 4; i
++) {
1566 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1567 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
1568 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
);
1571 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1572 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1575 alu
.src
[0].sel
= ctx
->temp_reg
;
1576 alu
.src
[0].chan
= i
;
1581 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1588 static int tgsi_op3(struct r600_shader_ctx
*ctx
)
1590 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1591 struct r600_bc_alu_src r600_src
[3];
1592 struct r600_bc_alu alu
;
1595 r
= tgsi_split_constant(ctx
, r600_src
);
1598 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1601 /* do it in 2 step as op3 doesn't support writemask */
1602 for (i
= 0; i
< 4; i
++) {
1603 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1604 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1605 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1606 alu
.src
[j
] = r600_src
[j
];
1607 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1609 alu
.dst
.sel
= ctx
->temp_reg
;
1616 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1620 return tgsi_helper_copy(ctx
, inst
);
1623 static int tgsi_dp(struct r600_shader_ctx
*ctx
)
1625 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1626 struct r600_bc_alu_src r600_src
[3];
1627 struct r600_bc_alu alu
;
1630 r
= tgsi_split_constant(ctx
, r600_src
);
1633 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1636 for (i
= 0; i
< 4; i
++) {
1637 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1638 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1639 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1640 alu
.src
[j
] = r600_src
[j
];
1641 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1643 alu
.dst
.sel
= ctx
->temp_reg
;
1646 /* handle some special cases */
1647 switch (ctx
->inst_info
->tgsi_opcode
) {
1648 case TGSI_OPCODE_DP2
:
1650 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1651 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1654 case TGSI_OPCODE_DP3
:
1656 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1657 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1660 case TGSI_OPCODE_DPH
:
1662 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1663 alu
.src
[0].chan
= 0;
1673 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1677 return tgsi_helper_copy(ctx
, inst
);
1680 static int tgsi_tex(struct r600_shader_ctx
*ctx
)
1682 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1683 struct r600_bc_tex tex
;
1684 struct r600_bc_alu alu
;
1688 boolean src_not_temp
= inst
->Src
[0].Register
.File
!= TGSI_FILE_TEMPORARY
;
1689 uint32_t lit_vals
[4];
1691 src_gpr
= ctx
->file_offset
[inst
->Src
[0].Register
.File
] + inst
->Src
[0].Register
.Index
;
1693 if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXP
) {
1694 /* Add perspective divide */
1695 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1696 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1697 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1701 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1702 alu
.dst
.sel
= ctx
->temp_reg
;
1706 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1710 for (i
= 0; i
< 3; i
++) {
1711 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1712 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1713 alu
.src
[0].sel
= ctx
->temp_reg
;
1714 alu
.src
[0].chan
= 3;
1715 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1718 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1719 alu
.dst
.sel
= ctx
->temp_reg
;
1722 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1726 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1727 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1728 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1729 alu
.src
[0].chan
= 0;
1730 alu
.dst
.sel
= ctx
->temp_reg
;
1734 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1737 src_not_temp
= FALSE
;
1738 src_gpr
= ctx
->temp_reg
;
1741 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1742 int src_chan
, src2_chan
;
1744 /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
1745 for (i
= 0; i
< 4; i
++) {
1746 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1747 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE
);
1771 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1774 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], src_chan
);
1775 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1778 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], src2_chan
);
1779 alu
.dst
.sel
= ctx
->temp_reg
;
1784 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1789 /* tmp1.z = RCP_e(|tmp1.z|) */
1790 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1791 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1792 alu
.src
[0].sel
= ctx
->temp_reg
;
1793 alu
.src
[0].chan
= 2;
1795 alu
.dst
.sel
= ctx
->temp_reg
;
1799 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1803 /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x
1804 * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x
1805 * muladd has no writemask, have to use another temp
1807 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1808 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1811 alu
.src
[0].sel
= ctx
->temp_reg
;
1812 alu
.src
[0].chan
= 0;
1813 alu
.src
[1].sel
= ctx
->temp_reg
;
1814 alu
.src
[1].chan
= 2;
1816 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1817 alu
.src
[2].chan
= 0;
1819 alu
.dst
.sel
= ctx
->temp_reg
;
1823 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1827 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1828 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1831 alu
.src
[0].sel
= ctx
->temp_reg
;
1832 alu
.src
[0].chan
= 1;
1833 alu
.src
[1].sel
= ctx
->temp_reg
;
1834 alu
.src
[1].chan
= 2;
1836 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1837 alu
.src
[2].chan
= 0;
1839 alu
.dst
.sel
= ctx
->temp_reg
;
1844 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1848 lit_vals
[0] = fui(1.5f
);
1850 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1853 src_not_temp
= FALSE
;
1854 src_gpr
= ctx
->temp_reg
;
1858 for (i
= 0; i
< 4; i
++) {
1859 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1860 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1861 alu
.src
[0].sel
= src_gpr
;
1862 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1863 alu
.dst
.sel
= ctx
->temp_reg
;
1868 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1872 src_gpr
= ctx
->temp_reg
;
1875 opcode
= ctx
->inst_info
->r600_opcode
;
1876 if (opcode
== SQ_TEX_INST_SAMPLE
&&
1877 (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
))
1878 opcode
= SQ_TEX_INST_SAMPLE_C
;
1880 memset(&tex
, 0, sizeof(struct r600_bc_tex
));
1882 tex
.sampler_id
= ctx
->file_offset
[inst
->Src
[1].Register
.File
] + inst
->Src
[1].Register
.Index
;
1883 tex
.resource_id
= tex
.sampler_id
;
1884 tex
.src_gpr
= src_gpr
;
1885 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
1886 tex
.dst_sel_x
= (inst
->Dst
[0].Register
.WriteMask
& 1) ? 0 : 7;
1887 tex
.dst_sel_y
= (inst
->Dst
[0].Register
.WriteMask
& 2) ? 1 : 7;
1888 tex
.dst_sel_z
= (inst
->Dst
[0].Register
.WriteMask
& 4) ? 2 : 7;
1889 tex
.dst_sel_w
= (inst
->Dst
[0].Register
.WriteMask
& 8) ? 3 : 7;
1895 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1902 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
) {
1903 tex
.coord_type_x
= 1;
1904 tex
.coord_type_y
= 1;
1905 tex
.coord_type_z
= 1;
1906 tex
.coord_type_w
= 1;
1909 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
)
1912 r
= r600_bc_add_tex(ctx
->bc
, &tex
);
1916 /* add shadow ambient support - gallium doesn't do it yet */
1920 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
1922 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1923 struct r600_bc_alu_src r600_src
[3];
1924 struct r600_bc_alu alu
;
1928 r
= tgsi_split_constant(ctx
, r600_src
);
1931 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1935 for (i
= 0; i
< 4; i
++) {
1936 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1937 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1938 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1939 alu
.src
[0].chan
= 0;
1940 alu
.src
[1] = r600_src
[0];
1941 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1943 alu
.dst
.sel
= ctx
->temp_reg
;
1949 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1953 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1957 /* (1 - src0) * src2 */
1958 for (i
= 0; i
< 4; i
++) {
1959 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1960 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1961 alu
.src
[0].sel
= ctx
->temp_reg
;
1962 alu
.src
[0].chan
= i
;
1963 alu
.src
[1] = r600_src
[2];
1964 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
1965 alu
.dst
.sel
= ctx
->temp_reg
;
1971 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1975 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1979 /* src0 * src1 + (1 - src0) * src2 */
1980 for (i
= 0; i
< 4; i
++) {
1981 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1982 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1984 alu
.src
[0] = r600_src
[0];
1985 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1986 alu
.src
[1] = r600_src
[1];
1987 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
1988 alu
.src
[2].sel
= ctx
->temp_reg
;
1989 alu
.src
[2].chan
= i
;
1990 alu
.dst
.sel
= ctx
->temp_reg
;
1995 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1999 return tgsi_helper_copy(ctx
, inst
);
2002 static int tgsi_cmp(struct r600_shader_ctx
*ctx
)
2004 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2005 struct r600_bc_alu_src r600_src
[3];
2006 struct r600_bc_alu alu
;
2010 r
= tgsi_split_constant(ctx
, r600_src
);
2013 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2017 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
2020 for (i
= 0; i
< 4; i
++) {
2021 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2022 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE
);
2023 alu
.src
[0] = r600_src
[0];
2024 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2026 alu
.src
[1] = r600_src
[2];
2027 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
2029 alu
.src
[2] = r600_src
[1];
2030 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[1], i
);
2033 alu
.dst
.sel
= ctx
->temp_reg
;
2035 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2044 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2049 return tgsi_helper_copy(ctx
, inst
);
2053 static int tgsi_xpd(struct r600_shader_ctx
*ctx
)
2055 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2056 struct r600_bc_alu_src r600_src
[3];
2057 struct r600_bc_alu alu
;
2058 uint32_t use_temp
= 0;
2061 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
2064 r
= tgsi_split_constant(ctx
, r600_src
);
2067 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2071 for (i
= 0; i
< 4; i
++) {
2072 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2073 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2075 alu
.src
[0] = r600_src
[0];
2078 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 2);
2081 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2084 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
2087 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2088 alu
.src
[0].chan
= i
;
2091 alu
.src
[1] = r600_src
[1];
2094 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2097 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2100 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2103 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2104 alu
.src
[1].chan
= i
;
2107 alu
.dst
.sel
= ctx
->temp_reg
;
2113 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2117 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2122 for (i
= 0; i
< 4; i
++) {
2123 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2124 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
2126 alu
.src
[0] = r600_src
[0];
2129 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
2132 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 2);
2135 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2138 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2139 alu
.src
[0].chan
= i
;
2142 alu
.src
[1] = r600_src
[1];
2145 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2148 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2151 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2154 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2155 alu
.src
[1].chan
= i
;
2158 alu
.src
[2].sel
= ctx
->temp_reg
;
2160 alu
.src
[2].chan
= i
;
2163 alu
.dst
.sel
= ctx
->temp_reg
;
2165 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2174 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2178 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2183 return tgsi_helper_copy(ctx
, inst
);
2187 static int tgsi_exp(struct r600_shader_ctx
*ctx
)
2189 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2190 struct r600_bc_alu_src r600_src
[3] = { { 0 } };
2191 struct r600_bc_alu alu
;
2194 /* result.x = 2^floor(src); */
2195 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2196 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2198 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2199 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2203 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2205 alu
.dst
.sel
= ctx
->temp_reg
;
2209 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2213 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2217 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2218 alu
.src
[0].sel
= ctx
->temp_reg
;
2219 alu
.src
[0].chan
= 0;
2221 alu
.dst
.sel
= ctx
->temp_reg
;
2225 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2229 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2234 /* result.y = tmp - floor(tmp); */
2235 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2236 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2238 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
2239 alu
.src
[0] = r600_src
[0];
2240 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2243 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2245 alu
.dst
.sel
= ctx
->temp_reg
;
2246 // r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
2254 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2257 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2262 /* result.z = RoughApprox2ToX(tmp);*/
2263 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 0x1) {
2264 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2265 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2266 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2269 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2271 alu
.dst
.sel
= ctx
->temp_reg
;
2277 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2280 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2285 /* result.w = 1.0;*/
2286 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 0x1) {
2287 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2289 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2290 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2291 alu
.src
[0].chan
= 0;
2293 alu
.dst
.sel
= ctx
->temp_reg
;
2297 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2300 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2304 return tgsi_helper_copy(ctx
, inst
);
2307 static int tgsi_log(struct r600_shader_ctx
*ctx
)
2309 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2310 struct r600_bc_alu alu
;
2313 /* result.x = floor(log2(src)); */
2314 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2315 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2317 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2318 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2322 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2324 alu
.dst
.sel
= ctx
->temp_reg
;
2328 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2332 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2336 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2337 alu
.src
[0].sel
= ctx
->temp_reg
;
2338 alu
.src
[0].chan
= 0;
2340 alu
.dst
.sel
= ctx
->temp_reg
;
2345 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2349 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2354 /* result.y = src.x / (2 ^ floor(log2(src.x))); */
2355 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2356 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2358 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2359 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2363 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2365 alu
.dst
.sel
= ctx
->temp_reg
;
2370 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2374 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2378 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2380 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2381 alu
.src
[0].sel
= ctx
->temp_reg
;
2382 alu
.src
[0].chan
= 1;
2384 alu
.dst
.sel
= ctx
->temp_reg
;
2389 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2393 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2397 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2399 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2400 alu
.src
[0].sel
= ctx
->temp_reg
;
2401 alu
.src
[0].chan
= 1;
2403 alu
.dst
.sel
= ctx
->temp_reg
;
2408 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2412 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2416 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2418 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
2419 alu
.src
[0].sel
= ctx
->temp_reg
;
2420 alu
.src
[0].chan
= 1;
2422 alu
.dst
.sel
= ctx
->temp_reg
;
2427 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2431 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2435 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2437 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2439 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2443 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2445 alu
.src
[1].sel
= ctx
->temp_reg
;
2446 alu
.src
[1].chan
= 1;
2448 alu
.dst
.sel
= ctx
->temp_reg
;
2453 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2457 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2462 /* result.z = log2(src);*/
2463 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 1) {
2464 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2466 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2467 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2471 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2473 alu
.dst
.sel
= ctx
->temp_reg
;
2478 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2482 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2487 /* result.w = 1.0; */
2488 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 1) {
2489 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2491 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2492 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2493 alu
.src
[0].chan
= 0;
2495 alu
.dst
.sel
= ctx
->temp_reg
;
2500 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2504 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2509 return tgsi_helper_copy(ctx
, inst
);
2512 static int tgsi_eg_arl(struct r600_shader_ctx
*ctx
)
2514 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2515 struct r600_bc_alu alu
;
2517 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2519 switch (inst
->Instruction
.Opcode
) {
2520 case TGSI_OPCODE_ARL
:
2521 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR
;
2523 case TGSI_OPCODE_ARR
:
2524 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
2531 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2534 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2537 alu
.dst
.sel
= ctx
->temp_reg
;
2539 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2542 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2543 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
;
2544 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2547 alu
.src
[0].sel
= ctx
->temp_reg
;
2548 alu
.src
[0].chan
= 0;
2550 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2555 static int tgsi_r600_arl(struct r600_shader_ctx
*ctx
)
2557 /* TODO from r600c, ar values don't persist between clauses */
2558 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2559 struct r600_bc_alu alu
;
2561 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2563 switch (inst
->Instruction
.Opcode
) {
2564 case TGSI_OPCODE_ARL
:
2565 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR
;
2567 case TGSI_OPCODE_ARR
:
2568 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA
;
2576 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2579 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2583 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2586 ctx
->bc
->cf_last
->r6xx_uses_waterfall
= 1;
2590 static int tgsi_opdst(struct r600_shader_ctx
*ctx
)
2592 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2593 struct r600_bc_alu alu
;
2596 for (i
= 0; i
< 4; i
++) {
2597 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2599 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2600 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2604 if (i
== 0 || i
== 3) {
2605 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2607 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2610 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2613 if (i
== 0 || i
== 2) {
2614 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
2616 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[1]);
2619 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
2623 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2630 static int emit_logic_pred(struct r600_shader_ctx
*ctx
, int opcode
)
2632 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2633 struct r600_bc_alu alu
;
2636 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2640 alu
.dst
.sel
= ctx
->temp_reg
;
2644 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2647 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2648 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2649 alu
.src
[1].chan
= 0;
2653 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE
));
2659 static int pops(struct r600_shader_ctx
*ctx
, int pops
)
2661 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP
));
2662 ctx
->bc
->cf_last
->pop_count
= pops
;
2663 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2667 static inline void callstack_decrease_current(struct r600_shader_ctx
*ctx
, unsigned reason
)
2671 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2675 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
-= 4;
2678 /* TOODO : for 16 vp asic should -= 2; */
2679 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2684 static inline void callstack_check_depth(struct r600_shader_ctx
*ctx
, unsigned reason
, unsigned check_max_only
)
2686 if (check_max_only
) {
2699 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
) >
2700 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2701 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2702 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
;
2708 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2712 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+= 4;
2715 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2719 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
) >
2720 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2721 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2722 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
;
2726 static void fc_set_mid(struct r600_shader_ctx
*ctx
, int fc_sp
)
2728 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[fc_sp
];
2730 sp
->mid
= (struct r600_bc_cf
**)realloc((void *)sp
->mid
,
2731 sizeof(struct r600_bc_cf
*) * (sp
->num_mid
+ 1));
2732 sp
->mid
[sp
->num_mid
] = ctx
->bc
->cf_last
;
2736 static void fc_pushlevel(struct r600_shader_ctx
*ctx
, int type
)
2739 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
= type
;
2740 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
= ctx
->bc
->cf_last
;
2743 static void fc_poplevel(struct r600_shader_ctx
*ctx
)
2745 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
];
2757 static int emit_return(struct r600_shader_ctx
*ctx
)
2759 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_RETURN
);
2763 static int emit_jump_to_offset(struct r600_shader_ctx
*ctx
, int pops
, int offset
)
2766 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_JUMP
);
2767 ctx
->bc
->cf_last
->pop_count
= pops
;
2768 /* TODO work out offset */
2772 static int emit_setret_in_loop_flag(struct r600_shader_ctx
*ctx
, unsigned flag_value
)
2777 static void emit_testflag(struct r600_shader_ctx
*ctx
)
2782 static void emit_return_on_flag(struct r600_shader_ctx
*ctx
, unsigned ifidx
)
2785 emit_jump_to_offset(ctx
, 1, 4);
2786 emit_setret_in_loop_flag(ctx
, V_SQ_ALU_SRC_0
);
2787 pops(ctx
, ifidx
+ 1);
2791 static void break_loop_on_flag(struct r600_shader_ctx
*ctx
, unsigned fc_sp
)
2795 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2796 ctx
->bc
->cf_last
->pop_count
= 1;
2798 fc_set_mid(ctx
, fc_sp
);
2804 static int tgsi_if(struct r600_shader_ctx
*ctx
)
2806 emit_logic_pred(ctx
, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE
));
2808 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
2810 fc_pushlevel(ctx
, FC_IF
);
2812 callstack_check_depth(ctx
, FC_PUSH_VPM
, 0);
2816 static int tgsi_else(struct r600_shader_ctx
*ctx
)
2818 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE
));
2819 ctx
->bc
->cf_last
->pop_count
= 1;
2821 fc_set_mid(ctx
, ctx
->bc
->fc_sp
);
2822 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
;
2826 static int tgsi_endif(struct r600_shader_ctx
*ctx
)
2829 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_IF
) {
2830 R600_ERR("if/endif unbalanced in shader\n");
2834 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
== NULL
) {
2835 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2836 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->pop_count
= 1;
2838 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[0]->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2842 callstack_decrease_current(ctx
, FC_PUSH_VPM
);
2846 static int tgsi_bgnloop(struct r600_shader_ctx
*ctx
)
2848 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL
));
2850 fc_pushlevel(ctx
, FC_LOOP
);
2852 /* check stack depth */
2853 callstack_check_depth(ctx
, FC_LOOP
, 0);
2857 static int tgsi_endloop(struct r600_shader_ctx
*ctx
)
2861 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END
));
2863 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_LOOP
) {
2864 R600_ERR("loop/endloop in shader code are not paired.\n");
2868 /* fixup loop pointers - from r600isa
2869 LOOP END points to CF after LOOP START,
2870 LOOP START point to CF after LOOP END
2871 BRK/CONT point to LOOP END CF
2873 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->id
+ 2;
2875 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2877 for (i
= 0; i
< ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].num_mid
; i
++) {
2878 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[i
]->cf_addr
= ctx
->bc
->cf_last
->id
;
2880 /* TODO add LOOPRET support */
2882 callstack_decrease_current(ctx
, FC_LOOP
);
2886 static int tgsi_loop_brk_cont(struct r600_shader_ctx
*ctx
)
2890 for (fscp
= ctx
->bc
->fc_sp
; fscp
> 0; fscp
--)
2892 if (FC_LOOP
== ctx
->bc
->fc_stack
[fscp
].type
)
2897 R600_ERR("Break not inside loop/endloop pair\n");
2901 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2902 ctx
->bc
->cf_last
->pop_count
= 1;
2904 fc_set_mid(ctx
, fscp
);
2907 callstack_check_depth(ctx
, FC_PUSH_VPM
, 1);
2911 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
2912 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2913 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2914 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
2917 * For state trackers other than OpenGL, we'll want to use
2918 * _RECIP_IEEE instead.
2920 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED
, tgsi_trans_srcx_replicate
},
2922 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_rsq
},
2923 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
2924 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
2925 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
2926 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2927 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2928 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2929 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
2930 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
2931 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
2932 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
2933 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
2934 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
2935 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2936 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
2937 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2939 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2940 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2942 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2943 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2944 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
2945 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2946 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
2947 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2948 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
2949 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
2950 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
2951 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
2953 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2954 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2955 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2956 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2957 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
2958 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
2959 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
2960 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
2961 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2962 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2963 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2964 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2965 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2966 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
2967 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2968 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
2969 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
2970 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
2971 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
2972 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2973 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2974 {TGSI_OPCODE_TXD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2975 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2976 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2977 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2978 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2979 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2980 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2981 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2982 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2983 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2984 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2985 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2986 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
2987 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
2988 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
2989 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2990 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2991 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2992 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2993 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2994 {TGSI_OPCODE_BRK
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
2995 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
2997 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2998 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2999 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
3000 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
3002 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3003 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3004 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3005 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3006 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3007 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3008 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3009 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
3010 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3012 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3013 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3014 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3015 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3016 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3017 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3018 {TGSI_OPCODE_TXF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3019 {TGSI_OPCODE_TXQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3020 {TGSI_OPCODE_CONT
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
3021 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3022 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3023 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
3024 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3025 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
3026 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3028 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3029 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3030 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3031 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3032 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3034 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3035 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3036 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3037 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3038 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3039 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3040 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3041 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3042 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
3043 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
3045 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3046 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3047 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3048 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3049 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3050 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3051 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3052 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3053 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3054 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3055 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3056 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3057 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3058 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3059 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3060 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3061 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3062 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3063 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3064 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3065 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3066 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3067 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3068 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3069 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3070 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3071 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3072 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3075 static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction
[] = {
3076 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
3077 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3078 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
3079 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
3080 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_trans_srcx_replicate
},
3081 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
3082 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3083 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
3084 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3085 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3086 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3087 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
3088 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
3089 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
3090 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
3091 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
3092 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
3093 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3094 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
3095 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3097 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3098 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3100 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3101 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3102 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
3103 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3104 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
3105 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3106 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
3107 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
3108 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
3109 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
3111 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3112 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3113 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3114 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3115 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
3116 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
3117 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
3118 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
3119 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3120 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3121 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3122 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3123 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3124 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
3125 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3126 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
3127 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
3128 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
3129 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
3130 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3131 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3132 {TGSI_OPCODE_TXD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3133 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3134 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3135 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3136 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3137 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3138 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3139 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3140 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
3141 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3142 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3143 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3144 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
3145 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
3146 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
3147 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3148 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3149 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3150 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3151 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3152 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
3153 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
3155 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3156 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3157 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
3158 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
3160 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3161 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3162 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3163 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3164 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3165 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3166 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3167 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
3168 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3170 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3171 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3172 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3173 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3174 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3175 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3176 {TGSI_OPCODE_TXF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3177 {TGSI_OPCODE_TXQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3178 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
3179 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3180 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3181 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
3182 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3183 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
3184 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3186 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3187 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3188 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3189 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3190 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3192 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3193 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3194 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3195 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3196 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3197 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3198 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3199 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3200 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
3201 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
3203 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3204 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3205 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3206 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3207 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3208 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3209 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3210 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3211 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3212 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3213 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3214 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3215 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3216 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3217 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3218 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3219 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3220 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3221 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3222 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3223 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3224 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3225 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3226 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3227 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3228 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3229 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3230 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},