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
->fs_write_all
) {
179 r600_pipe_state_add_reg(rstate
, R_028808_CB_COLOR_CONTROL
,
180 S_028808_MULTIWRITE_ENABLE(1),
181 S_028808_MULTIWRITE_ENABLE(1),
185 if (rshader
->uses_kill
) {
186 /* only set some bits here, the other bits are set in the dsa state */
187 r600_pipe_state_add_reg(rstate
,
188 R_02880C_DB_SHADER_CONTROL
,
189 S_02880C_KILL_ENABLE(1),
190 S_02880C_KILL_ENABLE(1), NULL
);
192 r600_pipe_state_add_reg(rstate
,
193 R_03E200_SQ_LOOP_CONST_0
, 0x01000FFF,
197 static int r600_pipe_shader(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
199 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
200 struct r600_shader
*rshader
= &shader
->shader
;
203 /* copy new shader */
204 if (shader
->bo
== NULL
) {
205 shader
->bo
= r600_bo(rctx
->radeon
, rshader
->bc
.ndw
* 4, 4096, 0, 0);
206 if (shader
->bo
== NULL
) {
209 ptr
= r600_bo_map(rctx
->radeon
, shader
->bo
, 0, NULL
);
210 memcpy(ptr
, rshader
->bc
.bytecode
, rshader
->bc
.ndw
* 4);
211 r600_bo_unmap(rctx
->radeon
, shader
->bo
);
214 switch (rshader
->processor_type
) {
215 case TGSI_PROCESSOR_VERTEX
:
216 if (rshader
->family
>= CHIP_CEDAR
) {
217 evergreen_pipe_shader_vs(ctx
, shader
);
219 r600_pipe_shader_vs(ctx
, shader
);
222 case TGSI_PROCESSOR_FRAGMENT
:
223 if (rshader
->family
>= CHIP_CEDAR
) {
224 evergreen_pipe_shader_ps(ctx
, shader
);
226 r600_pipe_shader_ps(ctx
, shader
);
235 static int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
);
237 int r600_pipe_shader_create(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
, const struct tgsi_token
*tokens
)
239 static int dump_shaders
= -1;
240 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
243 /* Would like some magic "get_bool_option_once" routine.
245 if (dump_shaders
== -1)
246 dump_shaders
= debug_get_bool_option("R600_DUMP_SHADERS", FALSE
);
249 fprintf(stderr
, "--------------------------------------------------------------\n");
250 tgsi_dump(tokens
, 0);
252 shader
->shader
.family
= r600_get_family(rctx
->radeon
);
253 r
= r600_shader_from_tgsi(tokens
, &shader
->shader
);
255 R600_ERR("translation from TGSI failed !\n");
258 r
= r600_bc_build(&shader
->shader
.bc
);
260 R600_ERR("building bytecode failed !\n");
264 r600_bc_dump(&shader
->shader
.bc
);
265 fprintf(stderr
, "______________________________________________________________\n");
267 return r600_pipe_shader(ctx
, shader
);
270 void r600_pipe_shader_destroy(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
272 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
274 r600_bo_reference(rctx
->radeon
, &shader
->bo
, NULL
);
275 r600_bc_clear(&shader
->shader
.bc
);
279 * tgsi -> r600 shader
281 struct r600_shader_tgsi_instruction
;
283 struct r600_shader_src
{
292 struct r600_shader_ctx
{
293 struct tgsi_shader_info info
;
294 struct tgsi_parse_context parse
;
295 const struct tgsi_token
*tokens
;
297 unsigned file_offset
[TGSI_FILE_COUNT
];
299 struct r600_shader_tgsi_instruction
*inst_info
;
301 struct r600_shader
*shader
;
302 struct r600_shader_src src
[3];
305 u32 max_driver_temp_used
;
306 /* needed for evergreen interpolation */
307 boolean input_centroid
;
308 boolean input_linear
;
309 boolean input_perspective
;
313 struct r600_shader_tgsi_instruction
{
314 unsigned tgsi_opcode
;
316 unsigned r600_opcode
;
317 int (*process
)(struct r600_shader_ctx
*ctx
);
320 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[], eg_shader_tgsi_instruction
[];
321 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
);
323 static int tgsi_is_supported(struct r600_shader_ctx
*ctx
)
325 struct tgsi_full_instruction
*i
= &ctx
->parse
.FullToken
.FullInstruction
;
328 if (i
->Instruction
.NumDstRegs
> 1) {
329 R600_ERR("too many dst (%d)\n", i
->Instruction
.NumDstRegs
);
332 if (i
->Instruction
.Predicate
) {
333 R600_ERR("predicate unsupported\n");
337 if (i
->Instruction
.Label
) {
338 R600_ERR("label unsupported\n");
342 for (j
= 0; j
< i
->Instruction
.NumSrcRegs
; j
++) {
343 if (i
->Src
[j
].Register
.Dimension
) {
344 R600_ERR("unsupported src %d (dimension %d)\n", j
,
345 i
->Src
[j
].Register
.Dimension
);
349 for (j
= 0; j
< i
->Instruction
.NumDstRegs
; j
++) {
350 if (i
->Dst
[j
].Register
.Dimension
) {
351 R600_ERR("unsupported dst (dimension)\n");
358 static int evergreen_interp_alu(struct r600_shader_ctx
*ctx
, int input
)
361 struct r600_bc_alu alu
;
362 int gpr
= 0, base_chan
= 0;
365 if (ctx
->shader
->input
[input
].interpolate
== TGSI_INTERPOLATE_PERSPECTIVE
) {
367 if (ctx
->shader
->input
[input
].centroid
)
369 } else if (ctx
->shader
->input
[input
].interpolate
== TGSI_INTERPOLATE_LINEAR
) {
371 /* if we have perspective add one */
372 if (ctx
->input_perspective
) {
374 /* if we have perspective centroid */
375 if (ctx
->input_centroid
)
378 if (ctx
->shader
->input
[input
].centroid
)
382 /* work out gpr and base_chan from index */
384 base_chan
= (2 * (ij_index
% 2)) + 1;
386 for (i
= 0; i
< 8; i
++) {
387 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
390 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW
;
392 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY
;
394 if ((i
> 1) && (i
< 6)) {
395 alu
.dst
.sel
= ctx
->shader
->input
[input
].gpr
;
399 alu
.dst
.chan
= i
% 4;
401 alu
.src
[0].sel
= gpr
;
402 alu
.src
[0].chan
= (base_chan
- (i
% 2));
404 alu
.src
[1].sel
= V_SQ_ALU_SRC_PARAM_BASE
+ ctx
->shader
->input
[input
].lds_pos
;
406 alu
.bank_swizzle_force
= SQ_ALU_VEC_210
;
409 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
417 static int tgsi_declaration(struct r600_shader_ctx
*ctx
)
419 struct tgsi_full_declaration
*d
= &ctx
->parse
.FullToken
.FullDeclaration
;
422 switch (d
->Declaration
.File
) {
423 case TGSI_FILE_INPUT
:
424 i
= ctx
->shader
->ninput
++;
425 ctx
->shader
->input
[i
].name
= d
->Semantic
.Name
;
426 ctx
->shader
->input
[i
].sid
= d
->Semantic
.Index
;
427 ctx
->shader
->input
[i
].interpolate
= d
->Declaration
.Interpolate
;
428 ctx
->shader
->input
[i
].centroid
= d
->Declaration
.Centroid
;
429 ctx
->shader
->input
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_INPUT
] + i
;
430 if (ctx
->type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
->bc
->chiprev
== CHIPREV_EVERGREEN
) {
431 /* turn input into interpolate on EG */
432 if (ctx
->shader
->input
[i
].name
!= TGSI_SEMANTIC_POSITION
) {
433 if (ctx
->shader
->input
[i
].interpolate
> 0) {
434 ctx
->shader
->input
[i
].lds_pos
= ctx
->shader
->nlds
++;
435 evergreen_interp_alu(ctx
, i
);
440 case TGSI_FILE_OUTPUT
:
441 i
= ctx
->shader
->noutput
++;
442 ctx
->shader
->output
[i
].name
= d
->Semantic
.Name
;
443 ctx
->shader
->output
[i
].sid
= d
->Semantic
.Index
;
444 ctx
->shader
->output
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_OUTPUT
] + i
;
445 ctx
->shader
->output
[i
].interpolate
= d
->Declaration
.Interpolate
;
447 case TGSI_FILE_CONSTANT
:
448 case TGSI_FILE_TEMPORARY
:
449 case TGSI_FILE_SAMPLER
:
450 case TGSI_FILE_ADDRESS
:
453 R600_ERR("unsupported file %d declaration\n", d
->Declaration
.File
);
459 static int r600_get_temp(struct r600_shader_ctx
*ctx
)
461 return ctx
->temp_reg
+ ctx
->max_driver_temp_used
++;
465 * for evergreen we need to scan the shader to find the number of GPRs we need to
466 * reserve for interpolation.
468 * we need to know if we are going to emit
469 * any centroid inputs
470 * if perspective and linear are required
472 static int evergreen_gpr_count(struct r600_shader_ctx
*ctx
)
477 ctx
->input_linear
= FALSE
;
478 ctx
->input_perspective
= FALSE
;
479 ctx
->input_centroid
= FALSE
;
480 ctx
->num_interp_gpr
= 1;
482 /* any centroid inputs */
483 for (i
= 0; i
< ctx
->info
.num_inputs
; i
++) {
484 /* skip position/face */
485 if (ctx
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_POSITION
||
486 ctx
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_FACE
)
488 if (ctx
->info
.input_interpolate
[i
] == TGSI_INTERPOLATE_LINEAR
)
489 ctx
->input_linear
= TRUE
;
490 if (ctx
->info
.input_interpolate
[i
] == TGSI_INTERPOLATE_PERSPECTIVE
)
491 ctx
->input_perspective
= TRUE
;
492 if (ctx
->info
.input_centroid
[i
])
493 ctx
->input_centroid
= TRUE
;
497 /* ignoring sample for now */
498 if (ctx
->input_perspective
)
500 if (ctx
->input_linear
)
502 if (ctx
->input_centroid
)
505 ctx
->num_interp_gpr
+= (num_baryc
+ 1) >> 1;
507 /* TODO PULL MODEL and LINE STIPPLE, FIXED PT POS */
508 return ctx
->num_interp_gpr
;
511 static void tgsi_src(struct r600_shader_ctx
*ctx
,
512 const struct tgsi_full_src_register
*tgsi_src
,
513 struct r600_shader_src
*r600_src
)
515 memset(r600_src
, 0, sizeof(*r600_src
));
516 r600_src
->swizzle
[0] = tgsi_src
->Register
.SwizzleX
;
517 r600_src
->swizzle
[1] = tgsi_src
->Register
.SwizzleY
;
518 r600_src
->swizzle
[2] = tgsi_src
->Register
.SwizzleZ
;
519 r600_src
->swizzle
[3] = tgsi_src
->Register
.SwizzleW
;
520 r600_src
->neg
= tgsi_src
->Register
.Negate
;
521 r600_src
->abs
= tgsi_src
->Register
.Absolute
;
522 if (tgsi_src
->Register
.File
== TGSI_FILE_IMMEDIATE
) {
524 if ((tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleY
) &&
525 (tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleZ
) &&
526 (tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleW
)) {
528 index
= tgsi_src
->Register
.Index
* 4 + tgsi_src
->Register
.SwizzleX
;
529 r600_bc_special_constants(ctx
->literals
[index
], &r600_src
->sel
, &r600_src
->neg
);
530 if (r600_src
->sel
!= V_SQ_ALU_SRC_LITERAL
)
533 index
= tgsi_src
->Register
.Index
;
534 r600_src
->sel
= V_SQ_ALU_SRC_LITERAL
;
535 memcpy(r600_src
->value
, ctx
->literals
+ index
* 4, sizeof(r600_src
->value
));
537 if (tgsi_src
->Register
.Indirect
)
538 r600_src
->rel
= V_SQ_REL_RELATIVE
;
539 r600_src
->sel
= tgsi_src
->Register
.Index
;
540 r600_src
->sel
+= ctx
->file_offset
[tgsi_src
->Register
.File
];
544 static int tgsi_split_constant(struct r600_shader_ctx
*ctx
)
546 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
547 struct r600_bc_alu alu
;
548 int i
, j
, k
, nconst
, r
;
550 for (i
= 0, nconst
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
551 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
554 tgsi_src(ctx
, &inst
->Src
[i
], &ctx
->src
[i
]);
556 for (i
= 0, j
= nconst
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
557 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
558 int treg
= r600_get_temp(ctx
);
559 for (k
= 0; k
< 4; k
++) {
560 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
561 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
562 alu
.src
[0].sel
= ctx
->src
[i
].sel
;
564 alu
.src
[0].rel
= ctx
->src
[i
].rel
;
570 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
574 ctx
->src
[i
].sel
= treg
;
582 /* need to move any immediate into a temp - for trig functions which use literal for PI stuff */
583 static int tgsi_split_literal_constant(struct r600_shader_ctx
*ctx
)
585 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
586 struct r600_bc_alu alu
;
587 int i
, j
, k
, nliteral
, r
;
589 for (i
= 0, nliteral
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
590 if (ctx
->src
[i
].sel
== V_SQ_ALU_SRC_LITERAL
) {
594 for (i
= 0, j
= nliteral
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
595 if (j
> 0 && ctx
->src
[i
].sel
== V_SQ_ALU_SRC_LITERAL
) {
596 int treg
= r600_get_temp(ctx
);
597 for (k
= 0; k
< 4; k
++) {
598 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
599 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
600 alu
.src
[0].sel
= ctx
->src
[i
].sel
;
602 alu
.src
[0].value
= ctx
->src
[i
].value
[k
];
608 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
612 ctx
->src
[i
].sel
= treg
;
619 static int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
)
621 struct tgsi_full_immediate
*immediate
;
622 struct tgsi_full_property
*property
;
623 struct r600_shader_ctx ctx
;
624 struct r600_bc_output output
[32];
625 unsigned output_done
, noutput
;
629 ctx
.bc
= &shader
->bc
;
631 r
= r600_bc_init(ctx
.bc
, shader
->family
);
635 tgsi_scan_shader(tokens
, &ctx
.info
);
636 tgsi_parse_init(&ctx
.parse
, tokens
);
637 ctx
.type
= ctx
.parse
.FullHeader
.Processor
.Processor
;
638 shader
->processor_type
= ctx
.type
;
639 ctx
.bc
->type
= shader
->processor_type
;
641 /* register allocations */
642 /* Values [0,127] correspond to GPR[0..127].
643 * Values [128,159] correspond to constant buffer bank 0
644 * Values [160,191] correspond to constant buffer bank 1
645 * Values [256,511] correspond to cfile constants c[0..255]. (Gone on EG)
646 * Values [256,287] correspond to constant buffer bank 2 (EG)
647 * Values [288,319] correspond to constant buffer bank 3 (EG)
648 * Other special values are shown in the list below.
649 * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
650 * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
651 * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
652 * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
653 * 248 SQ_ALU_SRC_0: special constant 0.0.
654 * 249 SQ_ALU_SRC_1: special constant 1.0 float.
655 * 250 SQ_ALU_SRC_1_INT: special constant 1 integer.
656 * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer.
657 * 252 SQ_ALU_SRC_0_5: special constant 0.5 float.
658 * 253 SQ_ALU_SRC_LITERAL: literal constant.
659 * 254 SQ_ALU_SRC_PV: previous vector result.
660 * 255 SQ_ALU_SRC_PS: previous scalar result.
662 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
663 ctx
.file_offset
[i
] = 0;
665 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
666 ctx
.file_offset
[TGSI_FILE_INPUT
] = 1;
667 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
) {
668 r600_bc_add_cfinst(ctx
.bc
, EG_V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
670 r600_bc_add_cfinst(ctx
.bc
, V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
673 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
) {
674 ctx
.file_offset
[TGSI_FILE_INPUT
] = evergreen_gpr_count(&ctx
);
676 ctx
.file_offset
[TGSI_FILE_OUTPUT
] = ctx
.file_offset
[TGSI_FILE_INPUT
] +
677 ctx
.info
.file_count
[TGSI_FILE_INPUT
];
678 ctx
.file_offset
[TGSI_FILE_TEMPORARY
] = ctx
.file_offset
[TGSI_FILE_OUTPUT
] +
679 ctx
.info
.file_count
[TGSI_FILE_OUTPUT
];
681 /* Outside the GPR range. This will be translated to one of the
682 * kcache banks later. */
683 ctx
.file_offset
[TGSI_FILE_CONSTANT
] = 512;
685 ctx
.file_offset
[TGSI_FILE_IMMEDIATE
] = V_SQ_ALU_SRC_LITERAL
;
686 ctx
.temp_reg
= ctx
.file_offset
[TGSI_FILE_TEMPORARY
] +
687 ctx
.info
.file_count
[TGSI_FILE_TEMPORARY
];
691 shader
->fs_write_all
= FALSE
;
692 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
693 tgsi_parse_token(&ctx
.parse
);
694 switch (ctx
.parse
.FullToken
.Token
.Type
) {
695 case TGSI_TOKEN_TYPE_IMMEDIATE
:
696 immediate
= &ctx
.parse
.FullToken
.FullImmediate
;
697 ctx
.literals
= realloc(ctx
.literals
, (ctx
.nliterals
+ 1) * 16);
698 if(ctx
.literals
== NULL
) {
702 ctx
.literals
[ctx
.nliterals
* 4 + 0] = immediate
->u
[0].Uint
;
703 ctx
.literals
[ctx
.nliterals
* 4 + 1] = immediate
->u
[1].Uint
;
704 ctx
.literals
[ctx
.nliterals
* 4 + 2] = immediate
->u
[2].Uint
;
705 ctx
.literals
[ctx
.nliterals
* 4 + 3] = immediate
->u
[3].Uint
;
708 case TGSI_TOKEN_TYPE_DECLARATION
:
709 r
= tgsi_declaration(&ctx
);
713 case TGSI_TOKEN_TYPE_INSTRUCTION
:
714 r
= tgsi_is_supported(&ctx
);
717 ctx
.max_driver_temp_used
= 0;
718 /* reserve first tmp for everyone */
721 opcode
= ctx
.parse
.FullToken
.FullInstruction
.Instruction
.Opcode
;
722 if ((r
= tgsi_split_constant(&ctx
)))
724 if ((r
= tgsi_split_literal_constant(&ctx
)))
726 if (ctx
.bc
->chiprev
== CHIPREV_EVERGREEN
)
727 ctx
.inst_info
= &eg_shader_tgsi_instruction
[opcode
];
729 ctx
.inst_info
= &r600_shader_tgsi_instruction
[opcode
];
730 r
= ctx
.inst_info
->process(&ctx
);
734 case TGSI_TOKEN_TYPE_PROPERTY
:
735 property
= &ctx
.parse
.FullToken
.FullProperty
;
736 if (property
->Property
.PropertyName
== TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS
) {
737 if (property
->u
[0].Data
== 1)
738 shader
->fs_write_all
= TRUE
;
742 R600_ERR("unsupported token type %d\n", ctx
.parse
.FullToken
.Token
.Type
);
748 noutput
= shader
->noutput
;
749 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
750 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
751 output
[i
].gpr
= shader
->output
[i
].gpr
;
752 output
[i
].elem_size
= 3;
753 output
[i
].swizzle_x
= 0;
754 output
[i
].swizzle_y
= 1;
755 output
[i
].swizzle_z
= 2;
756 output
[i
].swizzle_w
= 3;
757 output
[i
].burst_count
= 1;
758 output
[i
].barrier
= 1;
759 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
760 output
[i
].array_base
= i
- pos0
;
761 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
763 case TGSI_PROCESSOR_VERTEX
:
764 if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
765 output
[i
].array_base
= 60;
766 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
767 /* position doesn't count in array_base */
770 if (shader
->output
[i
].name
== TGSI_SEMANTIC_PSIZE
) {
771 output
[i
].array_base
= 61;
772 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
773 /* position doesn't count in array_base */
777 case TGSI_PROCESSOR_FRAGMENT
:
778 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
779 output
[i
].array_base
= shader
->output
[i
].sid
;
780 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
781 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
782 output
[i
].array_base
= 61;
783 output
[i
].swizzle_x
= 2;
784 output
[i
].swizzle_y
= 7;
785 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
786 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
787 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
) {
788 output
[i
].array_base
= 61;
789 output
[i
].swizzle_x
= 7;
790 output
[i
].swizzle_y
= 1;
791 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
792 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
794 R600_ERR("unsupported fragment output name %d\n", shader
->output
[i
].name
);
800 R600_ERR("unsupported processor type %d\n", ctx
.type
);
805 /* add fake param output for vertex shader if no param is exported */
806 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
807 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
808 if (output
[i
].type
== V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
) {
814 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
816 output
[i
].elem_size
= 3;
817 output
[i
].swizzle_x
= 0;
818 output
[i
].swizzle_y
= 1;
819 output
[i
].swizzle_z
= 2;
820 output
[i
].swizzle_w
= 3;
821 output
[i
].burst_count
= 1;
822 output
[i
].barrier
= 1;
823 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
824 output
[i
].array_base
= 0;
825 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
829 /* add fake pixel export */
830 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& !noutput
) {
831 memset(&output
[0], 0, sizeof(struct r600_bc_output
));
833 output
[0].elem_size
= 3;
834 output
[0].swizzle_x
= 7;
835 output
[0].swizzle_y
= 7;
836 output
[0].swizzle_z
= 7;
837 output
[0].swizzle_w
= 7;
838 output
[0].burst_count
= 1;
839 output
[0].barrier
= 1;
840 output
[0].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
841 output
[0].array_base
= 0;
842 output
[0].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
845 /* set export done on last export of each type */
846 for (i
= noutput
- 1, output_done
= 0; i
>= 0; i
--) {
847 if (i
== (noutput
- 1)) {
848 output
[i
].end_of_program
= 1;
850 if (!(output_done
& (1 << output
[i
].type
))) {
851 output_done
|= (1 << output
[i
].type
);
852 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE
);
855 /* add output to bytecode */
856 for (i
= 0; i
< noutput
; i
++) {
857 r
= r600_bc_add_output(ctx
.bc
, &output
[i
]);
862 tgsi_parse_free(&ctx
.parse
);
866 tgsi_parse_free(&ctx
.parse
);
870 static int tgsi_unsupported(struct r600_shader_ctx
*ctx
)
872 R600_ERR("%d tgsi opcode unsupported\n", ctx
->inst_info
->tgsi_opcode
);
876 static int tgsi_end(struct r600_shader_ctx
*ctx
)
881 static void r600_bc_src(struct r600_bc_alu_src
*bc_src
,
882 const struct r600_shader_src
*shader_src
,
885 bc_src
->sel
= shader_src
->sel
;
886 bc_src
->chan
= shader_src
->swizzle
[chan
];
887 bc_src
->neg
= shader_src
->neg
;
888 bc_src
->abs
= shader_src
->abs
;
889 bc_src
->rel
= shader_src
->rel
;
890 bc_src
->value
= shader_src
->value
[bc_src
->chan
];
893 static void tgsi_dst(struct r600_shader_ctx
*ctx
,
894 const struct tgsi_full_dst_register
*tgsi_dst
,
896 struct r600_bc_alu_dst
*r600_dst
)
898 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
900 r600_dst
->sel
= tgsi_dst
->Register
.Index
;
901 r600_dst
->sel
+= ctx
->file_offset
[tgsi_dst
->Register
.File
];
902 r600_dst
->chan
= swizzle
;
904 if (tgsi_dst
->Register
.Indirect
)
905 r600_dst
->rel
= V_SQ_REL_RELATIVE
;
906 if (inst
->Instruction
.Saturate
) {
911 static int tgsi_last_instruction(unsigned writemask
)
915 for (i
= 0; i
< 4; i
++) {
916 if (writemask
& (1 << i
)) {
923 static int tgsi_op2_s(struct r600_shader_ctx
*ctx
, int swap
)
925 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
926 struct r600_bc_alu alu
;
928 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
930 for (i
= 0; i
< lasti
+ 1; i
++) {
931 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
934 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
935 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
937 alu
.inst
= ctx
->inst_info
->r600_opcode
;
939 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
940 r600_bc_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
943 r600_bc_src(&alu
.src
[0], &ctx
->src
[1], i
);
944 r600_bc_src(&alu
.src
[1], &ctx
->src
[0], i
);
946 /* handle some special cases */
947 switch (ctx
->inst_info
->tgsi_opcode
) {
948 case TGSI_OPCODE_SUB
:
951 case TGSI_OPCODE_ABS
:
960 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
967 static int tgsi_op2(struct r600_shader_ctx
*ctx
)
969 return tgsi_op2_s(ctx
, 0);
972 static int tgsi_op2_swap(struct r600_shader_ctx
*ctx
)
974 return tgsi_op2_s(ctx
, 1);
978 * r600 - trunc to -PI..PI range
979 * r700 - normalize by dividing by 2PI
982 static int tgsi_setup_trig(struct r600_shader_ctx
*ctx
)
984 static float half_inv_pi
= 1.0 /(3.1415926535 * 2);
985 static float double_pi
= 3.1415926535 * 2;
986 static float neg_pi
= -3.1415926535;
989 struct r600_bc_alu alu
;
991 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
992 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
996 alu
.dst
.sel
= ctx
->temp_reg
;
999 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
1001 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
1002 alu
.src
[1].chan
= 0;
1003 alu
.src
[1].value
= *(uint32_t *)&half_inv_pi
;
1004 alu
.src
[2].sel
= V_SQ_ALU_SRC_0_5
;
1005 alu
.src
[2].chan
= 0;
1007 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1011 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1012 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
1015 alu
.dst
.sel
= ctx
->temp_reg
;
1018 alu
.src
[0].sel
= ctx
->temp_reg
;
1019 alu
.src
[0].chan
= 0;
1021 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1025 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1026 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1030 alu
.dst
.sel
= ctx
->temp_reg
;
1033 alu
.src
[0].sel
= ctx
->temp_reg
;
1034 alu
.src
[0].chan
= 0;
1036 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
1037 alu
.src
[1].chan
= 0;
1038 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1039 alu
.src
[2].chan
= 0;
1041 if (ctx
->bc
->chiprev
== CHIPREV_R600
) {
1042 alu
.src
[1].value
= *(uint32_t *)&double_pi
;
1043 alu
.src
[2].value
= *(uint32_t *)&neg_pi
;
1045 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1046 alu
.src
[2].sel
= V_SQ_ALU_SRC_0_5
;
1051 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1057 static int tgsi_trig(struct r600_shader_ctx
*ctx
)
1059 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1060 struct r600_bc_alu alu
;
1062 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1064 r
= tgsi_setup_trig(ctx
);
1068 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1069 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1071 alu
.dst
.sel
= ctx
->temp_reg
;
1074 alu
.src
[0].sel
= ctx
->temp_reg
;
1075 alu
.src
[0].chan
= 0;
1077 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1081 /* replicate result */
1082 for (i
= 0; i
< lasti
+ 1; i
++) {
1083 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1086 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1087 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1089 alu
.src
[0].sel
= ctx
->temp_reg
;
1090 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1093 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1100 static int tgsi_scs(struct r600_shader_ctx
*ctx
)
1102 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1103 struct r600_bc_alu alu
;
1106 /* We'll only need the trig stuff if we are going to write to the
1107 * X or Y components of the destination vector.
1109 if (likely(inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_XY
)) {
1110 r
= tgsi_setup_trig(ctx
);
1116 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_X
) {
1117 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1118 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
);
1119 tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1121 alu
.src
[0].sel
= ctx
->temp_reg
;
1122 alu
.src
[0].chan
= 0;
1124 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1130 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Y
) {
1131 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1132 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
);
1133 tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1135 alu
.src
[0].sel
= ctx
->temp_reg
;
1136 alu
.src
[0].chan
= 0;
1138 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1144 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Z
) {
1145 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1147 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1149 tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1151 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1152 alu
.src
[0].chan
= 0;
1156 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1162 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_W
) {
1163 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1165 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1167 tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1169 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1170 alu
.src
[0].chan
= 0;
1174 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1182 static int tgsi_kill(struct r600_shader_ctx
*ctx
)
1184 struct r600_bc_alu alu
;
1187 for (i
= 0; i
< 4; i
++) {
1188 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1189 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1193 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1195 if (ctx
->inst_info
->tgsi_opcode
== TGSI_OPCODE_KILP
) {
1196 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1199 r600_bc_src(&alu
.src
[1], &ctx
->src
[0], i
);
1204 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1209 /* kill must be last in ALU */
1210 ctx
->bc
->force_add_cf
= 1;
1211 ctx
->shader
->uses_kill
= TRUE
;
1215 static int tgsi_lit(struct r600_shader_ctx
*ctx
)
1217 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1218 struct r600_bc_alu alu
;
1222 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1223 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1224 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
; /*1.0*/
1225 alu
.src
[0].chan
= 0;
1226 tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1227 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 0) & 1;
1228 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1232 /* dst.y = max(src.x, 0.0) */
1233 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1234 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
);
1235 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
1236 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
1237 alu
.src
[1].chan
= 0;
1238 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 tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1250 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 3) & 1;
1252 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1256 if (inst
->Dst
[0].Register
.WriteMask
& (1 << 2))
1261 /* dst.z = log(src.y) */
1262 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1263 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
);
1264 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 1);
1265 tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1267 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1271 chan
= alu
.dst
.chan
;
1274 /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
1275 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1276 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT
);
1277 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 3);
1278 alu
.src
[1].sel
= sel
;
1279 alu
.src
[1].chan
= chan
;
1281 r600_bc_src(&alu
.src
[2], &ctx
->src
[0], 0);
1282 alu
.dst
.sel
= ctx
->temp_reg
;
1287 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1291 /* dst.z = exp(tmp.x) */
1292 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1293 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1294 alu
.src
[0].sel
= ctx
->temp_reg
;
1295 alu
.src
[0].chan
= 0;
1296 tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1298 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1305 static int tgsi_rsq(struct r600_shader_ctx
*ctx
)
1307 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1308 struct r600_bc_alu alu
;
1311 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1314 * For state trackers other than OpenGL, we'll want to use
1315 * _RECIPSQRT_IEEE instead.
1317 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED
);
1319 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1320 r600_bc_src(&alu
.src
[i
], &ctx
->src
[i
], 0);
1323 alu
.dst
.sel
= ctx
->temp_reg
;
1326 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1329 /* replicate result */
1330 return tgsi_helper_tempx_replicate(ctx
);
1333 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
)
1335 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1336 struct r600_bc_alu alu
;
1339 for (i
= 0; i
< 4; i
++) {
1340 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1341 alu
.src
[0].sel
= ctx
->temp_reg
;
1342 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1344 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1345 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1348 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1355 static int tgsi_trans_srcx_replicate(struct r600_shader_ctx
*ctx
)
1357 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1358 struct r600_bc_alu alu
;
1361 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1362 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1363 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1364 r600_bc_src(&alu
.src
[i
], &ctx
->src
[i
], 0);
1366 alu
.dst
.sel
= ctx
->temp_reg
;
1369 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1372 /* replicate result */
1373 return tgsi_helper_tempx_replicate(ctx
);
1376 static int tgsi_pow(struct r600_shader_ctx
*ctx
)
1378 struct r600_bc_alu alu
;
1382 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1383 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
1384 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
1385 alu
.dst
.sel
= ctx
->temp_reg
;
1388 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1392 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1393 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1394 r600_bc_src(&alu
.src
[0], &ctx
->src
[1], 0);
1395 alu
.src
[1].sel
= ctx
->temp_reg
;
1396 alu
.dst
.sel
= ctx
->temp_reg
;
1399 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1402 /* POW(a,b) = EXP2(b * LOG2(a))*/
1403 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1404 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1405 alu
.src
[0].sel
= ctx
->temp_reg
;
1406 alu
.dst
.sel
= ctx
->temp_reg
;
1409 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1412 return tgsi_helper_tempx_replicate(ctx
);
1415 static int tgsi_ssg(struct r600_shader_ctx
*ctx
)
1417 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1418 struct r600_bc_alu alu
;
1421 /* tmp = (src > 0 ? 1 : src) */
1422 for (i
= 0; i
< 4; i
++) {
1423 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1424 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1427 alu
.dst
.sel
= ctx
->temp_reg
;
1430 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], i
);
1431 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1432 r600_bc_src(&alu
.src
[2], &ctx
->src
[0], i
);
1436 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1441 /* dst = (-tmp > 0 ? -1 : tmp) */
1442 for (i
= 0; i
< 4; i
++) {
1443 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1444 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1446 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1448 alu
.src
[0].sel
= ctx
->temp_reg
;
1449 alu
.src
[0].chan
= i
;
1452 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1455 alu
.src
[2].sel
= ctx
->temp_reg
;
1456 alu
.src
[2].chan
= i
;
1460 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1467 static int tgsi_helper_copy(struct r600_shader_ctx
*ctx
, struct tgsi_full_instruction
*inst
)
1469 struct r600_bc_alu alu
;
1472 for (i
= 0; i
< 4; i
++) {
1473 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1474 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
1475 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
);
1478 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1479 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1480 alu
.src
[0].sel
= ctx
->temp_reg
;
1481 alu
.src
[0].chan
= i
;
1486 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1493 static int tgsi_op3(struct r600_shader_ctx
*ctx
)
1495 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1496 struct r600_bc_alu alu
;
1498 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1500 for (i
= 0; i
< lasti
+ 1; i
++) {
1501 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1504 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1505 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1506 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1507 r600_bc_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
1510 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1517 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1524 static int tgsi_dp(struct r600_shader_ctx
*ctx
)
1526 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1527 struct r600_bc_alu alu
;
1530 for (i
= 0; i
< 4; i
++) {
1531 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1532 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1533 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1534 r600_bc_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
1537 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1539 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1540 /* handle some special cases */
1541 switch (ctx
->inst_info
->tgsi_opcode
) {
1542 case TGSI_OPCODE_DP2
:
1544 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1545 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1548 case TGSI_OPCODE_DP3
:
1550 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1551 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1554 case TGSI_OPCODE_DPH
:
1556 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1557 alu
.src
[0].chan
= 0;
1567 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1574 static int tgsi_tex(struct r600_shader_ctx
*ctx
)
1576 static float one_point_five
= 1.5f
;
1577 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1578 struct r600_bc_tex tex
;
1579 struct r600_bc_alu alu
;
1583 boolean src_not_temp
=
1584 inst
->Src
[0].Register
.File
!= TGSI_FILE_TEMPORARY
&&
1585 inst
->Src
[0].Register
.File
!= TGSI_FILE_INPUT
;
1587 src_gpr
= ctx
->file_offset
[inst
->Src
[0].Register
.File
] + inst
->Src
[0].Register
.Index
;
1589 if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXP
) {
1590 /* Add perspective divide */
1591 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1592 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1593 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 3);
1595 alu
.dst
.sel
= ctx
->temp_reg
;
1599 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1603 for (i
= 0; i
< 3; i
++) {
1604 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1605 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1606 alu
.src
[0].sel
= ctx
->temp_reg
;
1607 alu
.src
[0].chan
= 3;
1608 r600_bc_src(&alu
.src
[1], &ctx
->src
[0], i
);
1609 alu
.dst
.sel
= ctx
->temp_reg
;
1612 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1616 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1617 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1618 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1619 alu
.src
[0].chan
= 0;
1620 alu
.dst
.sel
= ctx
->temp_reg
;
1624 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1627 src_not_temp
= FALSE
;
1628 src_gpr
= ctx
->temp_reg
;
1631 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1632 int src_chan
, src2_chan
;
1634 /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
1635 for (i
= 0; i
< 4; i
++) {
1636 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1637 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE
);
1661 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], src_chan
);
1662 r600_bc_src(&alu
.src
[1], &ctx
->src
[0], src2_chan
);
1663 alu
.dst
.sel
= ctx
->temp_reg
;
1668 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1673 /* tmp1.z = RCP_e(|tmp1.z|) */
1674 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1675 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1676 alu
.src
[0].sel
= ctx
->temp_reg
;
1677 alu
.src
[0].chan
= 2;
1679 alu
.dst
.sel
= ctx
->temp_reg
;
1683 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1687 /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x
1688 * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x
1689 * muladd has no writemask, have to use another temp
1691 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1692 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1695 alu
.src
[0].sel
= ctx
->temp_reg
;
1696 alu
.src
[0].chan
= 0;
1697 alu
.src
[1].sel
= ctx
->temp_reg
;
1698 alu
.src
[1].chan
= 2;
1700 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1701 alu
.src
[2].chan
= 0;
1702 alu
.src
[2].value
= *(uint32_t *)&one_point_five
;
1704 alu
.dst
.sel
= ctx
->temp_reg
;
1708 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1712 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1713 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1716 alu
.src
[0].sel
= ctx
->temp_reg
;
1717 alu
.src
[0].chan
= 1;
1718 alu
.src
[1].sel
= ctx
->temp_reg
;
1719 alu
.src
[1].chan
= 2;
1721 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1722 alu
.src
[2].chan
= 0;
1723 alu
.src
[2].value
= *(uint32_t *)&one_point_five
;
1725 alu
.dst
.sel
= ctx
->temp_reg
;
1730 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1734 src_not_temp
= FALSE
;
1735 src_gpr
= ctx
->temp_reg
;
1739 for (i
= 0; i
< 4; i
++) {
1740 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1741 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1742 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], i
);
1743 alu
.dst
.sel
= ctx
->temp_reg
;
1748 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1752 src_gpr
= ctx
->temp_reg
;
1755 opcode
= ctx
->inst_info
->r600_opcode
;
1756 if (opcode
== SQ_TEX_INST_SAMPLE
&&
1757 (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
))
1758 opcode
= SQ_TEX_INST_SAMPLE_C
;
1760 memset(&tex
, 0, sizeof(struct r600_bc_tex
));
1762 tex
.sampler_id
= ctx
->file_offset
[inst
->Src
[1].Register
.File
] + inst
->Src
[1].Register
.Index
;
1763 tex
.resource_id
= tex
.sampler_id
;
1764 tex
.src_gpr
= src_gpr
;
1765 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
1766 tex
.dst_sel_x
= (inst
->Dst
[0].Register
.WriteMask
& 1) ? 0 : 7;
1767 tex
.dst_sel_y
= (inst
->Dst
[0].Register
.WriteMask
& 2) ? 1 : 7;
1768 tex
.dst_sel_z
= (inst
->Dst
[0].Register
.WriteMask
& 4) ? 2 : 7;
1769 tex
.dst_sel_w
= (inst
->Dst
[0].Register
.WriteMask
& 8) ? 3 : 7;
1775 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1782 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
) {
1783 tex
.coord_type_x
= 1;
1784 tex
.coord_type_y
= 1;
1785 tex
.coord_type_z
= 1;
1786 tex
.coord_type_w
= 1;
1789 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
)
1792 r
= r600_bc_add_tex(ctx
->bc
, &tex
);
1796 /* add shadow ambient support - gallium doesn't do it yet */
1800 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
1802 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1803 struct r600_bc_alu alu
;
1804 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1808 /* optimize if it's just an equal balance */
1809 if (ctx
->src
[0].sel
== V_SQ_ALU_SRC_0_5
) {
1810 for (i
= 0; i
< lasti
+ 1; i
++) {
1811 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1814 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1815 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1816 r600_bc_src(&alu
.src
[0], &ctx
->src
[1], i
);
1817 r600_bc_src(&alu
.src
[1], &ctx
->src
[2], i
);
1819 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1824 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1832 for (i
= 0; i
< lasti
+ 1; i
++) {
1833 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1836 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1837 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1838 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1839 alu
.src
[0].chan
= 0;
1840 r600_bc_src(&alu
.src
[1], &ctx
->src
[0], i
);
1842 alu
.dst
.sel
= ctx
->temp_reg
;
1848 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1853 /* (1 - src0) * src2 */
1854 for (i
= 0; i
< lasti
+ 1; i
++) {
1855 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1858 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1859 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1860 alu
.src
[0].sel
= ctx
->temp_reg
;
1861 alu
.src
[0].chan
= i
;
1862 r600_bc_src(&alu
.src
[1], &ctx
->src
[2], i
);
1863 alu
.dst
.sel
= ctx
->temp_reg
;
1869 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1874 /* src0 * src1 + (1 - src0) * src2 */
1875 for (i
= 0; i
< lasti
+ 1; i
++) {
1876 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1879 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1880 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1882 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], i
);
1883 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], i
);
1884 alu
.src
[2].sel
= ctx
->temp_reg
;
1885 alu
.src
[2].chan
= i
;
1887 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1892 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1899 static int tgsi_cmp(struct r600_shader_ctx
*ctx
)
1901 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1902 struct r600_bc_alu alu
;
1904 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1906 for (i
= 0; i
< lasti
+ 1; i
++) {
1907 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1910 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1911 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE
);
1912 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], i
);
1913 r600_bc_src(&alu
.src
[1], &ctx
->src
[2], i
);
1914 r600_bc_src(&alu
.src
[2], &ctx
->src
[1], i
);
1915 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1921 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1928 static int tgsi_xpd(struct r600_shader_ctx
*ctx
)
1930 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1931 struct r600_bc_alu alu
;
1932 uint32_t use_temp
= 0;
1935 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
1938 for (i
= 0; i
< 4; i
++) {
1939 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1940 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1944 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 2);
1947 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
1950 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 1);
1953 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1954 alu
.src
[0].chan
= i
;
1959 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], 1);
1962 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], 2);
1965 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], 0);
1968 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1969 alu
.src
[1].chan
= i
;
1972 alu
.dst
.sel
= ctx
->temp_reg
;
1978 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1983 for (i
= 0; i
< 4; i
++) {
1984 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1985 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1989 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 1);
1992 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 2);
1995 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
1998 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1999 alu
.src
[0].chan
= i
;
2004 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], 2);
2007 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], 0);
2010 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], 1);
2013 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2014 alu
.src
[1].chan
= i
;
2017 alu
.src
[2].sel
= ctx
->temp_reg
;
2019 alu
.src
[2].chan
= i
;
2022 alu
.dst
.sel
= ctx
->temp_reg
;
2024 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2030 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2035 return tgsi_helper_copy(ctx
, inst
);
2039 static int tgsi_exp(struct r600_shader_ctx
*ctx
)
2041 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2042 struct r600_bc_alu alu
;
2045 /* result.x = 2^floor(src); */
2046 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2047 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2049 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2050 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2052 alu
.dst
.sel
= ctx
->temp_reg
;
2056 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2060 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2061 alu
.src
[0].sel
= ctx
->temp_reg
;
2062 alu
.src
[0].chan
= 0;
2064 alu
.dst
.sel
= ctx
->temp_reg
;
2068 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2073 /* result.y = tmp - floor(tmp); */
2074 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2075 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2077 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
2078 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2080 alu
.dst
.sel
= ctx
->temp_reg
;
2081 // r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
2089 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2094 /* result.z = RoughApprox2ToX(tmp);*/
2095 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 0x1) {
2096 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2097 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2098 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2100 alu
.dst
.sel
= ctx
->temp_reg
;
2106 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2111 /* result.w = 1.0;*/
2112 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 0x1) {
2113 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2115 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2116 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2117 alu
.src
[0].chan
= 0;
2119 alu
.dst
.sel
= ctx
->temp_reg
;
2123 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2127 return tgsi_helper_copy(ctx
, inst
);
2130 static int tgsi_log(struct r600_shader_ctx
*ctx
)
2132 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2133 struct r600_bc_alu alu
;
2136 /* result.x = floor(log2(src)); */
2137 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2138 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2140 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2141 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2143 alu
.dst
.sel
= ctx
->temp_reg
;
2147 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2151 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2152 alu
.src
[0].sel
= ctx
->temp_reg
;
2153 alu
.src
[0].chan
= 0;
2155 alu
.dst
.sel
= ctx
->temp_reg
;
2160 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2165 /* result.y = src.x / (2 ^ floor(log2(src.x))); */
2166 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2167 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2169 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2170 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2172 alu
.dst
.sel
= ctx
->temp_reg
;
2177 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2181 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2183 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2184 alu
.src
[0].sel
= ctx
->temp_reg
;
2185 alu
.src
[0].chan
= 1;
2187 alu
.dst
.sel
= ctx
->temp_reg
;
2192 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2196 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2198 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2199 alu
.src
[0].sel
= ctx
->temp_reg
;
2200 alu
.src
[0].chan
= 1;
2202 alu
.dst
.sel
= ctx
->temp_reg
;
2207 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2211 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2213 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
2214 alu
.src
[0].sel
= ctx
->temp_reg
;
2215 alu
.src
[0].chan
= 1;
2217 alu
.dst
.sel
= ctx
->temp_reg
;
2222 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2226 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2228 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2230 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2232 alu
.src
[1].sel
= ctx
->temp_reg
;
2233 alu
.src
[1].chan
= 1;
2235 alu
.dst
.sel
= ctx
->temp_reg
;
2240 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2245 /* result.z = log2(src);*/
2246 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 1) {
2247 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2249 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2250 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2252 alu
.dst
.sel
= ctx
->temp_reg
;
2257 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2262 /* result.w = 1.0; */
2263 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 1) {
2264 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2266 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2267 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2268 alu
.src
[0].chan
= 0;
2270 alu
.dst
.sel
= ctx
->temp_reg
;
2275 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2280 return tgsi_helper_copy(ctx
, inst
);
2283 static int tgsi_eg_arl(struct r600_shader_ctx
*ctx
)
2285 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2286 struct r600_bc_alu alu
;
2289 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2291 switch (inst
->Instruction
.Opcode
) {
2292 case TGSI_OPCODE_ARL
:
2293 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR
;
2295 case TGSI_OPCODE_ARR
:
2296 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
2303 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2306 alu
.dst
.sel
= ctx
->temp_reg
;
2308 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2311 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2312 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
;
2313 alu
.src
[0].sel
= ctx
->temp_reg
;
2314 alu
.src
[0].chan
= 0;
2316 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2321 static int tgsi_r600_arl(struct r600_shader_ctx
*ctx
)
2323 /* TODO from r600c, ar values don't persist between clauses */
2324 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2325 struct r600_bc_alu alu
;
2328 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2330 switch (inst
->Instruction
.Opcode
) {
2331 case TGSI_OPCODE_ARL
:
2332 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR
;
2334 case TGSI_OPCODE_ARR
:
2335 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA
;
2342 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2346 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2349 ctx
->bc
->cf_last
->r6xx_uses_waterfall
= 1;
2353 static int tgsi_opdst(struct r600_shader_ctx
*ctx
)
2355 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2356 struct r600_bc_alu alu
;
2359 for (i
= 0; i
< 4; i
++) {
2360 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2362 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2363 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2365 if (i
== 0 || i
== 3) {
2366 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2368 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], i
);
2371 if (i
== 0 || i
== 2) {
2372 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
2374 r600_bc_src(&alu
.src
[1], &ctx
->src
[1], i
);
2378 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2385 static int emit_logic_pred(struct r600_shader_ctx
*ctx
, int opcode
)
2387 struct r600_bc_alu alu
;
2390 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2394 alu
.dst
.sel
= ctx
->temp_reg
;
2398 r600_bc_src(&alu
.src
[0], &ctx
->src
[0], 0);
2399 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2400 alu
.src
[1].chan
= 0;
2404 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE
));
2410 static int pops(struct r600_shader_ctx
*ctx
, int pops
)
2413 if (ctx
->bc
->cf_last
) {
2414 if (ctx
->bc
->cf_last
->inst
== CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
) << 3)
2416 else if (ctx
->bc
->cf_last
->inst
== CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER
) << 3)
2421 ctx
->bc
->cf_last
->inst
= CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER
) << 3;
2422 ctx
->bc
->force_add_cf
= 1;
2423 } else if (alu_pop
== 2) {
2424 ctx
->bc
->cf_last
->inst
= CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER
) << 3;
2425 ctx
->bc
->force_add_cf
= 1;
2427 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP
));
2428 ctx
->bc
->cf_last
->pop_count
= pops
;
2429 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2434 static inline void callstack_decrease_current(struct r600_shader_ctx
*ctx
, unsigned reason
)
2438 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2442 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
-= 4;
2445 /* TOODO : for 16 vp asic should -= 2; */
2446 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2451 static inline void callstack_check_depth(struct r600_shader_ctx
*ctx
, unsigned reason
, unsigned check_max_only
)
2453 if (check_max_only
) {
2466 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
) >
2467 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2468 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2469 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
;
2475 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2479 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+= 4;
2482 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2486 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
) >
2487 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2488 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2489 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
;
2493 static void fc_set_mid(struct r600_shader_ctx
*ctx
, int fc_sp
)
2495 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[fc_sp
];
2497 sp
->mid
= (struct r600_bc_cf
**)realloc((void *)sp
->mid
,
2498 sizeof(struct r600_bc_cf
*) * (sp
->num_mid
+ 1));
2499 sp
->mid
[sp
->num_mid
] = ctx
->bc
->cf_last
;
2503 static void fc_pushlevel(struct r600_shader_ctx
*ctx
, int type
)
2506 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
= type
;
2507 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
= ctx
->bc
->cf_last
;
2510 static void fc_poplevel(struct r600_shader_ctx
*ctx
)
2512 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
];
2524 static int emit_return(struct r600_shader_ctx
*ctx
)
2526 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_RETURN
);
2530 static int emit_jump_to_offset(struct r600_shader_ctx
*ctx
, int pops
, int offset
)
2533 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_JUMP
);
2534 ctx
->bc
->cf_last
->pop_count
= pops
;
2535 /* TODO work out offset */
2539 static int emit_setret_in_loop_flag(struct r600_shader_ctx
*ctx
, unsigned flag_value
)
2544 static void emit_testflag(struct r600_shader_ctx
*ctx
)
2549 static void emit_return_on_flag(struct r600_shader_ctx
*ctx
, unsigned ifidx
)
2552 emit_jump_to_offset(ctx
, 1, 4);
2553 emit_setret_in_loop_flag(ctx
, V_SQ_ALU_SRC_0
);
2554 pops(ctx
, ifidx
+ 1);
2558 static void break_loop_on_flag(struct r600_shader_ctx
*ctx
, unsigned fc_sp
)
2562 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2563 ctx
->bc
->cf_last
->pop_count
= 1;
2565 fc_set_mid(ctx
, fc_sp
);
2571 static int tgsi_if(struct r600_shader_ctx
*ctx
)
2573 emit_logic_pred(ctx
, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE
));
2575 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
2577 fc_pushlevel(ctx
, FC_IF
);
2579 callstack_check_depth(ctx
, FC_PUSH_VPM
, 0);
2583 static int tgsi_else(struct r600_shader_ctx
*ctx
)
2585 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE
));
2586 ctx
->bc
->cf_last
->pop_count
= 1;
2588 fc_set_mid(ctx
, ctx
->bc
->fc_sp
);
2589 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
;
2593 static int tgsi_endif(struct r600_shader_ctx
*ctx
)
2596 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_IF
) {
2597 R600_ERR("if/endif unbalanced in shader\n");
2601 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
== NULL
) {
2602 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2603 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->pop_count
= 1;
2605 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[0]->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2609 callstack_decrease_current(ctx
, FC_PUSH_VPM
);
2613 static int tgsi_bgnloop(struct r600_shader_ctx
*ctx
)
2615 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL
));
2617 fc_pushlevel(ctx
, FC_LOOP
);
2619 /* check stack depth */
2620 callstack_check_depth(ctx
, FC_LOOP
, 0);
2624 static int tgsi_endloop(struct r600_shader_ctx
*ctx
)
2628 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END
));
2630 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_LOOP
) {
2631 R600_ERR("loop/endloop in shader code are not paired.\n");
2635 /* fixup loop pointers - from r600isa
2636 LOOP END points to CF after LOOP START,
2637 LOOP START point to CF after LOOP END
2638 BRK/CONT point to LOOP END CF
2640 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->id
+ 2;
2642 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2644 for (i
= 0; i
< ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].num_mid
; i
++) {
2645 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[i
]->cf_addr
= ctx
->bc
->cf_last
->id
;
2647 /* TODO add LOOPRET support */
2649 callstack_decrease_current(ctx
, FC_LOOP
);
2653 static int tgsi_loop_brk_cont(struct r600_shader_ctx
*ctx
)
2657 for (fscp
= ctx
->bc
->fc_sp
; fscp
> 0; fscp
--)
2659 if (FC_LOOP
== ctx
->bc
->fc_stack
[fscp
].type
)
2664 R600_ERR("Break not inside loop/endloop pair\n");
2668 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2669 ctx
->bc
->cf_last
->pop_count
= 1;
2671 fc_set_mid(ctx
, fscp
);
2674 callstack_check_depth(ctx
, FC_PUSH_VPM
, 1);
2678 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
2679 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2680 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2681 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
2684 * For state trackers other than OpenGL, we'll want to use
2685 * _RECIP_IEEE instead.
2687 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED
, tgsi_trans_srcx_replicate
},
2689 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_rsq
},
2690 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
2691 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
2692 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
2693 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2694 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2695 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2696 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
2697 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
2698 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
2699 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
2700 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
2701 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
2702 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2703 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
2704 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2706 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2707 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2709 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2710 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2711 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
2712 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2713 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
2714 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2715 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
2716 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
2717 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
2718 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
2720 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2721 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2722 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2723 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2724 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
2725 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
2726 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
2727 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
2728 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2729 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2730 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2731 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2732 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2733 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
2734 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2735 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
2736 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
2737 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
2738 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
2739 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2740 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2741 {TGSI_OPCODE_TXD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2742 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2743 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2744 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2745 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2746 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2747 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2748 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2749 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
2750 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2751 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2752 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2753 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
2754 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
2755 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
2756 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2757 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2758 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2759 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2760 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2761 {TGSI_OPCODE_BRK
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
2762 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
2764 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2765 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2766 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
2767 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
2769 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2770 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2771 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2772 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2773 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2774 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2775 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2776 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
2777 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2779 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2780 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2781 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2782 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2783 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2784 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2785 {TGSI_OPCODE_TXF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2786 {TGSI_OPCODE_TXQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2787 {TGSI_OPCODE_CONT
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
2788 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2789 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2790 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
2791 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2792 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
2793 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2795 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2796 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2797 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2798 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2799 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2801 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2802 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2803 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2804 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2805 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2806 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2807 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2808 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2809 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
2810 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
2812 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2813 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2814 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2815 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2816 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2817 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2818 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2819 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2820 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2821 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2822 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2823 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2824 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2825 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2826 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2827 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2828 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2829 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2830 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2831 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2832 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2833 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2834 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2835 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2836 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2837 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2838 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2839 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2842 static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction
[] = {
2843 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
2844 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2845 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
2846 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
2847 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_trans_srcx_replicate
},
2848 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
2849 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2850 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
2851 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2852 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2853 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2854 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
2855 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
2856 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
2857 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
2858 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
2859 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
2860 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2861 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
2862 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2864 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2865 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2867 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2868 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2869 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
2870 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2871 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
2872 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2873 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
2874 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
2875 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
2876 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
2878 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2879 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2880 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2881 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2882 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
2883 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
2884 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
2885 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
2886 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2887 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2888 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2889 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2890 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2891 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
2892 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2893 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
2894 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
2895 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
2896 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
2897 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2898 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2899 {TGSI_OPCODE_TXD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2900 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2901 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2902 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2903 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2904 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2905 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2906 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2907 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
2908 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2909 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2910 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2911 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
2912 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
2913 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
2914 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2915 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2916 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2917 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2918 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2919 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
2920 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
2922 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2923 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2924 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
2925 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
2927 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2928 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2929 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2930 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2931 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2932 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2933 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2934 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
2935 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2937 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2938 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2939 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2940 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2941 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2942 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2943 {TGSI_OPCODE_TXF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2944 {TGSI_OPCODE_TXQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2945 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
2946 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2947 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2948 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
2949 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2950 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
2951 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2953 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2954 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2955 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2956 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2957 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2959 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2960 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2961 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2962 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2963 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2964 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2965 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2966 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2967 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
2968 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
2970 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2971 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2972 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2973 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2974 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2975 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2976 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2977 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2978 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2979 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2980 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2981 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2982 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2983 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2984 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2985 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2986 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2987 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2988 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2989 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2990 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2991 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2992 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2993 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2994 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2995 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2996 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2997 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},