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 for (i
= 0; i
< 10; i
++) {
50 for (i
= 0; i
< 32; i
++) {
51 tmp
= i
<< ((i
& 3) * 8);
52 spi_vs_out_id
[i
/ 4] |= tmp
;
54 for (i
= 0; i
< 10; i
++) {
55 r600_pipe_state_add_reg(rstate
,
56 R_028614_SPI_VS_OUT_ID_0
+ i
* 4,
57 spi_vs_out_id
[i
], 0xFFFFFFFF, NULL
);
60 r600_pipe_state_add_reg(rstate
,
61 R_0286C4_SPI_VS_OUT_CONFIG
,
62 S_0286C4_VS_EXPORT_COUNT(rshader
->noutput
- 2),
64 r600_pipe_state_add_reg(rstate
,
65 R_028868_SQ_PGM_RESOURCES_VS
,
66 S_028868_NUM_GPRS(rshader
->bc
.ngpr
) |
67 S_028868_STACK_SIZE(rshader
->bc
.nstack
),
69 r600_pipe_state_add_reg(rstate
,
70 R_0288A4_SQ_PGM_RESOURCES_FS
,
71 0x00000000, 0xFFFFFFFF, NULL
);
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_0288DC_SQ_PGM_CF_OFFSET_FS
,
77 0x00000000, 0xFFFFFFFF, NULL
);
78 r600_pipe_state_add_reg(rstate
,
79 R_028858_SQ_PGM_START_VS
,
80 r600_bo_offset(shader
->bo
) >> 8, 0xFFFFFFFF, shader
->bo
);
81 r600_pipe_state_add_reg(rstate
,
82 R_028894_SQ_PGM_START_FS
,
83 r600_bo_offset(shader
->bo
) >> 8, 0xFFFFFFFF, shader
->bo
);
85 r600_pipe_state_add_reg(rstate
,
86 R_03E200_SQ_LOOP_CONST_0
+ (32 * 4), 0x01000FFF,
91 int r600_find_vs_semantic_index(struct r600_shader
*vs
,
92 struct r600_shader
*ps
, int id
)
94 struct r600_shader_io
*input
= &ps
->input
[id
];
96 for (int i
= 0; i
< vs
->noutput
; i
++) {
97 if (input
->name
== vs
->output
[i
].name
&&
98 input
->sid
== vs
->output
[i
].sid
) {
105 static void r600_pipe_shader_ps(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
107 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
108 struct r600_pipe_state
*rstate
= &shader
->rstate
;
109 struct r600_shader
*rshader
= &shader
->shader
;
110 unsigned i
, tmp
, exports_ps
, num_cout
, spi_ps_in_control_0
, spi_input_z
;
111 boolean have_pos
= FALSE
, have_face
= FALSE
;
113 /* clear previous register */
116 for (i
= 0; i
< rshader
->ninput
; i
++) {
117 tmp
= S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx
->vs_shader
->shader
, rshader
, i
));
118 tmp
|= S_028644_SEL_CENTROID(1);
119 if (rshader
->input
[i
].name
== TGSI_SEMANTIC_POSITION
)
121 if (rshader
->input
[i
].name
== TGSI_SEMANTIC_COLOR
||
122 rshader
->input
[i
].name
== TGSI_SEMANTIC_BCOLOR
||
123 rshader
->input
[i
].name
== TGSI_SEMANTIC_POSITION
) {
124 tmp
|= S_028644_FLAT_SHADE(rshader
->flat_shade
);
126 if (rshader
->input
[i
].name
== TGSI_SEMANTIC_FACE
)
128 if (rshader
->input
[i
].name
== TGSI_SEMANTIC_GENERIC
&&
129 rctx
->sprite_coord_enable
& (1 << rshader
->input
[i
].sid
)) {
130 tmp
|= S_028644_PT_SPRITE_TEX(1);
132 r600_pipe_state_add_reg(rstate
, R_028644_SPI_PS_INPUT_CNTL_0
+ i
* 4, tmp
, 0xFFFFFFFF, NULL
);
134 for (i
= 0; i
< rshader
->noutput
; i
++) {
135 if (rshader
->input
[i
].name
== TGSI_SEMANTIC_POSITION
)
136 r600_pipe_state_add_reg(rstate
,
137 R_02880C_DB_SHADER_CONTROL
,
138 S_02880C_Z_EXPORT_ENABLE(1),
139 S_02880C_Z_EXPORT_ENABLE(1), NULL
);
144 for (i
= 0; i
< rshader
->noutput
; i
++) {
145 if (rshader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
)
147 else if (rshader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
151 exports_ps
|= S_028854_EXPORT_COLORS(num_cout
);
153 /* always at least export 1 component per pixel */
157 spi_ps_in_control_0
= S_0286CC_NUM_INTERP(rshader
->ninput
) |
158 S_0286CC_PERSP_GRADIENT_ENA(1);
161 spi_ps_in_control_0
|= S_0286CC_POSITION_ENA(1) |
162 S_0286CC_BARYC_SAMPLE_CNTL(1);
165 r600_pipe_state_add_reg(rstate
, R_0286CC_SPI_PS_IN_CONTROL_0
, spi_ps_in_control_0
, 0xFFFFFFFF, NULL
);
166 r600_pipe_state_add_reg(rstate
, R_0286D0_SPI_PS_IN_CONTROL_1
, S_0286D0_FRONT_FACE_ENA(have_face
), 0xFFFFFFFF, NULL
);
167 r600_pipe_state_add_reg(rstate
, R_0286D8_SPI_INPUT_Z
, spi_input_z
, 0xFFFFFFFF, NULL
);
168 r600_pipe_state_add_reg(rstate
,
169 R_028840_SQ_PGM_START_PS
,
170 r600_bo_offset(shader
->bo
) >> 8, 0xFFFFFFFF, shader
->bo
);
171 r600_pipe_state_add_reg(rstate
,
172 R_028850_SQ_PGM_RESOURCES_PS
,
173 S_028868_NUM_GPRS(rshader
->bc
.ngpr
) |
174 S_028868_STACK_SIZE(rshader
->bc
.nstack
),
176 r600_pipe_state_add_reg(rstate
,
177 R_028854_SQ_PGM_EXPORTS_PS
,
178 exports_ps
, 0xFFFFFFFF, NULL
);
179 r600_pipe_state_add_reg(rstate
,
180 R_0288CC_SQ_PGM_CF_OFFSET_PS
,
181 0x00000000, 0xFFFFFFFF, NULL
);
183 if (rshader
->uses_kill
) {
184 /* only set some bits here, the other bits are set in the dsa state */
185 r600_pipe_state_add_reg(rstate
,
186 R_02880C_DB_SHADER_CONTROL
,
187 S_02880C_KILL_ENABLE(1),
188 S_02880C_KILL_ENABLE(1), NULL
);
190 r600_pipe_state_add_reg(rstate
,
191 R_03E200_SQ_LOOP_CONST_0
, 0x01000FFF,
195 static int r600_pipe_shader(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
197 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
198 struct r600_shader
*rshader
= &shader
->shader
;
201 /* copy new shader */
202 if (shader
->bo
== NULL
) {
203 shader
->bo
= r600_bo(rctx
->radeon
, rshader
->bc
.ndw
* 4, 4096, 0);
204 if (shader
->bo
== NULL
) {
207 ptr
= r600_bo_map(rctx
->radeon
, shader
->bo
, 0, NULL
);
208 memcpy(ptr
, rshader
->bc
.bytecode
, rshader
->bc
.ndw
* 4);
209 r600_bo_unmap(rctx
->radeon
, shader
->bo
);
212 rshader
->flat_shade
= rctx
->flatshade
;
213 switch (rshader
->processor_type
) {
214 case TGSI_PROCESSOR_VERTEX
:
215 if (rshader
->family
>= CHIP_CEDAR
) {
216 evergreen_pipe_shader_vs(ctx
, shader
);
218 r600_pipe_shader_vs(ctx
, shader
);
221 case TGSI_PROCESSOR_FRAGMENT
:
222 if (rshader
->family
>= CHIP_CEDAR
) {
223 evergreen_pipe_shader_ps(ctx
, shader
);
225 r600_pipe_shader_ps(ctx
, shader
);
231 r600_context_pipe_state_set(&rctx
->ctx
, &shader
->rstate
);
235 static int r600_shader_update(struct pipe_context
*ctx
, struct r600_pipe_shader
*rshader
)
237 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
238 struct r600_shader
*shader
= &rshader
->shader
;
239 const struct util_format_description
*desc
;
240 enum pipe_format resource_format
[160];
241 unsigned i
, nresources
= 0;
242 struct r600_bc
*bc
= &shader
->bc
;
243 struct r600_bc_cf
*cf
;
244 struct r600_bc_vtx
*vtx
;
246 if (shader
->processor_type
!= TGSI_PROCESSOR_VERTEX
)
248 /* doing a full memcmp fell over the refcount */
249 if ((rshader
->vertex_elements
.count
== rctx
->vertex_elements
->count
) &&
250 (!memcmp(&rshader
->vertex_elements
.elements
, &rctx
->vertex_elements
->elements
, 32 * sizeof(struct pipe_vertex_element
)))) {
253 rshader
->vertex_elements
= *rctx
->vertex_elements
;
254 for (i
= 0; i
< rctx
->vertex_elements
->count
; i
++) {
255 resource_format
[nresources
++] = rctx
->vertex_elements
->elements
[i
].src_format
;
257 r600_bo_reference(rctx
->radeon
, &rshader
->bo
, NULL
);
258 LIST_FOR_EACH_ENTRY(cf
, &bc
->cf
, list
) {
260 case V_SQ_CF_WORD1_SQ_CF_INST_VTX
:
261 case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC
:
262 LIST_FOR_EACH_ENTRY(vtx
, &cf
->vtx
, list
) {
263 desc
= util_format_description(resource_format
[vtx
->buffer_id
]);
265 R600_ERR("unknown format %d\n", resource_format
[vtx
->buffer_id
]);
268 vtx
->dst_sel_x
= desc
->swizzle
[0];
269 vtx
->dst_sel_y
= desc
->swizzle
[1];
270 vtx
->dst_sel_z
= desc
->swizzle
[2];
271 vtx
->dst_sel_w
= desc
->swizzle
[3];
278 return r600_bc_build(&shader
->bc
);
281 int r600_pipe_shader_update(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
283 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
288 /* there should be enough input */
289 if (rctx
->vertex_elements
->count
< shader
->shader
.bc
.nresource
) {
290 R600_ERR("%d resources provided, expecting %d\n",
291 rctx
->vertex_elements
->count
, shader
->shader
.bc
.nresource
);
294 r
= r600_shader_update(ctx
, shader
);
297 return r600_pipe_shader(ctx
, shader
);
300 int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
);
301 int r600_pipe_shader_create(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
, const struct tgsi_token
*tokens
)
303 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
306 //fprintf(stderr, "--------------------------------------------------------------\n");
307 //tgsi_dump(tokens, 0);
308 shader
->shader
.family
= r600_get_family(rctx
->radeon
);
309 r
= r600_shader_from_tgsi(tokens
, &shader
->shader
);
311 R600_ERR("translation from TGSI failed !\n");
314 r
= r600_bc_build(&shader
->shader
.bc
);
316 R600_ERR("building bytecode failed !\n");
319 //fprintf(stderr, "______________________________________________________________\n");
324 * tgsi -> r600 shader
326 struct r600_shader_tgsi_instruction
;
328 struct r600_shader_ctx
{
329 struct tgsi_shader_info info
;
330 struct tgsi_parse_context parse
;
331 const struct tgsi_token
*tokens
;
333 unsigned file_offset
[TGSI_FILE_COUNT
];
335 struct r600_shader_tgsi_instruction
*inst_info
;
337 struct r600_shader
*shader
;
341 u32 max_driver_temp_used
;
344 struct r600_shader_tgsi_instruction
{
345 unsigned tgsi_opcode
;
347 unsigned r600_opcode
;
348 int (*process
)(struct r600_shader_ctx
*ctx
);
351 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[], eg_shader_tgsi_instruction
[];
352 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
);
354 static int tgsi_is_supported(struct r600_shader_ctx
*ctx
)
356 struct tgsi_full_instruction
*i
= &ctx
->parse
.FullToken
.FullInstruction
;
359 if (i
->Instruction
.NumDstRegs
> 1) {
360 R600_ERR("too many dst (%d)\n", i
->Instruction
.NumDstRegs
);
363 if (i
->Instruction
.Predicate
) {
364 R600_ERR("predicate unsupported\n");
368 if (i
->Instruction
.Label
) {
369 R600_ERR("label unsupported\n");
373 for (j
= 0; j
< i
->Instruction
.NumSrcRegs
; j
++) {
374 if (i
->Src
[j
].Register
.Dimension
||
375 i
->Src
[j
].Register
.Absolute
) {
376 R600_ERR("unsupported src %d (dimension %d|absolute %d)\n", j
,
377 i
->Src
[j
].Register
.Dimension
,
378 i
->Src
[j
].Register
.Absolute
);
382 for (j
= 0; j
< i
->Instruction
.NumDstRegs
; j
++) {
383 if (i
->Dst
[j
].Register
.Dimension
) {
384 R600_ERR("unsupported dst (dimension)\n");
391 static int evergreen_interp_alu(struct r600_shader_ctx
*ctx
, int gpr
)
394 struct r600_bc_alu alu
;
396 for (i
= 0; i
< 8; i
++) {
397 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
400 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW
;
402 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY
;
404 if ((i
> 1) && (i
< 6)) {
405 alu
.dst
.sel
= ctx
->shader
->input
[gpr
].gpr
;
409 alu
.dst
.chan
= i
% 4;
410 alu
.src
[0].chan
= (1 - (i
% 2));
411 alu
.src
[1].sel
= V_SQ_ALU_SRC_PARAM_BASE
+ gpr
;
413 alu
.bank_swizzle_force
= SQ_ALU_VEC_210
;
416 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
424 static int tgsi_declaration(struct r600_shader_ctx
*ctx
)
426 struct tgsi_full_declaration
*d
= &ctx
->parse
.FullToken
.FullDeclaration
;
427 struct r600_bc_vtx vtx
;
431 switch (d
->Declaration
.File
) {
432 case TGSI_FILE_INPUT
:
433 i
= ctx
->shader
->ninput
++;
434 ctx
->shader
->input
[i
].name
= d
->Semantic
.Name
;
435 ctx
->shader
->input
[i
].sid
= d
->Semantic
.Index
;
436 ctx
->shader
->input
[i
].interpolate
= d
->Declaration
.Interpolate
;
437 ctx
->shader
->input
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_INPUT
] + i
;
438 if (ctx
->type
== TGSI_PROCESSOR_VERTEX
) {
439 /* turn input into fetch */
440 memset(&vtx
, 0, sizeof(struct r600_bc_vtx
));
444 /* register containing the index into the buffer */
447 vtx
.mega_fetch_count
= 0x1F;
448 vtx
.dst_gpr
= ctx
->shader
->input
[i
].gpr
;
453 vtx
.use_const_fields
= 1;
454 r
= r600_bc_add_vtx(ctx
->bc
, &vtx
);
458 if (ctx
->type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
->bc
->chiprev
== 2) {
459 /* turn input into interpolate on EG */
460 evergreen_interp_alu(ctx
, i
);
463 case TGSI_FILE_OUTPUT
:
464 i
= ctx
->shader
->noutput
++;
465 ctx
->shader
->output
[i
].name
= d
->Semantic
.Name
;
466 ctx
->shader
->output
[i
].sid
= d
->Semantic
.Index
;
467 ctx
->shader
->output
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_OUTPUT
] + i
;
468 ctx
->shader
->output
[i
].interpolate
= d
->Declaration
.Interpolate
;
470 case TGSI_FILE_CONSTANT
:
471 case TGSI_FILE_TEMPORARY
:
472 case TGSI_FILE_SAMPLER
:
473 case TGSI_FILE_ADDRESS
:
476 R600_ERR("unsupported file %d declaration\n", d
->Declaration
.File
);
482 static int r600_get_temp(struct r600_shader_ctx
*ctx
)
484 return ctx
->temp_reg
+ ctx
->max_driver_temp_used
++;
487 int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
)
489 struct tgsi_full_immediate
*immediate
;
490 struct r600_shader_ctx ctx
;
491 struct r600_bc_output output
[32];
492 unsigned output_done
, noutput
;
496 ctx
.bc
= &shader
->bc
;
498 r
= r600_bc_init(ctx
.bc
, shader
->family
);
502 tgsi_scan_shader(tokens
, &ctx
.info
);
503 tgsi_parse_init(&ctx
.parse
, tokens
);
504 ctx
.type
= ctx
.parse
.FullHeader
.Processor
.Processor
;
505 shader
->processor_type
= ctx
.type
;
507 /* register allocations */
508 /* Values [0,127] correspond to GPR[0..127].
509 * Values [128,159] correspond to constant buffer bank 0
510 * Values [160,191] correspond to constant buffer bank 1
511 * Values [256,511] correspond to cfile constants c[0..255].
512 * Other special values are shown in the list below.
513 * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
514 * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
515 * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
516 * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
517 * 248 SQ_ALU_SRC_0: special constant 0.0.
518 * 249 SQ_ALU_SRC_1: special constant 1.0 float.
519 * 250 SQ_ALU_SRC_1_INT: special constant 1 integer.
520 * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer.
521 * 252 SQ_ALU_SRC_0_5: special constant 0.5 float.
522 * 253 SQ_ALU_SRC_LITERAL: literal constant.
523 * 254 SQ_ALU_SRC_PV: previous vector result.
524 * 255 SQ_ALU_SRC_PS: previous scalar result.
526 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
527 ctx
.file_offset
[i
] = 0;
529 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
530 ctx
.file_offset
[TGSI_FILE_INPUT
] = 1;
532 ctx
.file_offset
[TGSI_FILE_OUTPUT
] = ctx
.file_offset
[TGSI_FILE_INPUT
] +
533 ctx
.info
.file_count
[TGSI_FILE_INPUT
];
534 ctx
.file_offset
[TGSI_FILE_TEMPORARY
] = ctx
.file_offset
[TGSI_FILE_OUTPUT
] +
535 ctx
.info
.file_count
[TGSI_FILE_OUTPUT
];
537 ctx
.file_offset
[TGSI_FILE_CONSTANT
] = 128;
539 ctx
.file_offset
[TGSI_FILE_IMMEDIATE
] = 253;
540 ctx
.temp_reg
= ctx
.file_offset
[TGSI_FILE_TEMPORARY
] +
541 ctx
.info
.file_count
[TGSI_FILE_TEMPORARY
];
546 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
547 tgsi_parse_token(&ctx
.parse
);
548 switch (ctx
.parse
.FullToken
.Token
.Type
) {
549 case TGSI_TOKEN_TYPE_IMMEDIATE
:
550 immediate
= &ctx
.parse
.FullToken
.FullImmediate
;
551 ctx
.literals
= realloc(ctx
.literals
, (ctx
.nliterals
+ 1) * 16);
552 if(ctx
.literals
== NULL
) {
556 ctx
.literals
[ctx
.nliterals
* 4 + 0] = immediate
->u
[0].Uint
;
557 ctx
.literals
[ctx
.nliterals
* 4 + 1] = immediate
->u
[1].Uint
;
558 ctx
.literals
[ctx
.nliterals
* 4 + 2] = immediate
->u
[2].Uint
;
559 ctx
.literals
[ctx
.nliterals
* 4 + 3] = immediate
->u
[3].Uint
;
562 case TGSI_TOKEN_TYPE_DECLARATION
:
563 r
= tgsi_declaration(&ctx
);
567 case TGSI_TOKEN_TYPE_INSTRUCTION
:
568 r
= tgsi_is_supported(&ctx
);
571 ctx
.max_driver_temp_used
= 0;
572 /* reserve first tmp for everyone */
574 opcode
= ctx
.parse
.FullToken
.FullInstruction
.Instruction
.Opcode
;
575 if (ctx
.bc
->chiprev
== 2)
576 ctx
.inst_info
= &eg_shader_tgsi_instruction
[opcode
];
578 ctx
.inst_info
= &r600_shader_tgsi_instruction
[opcode
];
579 r
= ctx
.inst_info
->process(&ctx
);
582 r
= r600_bc_add_literal(ctx
.bc
, ctx
.value
);
587 R600_ERR("unsupported token type %d\n", ctx
.parse
.FullToken
.Token
.Type
);
593 noutput
= shader
->noutput
;
594 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
595 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
596 output
[i
].gpr
= shader
->output
[i
].gpr
;
597 output
[i
].elem_size
= 3;
598 output
[i
].swizzle_x
= 0;
599 output
[i
].swizzle_y
= 1;
600 output
[i
].swizzle_z
= 2;
601 output
[i
].swizzle_w
= 3;
602 output
[i
].barrier
= 1;
603 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
604 output
[i
].array_base
= i
- pos0
;
605 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
607 case TGSI_PROCESSOR_VERTEX
:
608 if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
609 output
[i
].array_base
= 60;
610 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
611 /* position doesn't count in array_base */
614 if (shader
->output
[i
].name
== TGSI_SEMANTIC_PSIZE
) {
615 output
[i
].array_base
= 61;
616 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
617 /* position doesn't count in array_base */
621 case TGSI_PROCESSOR_FRAGMENT
:
622 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
623 output
[i
].array_base
= shader
->output
[i
].sid
;
624 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
625 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
626 output
[i
].array_base
= 61;
627 output
[i
].swizzle_x
= 2;
628 output
[i
].swizzle_y
= output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
629 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
631 R600_ERR("unsupported fragment output name %d\n", shader
->output
[i
].name
);
637 R600_ERR("unsupported processor type %d\n", ctx
.type
);
642 /* add fake param output for vertex shader if no param is exported */
643 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
644 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
645 if (output
[i
].type
== V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
) {
651 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
653 output
[i
].elem_size
= 3;
654 output
[i
].swizzle_x
= 0;
655 output
[i
].swizzle_y
= 1;
656 output
[i
].swizzle_z
= 2;
657 output
[i
].swizzle_w
= 3;
658 output
[i
].barrier
= 1;
659 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
660 output
[i
].array_base
= 0;
661 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
665 /* add fake pixel export */
666 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& !noutput
) {
667 memset(&output
[0], 0, sizeof(struct r600_bc_output
));
669 output
[0].elem_size
= 3;
670 output
[0].swizzle_x
= 7;
671 output
[0].swizzle_y
= 7;
672 output
[0].swizzle_z
= 7;
673 output
[0].swizzle_w
= 7;
674 output
[0].barrier
= 1;
675 output
[0].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
676 output
[0].array_base
= 0;
677 output
[0].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
680 /* set export done on last export of each type */
681 for (i
= noutput
- 1, output_done
= 0; i
>= 0; i
--) {
682 if (i
== (noutput
- 1)) {
683 output
[i
].end_of_program
= 1;
685 if (!(output_done
& (1 << output
[i
].type
))) {
686 output_done
|= (1 << output
[i
].type
);
687 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE
);
690 /* add output to bytecode */
691 for (i
= 0; i
< noutput
; i
++) {
692 r
= r600_bc_add_output(ctx
.bc
, &output
[i
]);
697 tgsi_parse_free(&ctx
.parse
);
701 tgsi_parse_free(&ctx
.parse
);
705 static int tgsi_unsupported(struct r600_shader_ctx
*ctx
)
707 R600_ERR("%d tgsi opcode unsupported\n", ctx
->inst_info
->tgsi_opcode
);
711 static int tgsi_end(struct r600_shader_ctx
*ctx
)
716 static int tgsi_src(struct r600_shader_ctx
*ctx
,
717 const struct tgsi_full_src_register
*tgsi_src
,
718 struct r600_bc_alu_src
*r600_src
)
721 memset(r600_src
, 0, sizeof(struct r600_bc_alu_src
));
722 r600_src
->sel
= tgsi_src
->Register
.Index
;
723 if (tgsi_src
->Register
.File
== TGSI_FILE_IMMEDIATE
) {
725 index
= tgsi_src
->Register
.Index
;
726 ctx
->value
[0] = ctx
->literals
[index
* 4 + 0];
727 ctx
->value
[1] = ctx
->literals
[index
* 4 + 1];
728 ctx
->value
[2] = ctx
->literals
[index
* 4 + 2];
729 ctx
->value
[3] = ctx
->literals
[index
* 4 + 3];
731 if (tgsi_src
->Register
.Indirect
)
732 r600_src
->rel
= V_SQ_REL_RELATIVE
;
733 r600_src
->neg
= tgsi_src
->Register
.Negate
;
734 r600_src
->sel
+= ctx
->file_offset
[tgsi_src
->Register
.File
];
738 static int tgsi_dst(struct r600_shader_ctx
*ctx
,
739 const struct tgsi_full_dst_register
*tgsi_dst
,
741 struct r600_bc_alu_dst
*r600_dst
)
743 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
745 r600_dst
->sel
= tgsi_dst
->Register
.Index
;
746 r600_dst
->sel
+= ctx
->file_offset
[tgsi_dst
->Register
.File
];
747 r600_dst
->chan
= swizzle
;
749 if (tgsi_dst
->Register
.Indirect
)
750 r600_dst
->rel
= V_SQ_REL_RELATIVE
;
751 if (inst
->Instruction
.Saturate
) {
757 static unsigned tgsi_chan(const struct tgsi_full_src_register
*tgsi_src
, unsigned swizzle
)
761 return tgsi_src
->Register
.SwizzleX
;
763 return tgsi_src
->Register
.SwizzleY
;
765 return tgsi_src
->Register
.SwizzleZ
;
767 return tgsi_src
->Register
.SwizzleW
;
773 static int tgsi_split_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
775 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
776 struct r600_bc_alu alu
;
777 int i
, j
, k
, nconst
, r
;
779 for (i
= 0, nconst
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
780 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
783 r
= tgsi_src(ctx
, &inst
->Src
[i
], &r600_src
[i
]);
788 for (i
= 0, j
= nconst
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
789 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
790 int treg
= r600_get_temp(ctx
);
791 for (k
= 0; k
< 4; k
++) {
792 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
793 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
794 alu
.src
[0].sel
= r600_src
[i
].sel
;
801 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
805 r600_src
[i
].sel
= treg
;
812 /* need to move any immediate into a temp - for trig functions which use literal for PI stuff */
813 static int tgsi_split_literal_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
815 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
816 struct r600_bc_alu alu
;
817 int i
, j
, k
, nliteral
, r
;
819 for (i
= 0, nliteral
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
820 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_IMMEDIATE
) {
824 for (i
= 0, j
= nliteral
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
825 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_IMMEDIATE
) {
826 int treg
= r600_get_temp(ctx
);
827 for (k
= 0; k
< 4; k
++) {
828 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
829 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
830 alu
.src
[0].sel
= r600_src
[i
].sel
;
837 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
841 r
= r600_bc_add_literal(ctx
->bc
, &ctx
->literals
[inst
->Src
[i
].Register
.Index
* 4]);
844 r600_src
[i
].sel
= treg
;
851 static int tgsi_op2_s(struct r600_shader_ctx
*ctx
, int swap
)
853 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
854 struct r600_bc_alu_src r600_src
[3];
855 struct r600_bc_alu alu
;
859 for (i
= 0; i
< 4; i
++) {
860 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
)) {
865 r
= tgsi_split_constant(ctx
, r600_src
);
868 r
= tgsi_split_literal_constant(ctx
, r600_src
);
871 for (i
= 0; i
< lasti
+ 1; i
++) {
872 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
875 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
876 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
880 alu
.inst
= ctx
->inst_info
->r600_opcode
;
882 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
883 alu
.src
[j
] = r600_src
[j
];
884 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
887 alu
.src
[0] = r600_src
[1];
888 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], i
);
890 alu
.src
[1] = r600_src
[0];
891 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
893 /* handle some special cases */
894 switch (ctx
->inst_info
->tgsi_opcode
) {
895 case TGSI_OPCODE_SUB
:
898 case TGSI_OPCODE_ABS
:
907 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
914 static int tgsi_op2(struct r600_shader_ctx
*ctx
)
916 return tgsi_op2_s(ctx
, 0);
919 static int tgsi_op2_swap(struct r600_shader_ctx
*ctx
)
921 return tgsi_op2_s(ctx
, 1);
925 * r600 - trunc to -PI..PI range
926 * r700 - normalize by dividing by 2PI
929 static int tgsi_setup_trig(struct r600_shader_ctx
*ctx
,
930 struct r600_bc_alu_src r600_src
[3])
932 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
934 uint32_t lit_vals
[4];
935 struct r600_bc_alu alu
;
937 memset(lit_vals
, 0, 4*4);
938 r
= tgsi_split_constant(ctx
, r600_src
);
941 r
= tgsi_split_literal_constant(ctx
, r600_src
);
945 r
= tgsi_split_literal_constant(ctx
, r600_src
);
949 lit_vals
[0] = fui(1.0 /(3.1415926535 * 2));
950 lit_vals
[1] = fui(0.5f
);
952 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
953 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
957 alu
.dst
.sel
= ctx
->temp_reg
;
960 alu
.src
[0] = r600_src
[0];
961 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
963 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
965 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
968 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
971 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
975 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
976 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
979 alu
.dst
.sel
= ctx
->temp_reg
;
982 alu
.src
[0].sel
= ctx
->temp_reg
;
985 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
989 if (ctx
->bc
->chiprev
== 0) {
990 lit_vals
[0] = fui(3.1415926535897f
* 2.0f
);
991 lit_vals
[1] = fui(-3.1415926535897f
);
993 lit_vals
[0] = fui(1.0f
);
994 lit_vals
[1] = fui(-0.5f
);
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 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1016 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1022 static int tgsi_trig(struct r600_shader_ctx
*ctx
)
1024 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1025 struct r600_bc_alu_src r600_src
[3];
1026 struct r600_bc_alu alu
;
1030 r
= tgsi_setup_trig(ctx
, r600_src
);
1034 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1035 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1037 alu
.dst
.sel
= ctx
->temp_reg
;
1040 alu
.src
[0].sel
= ctx
->temp_reg
;
1041 alu
.src
[0].chan
= 0;
1043 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1047 /* replicate result */
1048 for (i
= 0; i
< 4; i
++) {
1049 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
))
1052 for (i
= 0; i
< lasti
+ 1; i
++) {
1053 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1056 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1057 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1059 alu
.src
[0].sel
= ctx
->temp_reg
;
1060 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1065 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1072 static int tgsi_scs(struct r600_shader_ctx
*ctx
)
1074 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1075 struct r600_bc_alu_src r600_src
[3];
1076 struct r600_bc_alu alu
;
1079 /* We'll only need the trig stuff if we are going to write to the
1080 * X or Y components of the destination vector.
1082 if (likely(inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_XY
)) {
1083 r
= tgsi_setup_trig(ctx
, r600_src
);
1089 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_X
) {
1090 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1091 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
);
1092 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1096 alu
.src
[0].sel
= ctx
->temp_reg
;
1097 alu
.src
[0].chan
= 0;
1099 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1105 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Y
) {
1106 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1107 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
);
1108 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1112 alu
.src
[0].sel
= ctx
->temp_reg
;
1113 alu
.src
[0].chan
= 0;
1115 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1121 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Z
) {
1122 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1124 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1126 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1130 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1131 alu
.src
[0].chan
= 0;
1135 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1139 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1145 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_W
) {
1146 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1148 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1150 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1154 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1155 alu
.src
[0].chan
= 0;
1159 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1163 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1171 static int tgsi_kill(struct r600_shader_ctx
*ctx
)
1173 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1174 struct r600_bc_alu alu
;
1177 for (i
= 0; i
< 4; i
++) {
1178 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1179 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1183 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1185 if (ctx
->inst_info
->tgsi_opcode
== TGSI_OPCODE_KILP
) {
1186 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1189 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1192 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1197 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1201 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1205 /* kill must be last in ALU */
1206 ctx
->bc
->force_add_cf
= 1;
1207 ctx
->shader
->uses_kill
= TRUE
;
1211 static int tgsi_lit(struct r600_shader_ctx
*ctx
)
1213 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1214 struct r600_bc_alu alu
;
1215 struct r600_bc_alu_src r600_src
[3];
1218 r
= tgsi_split_constant(ctx
, r600_src
);
1221 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1226 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1227 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1228 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
; /*1.0*/
1229 alu
.src
[0].chan
= 0;
1230 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1233 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 0) & 1;
1234 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1238 /* dst.y = max(src.x, 0.0) */
1239 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1240 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
);
1241 alu
.src
[0] = r600_src
[0];
1242 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
1243 alu
.src
[1].chan
= 0;
1244 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1247 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 1) & 1;
1248 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1253 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1254 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1255 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1256 alu
.src
[0].chan
= 0;
1257 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1260 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 3) & 1;
1262 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1266 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1270 if (inst
->Dst
[0].Register
.WriteMask
& (1 << 2))
1275 /* dst.z = log(src.y) */
1276 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1277 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
);
1278 alu
.src
[0] = r600_src
[0];
1279 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
1280 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1284 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1288 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1292 chan
= alu
.dst
.chan
;
1295 /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
1296 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1297 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT
);
1298 alu
.src
[0] = r600_src
[0];
1299 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1300 alu
.src
[1].sel
= sel
;
1301 alu
.src
[1].chan
= chan
;
1303 alu
.src
[2] = r600_src
[0];
1304 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], 0);
1305 alu
.dst
.sel
= ctx
->temp_reg
;
1310 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1314 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1317 /* dst.z = exp(tmp.x) */
1318 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1319 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1320 alu
.src
[0].sel
= ctx
->temp_reg
;
1321 alu
.src
[0].chan
= 0;
1322 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1326 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1333 static int tgsi_rsq(struct r600_shader_ctx
*ctx
)
1335 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1336 struct r600_bc_alu alu
;
1339 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1342 * For state trackers other than OpenGL, we'll want to use
1343 * _RECIPSQRT_IEEE instead.
1345 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED
);
1347 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1348 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1351 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1354 alu
.dst
.sel
= ctx
->temp_reg
;
1357 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1360 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1363 /* replicate result */
1364 return tgsi_helper_tempx_replicate(ctx
);
1367 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
)
1369 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1370 struct r600_bc_alu alu
;
1373 for (i
= 0; i
< 4; i
++) {
1374 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1375 alu
.src
[0].sel
= ctx
->temp_reg
;
1376 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1378 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1381 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1384 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1391 static int tgsi_trans_srcx_replicate(struct r600_shader_ctx
*ctx
)
1393 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1394 struct r600_bc_alu alu
;
1397 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1398 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1399 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1400 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1403 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1405 alu
.dst
.sel
= ctx
->temp_reg
;
1408 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1411 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1414 /* replicate result */
1415 return tgsi_helper_tempx_replicate(ctx
);
1418 static int tgsi_pow(struct r600_shader_ctx
*ctx
)
1420 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1421 struct r600_bc_alu alu
;
1425 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1426 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
1427 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1430 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
1431 alu
.dst
.sel
= ctx
->temp_reg
;
1434 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1437 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1441 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1442 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE
);
1443 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[0]);
1446 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], 0);
1447 alu
.src
[1].sel
= ctx
->temp_reg
;
1448 alu
.dst
.sel
= ctx
->temp_reg
;
1451 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1454 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1457 /* POW(a,b) = EXP2(b * LOG2(a))*/
1458 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1459 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1460 alu
.src
[0].sel
= ctx
->temp_reg
;
1461 alu
.dst
.sel
= ctx
->temp_reg
;
1464 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1467 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1470 return tgsi_helper_tempx_replicate(ctx
);
1473 static int tgsi_ssg(struct r600_shader_ctx
*ctx
)
1475 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1476 struct r600_bc_alu alu
;
1477 struct r600_bc_alu_src r600_src
[3];
1480 r
= tgsi_split_constant(ctx
, r600_src
);
1483 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1487 /* tmp = (src > 0 ? 1 : src) */
1488 for (i
= 0; i
< 4; i
++) {
1489 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1490 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1493 alu
.dst
.sel
= ctx
->temp_reg
;
1496 alu
.src
[0] = r600_src
[0];
1497 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1499 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1501 alu
.src
[2] = r600_src
[0];
1502 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], i
);
1505 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1509 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1513 /* dst = (-tmp > 0 ? -1 : tmp) */
1514 for (i
= 0; i
< 4; i
++) {
1515 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1516 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1518 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1522 alu
.src
[0].sel
= ctx
->temp_reg
;
1523 alu
.src
[0].chan
= i
;
1526 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1529 alu
.src
[2].sel
= ctx
->temp_reg
;
1530 alu
.src
[2].chan
= i
;
1534 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1541 static int tgsi_helper_copy(struct r600_shader_ctx
*ctx
, struct tgsi_full_instruction
*inst
)
1543 struct r600_bc_alu alu
;
1546 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1549 for (i
= 0; i
< 4; i
++) {
1550 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1551 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
1552 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
);
1555 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1556 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1559 alu
.src
[0].sel
= ctx
->temp_reg
;
1560 alu
.src
[0].chan
= i
;
1565 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1572 static int tgsi_op3(struct r600_shader_ctx
*ctx
)
1574 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1575 struct r600_bc_alu_src r600_src
[3];
1576 struct r600_bc_alu alu
;
1579 r
= tgsi_split_constant(ctx
, r600_src
);
1582 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1585 /* do it in 2 step as op3 doesn't support writemask */
1586 for (i
= 0; i
< 4; i
++) {
1587 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1588 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1589 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1590 alu
.src
[j
] = r600_src
[j
];
1591 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1593 alu
.dst
.sel
= ctx
->temp_reg
;
1600 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1604 return tgsi_helper_copy(ctx
, inst
);
1607 static int tgsi_dp(struct r600_shader_ctx
*ctx
)
1609 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1610 struct r600_bc_alu_src r600_src
[3];
1611 struct r600_bc_alu alu
;
1614 r
= tgsi_split_constant(ctx
, r600_src
);
1617 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1620 for (i
= 0; i
< 4; i
++) {
1621 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1622 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1623 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1624 alu
.src
[j
] = r600_src
[j
];
1625 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1627 alu
.dst
.sel
= ctx
->temp_reg
;
1630 /* handle some special cases */
1631 switch (ctx
->inst_info
->tgsi_opcode
) {
1632 case TGSI_OPCODE_DP2
:
1634 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1635 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1638 case TGSI_OPCODE_DP3
:
1640 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1641 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1644 case TGSI_OPCODE_DPH
:
1646 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1647 alu
.src
[0].chan
= 0;
1657 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1661 return tgsi_helper_copy(ctx
, inst
);
1664 static int tgsi_tex(struct r600_shader_ctx
*ctx
)
1666 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1667 struct r600_bc_tex tex
;
1668 struct r600_bc_alu alu
;
1672 boolean src_not_temp
= inst
->Src
[0].Register
.File
!= TGSI_FILE_TEMPORARY
;
1673 uint32_t lit_vals
[4];
1675 src_gpr
= ctx
->file_offset
[inst
->Src
[0].Register
.File
] + inst
->Src
[0].Register
.Index
;
1677 if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXP
) {
1678 /* Add perspective divide */
1679 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1680 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1681 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1685 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1686 alu
.dst
.sel
= ctx
->temp_reg
;
1690 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1694 for (i
= 0; i
< 3; i
++) {
1695 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1696 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1697 alu
.src
[0].sel
= ctx
->temp_reg
;
1698 alu
.src
[0].chan
= 3;
1699 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1702 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1703 alu
.dst
.sel
= ctx
->temp_reg
;
1706 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1710 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1711 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1712 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1713 alu
.src
[0].chan
= 0;
1714 alu
.dst
.sel
= ctx
->temp_reg
;
1718 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1721 src_not_temp
= FALSE
;
1722 src_gpr
= ctx
->temp_reg
;
1725 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1726 int src_chan
, src2_chan
;
1728 /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
1729 for (i
= 0; i
< 4; i
++) {
1730 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1731 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE
);
1755 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1758 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], src_chan
);
1759 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1762 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], src2_chan
);
1763 alu
.dst
.sel
= ctx
->temp_reg
;
1768 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1773 /* tmp1.z = RCP_e(|tmp1.z|) */
1774 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1775 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1776 alu
.src
[0].sel
= ctx
->temp_reg
;
1777 alu
.src
[0].chan
= 2;
1779 alu
.dst
.sel
= ctx
->temp_reg
;
1783 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1787 /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x
1788 * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x
1789 * muladd has no writemask, have to use another temp
1791 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1792 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1795 alu
.src
[0].sel
= ctx
->temp_reg
;
1796 alu
.src
[0].chan
= 0;
1797 alu
.src
[1].sel
= ctx
->temp_reg
;
1798 alu
.src
[1].chan
= 2;
1800 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1801 alu
.src
[2].chan
= 0;
1803 alu
.dst
.sel
= ctx
->temp_reg
;
1807 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1811 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1812 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1815 alu
.src
[0].sel
= ctx
->temp_reg
;
1816 alu
.src
[0].chan
= 1;
1817 alu
.src
[1].sel
= ctx
->temp_reg
;
1818 alu
.src
[1].chan
= 2;
1820 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1821 alu
.src
[2].chan
= 0;
1823 alu
.dst
.sel
= ctx
->temp_reg
;
1828 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1832 lit_vals
[0] = fui(1.5f
);
1834 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1837 src_not_temp
= FALSE
;
1838 src_gpr
= ctx
->temp_reg
;
1842 for (i
= 0; i
< 4; i
++) {
1843 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1844 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1845 alu
.src
[0].sel
= src_gpr
;
1846 alu
.src
[0].chan
= i
;
1847 alu
.dst
.sel
= ctx
->temp_reg
;
1852 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1856 src_gpr
= ctx
->temp_reg
;
1859 opcode
= ctx
->inst_info
->r600_opcode
;
1860 if (opcode
== SQ_TEX_INST_SAMPLE
&&
1861 (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
))
1862 opcode
= SQ_TEX_INST_SAMPLE_C
;
1864 memset(&tex
, 0, sizeof(struct r600_bc_tex
));
1866 tex
.resource_id
= ctx
->file_offset
[inst
->Src
[1].Register
.File
] + inst
->Src
[1].Register
.Index
;
1867 tex
.sampler_id
= tex
.resource_id
;
1868 tex
.src_gpr
= src_gpr
;
1869 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
1870 tex
.dst_sel_x
= (inst
->Dst
[0].Register
.WriteMask
& 1) ? 0 : 7;
1871 tex
.dst_sel_y
= (inst
->Dst
[0].Register
.WriteMask
& 2) ? 1 : 7;
1872 tex
.dst_sel_z
= (inst
->Dst
[0].Register
.WriteMask
& 4) ? 2 : 7;
1873 tex
.dst_sel_w
= (inst
->Dst
[0].Register
.WriteMask
& 8) ? 3 : 7;
1879 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1886 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
) {
1887 tex
.coord_type_x
= 1;
1888 tex
.coord_type_y
= 1;
1889 tex
.coord_type_z
= 1;
1890 tex
.coord_type_w
= 1;
1893 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
)
1896 r
= r600_bc_add_tex(ctx
->bc
, &tex
);
1900 /* add shadow ambient support - gallium doesn't do it yet */
1905 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
1907 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1908 struct r600_bc_alu_src r600_src
[3];
1909 struct r600_bc_alu alu
;
1913 r
= tgsi_split_constant(ctx
, r600_src
);
1916 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1920 for (i
= 0; i
< 4; i
++) {
1921 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1922 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1923 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1924 alu
.src
[0].chan
= 0;
1925 alu
.src
[1] = r600_src
[0];
1926 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1928 alu
.dst
.sel
= ctx
->temp_reg
;
1934 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1938 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1942 /* (1 - src0) * src2 */
1943 for (i
= 0; i
< 4; i
++) {
1944 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1945 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1946 alu
.src
[0].sel
= ctx
->temp_reg
;
1947 alu
.src
[0].chan
= i
;
1948 alu
.src
[1] = r600_src
[2];
1949 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
1950 alu
.dst
.sel
= ctx
->temp_reg
;
1956 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1960 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1964 /* src0 * src1 + (1 - src0) * src2 */
1965 for (i
= 0; i
< 4; i
++) {
1966 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1967 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1969 alu
.src
[0] = r600_src
[0];
1970 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1971 alu
.src
[1] = r600_src
[1];
1972 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
1973 alu
.src
[2].sel
= ctx
->temp_reg
;
1974 alu
.src
[2].chan
= i
;
1975 alu
.dst
.sel
= ctx
->temp_reg
;
1980 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1984 return tgsi_helper_copy(ctx
, inst
);
1987 static int tgsi_cmp(struct r600_shader_ctx
*ctx
)
1989 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1990 struct r600_bc_alu_src r600_src
[3];
1991 struct r600_bc_alu alu
;
1995 r
= tgsi_split_constant(ctx
, r600_src
);
1998 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2002 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
2005 for (i
= 0; i
< 4; i
++) {
2006 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2007 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE
);
2008 alu
.src
[0] = r600_src
[0];
2009 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2011 alu
.src
[1] = r600_src
[2];
2012 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
2014 alu
.src
[2] = r600_src
[1];
2015 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[1], i
);
2018 alu
.dst
.sel
= ctx
->temp_reg
;
2020 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2029 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2034 return tgsi_helper_copy(ctx
, inst
);
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
);
2102 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2107 for (i
= 0; i
< 4; i
++) {
2108 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2109 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
2111 alu
.src
[0] = r600_src
[0];
2114 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
2117 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 2);
2120 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2123 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2124 alu
.src
[0].chan
= i
;
2127 alu
.src
[1] = r600_src
[1];
2130 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2133 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2136 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2139 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2140 alu
.src
[1].chan
= i
;
2143 alu
.src
[2].sel
= ctx
->temp_reg
;
2145 alu
.src
[2].chan
= i
;
2148 alu
.dst
.sel
= ctx
->temp_reg
;
2150 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2159 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2163 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2168 return tgsi_helper_copy(ctx
, inst
);
2172 static int tgsi_exp(struct r600_shader_ctx
*ctx
)
2174 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2175 struct r600_bc_alu_src r600_src
[3];
2176 struct r600_bc_alu alu
;
2179 /* result.x = 2^floor(src); */
2180 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2181 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2183 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2184 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2188 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2190 alu
.dst
.sel
= ctx
->temp_reg
;
2194 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2198 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2202 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2203 alu
.src
[0].sel
= ctx
->temp_reg
;
2204 alu
.src
[0].chan
= 0;
2206 alu
.dst
.sel
= ctx
->temp_reg
;
2210 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2214 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2219 /* result.y = tmp - floor(tmp); */
2220 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2221 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2223 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
2224 alu
.src
[0] = r600_src
[0];
2225 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2228 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2230 alu
.dst
.sel
= ctx
->temp_reg
;
2231 // r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
2239 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2242 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2247 /* result.z = RoughApprox2ToX(tmp);*/
2248 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 0x1) {
2249 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2250 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2251 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2254 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2256 alu
.dst
.sel
= ctx
->temp_reg
;
2262 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2265 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2270 /* result.w = 1.0;*/
2271 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 0x1) {
2272 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2274 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2275 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2276 alu
.src
[0].chan
= 0;
2278 alu
.dst
.sel
= ctx
->temp_reg
;
2282 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2285 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2289 return tgsi_helper_copy(ctx
, inst
);
2292 static int tgsi_log(struct r600_shader_ctx
*ctx
)
2294 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2295 struct r600_bc_alu alu
;
2298 /* result.x = floor(log2(src)); */
2299 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2300 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2302 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2303 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2307 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2309 alu
.dst
.sel
= ctx
->temp_reg
;
2313 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2317 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2321 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2322 alu
.src
[0].sel
= ctx
->temp_reg
;
2323 alu
.src
[0].chan
= 0;
2325 alu
.dst
.sel
= ctx
->temp_reg
;
2330 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2334 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2339 /* result.y = src.x / (2 ^ floor(log2(src.x))); */
2340 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2341 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2343 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2344 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2348 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2350 alu
.dst
.sel
= ctx
->temp_reg
;
2355 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2359 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2363 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2365 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2366 alu
.src
[0].sel
= ctx
->temp_reg
;
2367 alu
.src
[0].chan
= 1;
2369 alu
.dst
.sel
= ctx
->temp_reg
;
2374 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2378 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2382 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2384 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2385 alu
.src
[0].sel
= ctx
->temp_reg
;
2386 alu
.src
[0].chan
= 1;
2388 alu
.dst
.sel
= ctx
->temp_reg
;
2393 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2397 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2401 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2403 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
2404 alu
.src
[0].sel
= ctx
->temp_reg
;
2405 alu
.src
[0].chan
= 1;
2407 alu
.dst
.sel
= ctx
->temp_reg
;
2412 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2416 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2420 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2422 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2424 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2428 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2430 alu
.src
[1].sel
= ctx
->temp_reg
;
2431 alu
.src
[1].chan
= 1;
2433 alu
.dst
.sel
= ctx
->temp_reg
;
2438 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2442 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2447 /* result.z = log2(src);*/
2448 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 1) {
2449 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2451 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2452 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2456 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2458 alu
.dst
.sel
= ctx
->temp_reg
;
2463 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2467 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2472 /* result.w = 1.0; */
2473 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 1) {
2474 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2476 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2477 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2478 alu
.src
[0].chan
= 0;
2480 alu
.dst
.sel
= ctx
->temp_reg
;
2485 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2489 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2494 return tgsi_helper_copy(ctx
, inst
);
2497 /* r6/7 only for now */
2498 static int tgsi_arl(struct r600_shader_ctx
*ctx
)
2500 /* TODO from r600c, ar values don't persist between clauses */
2501 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2502 struct r600_bc_alu alu
;
2504 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2506 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR
;
2508 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2511 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2515 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2518 ctx
->bc
->cf_last
->r6xx_uses_waterfall
= 1;
2522 static int tgsi_opdst(struct r600_shader_ctx
*ctx
)
2524 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2525 struct r600_bc_alu alu
;
2528 for (i
= 0; i
< 4; i
++) {
2529 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2531 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2532 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2536 if (i
== 0 || i
== 3) {
2537 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2539 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2542 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2545 if (i
== 0 || i
== 2) {
2546 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
2548 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[1]);
2551 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
2555 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2562 static int emit_logic_pred(struct r600_shader_ctx
*ctx
, int opcode
)
2564 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2565 struct r600_bc_alu alu
;
2568 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2572 alu
.dst
.sel
= ctx
->temp_reg
;
2576 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2579 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2580 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2581 alu
.src
[1].chan
= 0;
2585 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE
));
2591 static int pops(struct r600_shader_ctx
*ctx
, int pops
)
2593 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP
));
2594 ctx
->bc
->cf_last
->pop_count
= pops
;
2598 static inline void callstack_decrease_current(struct r600_shader_ctx
*ctx
, unsigned reason
)
2602 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2606 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
-= 4;
2609 /* TOODO : for 16 vp asic should -= 2; */
2610 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2615 static inline void callstack_check_depth(struct r600_shader_ctx
*ctx
, unsigned reason
, unsigned check_max_only
)
2617 if (check_max_only
) {
2630 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
) >
2631 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2632 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2633 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
;
2639 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2643 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+= 4;
2646 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2650 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
) >
2651 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2652 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2653 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
;
2657 static void fc_set_mid(struct r600_shader_ctx
*ctx
, int fc_sp
)
2659 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[fc_sp
];
2661 sp
->mid
= (struct r600_bc_cf
**)realloc((void *)sp
->mid
,
2662 sizeof(struct r600_bc_cf
*) * (sp
->num_mid
+ 1));
2663 sp
->mid
[sp
->num_mid
] = ctx
->bc
->cf_last
;
2667 static void fc_pushlevel(struct r600_shader_ctx
*ctx
, int type
)
2670 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
= type
;
2671 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
= ctx
->bc
->cf_last
;
2674 static void fc_poplevel(struct r600_shader_ctx
*ctx
)
2676 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
];
2688 static int emit_return(struct r600_shader_ctx
*ctx
)
2690 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_RETURN
);
2694 static int emit_jump_to_offset(struct r600_shader_ctx
*ctx
, int pops
, int offset
)
2697 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_JUMP
);
2698 ctx
->bc
->cf_last
->pop_count
= pops
;
2699 /* TODO work out offset */
2703 static int emit_setret_in_loop_flag(struct r600_shader_ctx
*ctx
, unsigned flag_value
)
2708 static void emit_testflag(struct r600_shader_ctx
*ctx
)
2713 static void emit_return_on_flag(struct r600_shader_ctx
*ctx
, unsigned ifidx
)
2716 emit_jump_to_offset(ctx
, 1, 4);
2717 emit_setret_in_loop_flag(ctx
, V_SQ_ALU_SRC_0
);
2718 pops(ctx
, ifidx
+ 1);
2722 static void break_loop_on_flag(struct r600_shader_ctx
*ctx
, unsigned fc_sp
)
2726 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2727 ctx
->bc
->cf_last
->pop_count
= 1;
2729 fc_set_mid(ctx
, fc_sp
);
2735 static int tgsi_if(struct r600_shader_ctx
*ctx
)
2737 emit_logic_pred(ctx
, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE
));
2739 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
2741 fc_pushlevel(ctx
, FC_IF
);
2743 callstack_check_depth(ctx
, FC_PUSH_VPM
, 0);
2747 static int tgsi_else(struct r600_shader_ctx
*ctx
)
2749 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE
));
2750 ctx
->bc
->cf_last
->pop_count
= 1;
2752 fc_set_mid(ctx
, ctx
->bc
->fc_sp
);
2753 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
;
2757 static int tgsi_endif(struct r600_shader_ctx
*ctx
)
2760 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_IF
) {
2761 R600_ERR("if/endif unbalanced in shader\n");
2765 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
== NULL
) {
2766 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2767 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->pop_count
= 1;
2769 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[0]->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2773 callstack_decrease_current(ctx
, FC_PUSH_VPM
);
2777 static int tgsi_bgnloop(struct r600_shader_ctx
*ctx
)
2779 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL
));
2781 fc_pushlevel(ctx
, FC_LOOP
);
2783 /* check stack depth */
2784 callstack_check_depth(ctx
, FC_LOOP
, 0);
2788 static int tgsi_endloop(struct r600_shader_ctx
*ctx
)
2792 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END
));
2794 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_LOOP
) {
2795 R600_ERR("loop/endloop in shader code are not paired.\n");
2799 /* fixup loop pointers - from r600isa
2800 LOOP END points to CF after LOOP START,
2801 LOOP START point to CF after LOOP END
2802 BRK/CONT point to LOOP END CF
2804 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->id
+ 2;
2806 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2808 for (i
= 0; i
< ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].num_mid
; i
++) {
2809 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[i
]->cf_addr
= ctx
->bc
->cf_last
->id
;
2811 /* TODO add LOOPRET support */
2813 callstack_decrease_current(ctx
, FC_LOOP
);
2817 static int tgsi_loop_brk_cont(struct r600_shader_ctx
*ctx
)
2821 for (fscp
= ctx
->bc
->fc_sp
; fscp
> 0; fscp
--)
2823 if (FC_LOOP
== ctx
->bc
->fc_stack
[fscp
].type
)
2828 R600_ERR("Break not inside loop/endloop pair\n");
2832 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2833 ctx
->bc
->cf_last
->pop_count
= 1;
2835 fc_set_mid(ctx
, fscp
);
2838 callstack_check_depth(ctx
, FC_PUSH_VPM
, 1);
2842 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
2843 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_arl
},
2844 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2845 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
2848 * For state trackers other than OpenGL, we'll want to use
2849 * _RECIP_IEEE instead.
2851 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED
, tgsi_trans_srcx_replicate
},
2853 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_rsq
},
2854 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
2855 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
2856 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
2857 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2858 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2859 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2860 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
2861 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
2862 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
2863 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
2864 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
2865 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
2866 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2867 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
2868 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2870 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2871 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2873 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2874 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2875 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
2876 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2877 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
2878 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2879 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
2880 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
2881 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
2882 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
2884 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2885 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2886 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2887 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2888 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
2889 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
2890 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
2891 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
2892 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2893 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2894 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2895 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2896 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2897 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
2898 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2899 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
2900 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
2901 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
2902 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
2903 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2904 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2905 {TGSI_OPCODE_TXD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2906 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2907 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2908 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2909 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2910 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2911 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2912 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2913 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2914 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2915 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2916 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2917 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
2918 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
2919 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
2920 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2921 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2922 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2923 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2924 {TGSI_OPCODE_TXL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2925 {TGSI_OPCODE_BRK
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
2926 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
2928 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2929 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2930 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
2931 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
2933 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2934 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2935 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2936 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2937 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2938 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2939 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2940 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
2941 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2943 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2944 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2945 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2946 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2947 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2948 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2949 {TGSI_OPCODE_TXF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2950 {TGSI_OPCODE_TXQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2951 {TGSI_OPCODE_CONT
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
2952 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2953 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2954 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
2955 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2956 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
2957 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2959 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2960 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2961 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2962 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2963 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2965 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2966 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2967 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2968 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2969 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2970 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2971 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2972 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2973 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
2974 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
2976 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2977 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2978 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2979 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2980 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2981 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2982 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2983 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2984 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2985 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2986 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2987 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2988 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2989 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2990 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2991 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2992 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2993 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2994 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2995 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2996 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2997 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2998 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2999 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3000 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3001 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3002 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3003 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3006 static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction
[] = {
3007 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3008 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3009 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
3010 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
3011 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_trans_srcx_replicate
},
3012 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
3013 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3014 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
3015 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3016 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3017 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3018 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
3019 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
3020 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
3021 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
3022 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
3023 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
3024 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3025 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
3026 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3028 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3029 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3031 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3032 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3033 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
3034 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3035 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
3036 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3037 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
3038 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
3039 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
3040 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
3042 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3043 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3044 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3045 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3046 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
3047 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
3048 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
3049 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
3050 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3051 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3052 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3053 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3054 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3055 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
3056 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3057 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
3058 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
3059 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
3060 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
3061 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3062 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3063 {TGSI_OPCODE_TXD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3064 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3065 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3066 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3067 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3068 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3069 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3070 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3071 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3072 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3073 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3074 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3075 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
3076 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
3077 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
3078 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3079 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3080 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3081 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3082 {TGSI_OPCODE_TXL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3083 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
3084 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
3086 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3087 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3088 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
3089 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
3091 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3092 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3093 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3094 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3095 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3096 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3097 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3098 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
3099 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3101 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3102 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3103 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3104 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3105 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3106 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3107 {TGSI_OPCODE_TXF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3108 {TGSI_OPCODE_TXQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3109 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
3110 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3111 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3112 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
3113 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3114 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
3115 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3117 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3118 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3119 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3120 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3121 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3123 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3124 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3125 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3126 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3127 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3128 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3129 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3130 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3131 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
3132 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
3134 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3135 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3136 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3137 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3138 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3139 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3140 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3141 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3142 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3143 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3144 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3145 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3146 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3147 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3148 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3149 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3150 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3151 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3152 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3153 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3154 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3155 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3156 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3157 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3158 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3159 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3160 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3161 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},