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 ctx
.file_offset
[TGSI_FILE_CONSTANT
] = 128;
545 ctx
.file_offset
[TGSI_FILE_IMMEDIATE
] = 253;
546 ctx
.temp_reg
= ctx
.file_offset
[TGSI_FILE_TEMPORARY
] +
547 ctx
.info
.file_count
[TGSI_FILE_TEMPORARY
];
552 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
553 tgsi_parse_token(&ctx
.parse
);
554 switch (ctx
.parse
.FullToken
.Token
.Type
) {
555 case TGSI_TOKEN_TYPE_IMMEDIATE
:
556 immediate
= &ctx
.parse
.FullToken
.FullImmediate
;
557 ctx
.literals
= realloc(ctx
.literals
, (ctx
.nliterals
+ 1) * 16);
558 if(ctx
.literals
== NULL
) {
562 ctx
.literals
[ctx
.nliterals
* 4 + 0] = immediate
->u
[0].Uint
;
563 ctx
.literals
[ctx
.nliterals
* 4 + 1] = immediate
->u
[1].Uint
;
564 ctx
.literals
[ctx
.nliterals
* 4 + 2] = immediate
->u
[2].Uint
;
565 ctx
.literals
[ctx
.nliterals
* 4 + 3] = immediate
->u
[3].Uint
;
568 case TGSI_TOKEN_TYPE_DECLARATION
:
569 r
= tgsi_declaration(&ctx
);
573 case TGSI_TOKEN_TYPE_INSTRUCTION
:
574 r
= tgsi_is_supported(&ctx
);
577 ctx
.max_driver_temp_used
= 0;
578 /* reserve first tmp for everyone */
580 opcode
= ctx
.parse
.FullToken
.FullInstruction
.Instruction
.Opcode
;
581 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
)
582 ctx
.inst_info
= &eg_shader_tgsi_instruction
[opcode
];
584 ctx
.inst_info
= &r600_shader_tgsi_instruction
[opcode
];
585 r
= ctx
.inst_info
->process(&ctx
);
588 r
= r600_bc_add_literal(ctx
.bc
, ctx
.value
);
592 case TGSI_TOKEN_TYPE_PROPERTY
:
595 R600_ERR("unsupported token type %d\n", ctx
.parse
.FullToken
.Token
.Type
);
601 noutput
= shader
->noutput
;
602 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
603 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
604 output
[i
].gpr
= shader
->output
[i
].gpr
;
605 output
[i
].elem_size
= 3;
606 output
[i
].swizzle_x
= 0;
607 output
[i
].swizzle_y
= 1;
608 output
[i
].swizzle_z
= 2;
609 output
[i
].swizzle_w
= 3;
610 output
[i
].barrier
= 1;
611 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
612 output
[i
].array_base
= i
- pos0
;
613 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
615 case TGSI_PROCESSOR_VERTEX
:
616 if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
617 output
[i
].array_base
= 60;
618 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
619 /* position doesn't count in array_base */
622 if (shader
->output
[i
].name
== TGSI_SEMANTIC_PSIZE
) {
623 output
[i
].array_base
= 61;
624 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
625 /* position doesn't count in array_base */
629 case TGSI_PROCESSOR_FRAGMENT
:
630 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
631 output
[i
].array_base
= shader
->output
[i
].sid
;
632 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
633 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
634 output
[i
].array_base
= 61;
635 output
[i
].swizzle_x
= 2;
636 output
[i
].swizzle_y
= 7;
637 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
638 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
639 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
) {
640 output
[i
].array_base
= 61;
641 output
[i
].swizzle_x
= 7;
642 output
[i
].swizzle_y
= 1;
643 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
644 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
646 R600_ERR("unsupported fragment output name %d\n", shader
->output
[i
].name
);
652 R600_ERR("unsupported processor type %d\n", ctx
.type
);
657 /* add fake param output for vertex shader if no param is exported */
658 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
659 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
660 if (output
[i
].type
== V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
) {
666 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
668 output
[i
].elem_size
= 3;
669 output
[i
].swizzle_x
= 0;
670 output
[i
].swizzle_y
= 1;
671 output
[i
].swizzle_z
= 2;
672 output
[i
].swizzle_w
= 3;
673 output
[i
].barrier
= 1;
674 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
675 output
[i
].array_base
= 0;
676 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
680 /* add fake pixel export */
681 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& !noutput
) {
682 memset(&output
[0], 0, sizeof(struct r600_bc_output
));
684 output
[0].elem_size
= 3;
685 output
[0].swizzle_x
= 7;
686 output
[0].swizzle_y
= 7;
687 output
[0].swizzle_z
= 7;
688 output
[0].swizzle_w
= 7;
689 output
[0].barrier
= 1;
690 output
[0].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
691 output
[0].array_base
= 0;
692 output
[0].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
695 /* set export done on last export of each type */
696 for (i
= noutput
- 1, output_done
= 0; i
>= 0; i
--) {
697 if (i
== (noutput
- 1)) {
698 output
[i
].end_of_program
= 1;
700 if (!(output_done
& (1 << output
[i
].type
))) {
701 output_done
|= (1 << output
[i
].type
);
702 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE
);
705 /* add output to bytecode */
706 for (i
= 0; i
< noutput
; i
++) {
707 r
= r600_bc_add_output(ctx
.bc
, &output
[i
]);
712 tgsi_parse_free(&ctx
.parse
);
716 tgsi_parse_free(&ctx
.parse
);
720 static int tgsi_unsupported(struct r600_shader_ctx
*ctx
)
722 R600_ERR("%d tgsi opcode unsupported\n", ctx
->inst_info
->tgsi_opcode
);
726 static int tgsi_end(struct r600_shader_ctx
*ctx
)
731 static int tgsi_src(struct r600_shader_ctx
*ctx
,
732 const struct tgsi_full_src_register
*tgsi_src
,
733 struct r600_bc_alu_src
*r600_src
)
736 memset(r600_src
, 0, sizeof(struct r600_bc_alu_src
));
737 r600_src
->sel
= tgsi_src
->Register
.Index
;
738 if (tgsi_src
->Register
.File
== TGSI_FILE_IMMEDIATE
) {
740 index
= tgsi_src
->Register
.Index
;
741 ctx
->value
[0] = ctx
->literals
[index
* 4 + 0];
742 ctx
->value
[1] = ctx
->literals
[index
* 4 + 1];
743 ctx
->value
[2] = ctx
->literals
[index
* 4 + 2];
744 ctx
->value
[3] = ctx
->literals
[index
* 4 + 3];
746 if (tgsi_src
->Register
.Indirect
)
747 r600_src
->rel
= V_SQ_REL_RELATIVE
;
748 r600_src
->neg
= tgsi_src
->Register
.Negate
;
749 r600_src
->abs
= tgsi_src
->Register
.Absolute
;
750 r600_src
->sel
+= ctx
->file_offset
[tgsi_src
->Register
.File
];
754 static int tgsi_dst(struct r600_shader_ctx
*ctx
,
755 const struct tgsi_full_dst_register
*tgsi_dst
,
757 struct r600_bc_alu_dst
*r600_dst
)
759 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
761 r600_dst
->sel
= tgsi_dst
->Register
.Index
;
762 r600_dst
->sel
+= ctx
->file_offset
[tgsi_dst
->Register
.File
];
763 r600_dst
->chan
= swizzle
;
765 if (tgsi_dst
->Register
.Indirect
)
766 r600_dst
->rel
= V_SQ_REL_RELATIVE
;
767 if (inst
->Instruction
.Saturate
) {
773 static unsigned tgsi_chan(const struct tgsi_full_src_register
*tgsi_src
, unsigned swizzle
)
777 return tgsi_src
->Register
.SwizzleX
;
779 return tgsi_src
->Register
.SwizzleY
;
781 return tgsi_src
->Register
.SwizzleZ
;
783 return tgsi_src
->Register
.SwizzleW
;
789 static int tgsi_split_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
791 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
792 struct r600_bc_alu alu
;
793 int i
, j
, k
, nconst
, r
;
795 for (i
= 0, nconst
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
796 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
799 r
= tgsi_src(ctx
, &inst
->Src
[i
], &r600_src
[i
]);
804 for (i
= 0, j
= nconst
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
805 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
806 int treg
= r600_get_temp(ctx
);
807 for (k
= 0; k
< 4; k
++) {
808 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
809 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
810 alu
.src
[0].sel
= r600_src
[i
].sel
;
812 alu
.src
[0].rel
= r600_src
[i
].rel
;
818 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
822 r600_src
[i
].sel
= treg
;
830 /* need to move any immediate into a temp - for trig functions which use literal for PI stuff */
831 static int tgsi_split_literal_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
833 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
834 struct r600_bc_alu alu
;
835 int i
, j
, k
, nliteral
, r
;
837 for (i
= 0, nliteral
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
838 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_IMMEDIATE
) {
842 for (i
= 0, j
= nliteral
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
843 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_IMMEDIATE
) {
844 int treg
= r600_get_temp(ctx
);
845 for (k
= 0; k
< 4; k
++) {
846 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
847 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
848 alu
.src
[0].sel
= r600_src
[i
].sel
;
855 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
859 r
= r600_bc_add_literal(ctx
->bc
, &ctx
->literals
[inst
->Src
[i
].Register
.Index
* 4]);
862 r600_src
[i
].sel
= treg
;
869 static int tgsi_op2_s(struct r600_shader_ctx
*ctx
, int swap
)
871 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
872 struct r600_bc_alu_src r600_src
[3];
873 struct r600_bc_alu alu
;
877 for (i
= 0; i
< 4; i
++) {
878 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
)) {
883 r
= tgsi_split_constant(ctx
, r600_src
);
886 r
= tgsi_split_literal_constant(ctx
, r600_src
);
889 for (i
= 0; i
< lasti
+ 1; i
++) {
890 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
893 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
894 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
898 alu
.inst
= ctx
->inst_info
->r600_opcode
;
900 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
901 alu
.src
[j
] = r600_src
[j
];
902 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
905 alu
.src
[0] = r600_src
[1];
906 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], i
);
908 alu
.src
[1] = r600_src
[0];
909 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
911 /* handle some special cases */
912 switch (ctx
->inst_info
->tgsi_opcode
) {
913 case TGSI_OPCODE_SUB
:
916 case TGSI_OPCODE_ABS
:
925 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
932 static int tgsi_op2(struct r600_shader_ctx
*ctx
)
934 return tgsi_op2_s(ctx
, 0);
937 static int tgsi_op2_swap(struct r600_shader_ctx
*ctx
)
939 return tgsi_op2_s(ctx
, 1);
943 * r600 - trunc to -PI..PI range
944 * r700 - normalize by dividing by 2PI
947 static int tgsi_setup_trig(struct r600_shader_ctx
*ctx
,
948 struct r600_bc_alu_src r600_src
[3])
950 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
952 uint32_t lit_vals
[4];
953 struct r600_bc_alu alu
;
955 memset(lit_vals
, 0, 4*4);
956 r
= tgsi_split_constant(ctx
, r600_src
);
959 r
= tgsi_split_literal_constant(ctx
, r600_src
);
963 lit_vals
[0] = fui(1.0 /(3.1415926535 * 2));
964 lit_vals
[1] = fui(0.5f
);
966 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
967 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
971 alu
.dst
.sel
= ctx
->temp_reg
;
974 alu
.src
[0] = r600_src
[0];
975 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
977 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
979 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
982 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
985 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
989 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
990 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
993 alu
.dst
.sel
= ctx
->temp_reg
;
996 alu
.src
[0].sel
= ctx
->temp_reg
;
999 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1003 if (ctx
->bc
->chiprev
== CHIPREV_R600
) {
1004 lit_vals
[0] = fui(3.1415926535897f
* 2.0f
);
1005 lit_vals
[1] = fui(-3.1415926535897f
);
1007 lit_vals
[0] = fui(1.0f
);
1008 lit_vals
[1] = fui(-0.5f
);
1011 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1012 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1016 alu
.dst
.sel
= ctx
->temp_reg
;
1019 alu
.src
[0].sel
= ctx
->temp_reg
;
1020 alu
.src
[0].chan
= 0;
1022 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
1023 alu
.src
[1].chan
= 0;
1024 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1025 alu
.src
[2].chan
= 1;
1027 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1030 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1036 static int tgsi_trig(struct r600_shader_ctx
*ctx
)
1038 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1039 struct r600_bc_alu_src r600_src
[3];
1040 struct r600_bc_alu alu
;
1044 r
= tgsi_setup_trig(ctx
, r600_src
);
1048 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1049 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1051 alu
.dst
.sel
= ctx
->temp_reg
;
1054 alu
.src
[0].sel
= ctx
->temp_reg
;
1055 alu
.src
[0].chan
= 0;
1057 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1061 /* replicate result */
1062 for (i
= 0; i
< 4; i
++) {
1063 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
))
1066 for (i
= 0; i
< lasti
+ 1; i
++) {
1067 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1070 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1071 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1073 alu
.src
[0].sel
= ctx
->temp_reg
;
1074 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1079 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1086 static int tgsi_scs(struct r600_shader_ctx
*ctx
)
1088 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1089 struct r600_bc_alu_src r600_src
[3];
1090 struct r600_bc_alu alu
;
1093 /* We'll only need the trig stuff if we are going to write to the
1094 * X or Y components of the destination vector.
1096 if (likely(inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_XY
)) {
1097 r
= tgsi_setup_trig(ctx
, r600_src
);
1103 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_X
) {
1104 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1105 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
);
1106 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1110 alu
.src
[0].sel
= ctx
->temp_reg
;
1111 alu
.src
[0].chan
= 0;
1113 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1119 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Y
) {
1120 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1121 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
);
1122 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1126 alu
.src
[0].sel
= ctx
->temp_reg
;
1127 alu
.src
[0].chan
= 0;
1129 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1135 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Z
) {
1136 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1138 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1140 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1144 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1145 alu
.src
[0].chan
= 0;
1149 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1153 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1159 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_W
) {
1160 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1162 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1164 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1168 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1169 alu
.src
[0].chan
= 0;
1173 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1177 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1185 static int tgsi_kill(struct r600_shader_ctx
*ctx
)
1187 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1188 struct r600_bc_alu alu
;
1191 for (i
= 0; i
< 4; i
++) {
1192 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1193 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1197 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1199 if (ctx
->inst_info
->tgsi_opcode
== TGSI_OPCODE_KILP
) {
1200 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1203 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1206 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1211 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1215 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1219 /* kill must be last in ALU */
1220 ctx
->bc
->force_add_cf
= 1;
1221 ctx
->shader
->uses_kill
= TRUE
;
1225 static int tgsi_lit(struct r600_shader_ctx
*ctx
)
1227 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1228 struct r600_bc_alu alu
;
1229 struct r600_bc_alu_src r600_src
[3];
1232 r
= tgsi_split_constant(ctx
, r600_src
);
1235 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1240 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1241 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1242 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
; /*1.0*/
1243 alu
.src
[0].chan
= 0;
1244 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1247 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 0) & 1;
1248 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1252 /* dst.y = max(src.x, 0.0) */
1253 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1254 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
);
1255 alu
.src
[0] = r600_src
[0];
1256 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
1257 alu
.src
[1].chan
= 0;
1258 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1261 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 1) & 1;
1262 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1267 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1268 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1269 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1270 alu
.src
[0].chan
= 0;
1271 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1274 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 3) & 1;
1276 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1280 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1284 if (inst
->Dst
[0].Register
.WriteMask
& (1 << 2))
1289 /* dst.z = log(src.y) */
1290 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1291 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
);
1292 alu
.src
[0] = r600_src
[0];
1293 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
1294 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1298 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1302 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1306 chan
= alu
.dst
.chan
;
1309 /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
1310 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1311 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT
);
1312 alu
.src
[0] = r600_src
[0];
1313 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1314 alu
.src
[1].sel
= sel
;
1315 alu
.src
[1].chan
= chan
;
1317 alu
.src
[2] = r600_src
[0];
1318 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], 0);
1319 alu
.dst
.sel
= ctx
->temp_reg
;
1324 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1328 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1331 /* dst.z = exp(tmp.x) */
1332 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1333 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1334 alu
.src
[0].sel
= ctx
->temp_reg
;
1335 alu
.src
[0].chan
= 0;
1336 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1340 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1347 static int tgsi_rsq(struct r600_shader_ctx
*ctx
)
1349 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1350 struct r600_bc_alu alu
;
1353 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1356 * For state trackers other than OpenGL, we'll want to use
1357 * _RECIPSQRT_IEEE instead.
1359 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED
);
1361 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1362 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1365 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1368 alu
.dst
.sel
= ctx
->temp_reg
;
1371 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1374 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1377 /* replicate result */
1378 return tgsi_helper_tempx_replicate(ctx
);
1381 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
)
1383 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1384 struct r600_bc_alu alu
;
1387 for (i
= 0; i
< 4; i
++) {
1388 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1389 alu
.src
[0].sel
= ctx
->temp_reg
;
1390 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1392 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1395 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1398 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1405 static int tgsi_trans_srcx_replicate(struct r600_shader_ctx
*ctx
)
1407 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1408 struct r600_bc_alu alu
;
1411 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1412 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1413 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1414 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1417 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1419 alu
.dst
.sel
= ctx
->temp_reg
;
1422 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1425 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1428 /* replicate result */
1429 return tgsi_helper_tempx_replicate(ctx
);
1432 static int tgsi_pow(struct r600_shader_ctx
*ctx
)
1434 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1435 struct r600_bc_alu alu
;
1439 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1440 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
1441 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1444 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
1445 alu
.dst
.sel
= ctx
->temp_reg
;
1448 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1451 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1455 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1456 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1457 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[0]);
1460 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], 0);
1461 alu
.src
[1].sel
= ctx
->temp_reg
;
1462 alu
.dst
.sel
= ctx
->temp_reg
;
1465 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1468 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1471 /* POW(a,b) = EXP2(b * LOG2(a))*/
1472 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1473 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1474 alu
.src
[0].sel
= ctx
->temp_reg
;
1475 alu
.dst
.sel
= ctx
->temp_reg
;
1478 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1481 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1484 return tgsi_helper_tempx_replicate(ctx
);
1487 static int tgsi_ssg(struct r600_shader_ctx
*ctx
)
1489 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1490 struct r600_bc_alu alu
;
1491 struct r600_bc_alu_src r600_src
[3];
1494 r
= tgsi_split_constant(ctx
, r600_src
);
1497 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1501 /* tmp = (src > 0 ? 1 : src) */
1502 for (i
= 0; i
< 4; i
++) {
1503 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1504 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1507 alu
.dst
.sel
= ctx
->temp_reg
;
1510 alu
.src
[0] = r600_src
[0];
1511 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1513 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1515 alu
.src
[2] = r600_src
[0];
1516 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], i
);
1519 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1523 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1527 /* dst = (-tmp > 0 ? -1 : tmp) */
1528 for (i
= 0; i
< 4; i
++) {
1529 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1530 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1532 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1536 alu
.src
[0].sel
= ctx
->temp_reg
;
1537 alu
.src
[0].chan
= i
;
1540 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1543 alu
.src
[2].sel
= ctx
->temp_reg
;
1544 alu
.src
[2].chan
= i
;
1548 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1555 static int tgsi_helper_copy(struct r600_shader_ctx
*ctx
, struct tgsi_full_instruction
*inst
)
1557 struct r600_bc_alu alu
;
1560 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1563 for (i
= 0; i
< 4; i
++) {
1564 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1565 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
1566 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
);
1569 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1570 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1573 alu
.src
[0].sel
= ctx
->temp_reg
;
1574 alu
.src
[0].chan
= i
;
1579 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1586 static int tgsi_op3(struct r600_shader_ctx
*ctx
)
1588 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1589 struct r600_bc_alu_src r600_src
[3];
1590 struct r600_bc_alu alu
;
1593 r
= tgsi_split_constant(ctx
, r600_src
);
1596 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1599 /* do it in 2 step as op3 doesn't support writemask */
1600 for (i
= 0; i
< 4; i
++) {
1601 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1602 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1603 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1604 alu
.src
[j
] = r600_src
[j
];
1605 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1607 alu
.dst
.sel
= ctx
->temp_reg
;
1614 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1618 return tgsi_helper_copy(ctx
, inst
);
1621 static int tgsi_dp(struct r600_shader_ctx
*ctx
)
1623 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1624 struct r600_bc_alu_src r600_src
[3];
1625 struct r600_bc_alu alu
;
1628 r
= tgsi_split_constant(ctx
, r600_src
);
1631 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1634 for (i
= 0; i
< 4; i
++) {
1635 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1636 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1637 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1638 alu
.src
[j
] = r600_src
[j
];
1639 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1641 alu
.dst
.sel
= ctx
->temp_reg
;
1644 /* handle some special cases */
1645 switch (ctx
->inst_info
->tgsi_opcode
) {
1646 case TGSI_OPCODE_DP2
:
1648 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1649 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1652 case TGSI_OPCODE_DP3
:
1654 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1655 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1658 case TGSI_OPCODE_DPH
:
1660 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1661 alu
.src
[0].chan
= 0;
1671 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1675 return tgsi_helper_copy(ctx
, inst
);
1678 static int tgsi_tex(struct r600_shader_ctx
*ctx
)
1680 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1681 struct r600_bc_tex tex
;
1682 struct r600_bc_alu alu
;
1686 boolean src_not_temp
= inst
->Src
[0].Register
.File
!= TGSI_FILE_TEMPORARY
;
1687 uint32_t lit_vals
[4];
1689 src_gpr
= ctx
->file_offset
[inst
->Src
[0].Register
.File
] + inst
->Src
[0].Register
.Index
;
1691 if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXP
) {
1692 /* Add perspective divide */
1693 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1694 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1695 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1699 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1700 alu
.dst
.sel
= ctx
->temp_reg
;
1704 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1708 for (i
= 0; i
< 3; i
++) {
1709 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1710 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1711 alu
.src
[0].sel
= ctx
->temp_reg
;
1712 alu
.src
[0].chan
= 3;
1713 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1716 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1717 alu
.dst
.sel
= ctx
->temp_reg
;
1720 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1724 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1725 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1726 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1727 alu
.src
[0].chan
= 0;
1728 alu
.dst
.sel
= ctx
->temp_reg
;
1732 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1735 src_not_temp
= FALSE
;
1736 src_gpr
= ctx
->temp_reg
;
1739 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1740 int src_chan
, src2_chan
;
1742 /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
1743 for (i
= 0; i
< 4; i
++) {
1744 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1745 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE
);
1769 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1772 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], src_chan
);
1773 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1776 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], src2_chan
);
1777 alu
.dst
.sel
= ctx
->temp_reg
;
1782 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1787 /* tmp1.z = RCP_e(|tmp1.z|) */
1788 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1789 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1790 alu
.src
[0].sel
= ctx
->temp_reg
;
1791 alu
.src
[0].chan
= 2;
1793 alu
.dst
.sel
= ctx
->temp_reg
;
1797 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1801 /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x
1802 * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x
1803 * muladd has no writemask, have to use another temp
1805 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1806 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1809 alu
.src
[0].sel
= ctx
->temp_reg
;
1810 alu
.src
[0].chan
= 0;
1811 alu
.src
[1].sel
= ctx
->temp_reg
;
1812 alu
.src
[1].chan
= 2;
1814 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1815 alu
.src
[2].chan
= 0;
1817 alu
.dst
.sel
= ctx
->temp_reg
;
1821 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1825 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1826 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1829 alu
.src
[0].sel
= ctx
->temp_reg
;
1830 alu
.src
[0].chan
= 1;
1831 alu
.src
[1].sel
= ctx
->temp_reg
;
1832 alu
.src
[1].chan
= 2;
1834 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1835 alu
.src
[2].chan
= 0;
1837 alu
.dst
.sel
= ctx
->temp_reg
;
1842 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1846 lit_vals
[0] = fui(1.5f
);
1848 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1851 src_not_temp
= FALSE
;
1852 src_gpr
= ctx
->temp_reg
;
1856 for (i
= 0; i
< 4; i
++) {
1857 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1858 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1859 alu
.src
[0].sel
= src_gpr
;
1860 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1861 alu
.dst
.sel
= ctx
->temp_reg
;
1866 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1870 src_gpr
= ctx
->temp_reg
;
1873 opcode
= ctx
->inst_info
->r600_opcode
;
1874 if (opcode
== SQ_TEX_INST_SAMPLE
&&
1875 (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
))
1876 opcode
= SQ_TEX_INST_SAMPLE_C
;
1878 memset(&tex
, 0, sizeof(struct r600_bc_tex
));
1880 tex
.sampler_id
= ctx
->file_offset
[inst
->Src
[1].Register
.File
] + inst
->Src
[1].Register
.Index
;
1881 tex
.resource_id
= tex
.sampler_id
;
1882 tex
.src_gpr
= src_gpr
;
1883 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
1884 tex
.dst_sel_x
= (inst
->Dst
[0].Register
.WriteMask
& 1) ? 0 : 7;
1885 tex
.dst_sel_y
= (inst
->Dst
[0].Register
.WriteMask
& 2) ? 1 : 7;
1886 tex
.dst_sel_z
= (inst
->Dst
[0].Register
.WriteMask
& 4) ? 2 : 7;
1887 tex
.dst_sel_w
= (inst
->Dst
[0].Register
.WriteMask
& 8) ? 3 : 7;
1893 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1900 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
) {
1901 tex
.coord_type_x
= 1;
1902 tex
.coord_type_y
= 1;
1903 tex
.coord_type_z
= 1;
1904 tex
.coord_type_w
= 1;
1907 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
)
1910 r
= r600_bc_add_tex(ctx
->bc
, &tex
);
1914 /* add shadow ambient support - gallium doesn't do it yet */
1918 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
1920 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1921 struct r600_bc_alu_src r600_src
[3];
1922 struct r600_bc_alu alu
;
1926 r
= tgsi_split_constant(ctx
, r600_src
);
1929 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1933 for (i
= 0; i
< 4; i
++) {
1934 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1935 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1936 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1937 alu
.src
[0].chan
= 0;
1938 alu
.src
[1] = r600_src
[0];
1939 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1941 alu
.dst
.sel
= ctx
->temp_reg
;
1947 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1951 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1955 /* (1 - src0) * src2 */
1956 for (i
= 0; i
< 4; i
++) {
1957 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1958 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1959 alu
.src
[0].sel
= ctx
->temp_reg
;
1960 alu
.src
[0].chan
= i
;
1961 alu
.src
[1] = r600_src
[2];
1962 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
1963 alu
.dst
.sel
= ctx
->temp_reg
;
1969 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1973 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1977 /* src0 * src1 + (1 - src0) * src2 */
1978 for (i
= 0; i
< 4; i
++) {
1979 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1980 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1982 alu
.src
[0] = r600_src
[0];
1983 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1984 alu
.src
[1] = r600_src
[1];
1985 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
1986 alu
.src
[2].sel
= ctx
->temp_reg
;
1987 alu
.src
[2].chan
= i
;
1988 alu
.dst
.sel
= ctx
->temp_reg
;
1993 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1997 return tgsi_helper_copy(ctx
, inst
);
2000 static int tgsi_cmp(struct r600_shader_ctx
*ctx
)
2002 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2003 struct r600_bc_alu_src r600_src
[3];
2004 struct r600_bc_alu alu
;
2008 r
= tgsi_split_constant(ctx
, r600_src
);
2011 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2015 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
2018 for (i
= 0; i
< 4; i
++) {
2019 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2020 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE
);
2021 alu
.src
[0] = r600_src
[0];
2022 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2024 alu
.src
[1] = r600_src
[2];
2025 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
2027 alu
.src
[2] = r600_src
[1];
2028 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[1], i
);
2031 alu
.dst
.sel
= ctx
->temp_reg
;
2033 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2042 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2047 return tgsi_helper_copy(ctx
, inst
);
2051 static int tgsi_xpd(struct r600_shader_ctx
*ctx
)
2053 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2054 struct r600_bc_alu_src r600_src
[3];
2055 struct r600_bc_alu alu
;
2056 uint32_t use_temp
= 0;
2059 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
2062 r
= tgsi_split_constant(ctx
, r600_src
);
2065 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2069 for (i
= 0; i
< 4; i
++) {
2070 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2071 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2073 alu
.src
[0] = r600_src
[0];
2076 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 2);
2079 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2082 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
2085 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2086 alu
.src
[0].chan
= i
;
2089 alu
.src
[1] = r600_src
[1];
2092 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2095 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2098 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2101 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2102 alu
.src
[1].chan
= i
;
2105 alu
.dst
.sel
= ctx
->temp_reg
;
2111 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2115 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2120 for (i
= 0; i
< 4; i
++) {
2121 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2122 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
2124 alu
.src
[0] = r600_src
[0];
2127 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
2130 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 2);
2133 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2136 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2137 alu
.src
[0].chan
= i
;
2140 alu
.src
[1] = r600_src
[1];
2143 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2146 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2149 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2152 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2153 alu
.src
[1].chan
= i
;
2156 alu
.src
[2].sel
= ctx
->temp_reg
;
2158 alu
.src
[2].chan
= i
;
2161 alu
.dst
.sel
= ctx
->temp_reg
;
2163 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2172 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2176 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2181 return tgsi_helper_copy(ctx
, inst
);
2185 static int tgsi_exp(struct r600_shader_ctx
*ctx
)
2187 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2188 struct r600_bc_alu_src r600_src
[3] = { { 0 } };
2189 struct r600_bc_alu alu
;
2192 /* result.x = 2^floor(src); */
2193 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2194 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2196 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2197 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2201 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2203 alu
.dst
.sel
= ctx
->temp_reg
;
2207 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2211 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2215 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2216 alu
.src
[0].sel
= ctx
->temp_reg
;
2217 alu
.src
[0].chan
= 0;
2219 alu
.dst
.sel
= ctx
->temp_reg
;
2223 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2227 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2232 /* result.y = tmp - floor(tmp); */
2233 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2234 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2236 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
2237 alu
.src
[0] = r600_src
[0];
2238 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2241 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2243 alu
.dst
.sel
= ctx
->temp_reg
;
2244 // r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
2252 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2255 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2260 /* result.z = RoughApprox2ToX(tmp);*/
2261 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 0x1) {
2262 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2263 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2264 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2267 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2269 alu
.dst
.sel
= ctx
->temp_reg
;
2275 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2278 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2283 /* result.w = 1.0;*/
2284 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 0x1) {
2285 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2287 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2288 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2289 alu
.src
[0].chan
= 0;
2291 alu
.dst
.sel
= ctx
->temp_reg
;
2295 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2298 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2302 return tgsi_helper_copy(ctx
, inst
);
2305 static int tgsi_log(struct r600_shader_ctx
*ctx
)
2307 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2308 struct r600_bc_alu alu
;
2311 /* result.x = floor(log2(src)); */
2312 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2313 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2315 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2316 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2320 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2322 alu
.dst
.sel
= ctx
->temp_reg
;
2326 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2330 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2334 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2335 alu
.src
[0].sel
= ctx
->temp_reg
;
2336 alu
.src
[0].chan
= 0;
2338 alu
.dst
.sel
= ctx
->temp_reg
;
2343 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2347 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2352 /* result.y = src.x / (2 ^ floor(log2(src.x))); */
2353 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2354 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2356 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2357 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2361 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2363 alu
.dst
.sel
= ctx
->temp_reg
;
2368 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2372 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2376 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2378 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2379 alu
.src
[0].sel
= ctx
->temp_reg
;
2380 alu
.src
[0].chan
= 1;
2382 alu
.dst
.sel
= ctx
->temp_reg
;
2387 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2391 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2395 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2397 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2398 alu
.src
[0].sel
= ctx
->temp_reg
;
2399 alu
.src
[0].chan
= 1;
2401 alu
.dst
.sel
= ctx
->temp_reg
;
2406 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2410 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2414 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2416 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
2417 alu
.src
[0].sel
= ctx
->temp_reg
;
2418 alu
.src
[0].chan
= 1;
2420 alu
.dst
.sel
= ctx
->temp_reg
;
2425 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2429 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2433 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2435 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2437 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2441 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2443 alu
.src
[1].sel
= ctx
->temp_reg
;
2444 alu
.src
[1].chan
= 1;
2446 alu
.dst
.sel
= ctx
->temp_reg
;
2451 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2455 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2460 /* result.z = log2(src);*/
2461 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 1) {
2462 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2464 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2465 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2469 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2471 alu
.dst
.sel
= ctx
->temp_reg
;
2476 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2480 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2485 /* result.w = 1.0; */
2486 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 1) {
2487 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2489 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2490 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2491 alu
.src
[0].chan
= 0;
2493 alu
.dst
.sel
= ctx
->temp_reg
;
2498 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2502 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2507 return tgsi_helper_copy(ctx
, inst
);
2510 static int tgsi_eg_arl(struct r600_shader_ctx
*ctx
)
2512 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2513 struct r600_bc_alu alu
;
2515 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2517 switch (inst
->Instruction
.Opcode
) {
2518 case TGSI_OPCODE_ARL
:
2519 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR
;
2521 case TGSI_OPCODE_ARR
:
2522 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
2529 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2532 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2535 alu
.dst
.sel
= ctx
->temp_reg
;
2537 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2540 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2541 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
;
2542 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2545 alu
.src
[0].sel
= ctx
->temp_reg
;
2546 alu
.src
[0].chan
= 0;
2548 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2553 static int tgsi_r600_arl(struct r600_shader_ctx
*ctx
)
2555 /* TODO from r600c, ar values don't persist between clauses */
2556 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2557 struct r600_bc_alu alu
;
2559 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2561 switch (inst
->Instruction
.Opcode
) {
2562 case TGSI_OPCODE_ARL
:
2563 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR
;
2565 case TGSI_OPCODE_ARR
:
2566 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA
;
2574 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2577 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2581 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2584 ctx
->bc
->cf_last
->r6xx_uses_waterfall
= 1;
2588 static int tgsi_opdst(struct r600_shader_ctx
*ctx
)
2590 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2591 struct r600_bc_alu alu
;
2594 for (i
= 0; i
< 4; i
++) {
2595 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2597 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2598 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2602 if (i
== 0 || i
== 3) {
2603 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2605 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2608 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2611 if (i
== 0 || i
== 2) {
2612 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
2614 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[1]);
2617 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
2621 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2628 static int emit_logic_pred(struct r600_shader_ctx
*ctx
, int opcode
)
2630 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2631 struct r600_bc_alu alu
;
2634 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2638 alu
.dst
.sel
= ctx
->temp_reg
;
2642 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2645 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2646 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2647 alu
.src
[1].chan
= 0;
2651 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE
));
2657 static int pops(struct r600_shader_ctx
*ctx
, int pops
)
2659 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP
));
2660 ctx
->bc
->cf_last
->pop_count
= pops
;
2661 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2665 static inline void callstack_decrease_current(struct r600_shader_ctx
*ctx
, unsigned reason
)
2669 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2673 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
-= 4;
2676 /* TOODO : for 16 vp asic should -= 2; */
2677 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2682 static inline void callstack_check_depth(struct r600_shader_ctx
*ctx
, unsigned reason
, unsigned check_max_only
)
2684 if (check_max_only
) {
2697 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
) >
2698 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2699 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2700 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
;
2706 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2710 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+= 4;
2713 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2717 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
) >
2718 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2719 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2720 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
;
2724 static void fc_set_mid(struct r600_shader_ctx
*ctx
, int fc_sp
)
2726 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[fc_sp
];
2728 sp
->mid
= (struct r600_bc_cf
**)realloc((void *)sp
->mid
,
2729 sizeof(struct r600_bc_cf
*) * (sp
->num_mid
+ 1));
2730 sp
->mid
[sp
->num_mid
] = ctx
->bc
->cf_last
;
2734 static void fc_pushlevel(struct r600_shader_ctx
*ctx
, int type
)
2737 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
= type
;
2738 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
= ctx
->bc
->cf_last
;
2741 static void fc_poplevel(struct r600_shader_ctx
*ctx
)
2743 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
];
2755 static int emit_return(struct r600_shader_ctx
*ctx
)
2757 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_RETURN
);
2761 static int emit_jump_to_offset(struct r600_shader_ctx
*ctx
, int pops
, int offset
)
2764 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_JUMP
);
2765 ctx
->bc
->cf_last
->pop_count
= pops
;
2766 /* TODO work out offset */
2770 static int emit_setret_in_loop_flag(struct r600_shader_ctx
*ctx
, unsigned flag_value
)
2775 static void emit_testflag(struct r600_shader_ctx
*ctx
)
2780 static void emit_return_on_flag(struct r600_shader_ctx
*ctx
, unsigned ifidx
)
2783 emit_jump_to_offset(ctx
, 1, 4);
2784 emit_setret_in_loop_flag(ctx
, V_SQ_ALU_SRC_0
);
2785 pops(ctx
, ifidx
+ 1);
2789 static void break_loop_on_flag(struct r600_shader_ctx
*ctx
, unsigned fc_sp
)
2793 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2794 ctx
->bc
->cf_last
->pop_count
= 1;
2796 fc_set_mid(ctx
, fc_sp
);
2802 static int tgsi_if(struct r600_shader_ctx
*ctx
)
2804 emit_logic_pred(ctx
, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE
));
2806 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
2808 fc_pushlevel(ctx
, FC_IF
);
2810 callstack_check_depth(ctx
, FC_PUSH_VPM
, 0);
2814 static int tgsi_else(struct r600_shader_ctx
*ctx
)
2816 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE
));
2817 ctx
->bc
->cf_last
->pop_count
= 1;
2819 fc_set_mid(ctx
, ctx
->bc
->fc_sp
);
2820 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
;
2824 static int tgsi_endif(struct r600_shader_ctx
*ctx
)
2827 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_IF
) {
2828 R600_ERR("if/endif unbalanced in shader\n");
2832 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
== NULL
) {
2833 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2834 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->pop_count
= 1;
2836 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[0]->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2840 callstack_decrease_current(ctx
, FC_PUSH_VPM
);
2844 static int tgsi_bgnloop(struct r600_shader_ctx
*ctx
)
2846 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL
));
2848 fc_pushlevel(ctx
, FC_LOOP
);
2850 /* check stack depth */
2851 callstack_check_depth(ctx
, FC_LOOP
, 0);
2855 static int tgsi_endloop(struct r600_shader_ctx
*ctx
)
2859 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END
));
2861 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_LOOP
) {
2862 R600_ERR("loop/endloop in shader code are not paired.\n");
2866 /* fixup loop pointers - from r600isa
2867 LOOP END points to CF after LOOP START,
2868 LOOP START point to CF after LOOP END
2869 BRK/CONT point to LOOP END CF
2871 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->id
+ 2;
2873 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2875 for (i
= 0; i
< ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].num_mid
; i
++) {
2876 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[i
]->cf_addr
= ctx
->bc
->cf_last
->id
;
2878 /* TODO add LOOPRET support */
2880 callstack_decrease_current(ctx
, FC_LOOP
);
2884 static int tgsi_loop_brk_cont(struct r600_shader_ctx
*ctx
)
2888 for (fscp
= ctx
->bc
->fc_sp
; fscp
> 0; fscp
--)
2890 if (FC_LOOP
== ctx
->bc
->fc_stack
[fscp
].type
)
2895 R600_ERR("Break not inside loop/endloop pair\n");
2899 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2900 ctx
->bc
->cf_last
->pop_count
= 1;
2902 fc_set_mid(ctx
, fscp
);
2905 callstack_check_depth(ctx
, FC_PUSH_VPM
, 1);
2909 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
2910 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2911 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2912 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
2915 * For state trackers other than OpenGL, we'll want to use
2916 * _RECIP_IEEE instead.
2918 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED
, tgsi_trans_srcx_replicate
},
2920 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_rsq
},
2921 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
2922 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
2923 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
2924 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2925 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2926 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2927 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
2928 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
2929 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
2930 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
2931 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
2932 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
2933 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2934 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
2935 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2937 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2938 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2940 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2941 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2942 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
2943 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2944 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
2945 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2946 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
2947 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
2948 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
2949 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
2951 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2952 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2953 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2954 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2955 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
2956 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
2957 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
2958 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
2959 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2960 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2961 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2962 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2963 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2964 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
2965 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2966 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
2967 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
2968 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
2969 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
2970 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2971 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2972 {TGSI_OPCODE_TXD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2973 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2974 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2975 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2976 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2977 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2978 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2979 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2980 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2981 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2982 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2983 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2984 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
2985 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
2986 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
2987 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2988 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2989 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2990 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2991 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2992 {TGSI_OPCODE_BRK
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
2993 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
2995 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2996 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2997 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
2998 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
3000 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3001 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3002 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3003 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3004 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3005 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3006 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3007 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
3008 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3010 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3011 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3012 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3013 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3014 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3015 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3016 {TGSI_OPCODE_TXF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3017 {TGSI_OPCODE_TXQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3018 {TGSI_OPCODE_CONT
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
3019 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3020 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3021 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
3022 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3023 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
3024 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3026 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3027 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3028 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3029 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3030 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3032 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3033 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3034 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3035 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3036 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3037 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3038 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3039 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3040 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
3041 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
3043 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3044 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3045 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3046 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3047 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3048 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3049 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3050 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3051 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3052 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3053 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3054 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3055 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3056 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3057 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3058 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3059 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3060 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3061 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3062 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3063 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3064 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3065 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3066 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3067 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3068 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3069 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3070 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3073 static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction
[] = {
3074 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
3075 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3076 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
3077 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
3078 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_trans_srcx_replicate
},
3079 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
3080 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3081 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
3082 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3083 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3084 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3085 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
3086 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
3087 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
3088 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
3089 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
3090 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
3091 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3092 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
3093 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3095 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3096 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3098 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3099 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3100 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
3101 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3102 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
3103 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3104 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
3105 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
3106 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
3107 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
3109 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3110 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3111 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3112 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3113 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
3114 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
3115 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
3116 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
3117 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3118 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3119 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3120 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3121 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3122 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
3123 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3124 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
3125 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
3126 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
3127 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
3128 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3129 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3130 {TGSI_OPCODE_TXD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3131 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3132 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3133 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3134 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3135 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3136 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3137 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3138 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
3139 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3140 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3141 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3142 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
3143 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
3144 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
3145 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3146 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3147 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3148 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3149 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3150 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
3151 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
3153 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3154 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3155 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
3156 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
3158 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3159 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3160 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3161 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3162 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3163 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3164 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3165 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
3166 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3168 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3169 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3170 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3171 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3172 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3173 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3174 {TGSI_OPCODE_TXF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3175 {TGSI_OPCODE_TXQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3176 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
3177 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3178 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3179 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
3180 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3181 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
3182 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3184 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3185 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3186 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3187 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3188 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3190 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3191 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3192 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3193 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3194 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3195 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3196 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3197 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3198 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
3199 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
3201 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3202 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3203 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3204 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3205 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3206 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3207 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3208 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3209 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3210 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3211 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3212 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3213 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3214 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3215 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3216 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3217 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3218 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3219 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3220 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3221 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3222 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3223 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3224 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3225 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3226 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3227 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3228 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},