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
, u32
**literals
);
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
;
235 //fprintf(stderr, "--------------------------------------------------------------\n");
236 //tgsi_dump(tokens, 0);
237 shader
->shader
.family
= r600_get_family(rctx
->radeon
);
238 r
= r600_shader_from_tgsi(tokens
, &shader
->shader
, &literals
);
240 R600_ERR("translation from TGSI failed !\n");
243 r
= r600_bc_build(&shader
->shader
.bc
);
246 R600_ERR("building bytecode failed !\n");
249 //r600_bc_dump(&shader->shader.bc);
250 //fprintf(stderr, "______________________________________________________________\n");
251 return r600_pipe_shader(ctx
, shader
);
254 void r600_pipe_shader_destroy(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
256 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
258 r600_bo_reference(rctx
->radeon
, &shader
->bo
, NULL
);
259 r600_bc_clear(&shader
->shader
.bc
);
263 * tgsi -> r600 shader
265 struct r600_shader_tgsi_instruction
;
267 struct r600_shader_ctx
{
268 struct tgsi_shader_info info
;
269 struct tgsi_parse_context parse
;
270 const struct tgsi_token
*tokens
;
272 unsigned file_offset
[TGSI_FILE_COUNT
];
274 struct r600_shader_tgsi_instruction
*inst_info
;
276 struct r600_shader
*shader
;
279 u32 max_driver_temp_used
;
280 /* needed for evergreen interpolation */
281 boolean input_centroid
;
282 boolean input_linear
;
283 boolean input_perspective
;
287 struct r600_shader_tgsi_instruction
{
288 unsigned tgsi_opcode
;
290 unsigned r600_opcode
;
291 int (*process
)(struct r600_shader_ctx
*ctx
);
294 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[], eg_shader_tgsi_instruction
[];
295 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
);
297 static int tgsi_is_supported(struct r600_shader_ctx
*ctx
)
299 struct tgsi_full_instruction
*i
= &ctx
->parse
.FullToken
.FullInstruction
;
302 if (i
->Instruction
.NumDstRegs
> 1) {
303 R600_ERR("too many dst (%d)\n", i
->Instruction
.NumDstRegs
);
306 if (i
->Instruction
.Predicate
) {
307 R600_ERR("predicate unsupported\n");
311 if (i
->Instruction
.Label
) {
312 R600_ERR("label unsupported\n");
316 for (j
= 0; j
< i
->Instruction
.NumSrcRegs
; j
++) {
317 if (i
->Src
[j
].Register
.Dimension
) {
318 R600_ERR("unsupported src %d (dimension %d)\n", j
,
319 i
->Src
[j
].Register
.Dimension
);
323 for (j
= 0; j
< i
->Instruction
.NumDstRegs
; j
++) {
324 if (i
->Dst
[j
].Register
.Dimension
) {
325 R600_ERR("unsupported dst (dimension)\n");
332 static int evergreen_interp_alu(struct r600_shader_ctx
*ctx
, int input
)
335 struct r600_bc_alu alu
;
336 int gpr
= 0, base_chan
= 0;
339 if (ctx
->shader
->input
[input
].interpolate
== TGSI_INTERPOLATE_PERSPECTIVE
) {
341 if (ctx
->shader
->input
[input
].centroid
)
343 } else if (ctx
->shader
->input
[input
].interpolate
== TGSI_INTERPOLATE_LINEAR
) {
345 /* if we have perspective add one */
346 if (ctx
->input_perspective
) {
348 /* if we have perspective centroid */
349 if (ctx
->input_centroid
)
352 if (ctx
->shader
->input
[input
].centroid
)
356 /* work out gpr and base_chan from index */
358 base_chan
= (2 * (ij_index
% 2)) + 1;
360 for (i
= 0; i
< 8; i
++) {
361 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
364 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW
;
366 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY
;
368 if ((i
> 1) && (i
< 6)) {
369 alu
.dst
.sel
= ctx
->shader
->input
[input
].gpr
;
373 alu
.dst
.chan
= i
% 4;
375 alu
.src
[0].sel
= gpr
;
376 alu
.src
[0].chan
= (base_chan
- (i
% 2));
378 alu
.src
[1].sel
= V_SQ_ALU_SRC_PARAM_BASE
+ ctx
->shader
->input
[input
].lds_pos
;
380 alu
.bank_swizzle_force
= SQ_ALU_VEC_210
;
383 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
391 static int tgsi_declaration(struct r600_shader_ctx
*ctx
)
393 struct tgsi_full_declaration
*d
= &ctx
->parse
.FullToken
.FullDeclaration
;
396 switch (d
->Declaration
.File
) {
397 case TGSI_FILE_INPUT
:
398 i
= ctx
->shader
->ninput
++;
399 ctx
->shader
->input
[i
].name
= d
->Semantic
.Name
;
400 ctx
->shader
->input
[i
].sid
= d
->Semantic
.Index
;
401 ctx
->shader
->input
[i
].interpolate
= d
->Declaration
.Interpolate
;
402 ctx
->shader
->input
[i
].centroid
= d
->Declaration
.Centroid
;
403 ctx
->shader
->input
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_INPUT
] + i
;
404 if (ctx
->type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
->bc
->chiprev
== CHIPREV_EVERGREEN
) {
405 /* turn input into interpolate on EG */
406 if (ctx
->shader
->input
[i
].name
!= TGSI_SEMANTIC_POSITION
) {
407 if (ctx
->shader
->input
[i
].interpolate
> 0) {
408 ctx
->shader
->input
[i
].lds_pos
= ctx
->shader
->nlds
++;
409 evergreen_interp_alu(ctx
, i
);
414 case TGSI_FILE_OUTPUT
:
415 i
= ctx
->shader
->noutput
++;
416 ctx
->shader
->output
[i
].name
= d
->Semantic
.Name
;
417 ctx
->shader
->output
[i
].sid
= d
->Semantic
.Index
;
418 ctx
->shader
->output
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_OUTPUT
] + i
;
419 ctx
->shader
->output
[i
].interpolate
= d
->Declaration
.Interpolate
;
421 case TGSI_FILE_CONSTANT
:
422 case TGSI_FILE_TEMPORARY
:
423 case TGSI_FILE_SAMPLER
:
424 case TGSI_FILE_ADDRESS
:
427 R600_ERR("unsupported file %d declaration\n", d
->Declaration
.File
);
433 static int r600_get_temp(struct r600_shader_ctx
*ctx
)
435 return ctx
->temp_reg
+ ctx
->max_driver_temp_used
++;
439 * for evergreen we need to scan the shader to find the number of GPRs we need to
440 * reserve for interpolation.
442 * we need to know if we are going to emit
443 * any centroid inputs
444 * if perspective and linear are required
446 static int evergreen_gpr_count(struct r600_shader_ctx
*ctx
)
451 ctx
->input_linear
= FALSE
;
452 ctx
->input_perspective
= FALSE
;
453 ctx
->input_centroid
= FALSE
;
454 ctx
->num_interp_gpr
= 1;
456 /* any centroid inputs */
457 for (i
= 0; i
< ctx
->info
.num_inputs
; i
++) {
458 /* skip position/face */
459 if (ctx
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_POSITION
||
460 ctx
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_FACE
)
462 if (ctx
->info
.input_interpolate
[i
] == TGSI_INTERPOLATE_LINEAR
)
463 ctx
->input_linear
= TRUE
;
464 if (ctx
->info
.input_interpolate
[i
] == TGSI_INTERPOLATE_PERSPECTIVE
)
465 ctx
->input_perspective
= TRUE
;
466 if (ctx
->info
.input_centroid
[i
])
467 ctx
->input_centroid
= TRUE
;
471 /* ignoring sample for now */
472 if (ctx
->input_perspective
)
474 if (ctx
->input_linear
)
476 if (ctx
->input_centroid
)
479 ctx
->num_interp_gpr
+= (num_baryc
+ 1) >> 1;
481 /* TODO PULL MODEL and LINE STIPPLE, FIXED PT POS */
482 return ctx
->num_interp_gpr
;
485 int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
, u32
**literals
)
487 struct tgsi_full_immediate
*immediate
;
488 struct r600_shader_ctx ctx
;
489 struct r600_bc_output output
[32];
494 ctx
.bc
= &shader
->bc
;
496 r
= r600_bc_init(ctx
.bc
, shader
->family
);
500 tgsi_scan_shader(tokens
, &ctx
.info
);
501 tgsi_parse_init(&ctx
.parse
, tokens
);
502 ctx
.type
= ctx
.parse
.FullHeader
.Processor
.Processor
;
503 shader
->processor_type
= ctx
.type
;
504 ctx
.bc
->type
= shader
->processor_type
;
506 /* register allocations */
507 /* Values [0,127] correspond to GPR[0..127].
508 * Values [128,159] correspond to constant buffer bank 0
509 * Values [160,191] correspond to constant buffer bank 1
510 * Values [256,511] correspond to cfile constants c[0..255]. (Gone on EG)
511 * Values [256,287] correspond to constant buffer bank 2 (EG)
512 * Values [288,319] correspond to constant buffer bank 3 (EG)
513 * Other special values are shown in the list below.
514 * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
515 * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
516 * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
517 * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
518 * 248 SQ_ALU_SRC_0: special constant 0.0.
519 * 249 SQ_ALU_SRC_1: special constant 1.0 float.
520 * 250 SQ_ALU_SRC_1_INT: special constant 1 integer.
521 * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer.
522 * 252 SQ_ALU_SRC_0_5: special constant 0.5 float.
523 * 253 SQ_ALU_SRC_LITERAL: literal constant.
524 * 254 SQ_ALU_SRC_PV: previous vector result.
525 * 255 SQ_ALU_SRC_PS: previous scalar result.
527 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
528 ctx
.file_offset
[i
] = 0;
530 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
531 ctx
.file_offset
[TGSI_FILE_INPUT
] = 1;
532 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
) {
533 r600_bc_add_cfinst(ctx
.bc
, EG_V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
535 r600_bc_add_cfinst(ctx
.bc
, V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
538 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
) {
539 ctx
.file_offset
[TGSI_FILE_INPUT
] = evergreen_gpr_count(&ctx
);
541 ctx
.file_offset
[TGSI_FILE_OUTPUT
] = ctx
.file_offset
[TGSI_FILE_INPUT
] +
542 ctx
.info
.file_count
[TGSI_FILE_INPUT
];
543 ctx
.file_offset
[TGSI_FILE_TEMPORARY
] = ctx
.file_offset
[TGSI_FILE_OUTPUT
] +
544 ctx
.info
.file_count
[TGSI_FILE_OUTPUT
];
546 /* Outside the GPR range. This will be translated to one of the
547 * kcache banks later. */
548 ctx
.file_offset
[TGSI_FILE_CONSTANT
] = 512;
550 ctx
.file_offset
[TGSI_FILE_IMMEDIATE
] = V_SQ_ALU_SRC_LITERAL
;
551 ctx
.temp_reg
= ctx
.file_offset
[TGSI_FILE_TEMPORARY
] +
552 ctx
.info
.file_count
[TGSI_FILE_TEMPORARY
];
557 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
558 tgsi_parse_token(&ctx
.parse
);
559 switch (ctx
.parse
.FullToken
.Token
.Type
) {
560 case TGSI_TOKEN_TYPE_IMMEDIATE
:
561 immediate
= &ctx
.parse
.FullToken
.FullImmediate
;
562 ctx
.literals
= realloc(ctx
.literals
, (ctx
.nliterals
+ 1) * 16);
563 if(ctx
.literals
== NULL
) {
567 ctx
.literals
[ctx
.nliterals
* 4 + 0] = immediate
->u
[0].Uint
;
568 ctx
.literals
[ctx
.nliterals
* 4 + 1] = immediate
->u
[1].Uint
;
569 ctx
.literals
[ctx
.nliterals
* 4 + 2] = immediate
->u
[2].Uint
;
570 ctx
.literals
[ctx
.nliterals
* 4 + 3] = immediate
->u
[3].Uint
;
573 case TGSI_TOKEN_TYPE_DECLARATION
:
574 r
= tgsi_declaration(&ctx
);
578 case TGSI_TOKEN_TYPE_INSTRUCTION
:
579 r
= tgsi_is_supported(&ctx
);
582 ctx
.max_driver_temp_used
= 0;
583 /* reserve first tmp for everyone */
585 opcode
= ctx
.parse
.FullToken
.FullInstruction
.Instruction
.Opcode
;
586 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
)
587 ctx
.inst_info
= &eg_shader_tgsi_instruction
[opcode
];
589 ctx
.inst_info
= &r600_shader_tgsi_instruction
[opcode
];
590 r
= ctx
.inst_info
->process(&ctx
);
594 case TGSI_TOKEN_TYPE_PROPERTY
:
597 R600_ERR("unsupported token type %d\n", ctx
.parse
.FullToken
.Token
.Type
);
603 noutput
= shader
->noutput
;
604 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
605 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
606 output
[i
].gpr
= shader
->output
[i
].gpr
;
607 output
[i
].elem_size
= 3;
608 output
[i
].swizzle_x
= 0;
609 output
[i
].swizzle_y
= 1;
610 output
[i
].swizzle_z
= 2;
611 output
[i
].swizzle_w
= 3;
612 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
613 output
[i
].array_base
= i
- pos0
;
615 case TGSI_PROCESSOR_VERTEX
:
616 if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
617 output
[i
].array_base
= 60;
618 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
619 /* position doesn't count in array_base */
622 if (shader
->output
[i
].name
== TGSI_SEMANTIC_PSIZE
) {
623 output
[i
].array_base
= 61;
624 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
625 /* position doesn't count in array_base */
629 case TGSI_PROCESSOR_FRAGMENT
:
630 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
631 output
[i
].array_base
= shader
->output
[i
].sid
;
632 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
633 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
634 output
[i
].array_base
= 61;
635 output
[i
].swizzle_x
= 2;
636 output
[i
].swizzle_y
= 7;
637 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
638 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
639 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
) {
640 output
[i
].array_base
= 61;
641 output
[i
].swizzle_x
= 7;
642 output
[i
].swizzle_y
= 1;
643 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
644 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
646 R600_ERR("unsupported fragment output name %d\n", shader
->output
[i
].name
);
652 R600_ERR("unsupported processor type %d\n", ctx
.type
);
657 /* add fake param output for vertex shader if no param is exported */
658 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
659 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
660 if (output
[i
].type
== V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
) {
666 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
668 output
[i
].elem_size
= 3;
669 output
[i
].swizzle_x
= 0;
670 output
[i
].swizzle_y
= 1;
671 output
[i
].swizzle_z
= 2;
672 output
[i
].swizzle_w
= 3;
673 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
674 output
[i
].array_base
= 0;
678 /* add fake pixel export */
679 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& !noutput
) {
680 memset(&output
[0], 0, sizeof(struct r600_bc_output
));
682 output
[0].elem_size
= 3;
683 output
[0].swizzle_x
= 7;
684 output
[0].swizzle_y
= 7;
685 output
[0].swizzle_z
= 7;
686 output
[0].swizzle_w
= 7;
687 output
[0].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
688 output
[0].array_base
= 0;
691 /* add output to bytecode */
692 for (i
= 0; i
< noutput
; i
++) {
693 r
= r600_bc_add_output(ctx
.bc
, &output
[i
]);
697 *literals
= ctx
.literals
;
698 tgsi_parse_free(&ctx
.parse
);
702 tgsi_parse_free(&ctx
.parse
);
706 static int tgsi_unsupported(struct r600_shader_ctx
*ctx
)
708 R600_ERR("%d tgsi opcode unsupported\n", ctx
->inst_info
->tgsi_opcode
);
712 static int tgsi_end(struct r600_shader_ctx
*ctx
)
717 static int tgsi_src(struct r600_shader_ctx
*ctx
,
718 const struct tgsi_full_src_register
*tgsi_src
,
719 struct r600_bc_alu_src
*r600_src
)
721 memset(r600_src
, 0, sizeof(struct r600_bc_alu_src
));
722 r600_src
->neg
= tgsi_src
->Register
.Negate
;
723 r600_src
->abs
= tgsi_src
->Register
.Absolute
;
724 if (tgsi_src
->Register
.File
== TGSI_FILE_IMMEDIATE
) {
726 if((tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleY
) &&
727 (tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleZ
) &&
728 (tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleW
)) {
730 index
= tgsi_src
->Register
.Index
* 4 + tgsi_src
->Register
.SwizzleX
;
731 r600_bc_special_constants(ctx
->literals
[index
], &r600_src
->sel
, &r600_src
->neg
);
732 if (r600_src
->sel
!= V_SQ_ALU_SRC_LITERAL
)
735 index
= tgsi_src
->Register
.Index
;
736 r600_src
->sel
= V_SQ_ALU_SRC_LITERAL
;
737 r600_src
->value
= ctx
->literals
+ index
* 4;
739 if (tgsi_src
->Register
.Indirect
)
740 r600_src
->rel
= V_SQ_REL_RELATIVE
;
741 r600_src
->sel
= tgsi_src
->Register
.Index
;
742 r600_src
->sel
+= ctx
->file_offset
[tgsi_src
->Register
.File
];
747 static int tgsi_dst(struct r600_shader_ctx
*ctx
,
748 const struct tgsi_full_dst_register
*tgsi_dst
,
750 struct r600_bc_alu_dst
*r600_dst
)
752 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
754 r600_dst
->sel
= tgsi_dst
->Register
.Index
;
755 r600_dst
->sel
+= ctx
->file_offset
[tgsi_dst
->Register
.File
];
756 r600_dst
->chan
= swizzle
;
758 if (tgsi_dst
->Register
.Indirect
)
759 r600_dst
->rel
= V_SQ_REL_RELATIVE
;
760 if (inst
->Instruction
.Saturate
) {
766 static unsigned tgsi_chan(const struct tgsi_full_src_register
*tgsi_src
, unsigned swizzle
)
770 return tgsi_src
->Register
.SwizzleX
;
772 return tgsi_src
->Register
.SwizzleY
;
774 return tgsi_src
->Register
.SwizzleZ
;
776 return tgsi_src
->Register
.SwizzleW
;
782 static int tgsi_split_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
784 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
785 struct r600_bc_alu alu
;
786 int i
, j
, k
, nconst
, r
;
788 for (i
= 0, nconst
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
789 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
792 r
= tgsi_src(ctx
, &inst
->Src
[i
], &r600_src
[i
]);
797 for (i
= 0, j
= nconst
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
798 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
799 int treg
= r600_get_temp(ctx
);
800 for (k
= 0; k
< 4; k
++) {
801 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
802 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
803 alu
.src
[0].sel
= r600_src
[i
].sel
;
805 alu
.src
[0].rel
= r600_src
[i
].rel
;
811 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
815 r600_src
[i
].sel
= treg
;
823 /* need to move any immediate into a temp - for trig functions which use literal for PI stuff */
824 static int tgsi_split_literal_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
826 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
827 struct r600_bc_alu alu
;
828 int i
, j
, k
, nliteral
, r
;
830 for (i
= 0, nliteral
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
831 if (r600_src
[i
].sel
== V_SQ_ALU_SRC_LITERAL
) {
835 for (i
= 0, j
= nliteral
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
836 if (j
> 0 && r600_src
[i
].sel
== V_SQ_ALU_SRC_LITERAL
) {
837 int treg
= r600_get_temp(ctx
);
838 for (k
= 0; k
< 4; k
++) {
839 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
840 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
841 alu
.src
[0].sel
= r600_src
[i
].sel
;
843 alu
.src
[0].value
= r600_src
[i
].value
;
849 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
853 r600_src
[i
].sel
= treg
;
860 static int tgsi_last_instruction(unsigned writemask
)
864 for (i
= 0; i
< 4; i
++) {
865 if (writemask
& (1 << i
)) {
872 static int tgsi_op2_s(struct r600_shader_ctx
*ctx
, int swap
)
874 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
875 struct r600_bc_alu_src r600_src
[3];
876 struct r600_bc_alu alu
;
878 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
880 r
= tgsi_split_constant(ctx
, r600_src
);
883 r
= tgsi_split_literal_constant(ctx
, r600_src
);
886 for (i
= 0; i
< lasti
+ 1; i
++) {
887 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
890 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
891 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
895 alu
.inst
= ctx
->inst_info
->r600_opcode
;
897 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
898 alu
.src
[j
] = r600_src
[j
];
899 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
902 alu
.src
[0] = r600_src
[1];
903 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], i
);
905 alu
.src
[1] = r600_src
[0];
906 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
908 /* handle some special cases */
909 switch (ctx
->inst_info
->tgsi_opcode
) {
910 case TGSI_OPCODE_SUB
:
913 case TGSI_OPCODE_ABS
:
922 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
929 static int tgsi_op2(struct r600_shader_ctx
*ctx
)
931 return tgsi_op2_s(ctx
, 0);
934 static int tgsi_op2_swap(struct r600_shader_ctx
*ctx
)
936 return tgsi_op2_s(ctx
, 1);
940 * r600 - trunc to -PI..PI range
941 * r700 - normalize by dividing by 2PI
944 static int tgsi_setup_trig(struct r600_shader_ctx
*ctx
,
945 struct r600_bc_alu_src r600_src
[3])
947 static float half_inv_pi
= 1.0 /(3.1415926535 * 2);
948 static float double_pi
= 3.1415926535 * 2;
949 static float neg_pi
= -3.1415926535;
951 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
953 struct r600_bc_alu alu
;
955 r
= tgsi_split_constant(ctx
, r600_src
);
958 r
= tgsi_split_literal_constant(ctx
, r600_src
);
962 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
963 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
967 alu
.dst
.sel
= ctx
->temp_reg
;
970 alu
.src
[0] = r600_src
[0];
971 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
973 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
975 alu
.src
[1].value
= (uint32_t *)&half_inv_pi
;
976 alu
.src
[2].sel
= V_SQ_ALU_SRC_0_5
;
979 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
983 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
984 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
987 alu
.dst
.sel
= ctx
->temp_reg
;
990 alu
.src
[0].sel
= ctx
->temp_reg
;
993 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
997 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
998 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1002 alu
.dst
.sel
= ctx
->temp_reg
;
1005 alu
.src
[0].sel
= ctx
->temp_reg
;
1006 alu
.src
[0].chan
= 0;
1008 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
1009 alu
.src
[1].chan
= 0;
1010 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1011 alu
.src
[2].chan
= 1;
1013 if (ctx
->bc
->chiprev
== CHIPREV_R600
) {
1014 alu
.src
[1].value
= (uint32_t *)&double_pi
;
1015 alu
.src
[2].value
= (uint32_t *)&neg_pi
;
1017 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1018 alu
.src
[2].sel
= V_SQ_ALU_SRC_0_5
;
1023 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1029 static int tgsi_trig(struct r600_shader_ctx
*ctx
)
1031 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1032 struct r600_bc_alu_src r600_src
[3];
1033 struct r600_bc_alu alu
;
1035 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1037 r
= tgsi_setup_trig(ctx
, r600_src
);
1041 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1042 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1044 alu
.dst
.sel
= ctx
->temp_reg
;
1047 alu
.src
[0].sel
= ctx
->temp_reg
;
1048 alu
.src
[0].chan
= 0;
1050 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1054 /* replicate result */
1055 for (i
= 0; i
< lasti
+ 1; i
++) {
1056 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1059 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1060 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1062 alu
.src
[0].sel
= ctx
->temp_reg
;
1063 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1068 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1075 static int tgsi_scs(struct r600_shader_ctx
*ctx
)
1077 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1078 struct r600_bc_alu_src r600_src
[3];
1079 struct r600_bc_alu alu
;
1082 /* We'll only need the trig stuff if we are going to write to the
1083 * X or Y components of the destination vector.
1085 if (likely(inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_XY
)) {
1086 r
= tgsi_setup_trig(ctx
, r600_src
);
1092 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_X
) {
1093 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1094 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
);
1095 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1099 alu
.src
[0].sel
= ctx
->temp_reg
;
1100 alu
.src
[0].chan
= 0;
1102 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1108 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Y
) {
1109 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1110 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
);
1111 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1115 alu
.src
[0].sel
= ctx
->temp_reg
;
1116 alu
.src
[0].chan
= 0;
1118 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1124 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Z
) {
1125 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1127 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1129 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1133 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1134 alu
.src
[0].chan
= 0;
1138 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1144 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_W
) {
1145 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1147 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1149 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1153 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1154 alu
.src
[0].chan
= 0;
1158 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1166 static int tgsi_kill(struct r600_shader_ctx
*ctx
)
1168 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1169 struct r600_bc_alu alu
;
1172 for (i
= 0; i
< 4; i
++) {
1173 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1174 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1178 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1180 if (ctx
->inst_info
->tgsi_opcode
== TGSI_OPCODE_KILP
) {
1181 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1184 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1187 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1192 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1197 /* kill must be last in ALU */
1198 ctx
->bc
->force_add_cf
= 1;
1199 ctx
->shader
->uses_kill
= TRUE
;
1203 static int tgsi_lit(struct r600_shader_ctx
*ctx
)
1205 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1206 struct r600_bc_alu alu
;
1207 struct r600_bc_alu_src r600_src
[3];
1210 r
= tgsi_split_constant(ctx
, r600_src
);
1213 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1218 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1219 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1220 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
; /*1.0*/
1221 alu
.src
[0].chan
= 0;
1222 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1225 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 0) & 1;
1226 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1230 /* dst.y = max(src.x, 0.0) */
1231 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1232 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
);
1233 alu
.src
[0] = r600_src
[0];
1234 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
1235 alu
.src
[1].chan
= 0;
1236 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1239 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 1) & 1;
1240 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1245 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1246 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1247 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1248 alu
.src
[0].chan
= 0;
1249 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1252 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 3) & 1;
1254 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1258 if (inst
->Dst
[0].Register
.WriteMask
& (1 << 2))
1263 /* dst.z = log(src.y) */
1264 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1265 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
);
1266 alu
.src
[0] = r600_src
[0];
1267 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
1268 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1272 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1276 chan
= alu
.dst
.chan
;
1279 /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
1280 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1281 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT
);
1282 alu
.src
[0] = r600_src
[0];
1283 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1284 alu
.src
[1].sel
= sel
;
1285 alu
.src
[1].chan
= chan
;
1287 alu
.src
[2] = r600_src
[0];
1288 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], 0);
1289 alu
.dst
.sel
= ctx
->temp_reg
;
1294 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1298 /* dst.z = exp(tmp.x) */
1299 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1300 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1301 alu
.src
[0].sel
= ctx
->temp_reg
;
1302 alu
.src
[0].chan
= 0;
1303 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1307 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1314 static int tgsi_rsq(struct r600_shader_ctx
*ctx
)
1316 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1317 struct r600_bc_alu alu
;
1320 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1323 * For state trackers other than OpenGL, we'll want to use
1324 * _RECIPSQRT_IEEE instead.
1326 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED
);
1328 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1329 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1332 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1335 alu
.dst
.sel
= ctx
->temp_reg
;
1338 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1341 /* replicate result */
1342 return tgsi_helper_tempx_replicate(ctx
);
1345 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
)
1347 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1348 struct r600_bc_alu alu
;
1351 for (i
= 0; i
< 4; i
++) {
1352 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1353 alu
.src
[0].sel
= ctx
->temp_reg
;
1354 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1356 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1359 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1362 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1369 static int tgsi_trans_srcx_replicate(struct r600_shader_ctx
*ctx
)
1371 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1372 struct r600_bc_alu alu
;
1375 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1376 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1377 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1378 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1381 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1383 alu
.dst
.sel
= ctx
->temp_reg
;
1386 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1389 /* replicate result */
1390 return tgsi_helper_tempx_replicate(ctx
);
1393 static int tgsi_pow(struct r600_shader_ctx
*ctx
)
1395 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1396 struct r600_bc_alu alu
;
1400 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1401 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
1402 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1405 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
1406 alu
.dst
.sel
= ctx
->temp_reg
;
1409 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1413 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1414 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1415 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[0]);
1418 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], 0);
1419 alu
.src
[1].sel
= ctx
->temp_reg
;
1420 alu
.dst
.sel
= ctx
->temp_reg
;
1423 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1426 /* POW(a,b) = EXP2(b * LOG2(a))*/
1427 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1428 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1429 alu
.src
[0].sel
= ctx
->temp_reg
;
1430 alu
.dst
.sel
= ctx
->temp_reg
;
1433 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1436 return tgsi_helper_tempx_replicate(ctx
);
1439 static int tgsi_ssg(struct r600_shader_ctx
*ctx
)
1441 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1442 struct r600_bc_alu alu
;
1443 struct r600_bc_alu_src r600_src
[3];
1446 r
= tgsi_split_constant(ctx
, r600_src
);
1449 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1453 /* tmp = (src > 0 ? 1 : src) */
1454 for (i
= 0; i
< 4; i
++) {
1455 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1456 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1459 alu
.dst
.sel
= ctx
->temp_reg
;
1462 alu
.src
[0] = r600_src
[0];
1463 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1465 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1467 alu
.src
[2] = r600_src
[0];
1468 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], i
);
1471 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1476 /* dst = (-tmp > 0 ? -1 : tmp) */
1477 for (i
= 0; i
< 4; i
++) {
1478 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1479 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1481 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1485 alu
.src
[0].sel
= ctx
->temp_reg
;
1486 alu
.src
[0].chan
= i
;
1489 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1492 alu
.src
[2].sel
= ctx
->temp_reg
;
1493 alu
.src
[2].chan
= i
;
1497 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1504 static int tgsi_helper_copy(struct r600_shader_ctx
*ctx
, struct tgsi_full_instruction
*inst
)
1506 struct r600_bc_alu alu
;
1509 for (i
= 0; i
< 4; i
++) {
1510 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1511 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
1512 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
);
1515 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1516 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1519 alu
.src
[0].sel
= ctx
->temp_reg
;
1520 alu
.src
[0].chan
= i
;
1525 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1532 static int tgsi_op3(struct r600_shader_ctx
*ctx
)
1534 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1535 struct r600_bc_alu_src r600_src
[3];
1536 struct r600_bc_alu alu
;
1538 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1540 r
= tgsi_split_constant(ctx
, r600_src
);
1543 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1546 for (i
= 0; i
< lasti
+ 1; i
++) {
1547 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1550 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1551 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1552 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1553 alu
.src
[j
] = r600_src
[j
];
1554 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1557 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1567 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1574 static int tgsi_dp(struct r600_shader_ctx
*ctx
)
1576 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1577 struct r600_bc_alu_src r600_src
[3];
1578 struct r600_bc_alu alu
;
1581 r
= tgsi_split_constant(ctx
, r600_src
);
1584 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1587 for (i
= 0; i
< 4; i
++) {
1588 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1589 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1590 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1591 alu
.src
[j
] = r600_src
[j
];
1592 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1595 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1600 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1601 /* handle some special cases */
1602 switch (ctx
->inst_info
->tgsi_opcode
) {
1603 case TGSI_OPCODE_DP2
:
1605 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1606 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1609 case TGSI_OPCODE_DP3
:
1611 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1612 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1615 case TGSI_OPCODE_DPH
:
1617 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1618 alu
.src
[0].chan
= 0;
1628 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1635 static int tgsi_tex(struct r600_shader_ctx
*ctx
)
1637 static float one_point_five
= 1.5f
;
1638 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1639 struct r600_bc_tex tex
;
1640 struct r600_bc_alu alu
;
1644 boolean src_not_temp
=
1645 inst
->Src
[0].Register
.File
!= TGSI_FILE_TEMPORARY
&&
1646 inst
->Src
[0].Register
.File
!= TGSI_FILE_INPUT
;
1648 src_gpr
= ctx
->file_offset
[inst
->Src
[0].Register
.File
] + inst
->Src
[0].Register
.Index
;
1650 if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXP
) {
1651 /* Add perspective divide */
1652 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1653 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1654 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1658 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1659 alu
.dst
.sel
= ctx
->temp_reg
;
1663 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1667 for (i
= 0; i
< 3; i
++) {
1668 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1669 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1670 alu
.src
[0].sel
= ctx
->temp_reg
;
1671 alu
.src
[0].chan
= 3;
1672 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1675 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1676 alu
.dst
.sel
= ctx
->temp_reg
;
1679 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1683 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1684 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1685 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1686 alu
.src
[0].chan
= 0;
1687 alu
.dst
.sel
= ctx
->temp_reg
;
1691 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1694 src_not_temp
= FALSE
;
1695 src_gpr
= ctx
->temp_reg
;
1698 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1699 int src_chan
, src2_chan
;
1701 /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
1702 for (i
= 0; i
< 4; i
++) {
1703 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1704 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE
);
1728 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1731 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], src_chan
);
1732 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1735 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], src2_chan
);
1736 alu
.dst
.sel
= ctx
->temp_reg
;
1741 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1746 /* tmp1.z = RCP_e(|tmp1.z|) */
1747 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1748 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1749 alu
.src
[0].sel
= ctx
->temp_reg
;
1750 alu
.src
[0].chan
= 2;
1752 alu
.dst
.sel
= ctx
->temp_reg
;
1756 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1760 /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x
1761 * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x
1762 * muladd has no writemask, have to use another temp
1764 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1765 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1768 alu
.src
[0].sel
= ctx
->temp_reg
;
1769 alu
.src
[0].chan
= 0;
1770 alu
.src
[1].sel
= ctx
->temp_reg
;
1771 alu
.src
[1].chan
= 2;
1773 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1774 alu
.src
[2].chan
= 0;
1776 alu
.dst
.sel
= ctx
->temp_reg
;
1780 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1784 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1785 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1788 alu
.src
[0].sel
= ctx
->temp_reg
;
1789 alu
.src
[0].chan
= 1;
1790 alu
.src
[1].sel
= ctx
->temp_reg
;
1791 alu
.src
[1].chan
= 2;
1793 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1794 alu
.src
[2].chan
= 0;
1795 alu
.src
[2].value
= (u32
*)&one_point_five
;
1797 alu
.dst
.sel
= ctx
->temp_reg
;
1802 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1806 src_not_temp
= FALSE
;
1807 src_gpr
= ctx
->temp_reg
;
1811 for (i
= 0; i
< 4; i
++) {
1812 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1813 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1814 alu
.src
[0].sel
= src_gpr
;
1815 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1816 alu
.dst
.sel
= ctx
->temp_reg
;
1821 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1825 src_gpr
= ctx
->temp_reg
;
1828 opcode
= ctx
->inst_info
->r600_opcode
;
1829 if (opcode
== SQ_TEX_INST_SAMPLE
&&
1830 (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
))
1831 opcode
= SQ_TEX_INST_SAMPLE_C
;
1833 memset(&tex
, 0, sizeof(struct r600_bc_tex
));
1835 tex
.sampler_id
= ctx
->file_offset
[inst
->Src
[1].Register
.File
] + inst
->Src
[1].Register
.Index
;
1836 tex
.resource_id
= tex
.sampler_id
;
1837 tex
.src_gpr
= src_gpr
;
1838 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
1839 tex
.dst_sel_x
= (inst
->Dst
[0].Register
.WriteMask
& 1) ? 0 : 7;
1840 tex
.dst_sel_y
= (inst
->Dst
[0].Register
.WriteMask
& 2) ? 1 : 7;
1841 tex
.dst_sel_z
= (inst
->Dst
[0].Register
.WriteMask
& 4) ? 2 : 7;
1842 tex
.dst_sel_w
= (inst
->Dst
[0].Register
.WriteMask
& 8) ? 3 : 7;
1848 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1855 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
) {
1856 tex
.coord_type_x
= 1;
1857 tex
.coord_type_y
= 1;
1858 tex
.coord_type_z
= 1;
1859 tex
.coord_type_w
= 1;
1862 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
)
1865 r
= r600_bc_add_tex(ctx
->bc
, &tex
);
1869 /* add shadow ambient support - gallium doesn't do it yet */
1873 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
1875 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1876 struct r600_bc_alu_src r600_src
[3];
1877 struct r600_bc_alu alu
;
1878 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1882 r
= tgsi_split_constant(ctx
, r600_src
);
1885 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1889 /* optimize if it's just an equal balance */
1890 if(r600_src
[0].sel
== V_SQ_ALU_SRC_0_5
) {
1891 for (i
= 0; i
< lasti
+ 1; i
++) {
1892 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1895 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1896 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1897 alu
.src
[0] = r600_src
[1];
1898 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], i
);
1899 alu
.src
[1] = r600_src
[2];
1900 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
1902 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1910 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1918 for (i
= 0; i
< lasti
+ 1; i
++) {
1919 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1922 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1923 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1924 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1925 alu
.src
[0].chan
= 0;
1926 alu
.src
[1] = r600_src
[0];
1927 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1929 alu
.dst
.sel
= ctx
->temp_reg
;
1935 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1940 /* (1 - src0) * src2 */
1941 for (i
= 0; i
< lasti
+ 1; i
++) {
1942 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1945 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1946 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1947 alu
.src
[0].sel
= ctx
->temp_reg
;
1948 alu
.src
[0].chan
= i
;
1949 alu
.src
[1] = r600_src
[2];
1950 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
1951 alu
.dst
.sel
= ctx
->temp_reg
;
1957 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1962 /* src0 * src1 + (1 - src0) * src2 */
1963 for (i
= 0; i
< lasti
+ 1; i
++) {
1964 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1967 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1968 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1970 alu
.src
[0] = r600_src
[0];
1971 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1972 alu
.src
[1] = r600_src
[1];
1973 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
1974 alu
.src
[2].sel
= ctx
->temp_reg
;
1975 alu
.src
[2].chan
= i
;
1977 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1985 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1992 static int tgsi_cmp(struct r600_shader_ctx
*ctx
)
1994 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1995 struct r600_bc_alu_src r600_src
[3];
1996 struct r600_bc_alu alu
;
1998 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
2000 r
= tgsi_split_constant(ctx
, r600_src
);
2003 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2007 for (i
= 0; i
< lasti
+ 1; i
++) {
2008 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
2011 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2012 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE
);
2013 alu
.src
[0] = r600_src
[0];
2014 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2016 alu
.src
[1] = r600_src
[2];
2017 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
2019 alu
.src
[2] = r600_src
[1];
2020 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[1], i
);
2022 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2031 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2038 static int tgsi_xpd(struct r600_shader_ctx
*ctx
)
2040 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2041 struct r600_bc_alu_src r600_src
[3];
2042 struct r600_bc_alu alu
;
2043 uint32_t use_temp
= 0;
2046 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
2049 r
= tgsi_split_constant(ctx
, r600_src
);
2052 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2056 for (i
= 0; i
< 4; i
++) {
2057 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2058 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2060 alu
.src
[0] = r600_src
[0];
2063 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 2);
2066 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2069 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
2072 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2073 alu
.src
[0].chan
= i
;
2076 alu
.src
[1] = r600_src
[1];
2079 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2082 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2085 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2088 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2089 alu
.src
[1].chan
= i
;
2092 alu
.dst
.sel
= ctx
->temp_reg
;
2098 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2103 for (i
= 0; i
< 4; i
++) {
2104 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2105 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
2107 alu
.src
[0] = r600_src
[0];
2110 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
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].sel
= V_SQ_ALU_SRC_0
;
2120 alu
.src
[0].chan
= i
;
2123 alu
.src
[1] = r600_src
[1];
2126 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2129 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2132 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2135 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2136 alu
.src
[1].chan
= i
;
2139 alu
.src
[2].sel
= ctx
->temp_reg
;
2141 alu
.src
[2].chan
= i
;
2144 alu
.dst
.sel
= ctx
->temp_reg
;
2146 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2155 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2160 return tgsi_helper_copy(ctx
, inst
);
2164 static int tgsi_exp(struct r600_shader_ctx
*ctx
)
2166 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2167 struct r600_bc_alu_src r600_src
[3] = { { 0 } };
2168 struct r600_bc_alu alu
;
2171 /* result.x = 2^floor(src); */
2172 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2173 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2175 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2176 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2180 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2182 alu
.dst
.sel
= ctx
->temp_reg
;
2186 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2190 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2191 alu
.src
[0].sel
= ctx
->temp_reg
;
2192 alu
.src
[0].chan
= 0;
2194 alu
.dst
.sel
= ctx
->temp_reg
;
2198 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2203 /* result.y = tmp - floor(tmp); */
2204 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2205 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2207 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
2208 alu
.src
[0] = r600_src
[0];
2209 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2212 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2214 alu
.dst
.sel
= ctx
->temp_reg
;
2215 // r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
2223 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2228 /* result.z = RoughApprox2ToX(tmp);*/
2229 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 0x1) {
2230 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2231 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2232 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2235 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2237 alu
.dst
.sel
= ctx
->temp_reg
;
2243 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2248 /* result.w = 1.0;*/
2249 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 0x1) {
2250 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2252 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2253 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2254 alu
.src
[0].chan
= 0;
2256 alu
.dst
.sel
= ctx
->temp_reg
;
2260 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2264 return tgsi_helper_copy(ctx
, inst
);
2267 static int tgsi_log(struct r600_shader_ctx
*ctx
)
2269 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2270 struct r600_bc_alu alu
;
2273 /* result.x = floor(log2(src)); */
2274 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2275 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2277 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2278 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2282 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2284 alu
.dst
.sel
= ctx
->temp_reg
;
2288 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2292 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2293 alu
.src
[0].sel
= ctx
->temp_reg
;
2294 alu
.src
[0].chan
= 0;
2296 alu
.dst
.sel
= ctx
->temp_reg
;
2301 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2306 /* result.y = src.x / (2 ^ floor(log2(src.x))); */
2307 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2308 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2310 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2311 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2315 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2317 alu
.dst
.sel
= ctx
->temp_reg
;
2322 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2326 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2328 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2329 alu
.src
[0].sel
= ctx
->temp_reg
;
2330 alu
.src
[0].chan
= 1;
2332 alu
.dst
.sel
= ctx
->temp_reg
;
2337 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2341 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2343 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2344 alu
.src
[0].sel
= ctx
->temp_reg
;
2345 alu
.src
[0].chan
= 1;
2347 alu
.dst
.sel
= ctx
->temp_reg
;
2352 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2356 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2358 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
2359 alu
.src
[0].sel
= ctx
->temp_reg
;
2360 alu
.src
[0].chan
= 1;
2362 alu
.dst
.sel
= ctx
->temp_reg
;
2367 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2371 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2373 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2375 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2379 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2381 alu
.src
[1].sel
= ctx
->temp_reg
;
2382 alu
.src
[1].chan
= 1;
2384 alu
.dst
.sel
= ctx
->temp_reg
;
2389 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2394 /* result.z = log2(src);*/
2395 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 1) {
2396 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2398 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2399 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2403 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2405 alu
.dst
.sel
= ctx
->temp_reg
;
2410 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2415 /* result.w = 1.0; */
2416 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 1) {
2417 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2419 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2420 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2421 alu
.src
[0].chan
= 0;
2423 alu
.dst
.sel
= ctx
->temp_reg
;
2428 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2433 return tgsi_helper_copy(ctx
, inst
);
2436 static int tgsi_eg_arl(struct r600_shader_ctx
*ctx
)
2438 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2439 struct r600_bc_alu alu
;
2441 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2443 switch (inst
->Instruction
.Opcode
) {
2444 case TGSI_OPCODE_ARL
:
2445 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR
;
2447 case TGSI_OPCODE_ARR
:
2448 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
2455 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2458 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2461 alu
.dst
.sel
= ctx
->temp_reg
;
2463 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2466 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2467 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
;
2468 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2471 alu
.src
[0].sel
= ctx
->temp_reg
;
2472 alu
.src
[0].chan
= 0;
2474 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2479 static int tgsi_r600_arl(struct r600_shader_ctx
*ctx
)
2481 /* TODO from r600c, ar values don't persist between clauses */
2482 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2483 struct r600_bc_alu alu
;
2485 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2487 switch (inst
->Instruction
.Opcode
) {
2488 case TGSI_OPCODE_ARL
:
2489 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR
;
2491 case TGSI_OPCODE_ARR
:
2492 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA
;
2500 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2503 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2507 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2510 ctx
->bc
->cf_last
->r6xx_uses_waterfall
= 1;
2514 static int tgsi_opdst(struct r600_shader_ctx
*ctx
)
2516 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2517 struct r600_bc_alu alu
;
2520 for (i
= 0; i
< 4; i
++) {
2521 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2523 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2524 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2528 if (i
== 0 || i
== 3) {
2529 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2531 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2534 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2537 if (i
== 0 || i
== 2) {
2538 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
2540 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[1]);
2543 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
2547 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2554 static int emit_logic_pred(struct r600_shader_ctx
*ctx
, int opcode
)
2556 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2557 struct r600_bc_alu alu
;
2560 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2564 alu
.dst
.sel
= ctx
->temp_reg
;
2568 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2571 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2572 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2573 alu
.src
[1].chan
= 0;
2577 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE
));
2583 static int pops(struct r600_shader_ctx
*ctx
, int pops
)
2586 if (ctx
->bc
->cf_last
) {
2587 if (ctx
->bc
->cf_last
->inst
== CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
) << 3)
2589 else if (ctx
->bc
->cf_last
->inst
== CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER
) << 3)
2594 ctx
->bc
->cf_last
->inst
= CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER
) << 3;
2595 ctx
->bc
->force_add_cf
= 1;
2596 } else if (alu_pop
== 2) {
2597 ctx
->bc
->cf_last
->inst
= CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER
) << 3;
2598 ctx
->bc
->force_add_cf
= 1;
2600 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP
));
2601 ctx
->bc
->cf_last
->pop_count
= pops
;
2602 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2607 static inline void callstack_decrease_current(struct r600_shader_ctx
*ctx
, unsigned reason
)
2611 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2615 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
-= 4;
2618 /* TOODO : for 16 vp asic should -= 2; */
2619 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2624 static inline void callstack_check_depth(struct r600_shader_ctx
*ctx
, unsigned reason
, unsigned check_max_only
)
2626 if (check_max_only
) {
2639 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
) >
2640 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2641 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2642 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
;
2648 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2652 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+= 4;
2655 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2659 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
) >
2660 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2661 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2662 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
;
2666 static void fc_set_mid(struct r600_shader_ctx
*ctx
, int fc_sp
)
2668 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[fc_sp
];
2670 sp
->mid
= (struct r600_bc_cf
**)realloc((void *)sp
->mid
,
2671 sizeof(struct r600_bc_cf
*) * (sp
->num_mid
+ 1));
2672 sp
->mid
[sp
->num_mid
] = ctx
->bc
->cf_last
;
2676 static void fc_pushlevel(struct r600_shader_ctx
*ctx
, int type
)
2679 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
= type
;
2680 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
= ctx
->bc
->cf_last
;
2683 static void fc_poplevel(struct r600_shader_ctx
*ctx
)
2685 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
];
2697 static int emit_return(struct r600_shader_ctx
*ctx
)
2699 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_RETURN
);
2703 static int emit_jump_to_offset(struct r600_shader_ctx
*ctx
, int pops
, int offset
)
2706 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_JUMP
);
2707 ctx
->bc
->cf_last
->pop_count
= pops
;
2708 /* TODO work out offset */
2712 static int emit_setret_in_loop_flag(struct r600_shader_ctx
*ctx
, unsigned flag_value
)
2717 static void emit_testflag(struct r600_shader_ctx
*ctx
)
2722 static void emit_return_on_flag(struct r600_shader_ctx
*ctx
, unsigned ifidx
)
2725 emit_jump_to_offset(ctx
, 1, 4);
2726 emit_setret_in_loop_flag(ctx
, V_SQ_ALU_SRC_0
);
2727 pops(ctx
, ifidx
+ 1);
2731 static void break_loop_on_flag(struct r600_shader_ctx
*ctx
, unsigned fc_sp
)
2735 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2736 ctx
->bc
->cf_last
->pop_count
= 1;
2738 fc_set_mid(ctx
, fc_sp
);
2744 static int tgsi_if(struct r600_shader_ctx
*ctx
)
2746 emit_logic_pred(ctx
, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE
));
2748 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
2750 fc_pushlevel(ctx
, FC_IF
);
2752 callstack_check_depth(ctx
, FC_PUSH_VPM
, 0);
2756 static int tgsi_else(struct r600_shader_ctx
*ctx
)
2758 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE
));
2759 ctx
->bc
->cf_last
->pop_count
= 1;
2761 fc_set_mid(ctx
, ctx
->bc
->fc_sp
);
2762 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
;
2766 static int tgsi_endif(struct r600_shader_ctx
*ctx
)
2769 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_IF
) {
2770 R600_ERR("if/endif unbalanced in shader\n");
2774 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
== NULL
) {
2775 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2776 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->pop_count
= 1;
2778 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[0]->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2782 callstack_decrease_current(ctx
, FC_PUSH_VPM
);
2786 static int tgsi_bgnloop(struct r600_shader_ctx
*ctx
)
2788 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL
));
2790 fc_pushlevel(ctx
, FC_LOOP
);
2792 /* check stack depth */
2793 callstack_check_depth(ctx
, FC_LOOP
, 0);
2797 static int tgsi_endloop(struct r600_shader_ctx
*ctx
)
2801 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END
));
2803 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_LOOP
) {
2804 R600_ERR("loop/endloop in shader code are not paired.\n");
2808 /* fixup loop pointers - from r600isa
2809 LOOP END points to CF after LOOP START,
2810 LOOP START point to CF after LOOP END
2811 BRK/CONT point to LOOP END CF
2813 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->id
+ 2;
2815 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2817 for (i
= 0; i
< ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].num_mid
; i
++) {
2818 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[i
]->cf_addr
= ctx
->bc
->cf_last
->id
;
2820 /* TODO add LOOPRET support */
2822 callstack_decrease_current(ctx
, FC_LOOP
);
2826 static int tgsi_loop_brk_cont(struct r600_shader_ctx
*ctx
)
2830 for (fscp
= ctx
->bc
->fc_sp
; fscp
> 0; fscp
--)
2832 if (FC_LOOP
== ctx
->bc
->fc_stack
[fscp
].type
)
2837 R600_ERR("Break not inside loop/endloop pair\n");
2841 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2842 ctx
->bc
->cf_last
->pop_count
= 1;
2844 fc_set_mid(ctx
, fscp
);
2847 callstack_check_depth(ctx
, FC_PUSH_VPM
, 1);
2851 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
2852 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2853 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2854 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
2857 * For state trackers other than OpenGL, we'll want to use
2858 * _RECIP_IEEE instead.
2860 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED
, tgsi_trans_srcx_replicate
},
2862 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_rsq
},
2863 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
2864 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
2865 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
2866 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2867 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2868 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2869 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
2870 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
2871 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
2872 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
2873 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
2874 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
2875 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2876 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
2877 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2879 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2880 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2882 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2883 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2884 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
2885 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2886 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
2887 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2888 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
2889 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
2890 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
2891 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
2893 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2894 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2895 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2896 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2897 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
2898 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
2899 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
2900 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
2901 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2902 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2903 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2904 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2905 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2906 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
2907 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2908 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
2909 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
2910 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
2911 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
2912 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2913 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2914 {TGSI_OPCODE_TXD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2915 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2916 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2917 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2918 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2919 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2920 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2921 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2922 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2923 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2924 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2925 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2926 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
2927 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
2928 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
2929 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2930 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2931 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2932 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2933 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2934 {TGSI_OPCODE_BRK
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
2935 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
2937 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2938 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2939 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
2940 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
2942 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2943 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2944 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2945 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2946 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2947 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2948 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2949 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
2950 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2952 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2953 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2954 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2955 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2956 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2957 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2958 {TGSI_OPCODE_TXF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2959 {TGSI_OPCODE_TXQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2960 {TGSI_OPCODE_CONT
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
2961 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2962 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2963 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
2964 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2965 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
2966 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2968 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2969 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2970 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2971 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2972 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2974 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2975 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2976 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2977 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2978 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2979 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2980 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2981 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2982 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
2983 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
2985 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2986 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2987 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2988 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2989 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2990 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2991 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2992 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2993 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2994 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2995 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2996 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2997 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2998 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2999 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3000 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3001 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3002 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3003 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3004 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3005 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3006 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3007 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3008 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3009 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3010 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3011 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3012 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3015 static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction
[] = {
3016 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
3017 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3018 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
3019 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
3020 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_trans_srcx_replicate
},
3021 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
3022 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3023 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
3024 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3025 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3026 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3027 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
3028 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
3029 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
3030 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
3031 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
3032 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
3033 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3034 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
3035 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3037 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3038 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3040 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3041 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3042 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
3043 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3044 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
3045 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3046 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
3047 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
3048 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
3049 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
3051 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3052 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3053 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3054 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3055 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
3056 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
3057 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
3058 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
3059 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3060 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3061 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3062 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3063 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3064 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
3065 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3066 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
3067 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
3068 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
3069 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
3070 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3071 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3072 {TGSI_OPCODE_TXD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3073 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3074 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3075 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3076 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3077 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3078 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3079 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3080 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
3081 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3082 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3083 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3084 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
3085 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
3086 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
3087 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3088 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3089 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3090 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3091 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3092 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
3093 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
3095 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3096 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3097 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
3098 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
3100 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3101 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3102 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3103 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3104 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3105 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3106 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3107 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
3108 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3110 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3111 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3112 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3113 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3114 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3115 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3116 {TGSI_OPCODE_TXF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3117 {TGSI_OPCODE_TXQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3118 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
3119 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3120 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3121 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
3122 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3123 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
3124 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3126 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3127 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3128 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3129 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3130 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3132 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3133 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3134 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3135 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3136 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3137 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3138 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3139 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3140 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
3141 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
3143 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3144 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3145 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3146 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3147 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3148 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3149 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3150 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3151 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3152 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3153 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3154 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3155 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3156 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3157 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3158 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3159 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3160 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3161 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3162 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3163 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3164 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3165 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3166 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3167 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3168 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3169 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3170 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},