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]. (Gone on EG)
510 * Values [256,287] correspond to constant buffer bank 2 (EG)
511 * Values [288,319] correspond to constant buffer bank 3 (EG)
512 * Other special values are shown in the list below.
513 * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
514 * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
515 * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
516 * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
517 * 248 SQ_ALU_SRC_0: special constant 0.0.
518 * 249 SQ_ALU_SRC_1: special constant 1.0 float.
519 * 250 SQ_ALU_SRC_1_INT: special constant 1 integer.
520 * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer.
521 * 252 SQ_ALU_SRC_0_5: special constant 0.5 float.
522 * 253 SQ_ALU_SRC_LITERAL: literal constant.
523 * 254 SQ_ALU_SRC_PV: previous vector result.
524 * 255 SQ_ALU_SRC_PS: previous scalar result.
526 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
527 ctx
.file_offset
[i
] = 0;
529 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
530 ctx
.file_offset
[TGSI_FILE_INPUT
] = 1;
531 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
) {
532 r600_bc_add_cfinst(ctx
.bc
, EG_V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
534 r600_bc_add_cfinst(ctx
.bc
, V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
537 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
) {
538 ctx
.file_offset
[TGSI_FILE_INPUT
] = evergreen_gpr_count(&ctx
);
540 ctx
.file_offset
[TGSI_FILE_OUTPUT
] = ctx
.file_offset
[TGSI_FILE_INPUT
] +
541 ctx
.info
.file_count
[TGSI_FILE_INPUT
];
542 ctx
.file_offset
[TGSI_FILE_TEMPORARY
] = ctx
.file_offset
[TGSI_FILE_OUTPUT
] +
543 ctx
.info
.file_count
[TGSI_FILE_OUTPUT
];
545 /* Outside the GPR range. This will be translated to one of the
546 * kcache banks later. */
547 ctx
.file_offset
[TGSI_FILE_CONSTANT
] = 512;
549 ctx
.file_offset
[TGSI_FILE_IMMEDIATE
] = 253;
550 ctx
.temp_reg
= ctx
.file_offset
[TGSI_FILE_TEMPORARY
] +
551 ctx
.info
.file_count
[TGSI_FILE_TEMPORARY
];
556 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
557 tgsi_parse_token(&ctx
.parse
);
558 switch (ctx
.parse
.FullToken
.Token
.Type
) {
559 case TGSI_TOKEN_TYPE_IMMEDIATE
:
560 immediate
= &ctx
.parse
.FullToken
.FullImmediate
;
561 ctx
.literals
= realloc(ctx
.literals
, (ctx
.nliterals
+ 1) * 16);
562 if(ctx
.literals
== NULL
) {
566 ctx
.literals
[ctx
.nliterals
* 4 + 0] = immediate
->u
[0].Uint
;
567 ctx
.literals
[ctx
.nliterals
* 4 + 1] = immediate
->u
[1].Uint
;
568 ctx
.literals
[ctx
.nliterals
* 4 + 2] = immediate
->u
[2].Uint
;
569 ctx
.literals
[ctx
.nliterals
* 4 + 3] = immediate
->u
[3].Uint
;
572 case TGSI_TOKEN_TYPE_DECLARATION
:
573 r
= tgsi_declaration(&ctx
);
577 case TGSI_TOKEN_TYPE_INSTRUCTION
:
578 r
= tgsi_is_supported(&ctx
);
581 ctx
.max_driver_temp_used
= 0;
582 /* reserve first tmp for everyone */
584 opcode
= ctx
.parse
.FullToken
.FullInstruction
.Instruction
.Opcode
;
585 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
)
586 ctx
.inst_info
= &eg_shader_tgsi_instruction
[opcode
];
588 ctx
.inst_info
= &r600_shader_tgsi_instruction
[opcode
];
589 r
= ctx
.inst_info
->process(&ctx
);
592 r
= r600_bc_add_literal(ctx
.bc
, ctx
.value
);
596 case TGSI_TOKEN_TYPE_PROPERTY
:
599 R600_ERR("unsupported token type %d\n", ctx
.parse
.FullToken
.Token
.Type
);
605 noutput
= shader
->noutput
;
606 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
607 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
608 output
[i
].gpr
= shader
->output
[i
].gpr
;
609 output
[i
].elem_size
= 3;
610 output
[i
].swizzle_x
= 0;
611 output
[i
].swizzle_y
= 1;
612 output
[i
].swizzle_z
= 2;
613 output
[i
].swizzle_w
= 3;
614 output
[i
].barrier
= 1;
615 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
616 output
[i
].array_base
= i
- pos0
;
617 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
619 case TGSI_PROCESSOR_VERTEX
:
620 if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
621 output
[i
].array_base
= 60;
622 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
623 /* position doesn't count in array_base */
626 if (shader
->output
[i
].name
== TGSI_SEMANTIC_PSIZE
) {
627 output
[i
].array_base
= 61;
628 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
629 /* position doesn't count in array_base */
633 case TGSI_PROCESSOR_FRAGMENT
:
634 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
635 output
[i
].array_base
= shader
->output
[i
].sid
;
636 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
637 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
638 output
[i
].array_base
= 61;
639 output
[i
].swizzle_x
= 2;
640 output
[i
].swizzle_y
= 7;
641 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
642 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
643 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
) {
644 output
[i
].array_base
= 61;
645 output
[i
].swizzle_x
= 7;
646 output
[i
].swizzle_y
= 1;
647 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
648 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
650 R600_ERR("unsupported fragment output name %d\n", shader
->output
[i
].name
);
656 R600_ERR("unsupported processor type %d\n", ctx
.type
);
661 /* add fake param output for vertex shader if no param is exported */
662 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
663 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
664 if (output
[i
].type
== V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
) {
670 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
672 output
[i
].elem_size
= 3;
673 output
[i
].swizzle_x
= 0;
674 output
[i
].swizzle_y
= 1;
675 output
[i
].swizzle_z
= 2;
676 output
[i
].swizzle_w
= 3;
677 output
[i
].barrier
= 1;
678 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
679 output
[i
].array_base
= 0;
680 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
684 /* add fake pixel export */
685 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& !noutput
) {
686 memset(&output
[0], 0, sizeof(struct r600_bc_output
));
688 output
[0].elem_size
= 3;
689 output
[0].swizzle_x
= 7;
690 output
[0].swizzle_y
= 7;
691 output
[0].swizzle_z
= 7;
692 output
[0].swizzle_w
= 7;
693 output
[0].barrier
= 1;
694 output
[0].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
695 output
[0].array_base
= 0;
696 output
[0].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
699 /* set export done on last export of each type */
700 for (i
= noutput
- 1, output_done
= 0; i
>= 0; i
--) {
701 if (i
== (noutput
- 1)) {
702 output
[i
].end_of_program
= 1;
704 if (!(output_done
& (1 << output
[i
].type
))) {
705 output_done
|= (1 << output
[i
].type
);
706 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE
);
709 /* add output to bytecode */
710 for (i
= 0; i
< noutput
; i
++) {
711 r
= r600_bc_add_output(ctx
.bc
, &output
[i
]);
716 tgsi_parse_free(&ctx
.parse
);
720 tgsi_parse_free(&ctx
.parse
);
724 static int tgsi_unsupported(struct r600_shader_ctx
*ctx
)
726 R600_ERR("%d tgsi opcode unsupported\n", ctx
->inst_info
->tgsi_opcode
);
730 static int tgsi_end(struct r600_shader_ctx
*ctx
)
735 static int tgsi_src(struct r600_shader_ctx
*ctx
,
736 const struct tgsi_full_src_register
*tgsi_src
,
737 struct r600_bc_alu_src
*r600_src
)
740 memset(r600_src
, 0, sizeof(struct r600_bc_alu_src
));
741 r600_src
->sel
= tgsi_src
->Register
.Index
;
742 if (tgsi_src
->Register
.File
== TGSI_FILE_IMMEDIATE
) {
744 index
= tgsi_src
->Register
.Index
;
745 ctx
->value
[0] = ctx
->literals
[index
* 4 + 0];
746 ctx
->value
[1] = ctx
->literals
[index
* 4 + 1];
747 ctx
->value
[2] = ctx
->literals
[index
* 4 + 2];
748 ctx
->value
[3] = ctx
->literals
[index
* 4 + 3];
750 if (tgsi_src
->Register
.Indirect
)
751 r600_src
->rel
= V_SQ_REL_RELATIVE
;
752 r600_src
->neg
= tgsi_src
->Register
.Negate
;
753 r600_src
->abs
= tgsi_src
->Register
.Absolute
;
754 r600_src
->sel
+= ctx
->file_offset
[tgsi_src
->Register
.File
];
758 static int tgsi_dst(struct r600_shader_ctx
*ctx
,
759 const struct tgsi_full_dst_register
*tgsi_dst
,
761 struct r600_bc_alu_dst
*r600_dst
)
763 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
765 r600_dst
->sel
= tgsi_dst
->Register
.Index
;
766 r600_dst
->sel
+= ctx
->file_offset
[tgsi_dst
->Register
.File
];
767 r600_dst
->chan
= swizzle
;
769 if (tgsi_dst
->Register
.Indirect
)
770 r600_dst
->rel
= V_SQ_REL_RELATIVE
;
771 if (inst
->Instruction
.Saturate
) {
777 static unsigned tgsi_chan(const struct tgsi_full_src_register
*tgsi_src
, unsigned swizzle
)
781 return tgsi_src
->Register
.SwizzleX
;
783 return tgsi_src
->Register
.SwizzleY
;
785 return tgsi_src
->Register
.SwizzleZ
;
787 return tgsi_src
->Register
.SwizzleW
;
793 static int tgsi_split_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
795 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
796 struct r600_bc_alu alu
;
797 int i
, j
, k
, nconst
, r
;
799 for (i
= 0, nconst
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
800 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
803 r
= tgsi_src(ctx
, &inst
->Src
[i
], &r600_src
[i
]);
808 for (i
= 0, j
= nconst
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
809 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
810 int treg
= r600_get_temp(ctx
);
811 for (k
= 0; k
< 4; k
++) {
812 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
813 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
814 alu
.src
[0].sel
= r600_src
[i
].sel
;
816 alu
.src
[0].rel
= r600_src
[i
].rel
;
822 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
826 r600_src
[i
].sel
= treg
;
834 /* need to move any immediate into a temp - for trig functions which use literal for PI stuff */
835 static int tgsi_split_literal_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
837 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
838 struct r600_bc_alu alu
;
839 int i
, j
, k
, nliteral
, r
;
841 for (i
= 0, nliteral
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
842 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_IMMEDIATE
) {
846 for (i
= 0, j
= nliteral
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
847 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_IMMEDIATE
) {
848 int treg
= r600_get_temp(ctx
);
849 for (k
= 0; k
< 4; k
++) {
850 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
851 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
852 alu
.src
[0].sel
= r600_src
[i
].sel
;
859 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
863 r
= r600_bc_add_literal(ctx
->bc
, &ctx
->literals
[inst
->Src
[i
].Register
.Index
* 4]);
866 r600_src
[i
].sel
= treg
;
873 static int tgsi_op2_s(struct r600_shader_ctx
*ctx
, int swap
)
875 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
876 struct r600_bc_alu_src r600_src
[3];
877 struct r600_bc_alu alu
;
881 for (i
= 0; i
< 4; i
++) {
882 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
)) {
887 r
= tgsi_split_constant(ctx
, r600_src
);
890 r
= tgsi_split_literal_constant(ctx
, r600_src
);
893 for (i
= 0; i
< lasti
+ 1; i
++) {
894 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
897 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
898 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
902 alu
.inst
= ctx
->inst_info
->r600_opcode
;
904 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
905 alu
.src
[j
] = r600_src
[j
];
906 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
909 alu
.src
[0] = r600_src
[1];
910 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], i
);
912 alu
.src
[1] = r600_src
[0];
913 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
915 /* handle some special cases */
916 switch (ctx
->inst_info
->tgsi_opcode
) {
917 case TGSI_OPCODE_SUB
:
920 case TGSI_OPCODE_ABS
:
929 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
936 static int tgsi_op2(struct r600_shader_ctx
*ctx
)
938 return tgsi_op2_s(ctx
, 0);
941 static int tgsi_op2_swap(struct r600_shader_ctx
*ctx
)
943 return tgsi_op2_s(ctx
, 1);
947 * r600 - trunc to -PI..PI range
948 * r700 - normalize by dividing by 2PI
951 static int tgsi_setup_trig(struct r600_shader_ctx
*ctx
,
952 struct r600_bc_alu_src r600_src
[3])
954 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
956 uint32_t lit_vals
[4];
957 struct r600_bc_alu alu
;
959 memset(lit_vals
, 0, 4*4);
960 r
= tgsi_split_constant(ctx
, r600_src
);
963 r
= tgsi_split_literal_constant(ctx
, r600_src
);
967 src0_chan
= tgsi_chan(&inst
->Src
[0], 0);
969 /* We are going to feed two literals to the MAD below,
970 * which means that if the first operand is a literal as well,
971 * we need to copy its value manually.
973 if (r600_src
[0].sel
== V_SQ_ALU_SRC_LITERAL
) {
974 unsigned index
= inst
->Src
[0].Register
.Index
;
976 lit_vals
[2] = ctx
->literals
[index
* 4 + src0_chan
];
980 lit_vals
[0] = fui(1.0 /(3.1415926535 * 2));
981 lit_vals
[1] = fui(0.5f
);
983 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
984 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
988 alu
.dst
.sel
= ctx
->temp_reg
;
991 alu
.src
[0] = r600_src
[0];
992 alu
.src
[0].chan
= src0_chan
;
994 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
996 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
999 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1002 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1006 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1007 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
1010 alu
.dst
.sel
= ctx
->temp_reg
;
1013 alu
.src
[0].sel
= ctx
->temp_reg
;
1014 alu
.src
[0].chan
= 0;
1016 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1020 if (ctx
->bc
->chiprev
== CHIPREV_R600
) {
1021 lit_vals
[0] = fui(3.1415926535897f
* 2.0f
);
1022 lit_vals
[1] = fui(-3.1415926535897f
);
1024 lit_vals
[0] = fui(1.0f
);
1025 lit_vals
[1] = fui(-0.5f
);
1028 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1029 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1033 alu
.dst
.sel
= ctx
->temp_reg
;
1036 alu
.src
[0].sel
= ctx
->temp_reg
;
1037 alu
.src
[0].chan
= 0;
1039 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
1040 alu
.src
[1].chan
= 0;
1041 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1042 alu
.src
[2].chan
= 1;
1044 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1047 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1053 static int tgsi_trig(struct r600_shader_ctx
*ctx
)
1055 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1056 struct r600_bc_alu_src r600_src
[3];
1057 struct r600_bc_alu alu
;
1061 r
= tgsi_setup_trig(ctx
, r600_src
);
1065 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1066 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1068 alu
.dst
.sel
= ctx
->temp_reg
;
1071 alu
.src
[0].sel
= ctx
->temp_reg
;
1072 alu
.src
[0].chan
= 0;
1074 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1078 /* replicate result */
1079 for (i
= 0; i
< 4; i
++) {
1080 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
))
1083 for (i
= 0; i
< lasti
+ 1; i
++) {
1084 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1087 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1088 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1090 alu
.src
[0].sel
= ctx
->temp_reg
;
1091 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1096 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1103 static int tgsi_scs(struct r600_shader_ctx
*ctx
)
1105 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1106 struct r600_bc_alu_src r600_src
[3];
1107 struct r600_bc_alu alu
;
1110 /* We'll only need the trig stuff if we are going to write to the
1111 * X or Y components of the destination vector.
1113 if (likely(inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_XY
)) {
1114 r
= tgsi_setup_trig(ctx
, r600_src
);
1120 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_X
) {
1121 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1122 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
);
1123 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1127 alu
.src
[0].sel
= ctx
->temp_reg
;
1128 alu
.src
[0].chan
= 0;
1130 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1136 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Y
) {
1137 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1138 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
);
1139 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1143 alu
.src
[0].sel
= ctx
->temp_reg
;
1144 alu
.src
[0].chan
= 0;
1146 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1152 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Z
) {
1153 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1155 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1157 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1161 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1162 alu
.src
[0].chan
= 0;
1166 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1170 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1176 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_W
) {
1177 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1179 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1181 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1185 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1186 alu
.src
[0].chan
= 0;
1190 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1194 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1202 static int tgsi_kill(struct r600_shader_ctx
*ctx
)
1204 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1205 struct r600_bc_alu alu
;
1208 for (i
= 0; i
< 4; i
++) {
1209 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1210 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1214 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1216 if (ctx
->inst_info
->tgsi_opcode
== TGSI_OPCODE_KILP
) {
1217 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1220 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1223 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1228 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1232 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1236 /* kill must be last in ALU */
1237 ctx
->bc
->force_add_cf
= 1;
1238 ctx
->shader
->uses_kill
= TRUE
;
1242 static int tgsi_lit(struct r600_shader_ctx
*ctx
)
1244 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1245 struct r600_bc_alu alu
;
1246 struct r600_bc_alu_src r600_src
[3];
1249 r
= tgsi_split_constant(ctx
, r600_src
);
1252 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1257 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1258 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1259 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
; /*1.0*/
1260 alu
.src
[0].chan
= 0;
1261 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1264 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 0) & 1;
1265 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1269 /* dst.y = max(src.x, 0.0) */
1270 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1271 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
);
1272 alu
.src
[0] = r600_src
[0];
1273 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
1274 alu
.src
[1].chan
= 0;
1275 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1278 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 1) & 1;
1279 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1284 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1285 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1286 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1287 alu
.src
[0].chan
= 0;
1288 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1291 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 3) & 1;
1293 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1297 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1301 if (inst
->Dst
[0].Register
.WriteMask
& (1 << 2))
1306 /* dst.z = log(src.y) */
1307 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1308 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
);
1309 alu
.src
[0] = r600_src
[0];
1310 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
1311 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1315 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1319 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1323 chan
= alu
.dst
.chan
;
1326 /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
1327 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1328 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT
);
1329 alu
.src
[0] = r600_src
[0];
1330 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1331 alu
.src
[1].sel
= sel
;
1332 alu
.src
[1].chan
= chan
;
1334 alu
.src
[2] = r600_src
[0];
1335 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], 0);
1336 alu
.dst
.sel
= ctx
->temp_reg
;
1341 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1345 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1348 /* dst.z = exp(tmp.x) */
1349 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1350 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1351 alu
.src
[0].sel
= ctx
->temp_reg
;
1352 alu
.src
[0].chan
= 0;
1353 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1357 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1364 static int tgsi_rsq(struct r600_shader_ctx
*ctx
)
1366 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1367 struct r600_bc_alu alu
;
1370 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1373 * For state trackers other than OpenGL, we'll want to use
1374 * _RECIPSQRT_IEEE instead.
1376 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED
);
1378 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1379 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1382 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1385 alu
.dst
.sel
= ctx
->temp_reg
;
1388 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1391 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1394 /* replicate result */
1395 return tgsi_helper_tempx_replicate(ctx
);
1398 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
)
1400 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1401 struct r600_bc_alu alu
;
1404 for (i
= 0; i
< 4; i
++) {
1405 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1406 alu
.src
[0].sel
= ctx
->temp_reg
;
1407 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1409 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1412 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1415 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1422 static int tgsi_trans_srcx_replicate(struct r600_shader_ctx
*ctx
)
1424 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1425 struct r600_bc_alu alu
;
1428 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1429 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1430 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1431 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1434 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1436 alu
.dst
.sel
= ctx
->temp_reg
;
1439 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1442 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1445 /* replicate result */
1446 return tgsi_helper_tempx_replicate(ctx
);
1449 static int tgsi_pow(struct r600_shader_ctx
*ctx
)
1451 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1452 struct r600_bc_alu alu
;
1456 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1457 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
1458 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1461 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
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
);
1472 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1473 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1474 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[0]);
1477 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], 0);
1478 alu
.src
[1].sel
= ctx
->temp_reg
;
1479 alu
.dst
.sel
= ctx
->temp_reg
;
1482 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1485 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1488 /* POW(a,b) = EXP2(b * LOG2(a))*/
1489 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1490 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1491 alu
.src
[0].sel
= ctx
->temp_reg
;
1492 alu
.dst
.sel
= ctx
->temp_reg
;
1495 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1498 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1501 return tgsi_helper_tempx_replicate(ctx
);
1504 static int tgsi_ssg(struct r600_shader_ctx
*ctx
)
1506 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1507 struct r600_bc_alu alu
;
1508 struct r600_bc_alu_src r600_src
[3];
1511 r
= tgsi_split_constant(ctx
, r600_src
);
1514 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1518 /* tmp = (src > 0 ? 1 : src) */
1519 for (i
= 0; i
< 4; i
++) {
1520 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1521 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1524 alu
.dst
.sel
= ctx
->temp_reg
;
1527 alu
.src
[0] = r600_src
[0];
1528 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1530 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1532 alu
.src
[2] = r600_src
[0];
1533 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], i
);
1536 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1540 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1544 /* dst = (-tmp > 0 ? -1 : tmp) */
1545 for (i
= 0; i
< 4; i
++) {
1546 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1547 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1549 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1553 alu
.src
[0].sel
= ctx
->temp_reg
;
1554 alu
.src
[0].chan
= i
;
1557 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1560 alu
.src
[2].sel
= ctx
->temp_reg
;
1561 alu
.src
[2].chan
= i
;
1565 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1572 static int tgsi_helper_copy(struct r600_shader_ctx
*ctx
, struct tgsi_full_instruction
*inst
)
1574 struct r600_bc_alu alu
;
1577 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1580 for (i
= 0; i
< 4; i
++) {
1581 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1582 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
1583 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
);
1586 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1587 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1590 alu
.src
[0].sel
= ctx
->temp_reg
;
1591 alu
.src
[0].chan
= i
;
1596 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1603 static int tgsi_op3(struct r600_shader_ctx
*ctx
)
1605 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1606 struct r600_bc_alu_src r600_src
[3];
1607 struct r600_bc_alu alu
;
1611 for (i
= 0; i
< 4; i
++) {
1612 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
)) {
1617 r
= tgsi_split_constant(ctx
, r600_src
);
1620 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1623 for (i
= 0; i
< lasti
+ 1; i
++) {
1624 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1627 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1628 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1629 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1630 alu
.src
[j
] = r600_src
[j
];
1631 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1634 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1644 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1651 static int tgsi_dp(struct r600_shader_ctx
*ctx
)
1653 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1654 struct r600_bc_alu_src r600_src
[3];
1655 struct r600_bc_alu alu
;
1658 r
= tgsi_split_constant(ctx
, r600_src
);
1661 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1664 for (i
= 0; i
< 4; i
++) {
1665 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1666 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1667 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1668 alu
.src
[j
] = r600_src
[j
];
1669 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1671 if(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)) {
1672 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1676 alu
.dst
.sel
= ctx
->temp_reg
;
1680 /* handle some special cases */
1681 switch (ctx
->inst_info
->tgsi_opcode
) {
1682 case TGSI_OPCODE_DP2
:
1684 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1685 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1688 case TGSI_OPCODE_DP3
:
1690 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1691 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1694 case TGSI_OPCODE_DPH
:
1696 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1697 alu
.src
[0].chan
= 0;
1707 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1714 static int tgsi_tex(struct r600_shader_ctx
*ctx
)
1716 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1717 struct r600_bc_tex tex
;
1718 struct r600_bc_alu alu
;
1722 boolean src_not_temp
= inst
->Src
[0].Register
.File
!= TGSI_FILE_TEMPORARY
;
1723 uint32_t lit_vals
[4];
1725 src_gpr
= ctx
->file_offset
[inst
->Src
[0].Register
.File
] + inst
->Src
[0].Register
.Index
;
1727 if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXP
) {
1728 /* Add perspective divide */
1729 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1730 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1731 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1735 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1736 alu
.dst
.sel
= ctx
->temp_reg
;
1740 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1744 for (i
= 0; i
< 3; i
++) {
1745 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1746 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1747 alu
.src
[0].sel
= ctx
->temp_reg
;
1748 alu
.src
[0].chan
= 3;
1749 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1752 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1753 alu
.dst
.sel
= ctx
->temp_reg
;
1756 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1760 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1761 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1762 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1763 alu
.src
[0].chan
= 0;
1764 alu
.dst
.sel
= ctx
->temp_reg
;
1768 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1771 src_not_temp
= FALSE
;
1772 src_gpr
= ctx
->temp_reg
;
1775 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1776 int src_chan
, src2_chan
;
1778 /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
1779 for (i
= 0; i
< 4; i
++) {
1780 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1781 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE
);
1805 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1808 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], src_chan
);
1809 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1812 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], src2_chan
);
1813 alu
.dst
.sel
= ctx
->temp_reg
;
1818 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1823 /* tmp1.z = RCP_e(|tmp1.z|) */
1824 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1825 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1826 alu
.src
[0].sel
= ctx
->temp_reg
;
1827 alu
.src
[0].chan
= 2;
1829 alu
.dst
.sel
= ctx
->temp_reg
;
1833 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1837 /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x
1838 * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x
1839 * muladd has no writemask, have to use another temp
1841 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1842 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1845 alu
.src
[0].sel
= ctx
->temp_reg
;
1846 alu
.src
[0].chan
= 0;
1847 alu
.src
[1].sel
= ctx
->temp_reg
;
1848 alu
.src
[1].chan
= 2;
1850 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1851 alu
.src
[2].chan
= 0;
1853 alu
.dst
.sel
= ctx
->temp_reg
;
1857 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1861 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1862 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1865 alu
.src
[0].sel
= ctx
->temp_reg
;
1866 alu
.src
[0].chan
= 1;
1867 alu
.src
[1].sel
= ctx
->temp_reg
;
1868 alu
.src
[1].chan
= 2;
1870 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1871 alu
.src
[2].chan
= 0;
1873 alu
.dst
.sel
= ctx
->temp_reg
;
1878 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1882 lit_vals
[0] = fui(1.5f
);
1884 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1887 src_not_temp
= FALSE
;
1888 src_gpr
= ctx
->temp_reg
;
1892 for (i
= 0; i
< 4; i
++) {
1893 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1894 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1895 alu
.src
[0].sel
= src_gpr
;
1896 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1897 alu
.dst
.sel
= ctx
->temp_reg
;
1902 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1906 src_gpr
= ctx
->temp_reg
;
1909 opcode
= ctx
->inst_info
->r600_opcode
;
1910 if (opcode
== SQ_TEX_INST_SAMPLE
&&
1911 (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
))
1912 opcode
= SQ_TEX_INST_SAMPLE_C
;
1914 memset(&tex
, 0, sizeof(struct r600_bc_tex
));
1916 tex
.sampler_id
= ctx
->file_offset
[inst
->Src
[1].Register
.File
] + inst
->Src
[1].Register
.Index
;
1917 tex
.resource_id
= tex
.sampler_id
;
1918 tex
.src_gpr
= src_gpr
;
1919 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
1920 tex
.dst_sel_x
= (inst
->Dst
[0].Register
.WriteMask
& 1) ? 0 : 7;
1921 tex
.dst_sel_y
= (inst
->Dst
[0].Register
.WriteMask
& 2) ? 1 : 7;
1922 tex
.dst_sel_z
= (inst
->Dst
[0].Register
.WriteMask
& 4) ? 2 : 7;
1923 tex
.dst_sel_w
= (inst
->Dst
[0].Register
.WriteMask
& 8) ? 3 : 7;
1929 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1936 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
) {
1937 tex
.coord_type_x
= 1;
1938 tex
.coord_type_y
= 1;
1939 tex
.coord_type_z
= 1;
1940 tex
.coord_type_w
= 1;
1943 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
)
1946 r
= r600_bc_add_tex(ctx
->bc
, &tex
);
1950 /* add shadow ambient support - gallium doesn't do it yet */
1954 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
1956 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1957 struct r600_bc_alu_src r600_src
[3];
1958 struct r600_bc_alu alu
;
1962 r
= tgsi_split_constant(ctx
, r600_src
);
1965 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1969 for (i
= 0; i
< 4; i
++) {
1970 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1971 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1972 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1973 alu
.src
[0].chan
= 0;
1974 alu
.src
[1] = r600_src
[0];
1975 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1977 alu
.dst
.sel
= ctx
->temp_reg
;
1983 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1987 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1991 /* (1 - src0) * src2 */
1992 for (i
= 0; i
< 4; i
++) {
1993 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1994 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1995 alu
.src
[0].sel
= ctx
->temp_reg
;
1996 alu
.src
[0].chan
= i
;
1997 alu
.src
[1] = r600_src
[2];
1998 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
1999 alu
.dst
.sel
= ctx
->temp_reg
;
2005 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2009 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2013 /* src0 * src1 + (1 - src0) * src2 */
2014 for (i
= 0; i
< 4; i
++) {
2015 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2016 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
2018 alu
.src
[0] = r600_src
[0];
2019 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2020 alu
.src
[1] = r600_src
[1];
2021 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
2022 alu
.src
[2].sel
= ctx
->temp_reg
;
2023 alu
.src
[2].chan
= i
;
2024 alu
.dst
.sel
= ctx
->temp_reg
;
2029 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2033 return tgsi_helper_copy(ctx
, inst
);
2036 static int tgsi_cmp(struct r600_shader_ctx
*ctx
)
2038 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2039 struct r600_bc_alu_src r600_src
[3];
2040 struct r600_bc_alu alu
;
2044 for (i
= 0; i
< 4; i
++) {
2045 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
)) {
2050 r
= tgsi_split_constant(ctx
, r600_src
);
2053 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2057 for (i
= 0; i
< lasti
+ 1; i
++) {
2058 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
2061 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2062 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE
);
2063 alu
.src
[0] = r600_src
[0];
2064 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2066 alu
.src
[1] = r600_src
[2];
2067 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
2069 alu
.src
[2] = r600_src
[1];
2070 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[1], i
);
2072 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2081 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2088 static int tgsi_xpd(struct r600_shader_ctx
*ctx
)
2090 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2091 struct r600_bc_alu_src r600_src
[3];
2092 struct r600_bc_alu alu
;
2093 uint32_t use_temp
= 0;
2096 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
2099 r
= tgsi_split_constant(ctx
, r600_src
);
2102 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2106 for (i
= 0; i
< 4; i
++) {
2107 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2108 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2110 alu
.src
[0] = r600_src
[0];
2113 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 2);
2116 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2119 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
2122 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2123 alu
.src
[0].chan
= i
;
2126 alu
.src
[1] = r600_src
[1];
2129 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2132 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2135 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2138 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2139 alu
.src
[1].chan
= i
;
2142 alu
.dst
.sel
= ctx
->temp_reg
;
2148 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2152 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2157 for (i
= 0; i
< 4; i
++) {
2158 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2159 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
2161 alu
.src
[0] = r600_src
[0];
2164 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
2167 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 2);
2170 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2173 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2174 alu
.src
[0].chan
= i
;
2177 alu
.src
[1] = r600_src
[1];
2180 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2183 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2186 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2189 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2190 alu
.src
[1].chan
= i
;
2193 alu
.src
[2].sel
= ctx
->temp_reg
;
2195 alu
.src
[2].chan
= i
;
2198 alu
.dst
.sel
= ctx
->temp_reg
;
2200 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2209 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2213 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2218 return tgsi_helper_copy(ctx
, inst
);
2222 static int tgsi_exp(struct r600_shader_ctx
*ctx
)
2224 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2225 struct r600_bc_alu_src r600_src
[3] = { { 0 } };
2226 struct r600_bc_alu alu
;
2229 /* result.x = 2^floor(src); */
2230 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2231 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2233 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2234 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2238 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2240 alu
.dst
.sel
= ctx
->temp_reg
;
2244 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2248 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2252 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2253 alu
.src
[0].sel
= ctx
->temp_reg
;
2254 alu
.src
[0].chan
= 0;
2256 alu
.dst
.sel
= ctx
->temp_reg
;
2260 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2264 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2269 /* result.y = tmp - floor(tmp); */
2270 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2271 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2273 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
2274 alu
.src
[0] = r600_src
[0];
2275 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2278 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2280 alu
.dst
.sel
= ctx
->temp_reg
;
2281 // r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
2289 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2292 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2297 /* result.z = RoughApprox2ToX(tmp);*/
2298 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 0x1) {
2299 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2300 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2301 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2304 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2306 alu
.dst
.sel
= ctx
->temp_reg
;
2312 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2315 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2320 /* result.w = 1.0;*/
2321 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 0x1) {
2322 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2324 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2325 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2326 alu
.src
[0].chan
= 0;
2328 alu
.dst
.sel
= ctx
->temp_reg
;
2332 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2335 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2339 return tgsi_helper_copy(ctx
, inst
);
2342 static int tgsi_log(struct r600_shader_ctx
*ctx
)
2344 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2345 struct r600_bc_alu alu
;
2348 /* result.x = floor(log2(src)); */
2349 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2350 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2352 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2353 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2357 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2359 alu
.dst
.sel
= ctx
->temp_reg
;
2363 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2367 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2371 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2372 alu
.src
[0].sel
= ctx
->temp_reg
;
2373 alu
.src
[0].chan
= 0;
2375 alu
.dst
.sel
= ctx
->temp_reg
;
2380 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2384 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2389 /* result.y = src.x / (2 ^ floor(log2(src.x))); */
2390 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2391 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2393 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2394 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2398 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2400 alu
.dst
.sel
= ctx
->temp_reg
;
2405 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2409 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2413 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2415 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2416 alu
.src
[0].sel
= ctx
->temp_reg
;
2417 alu
.src
[0].chan
= 1;
2419 alu
.dst
.sel
= ctx
->temp_reg
;
2424 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2428 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2432 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2434 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2435 alu
.src
[0].sel
= ctx
->temp_reg
;
2436 alu
.src
[0].chan
= 1;
2438 alu
.dst
.sel
= ctx
->temp_reg
;
2443 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2447 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2451 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2453 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
2454 alu
.src
[0].sel
= ctx
->temp_reg
;
2455 alu
.src
[0].chan
= 1;
2457 alu
.dst
.sel
= ctx
->temp_reg
;
2462 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2466 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2470 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2472 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2474 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2478 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2480 alu
.src
[1].sel
= ctx
->temp_reg
;
2481 alu
.src
[1].chan
= 1;
2483 alu
.dst
.sel
= ctx
->temp_reg
;
2488 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2492 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2497 /* result.z = log2(src);*/
2498 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 1) {
2499 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2501 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2502 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2506 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2508 alu
.dst
.sel
= ctx
->temp_reg
;
2513 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2517 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2522 /* result.w = 1.0; */
2523 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 1) {
2524 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2526 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2527 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2528 alu
.src
[0].chan
= 0;
2530 alu
.dst
.sel
= ctx
->temp_reg
;
2535 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2539 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2544 return tgsi_helper_copy(ctx
, inst
);
2547 static int tgsi_eg_arl(struct r600_shader_ctx
*ctx
)
2549 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2550 struct r600_bc_alu alu
;
2552 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2554 switch (inst
->Instruction
.Opcode
) {
2555 case TGSI_OPCODE_ARL
:
2556 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR
;
2558 case TGSI_OPCODE_ARR
:
2559 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
2566 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2569 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2572 alu
.dst
.sel
= ctx
->temp_reg
;
2574 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2577 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2578 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
;
2579 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2582 alu
.src
[0].sel
= ctx
->temp_reg
;
2583 alu
.src
[0].chan
= 0;
2585 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2590 static int tgsi_r600_arl(struct r600_shader_ctx
*ctx
)
2592 /* TODO from r600c, ar values don't persist between clauses */
2593 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2594 struct r600_bc_alu alu
;
2596 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2598 switch (inst
->Instruction
.Opcode
) {
2599 case TGSI_OPCODE_ARL
:
2600 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR
;
2602 case TGSI_OPCODE_ARR
:
2603 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA
;
2611 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2614 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2618 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2621 ctx
->bc
->cf_last
->r6xx_uses_waterfall
= 1;
2625 static int tgsi_opdst(struct r600_shader_ctx
*ctx
)
2627 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2628 struct r600_bc_alu alu
;
2631 for (i
= 0; i
< 4; i
++) {
2632 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2634 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2635 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2639 if (i
== 0 || i
== 3) {
2640 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2642 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2645 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2648 if (i
== 0 || i
== 2) {
2649 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
2651 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[1]);
2654 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
2658 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2665 static int emit_logic_pred(struct r600_shader_ctx
*ctx
, int opcode
)
2667 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2668 struct r600_bc_alu alu
;
2671 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2675 alu
.dst
.sel
= ctx
->temp_reg
;
2679 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2682 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2683 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2684 alu
.src
[1].chan
= 0;
2688 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE
));
2694 static int pops(struct r600_shader_ctx
*ctx
, int pops
)
2696 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP
));
2697 ctx
->bc
->cf_last
->pop_count
= pops
;
2698 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2702 static inline void callstack_decrease_current(struct r600_shader_ctx
*ctx
, unsigned reason
)
2706 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2710 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
-= 4;
2713 /* TOODO : for 16 vp asic should -= 2; */
2714 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2719 static inline void callstack_check_depth(struct r600_shader_ctx
*ctx
, unsigned reason
, unsigned check_max_only
)
2721 if (check_max_only
) {
2734 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
) >
2735 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2736 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2737 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
;
2743 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2747 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+= 4;
2750 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2754 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
) >
2755 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2756 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2757 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
;
2761 static void fc_set_mid(struct r600_shader_ctx
*ctx
, int fc_sp
)
2763 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[fc_sp
];
2765 sp
->mid
= (struct r600_bc_cf
**)realloc((void *)sp
->mid
,
2766 sizeof(struct r600_bc_cf
*) * (sp
->num_mid
+ 1));
2767 sp
->mid
[sp
->num_mid
] = ctx
->bc
->cf_last
;
2771 static void fc_pushlevel(struct r600_shader_ctx
*ctx
, int type
)
2774 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
= type
;
2775 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
= ctx
->bc
->cf_last
;
2778 static void fc_poplevel(struct r600_shader_ctx
*ctx
)
2780 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
];
2792 static int emit_return(struct r600_shader_ctx
*ctx
)
2794 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_RETURN
);
2798 static int emit_jump_to_offset(struct r600_shader_ctx
*ctx
, int pops
, int offset
)
2801 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_JUMP
);
2802 ctx
->bc
->cf_last
->pop_count
= pops
;
2803 /* TODO work out offset */
2807 static int emit_setret_in_loop_flag(struct r600_shader_ctx
*ctx
, unsigned flag_value
)
2812 static void emit_testflag(struct r600_shader_ctx
*ctx
)
2817 static void emit_return_on_flag(struct r600_shader_ctx
*ctx
, unsigned ifidx
)
2820 emit_jump_to_offset(ctx
, 1, 4);
2821 emit_setret_in_loop_flag(ctx
, V_SQ_ALU_SRC_0
);
2822 pops(ctx
, ifidx
+ 1);
2826 static void break_loop_on_flag(struct r600_shader_ctx
*ctx
, unsigned fc_sp
)
2830 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2831 ctx
->bc
->cf_last
->pop_count
= 1;
2833 fc_set_mid(ctx
, fc_sp
);
2839 static int tgsi_if(struct r600_shader_ctx
*ctx
)
2841 emit_logic_pred(ctx
, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE
));
2843 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
2845 fc_pushlevel(ctx
, FC_IF
);
2847 callstack_check_depth(ctx
, FC_PUSH_VPM
, 0);
2851 static int tgsi_else(struct r600_shader_ctx
*ctx
)
2853 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE
));
2854 ctx
->bc
->cf_last
->pop_count
= 1;
2856 fc_set_mid(ctx
, ctx
->bc
->fc_sp
);
2857 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
;
2861 static int tgsi_endif(struct r600_shader_ctx
*ctx
)
2864 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_IF
) {
2865 R600_ERR("if/endif unbalanced in shader\n");
2869 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
== NULL
) {
2870 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2871 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->pop_count
= 1;
2873 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[0]->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2877 callstack_decrease_current(ctx
, FC_PUSH_VPM
);
2881 static int tgsi_bgnloop(struct r600_shader_ctx
*ctx
)
2883 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL
));
2885 fc_pushlevel(ctx
, FC_LOOP
);
2887 /* check stack depth */
2888 callstack_check_depth(ctx
, FC_LOOP
, 0);
2892 static int tgsi_endloop(struct r600_shader_ctx
*ctx
)
2896 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END
));
2898 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_LOOP
) {
2899 R600_ERR("loop/endloop in shader code are not paired.\n");
2903 /* fixup loop pointers - from r600isa
2904 LOOP END points to CF after LOOP START,
2905 LOOP START point to CF after LOOP END
2906 BRK/CONT point to LOOP END CF
2908 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->id
+ 2;
2910 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2912 for (i
= 0; i
< ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].num_mid
; i
++) {
2913 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[i
]->cf_addr
= ctx
->bc
->cf_last
->id
;
2915 /* TODO add LOOPRET support */
2917 callstack_decrease_current(ctx
, FC_LOOP
);
2921 static int tgsi_loop_brk_cont(struct r600_shader_ctx
*ctx
)
2925 for (fscp
= ctx
->bc
->fc_sp
; fscp
> 0; fscp
--)
2927 if (FC_LOOP
== ctx
->bc
->fc_stack
[fscp
].type
)
2932 R600_ERR("Break not inside loop/endloop pair\n");
2936 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2937 ctx
->bc
->cf_last
->pop_count
= 1;
2939 fc_set_mid(ctx
, fscp
);
2942 callstack_check_depth(ctx
, FC_PUSH_VPM
, 1);
2946 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
2947 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2948 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2949 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
2952 * For state trackers other than OpenGL, we'll want to use
2953 * _RECIP_IEEE instead.
2955 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED
, tgsi_trans_srcx_replicate
},
2957 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_rsq
},
2958 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
2959 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
2960 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
2961 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2962 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2963 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2964 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
2965 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
2966 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
2967 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
2968 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
2969 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
2970 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2971 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
2972 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2974 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2975 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2977 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2978 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2979 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
2980 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2981 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
2982 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2983 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
2984 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
2985 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
2986 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
2988 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2989 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2990 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2991 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2992 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
2993 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
2994 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
2995 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
2996 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2997 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2998 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2999 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3000 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3001 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
3002 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3003 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
3004 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
3005 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
3006 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
3007 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3008 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3009 {TGSI_OPCODE_TXD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3010 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3011 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3012 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3013 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3014 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3015 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3016 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3017 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
3018 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3019 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3020 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3021 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
3022 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
3023 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
3024 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3025 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3026 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3027 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3028 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3029 {TGSI_OPCODE_BRK
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
3030 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
3032 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3033 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3034 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
3035 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
3037 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3038 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3039 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3040 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3041 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3042 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3043 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3044 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
3045 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3047 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3048 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3049 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3050 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3051 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3052 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3053 {TGSI_OPCODE_TXF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3054 {TGSI_OPCODE_TXQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3055 {TGSI_OPCODE_CONT
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
3056 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3057 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3058 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
3059 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3060 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
3061 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3063 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3064 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3065 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3066 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3067 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3069 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3070 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3071 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3072 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3073 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3074 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3075 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3076 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3077 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
3078 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
3080 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3081 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3082 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3083 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3084 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3085 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3086 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3087 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3088 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3089 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3090 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3091 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3092 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3093 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3094 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3095 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3096 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3097 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3098 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3099 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3100 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3101 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3102 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3103 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3104 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3105 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3106 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3107 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3110 static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction
[] = {
3111 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
3112 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3113 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
3114 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
3115 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_trans_srcx_replicate
},
3116 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
3117 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3118 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
3119 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3120 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3121 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3122 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
3123 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
3124 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
3125 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
3126 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
3127 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
3128 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3129 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
3130 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3132 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3133 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3135 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3136 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3137 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
3138 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3139 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
3140 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3141 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
3142 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
3143 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
3144 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
3146 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3147 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3148 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3149 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3150 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
3151 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
3152 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
3153 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
3154 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3155 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3156 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3157 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3158 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3159 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
3160 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3161 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
3162 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
3163 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
3164 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
3165 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3166 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3167 {TGSI_OPCODE_TXD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3168 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3169 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3170 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3171 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3172 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3173 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3174 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3175 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
3176 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3177 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3178 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3179 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
3180 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
3181 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
3182 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3183 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3184 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3185 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3186 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3187 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
3188 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
3190 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3191 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3192 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
3193 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
3195 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3196 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3197 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3198 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3199 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3200 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3201 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3202 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
3203 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3205 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3206 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3207 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3208 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3209 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3210 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3211 {TGSI_OPCODE_TXF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3212 {TGSI_OPCODE_TXQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3213 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
3214 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3215 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3216 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
3217 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3218 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
3219 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3221 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3222 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3223 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3224 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3225 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3227 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3228 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3229 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3230 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3231 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3232 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3233 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3234 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3235 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
3236 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
3238 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3239 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3240 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3241 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3242 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3243 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3244 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3245 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3246 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3247 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3248 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3249 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3250 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3251 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3252 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3253 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3254 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3255 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3256 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3257 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3258 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3259 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3260 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3261 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3262 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3263 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3264 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3265 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},