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
->output
[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
);
140 if (rshader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
)
141 r600_pipe_state_add_reg(rstate
,
142 R_02880C_DB_SHADER_CONTROL
,
143 S_02880C_STENCIL_REF_EXPORT_ENABLE(1),
144 S_02880C_STENCIL_REF_EXPORT_ENABLE(1), NULL
);
149 for (i
= 0; i
< rshader
->noutput
; i
++) {
150 if (rshader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
|| rshader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
)
152 else if (rshader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
156 exports_ps
|= S_028854_EXPORT_COLORS(num_cout
);
158 /* always at least export 1 component per pixel */
162 spi_ps_in_control_0
= S_0286CC_NUM_INTERP(rshader
->ninput
) |
163 S_0286CC_PERSP_GRADIENT_ENA(1);
166 spi_ps_in_control_0
|= S_0286CC_POSITION_ENA(1) |
167 S_0286CC_BARYC_SAMPLE_CNTL(1);
170 r600_pipe_state_add_reg(rstate
, R_0286CC_SPI_PS_IN_CONTROL_0
, spi_ps_in_control_0
, 0xFFFFFFFF, NULL
);
171 r600_pipe_state_add_reg(rstate
, R_0286D0_SPI_PS_IN_CONTROL_1
, S_0286D0_FRONT_FACE_ENA(have_face
), 0xFFFFFFFF, NULL
);
172 r600_pipe_state_add_reg(rstate
, R_0286D8_SPI_INPUT_Z
, spi_input_z
, 0xFFFFFFFF, NULL
);
173 r600_pipe_state_add_reg(rstate
,
174 R_028840_SQ_PGM_START_PS
,
175 r600_bo_offset(shader
->bo
) >> 8, 0xFFFFFFFF, shader
->bo
);
176 r600_pipe_state_add_reg(rstate
,
177 R_028850_SQ_PGM_RESOURCES_PS
,
178 S_028868_NUM_GPRS(rshader
->bc
.ngpr
) |
179 S_028868_STACK_SIZE(rshader
->bc
.nstack
),
181 r600_pipe_state_add_reg(rstate
,
182 R_028854_SQ_PGM_EXPORTS_PS
,
183 exports_ps
, 0xFFFFFFFF, NULL
);
184 r600_pipe_state_add_reg(rstate
,
185 R_0288CC_SQ_PGM_CF_OFFSET_PS
,
186 0x00000000, 0xFFFFFFFF, NULL
);
188 if (rshader
->uses_kill
) {
189 /* only set some bits here, the other bits are set in the dsa state */
190 r600_pipe_state_add_reg(rstate
,
191 R_02880C_DB_SHADER_CONTROL
,
192 S_02880C_KILL_ENABLE(1),
193 S_02880C_KILL_ENABLE(1), NULL
);
195 r600_pipe_state_add_reg(rstate
,
196 R_03E200_SQ_LOOP_CONST_0
, 0x01000FFF,
200 static int r600_pipe_shader(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
202 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
203 struct r600_shader
*rshader
= &shader
->shader
;
206 /* copy new shader */
207 if (shader
->bo
== NULL
) {
208 shader
->bo
= r600_bo(rctx
->radeon
, rshader
->bc
.ndw
* 4, 4096, 0);
209 if (shader
->bo
== NULL
) {
212 ptr
= r600_bo_map(rctx
->radeon
, shader
->bo
, 0, NULL
);
213 memcpy(ptr
, rshader
->bc
.bytecode
, rshader
->bc
.ndw
* 4);
214 r600_bo_unmap(rctx
->radeon
, shader
->bo
);
217 rshader
->flat_shade
= rctx
->flatshade
;
218 switch (rshader
->processor_type
) {
219 case TGSI_PROCESSOR_VERTEX
:
220 if (rshader
->family
>= CHIP_CEDAR
) {
221 evergreen_pipe_shader_vs(ctx
, shader
);
223 r600_pipe_shader_vs(ctx
, shader
);
226 case TGSI_PROCESSOR_FRAGMENT
:
227 if (rshader
->family
>= CHIP_CEDAR
) {
228 evergreen_pipe_shader_ps(ctx
, shader
);
230 r600_pipe_shader_ps(ctx
, shader
);
236 r600_context_pipe_state_set(&rctx
->ctx
, &shader
->rstate
);
240 static int r600_shader_update(struct pipe_context
*ctx
, struct r600_pipe_shader
*rshader
)
242 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
243 struct r600_shader
*shader
= &rshader
->shader
;
244 const struct util_format_description
*desc
;
245 enum pipe_format resource_format
[160];
246 unsigned i
, nresources
= 0;
247 struct r600_bc
*bc
= &shader
->bc
;
248 struct r600_bc_cf
*cf
;
249 struct r600_bc_vtx
*vtx
;
251 if (shader
->processor_type
!= TGSI_PROCESSOR_VERTEX
)
253 /* doing a full memcmp fell over the refcount */
254 if ((rshader
->vertex_elements
.count
== rctx
->vertex_elements
->count
) &&
255 (!memcmp(&rshader
->vertex_elements
.elements
, &rctx
->vertex_elements
->elements
, 32 * sizeof(struct pipe_vertex_element
)))) {
258 rshader
->vertex_elements
= *rctx
->vertex_elements
;
259 for (i
= 0; i
< rctx
->vertex_elements
->count
; i
++) {
260 resource_format
[nresources
++] = rctx
->vertex_elements
->elements
[i
].src_format
;
262 r600_bo_reference(rctx
->radeon
, &rshader
->bo
, NULL
);
263 LIST_FOR_EACH_ENTRY(cf
, &bc
->cf
, list
) {
265 case V_SQ_CF_WORD1_SQ_CF_INST_VTX
:
266 case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC
:
267 LIST_FOR_EACH_ENTRY(vtx
, &cf
->vtx
, list
) {
268 desc
= util_format_description(resource_format
[vtx
->buffer_id
]);
270 R600_ERR("unknown format %d\n", resource_format
[vtx
->buffer_id
]);
273 vtx
->dst_sel_x
= desc
->swizzle
[0];
274 vtx
->dst_sel_y
= desc
->swizzle
[1];
275 vtx
->dst_sel_z
= desc
->swizzle
[2];
276 vtx
->dst_sel_w
= desc
->swizzle
[3];
283 return r600_bc_build(&shader
->bc
);
286 int r600_pipe_shader_update(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
288 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
293 /* there should be enough input */
294 if (rctx
->vertex_elements
->count
< shader
->shader
.bc
.nresource
) {
295 R600_ERR("%d resources provided, expecting %d\n",
296 rctx
->vertex_elements
->count
, shader
->shader
.bc
.nresource
);
299 r
= r600_shader_update(ctx
, shader
);
302 return r600_pipe_shader(ctx
, shader
);
305 int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
);
306 int r600_pipe_shader_create(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
, const struct tgsi_token
*tokens
)
308 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
311 //fprintf(stderr, "--------------------------------------------------------------\n");
312 //tgsi_dump(tokens, 0);
313 shader
->shader
.family
= r600_get_family(rctx
->radeon
);
314 r
= r600_shader_from_tgsi(tokens
, &shader
->shader
);
316 R600_ERR("translation from TGSI failed !\n");
319 r
= r600_bc_build(&shader
->shader
.bc
);
321 R600_ERR("building bytecode failed !\n");
324 //fprintf(stderr, "______________________________________________________________\n");
329 * tgsi -> r600 shader
331 struct r600_shader_tgsi_instruction
;
333 struct r600_shader_ctx
{
334 struct tgsi_shader_info info
;
335 struct tgsi_parse_context parse
;
336 const struct tgsi_token
*tokens
;
338 unsigned file_offset
[TGSI_FILE_COUNT
];
340 struct r600_shader_tgsi_instruction
*inst_info
;
342 struct r600_shader
*shader
;
346 u32 max_driver_temp_used
;
349 struct r600_shader_tgsi_instruction
{
350 unsigned tgsi_opcode
;
352 unsigned r600_opcode
;
353 int (*process
)(struct r600_shader_ctx
*ctx
);
356 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[], eg_shader_tgsi_instruction
[];
357 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
);
359 static int tgsi_is_supported(struct r600_shader_ctx
*ctx
)
361 struct tgsi_full_instruction
*i
= &ctx
->parse
.FullToken
.FullInstruction
;
364 if (i
->Instruction
.NumDstRegs
> 1) {
365 R600_ERR("too many dst (%d)\n", i
->Instruction
.NumDstRegs
);
368 if (i
->Instruction
.Predicate
) {
369 R600_ERR("predicate unsupported\n");
373 if (i
->Instruction
.Label
) {
374 R600_ERR("label unsupported\n");
378 for (j
= 0; j
< i
->Instruction
.NumSrcRegs
; j
++) {
379 if (i
->Src
[j
].Register
.Dimension
||
380 i
->Src
[j
].Register
.Absolute
) {
381 R600_ERR("unsupported src %d (dimension %d|absolute %d)\n", j
,
382 i
->Src
[j
].Register
.Dimension
,
383 i
->Src
[j
].Register
.Absolute
);
387 for (j
= 0; j
< i
->Instruction
.NumDstRegs
; j
++) {
388 if (i
->Dst
[j
].Register
.Dimension
) {
389 R600_ERR("unsupported dst (dimension)\n");
396 static int evergreen_interp_alu(struct r600_shader_ctx
*ctx
, int gpr
)
399 struct r600_bc_alu alu
;
401 for (i
= 0; i
< 8; i
++) {
402 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
405 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW
;
407 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY
;
409 if ((i
> 1) && (i
< 6)) {
410 alu
.dst
.sel
= ctx
->shader
->input
[gpr
].gpr
;
414 alu
.dst
.chan
= i
% 4;
415 alu
.src
[0].chan
= (1 - (i
% 2));
416 alu
.src
[1].sel
= V_SQ_ALU_SRC_PARAM_BASE
+ gpr
;
418 alu
.bank_swizzle_force
= SQ_ALU_VEC_210
;
421 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
429 static int tgsi_declaration(struct r600_shader_ctx
*ctx
)
431 struct tgsi_full_declaration
*d
= &ctx
->parse
.FullToken
.FullDeclaration
;
432 struct r600_bc_vtx vtx
;
436 switch (d
->Declaration
.File
) {
437 case TGSI_FILE_INPUT
:
438 i
= ctx
->shader
->ninput
++;
439 ctx
->shader
->input
[i
].name
= d
->Semantic
.Name
;
440 ctx
->shader
->input
[i
].sid
= d
->Semantic
.Index
;
441 ctx
->shader
->input
[i
].interpolate
= d
->Declaration
.Interpolate
;
442 ctx
->shader
->input
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_INPUT
] + i
;
443 if (ctx
->type
== TGSI_PROCESSOR_VERTEX
) {
444 /* turn input into fetch */
445 memset(&vtx
, 0, sizeof(struct r600_bc_vtx
));
449 /* register containing the index into the buffer */
452 vtx
.mega_fetch_count
= 0x1F;
453 vtx
.dst_gpr
= ctx
->shader
->input
[i
].gpr
;
458 vtx
.use_const_fields
= 1;
459 r
= r600_bc_add_vtx(ctx
->bc
, &vtx
);
463 if (ctx
->type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
->bc
->chiprev
== 2) {
464 /* turn input into interpolate on EG */
465 evergreen_interp_alu(ctx
, i
);
468 case TGSI_FILE_OUTPUT
:
469 i
= ctx
->shader
->noutput
++;
470 ctx
->shader
->output
[i
].name
= d
->Semantic
.Name
;
471 ctx
->shader
->output
[i
].sid
= d
->Semantic
.Index
;
472 ctx
->shader
->output
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_OUTPUT
] + i
;
473 ctx
->shader
->output
[i
].interpolate
= d
->Declaration
.Interpolate
;
475 case TGSI_FILE_CONSTANT
:
476 case TGSI_FILE_TEMPORARY
:
477 case TGSI_FILE_SAMPLER
:
478 case TGSI_FILE_ADDRESS
:
481 R600_ERR("unsupported file %d declaration\n", d
->Declaration
.File
);
487 static int r600_get_temp(struct r600_shader_ctx
*ctx
)
489 return ctx
->temp_reg
+ ctx
->max_driver_temp_used
++;
492 int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
)
494 struct tgsi_full_immediate
*immediate
;
495 struct r600_shader_ctx ctx
;
496 struct r600_bc_output output
[32];
497 unsigned output_done
, noutput
;
501 ctx
.bc
= &shader
->bc
;
503 r
= r600_bc_init(ctx
.bc
, shader
->family
);
507 tgsi_scan_shader(tokens
, &ctx
.info
);
508 tgsi_parse_init(&ctx
.parse
, tokens
);
509 ctx
.type
= ctx
.parse
.FullHeader
.Processor
.Processor
;
510 shader
->processor_type
= ctx
.type
;
512 /* register allocations */
513 /* Values [0,127] correspond to GPR[0..127].
514 * Values [128,159] correspond to constant buffer bank 0
515 * Values [160,191] correspond to constant buffer bank 1
516 * Values [256,511] correspond to cfile constants c[0..255].
517 * Other special values are shown in the list below.
518 * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
519 * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
520 * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
521 * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
522 * 248 SQ_ALU_SRC_0: special constant 0.0.
523 * 249 SQ_ALU_SRC_1: special constant 1.0 float.
524 * 250 SQ_ALU_SRC_1_INT: special constant 1 integer.
525 * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer.
526 * 252 SQ_ALU_SRC_0_5: special constant 0.5 float.
527 * 253 SQ_ALU_SRC_LITERAL: literal constant.
528 * 254 SQ_ALU_SRC_PV: previous vector result.
529 * 255 SQ_ALU_SRC_PS: previous scalar result.
531 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
532 ctx
.file_offset
[i
] = 0;
534 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
535 ctx
.file_offset
[TGSI_FILE_INPUT
] = 1;
537 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
.bc
->chiprev
== 2) {
538 ctx
.file_offset
[TGSI_FILE_INPUT
] = 1;
540 ctx
.file_offset
[TGSI_FILE_OUTPUT
] = ctx
.file_offset
[TGSI_FILE_INPUT
] +
541 ctx
.info
.file_count
[TGSI_FILE_INPUT
];
542 ctx
.file_offset
[TGSI_FILE_TEMPORARY
] = ctx
.file_offset
[TGSI_FILE_OUTPUT
] +
543 ctx
.info
.file_count
[TGSI_FILE_OUTPUT
];
545 ctx
.file_offset
[TGSI_FILE_CONSTANT
] = 128;
547 ctx
.file_offset
[TGSI_FILE_IMMEDIATE
] = 253;
548 ctx
.temp_reg
= ctx
.file_offset
[TGSI_FILE_TEMPORARY
] +
549 ctx
.info
.file_count
[TGSI_FILE_TEMPORARY
];
554 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
555 tgsi_parse_token(&ctx
.parse
);
556 switch (ctx
.parse
.FullToken
.Token
.Type
) {
557 case TGSI_TOKEN_TYPE_IMMEDIATE
:
558 immediate
= &ctx
.parse
.FullToken
.FullImmediate
;
559 ctx
.literals
= realloc(ctx
.literals
, (ctx
.nliterals
+ 1) * 16);
560 if(ctx
.literals
== NULL
) {
564 ctx
.literals
[ctx
.nliterals
* 4 + 0] = immediate
->u
[0].Uint
;
565 ctx
.literals
[ctx
.nliterals
* 4 + 1] = immediate
->u
[1].Uint
;
566 ctx
.literals
[ctx
.nliterals
* 4 + 2] = immediate
->u
[2].Uint
;
567 ctx
.literals
[ctx
.nliterals
* 4 + 3] = immediate
->u
[3].Uint
;
570 case TGSI_TOKEN_TYPE_DECLARATION
:
571 r
= tgsi_declaration(&ctx
);
575 case TGSI_TOKEN_TYPE_INSTRUCTION
:
576 r
= tgsi_is_supported(&ctx
);
579 ctx
.max_driver_temp_used
= 0;
580 /* reserve first tmp for everyone */
582 opcode
= ctx
.parse
.FullToken
.FullInstruction
.Instruction
.Opcode
;
583 if (ctx
.bc
->chiprev
== 2)
584 ctx
.inst_info
= &eg_shader_tgsi_instruction
[opcode
];
586 ctx
.inst_info
= &r600_shader_tgsi_instruction
[opcode
];
587 r
= ctx
.inst_info
->process(&ctx
);
590 r
= r600_bc_add_literal(ctx
.bc
, ctx
.value
);
595 R600_ERR("unsupported token type %d\n", ctx
.parse
.FullToken
.Token
.Type
);
601 noutput
= shader
->noutput
;
602 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
603 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
604 output
[i
].gpr
= shader
->output
[i
].gpr
;
605 output
[i
].elem_size
= 3;
606 output
[i
].swizzle_x
= 0;
607 output
[i
].swizzle_y
= 1;
608 output
[i
].swizzle_z
= 2;
609 output
[i
].swizzle_w
= 3;
610 output
[i
].barrier
= 1;
611 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
612 output
[i
].array_base
= i
- pos0
;
613 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
615 case TGSI_PROCESSOR_VERTEX
:
616 if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
617 output
[i
].array_base
= 60;
618 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
619 /* position doesn't count in array_base */
622 if (shader
->output
[i
].name
== TGSI_SEMANTIC_PSIZE
) {
623 output
[i
].array_base
= 61;
624 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
625 /* position doesn't count in array_base */
629 case TGSI_PROCESSOR_FRAGMENT
:
630 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
631 output
[i
].array_base
= shader
->output
[i
].sid
;
632 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
633 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
634 output
[i
].array_base
= 61;
635 output
[i
].swizzle_x
= 2;
636 output
[i
].swizzle_y
= 7;
637 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
638 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
639 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
) {
640 output
[i
].array_base
= 61;
641 output
[i
].swizzle_x
= 7;
642 output
[i
].swizzle_y
= 1;
643 output
[i
].swizzle_z
= output
[i
].swizzle_w
= 7;
644 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
646 R600_ERR("unsupported fragment output name %d\n", shader
->output
[i
].name
);
652 R600_ERR("unsupported processor type %d\n", ctx
.type
);
657 /* add fake param output for vertex shader if no param is exported */
658 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
659 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
660 if (output
[i
].type
== V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
) {
666 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
668 output
[i
].elem_size
= 3;
669 output
[i
].swizzle_x
= 0;
670 output
[i
].swizzle_y
= 1;
671 output
[i
].swizzle_z
= 2;
672 output
[i
].swizzle_w
= 3;
673 output
[i
].barrier
= 1;
674 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
675 output
[i
].array_base
= 0;
676 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
680 /* add fake pixel export */
681 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& !noutput
) {
682 memset(&output
[0], 0, sizeof(struct r600_bc_output
));
684 output
[0].elem_size
= 3;
685 output
[0].swizzle_x
= 7;
686 output
[0].swizzle_y
= 7;
687 output
[0].swizzle_z
= 7;
688 output
[0].swizzle_w
= 7;
689 output
[0].barrier
= 1;
690 output
[0].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
691 output
[0].array_base
= 0;
692 output
[0].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
695 /* set export done on last export of each type */
696 for (i
= noutput
- 1, output_done
= 0; i
>= 0; i
--) {
697 if (i
== (noutput
- 1)) {
698 output
[i
].end_of_program
= 1;
700 if (!(output_done
& (1 << output
[i
].type
))) {
701 output_done
|= (1 << output
[i
].type
);
702 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE
);
705 /* add output to bytecode */
706 for (i
= 0; i
< noutput
; i
++) {
707 r
= r600_bc_add_output(ctx
.bc
, &output
[i
]);
712 tgsi_parse_free(&ctx
.parse
);
716 tgsi_parse_free(&ctx
.parse
);
720 static int tgsi_unsupported(struct r600_shader_ctx
*ctx
)
722 R600_ERR("%d tgsi opcode unsupported\n", ctx
->inst_info
->tgsi_opcode
);
726 static int tgsi_end(struct r600_shader_ctx
*ctx
)
731 static int tgsi_src(struct r600_shader_ctx
*ctx
,
732 const struct tgsi_full_src_register
*tgsi_src
,
733 struct r600_bc_alu_src
*r600_src
)
736 memset(r600_src
, 0, sizeof(struct r600_bc_alu_src
));
737 r600_src
->sel
= tgsi_src
->Register
.Index
;
738 if (tgsi_src
->Register
.File
== TGSI_FILE_IMMEDIATE
) {
740 index
= tgsi_src
->Register
.Index
;
741 ctx
->value
[0] = ctx
->literals
[index
* 4 + 0];
742 ctx
->value
[1] = ctx
->literals
[index
* 4 + 1];
743 ctx
->value
[2] = ctx
->literals
[index
* 4 + 2];
744 ctx
->value
[3] = ctx
->literals
[index
* 4 + 3];
746 if (tgsi_src
->Register
.Indirect
)
747 r600_src
->rel
= V_SQ_REL_RELATIVE
;
748 r600_src
->neg
= tgsi_src
->Register
.Negate
;
749 r600_src
->sel
+= ctx
->file_offset
[tgsi_src
->Register
.File
];
753 static int tgsi_dst(struct r600_shader_ctx
*ctx
,
754 const struct tgsi_full_dst_register
*tgsi_dst
,
756 struct r600_bc_alu_dst
*r600_dst
)
758 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
760 r600_dst
->sel
= tgsi_dst
->Register
.Index
;
761 r600_dst
->sel
+= ctx
->file_offset
[tgsi_dst
->Register
.File
];
762 r600_dst
->chan
= swizzle
;
764 if (tgsi_dst
->Register
.Indirect
)
765 r600_dst
->rel
= V_SQ_REL_RELATIVE
;
766 if (inst
->Instruction
.Saturate
) {
772 static unsigned tgsi_chan(const struct tgsi_full_src_register
*tgsi_src
, unsigned swizzle
)
776 return tgsi_src
->Register
.SwizzleX
;
778 return tgsi_src
->Register
.SwizzleY
;
780 return tgsi_src
->Register
.SwizzleZ
;
782 return tgsi_src
->Register
.SwizzleW
;
788 static int tgsi_split_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
790 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
791 struct r600_bc_alu alu
;
792 int i
, j
, k
, nconst
, r
;
794 for (i
= 0, nconst
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
795 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
798 r
= tgsi_src(ctx
, &inst
->Src
[i
], &r600_src
[i
]);
803 for (i
= 0, j
= nconst
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
804 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
805 int treg
= r600_get_temp(ctx
);
806 for (k
= 0; k
< 4; k
++) {
807 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
808 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
809 alu
.src
[0].sel
= r600_src
[i
].sel
;
816 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
820 r600_src
[i
].sel
= treg
;
827 /* need to move any immediate into a temp - for trig functions which use literal for PI stuff */
828 static int tgsi_split_literal_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
830 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
831 struct r600_bc_alu alu
;
832 int i
, j
, k
, nliteral
, r
;
834 for (i
= 0, nliteral
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
835 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_IMMEDIATE
) {
839 for (i
= 0, j
= nliteral
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
840 if (j
> 0 && inst
->Src
[i
].Register
.File
== TGSI_FILE_IMMEDIATE
) {
841 int treg
= r600_get_temp(ctx
);
842 for (k
= 0; k
< 4; k
++) {
843 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
844 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
845 alu
.src
[0].sel
= r600_src
[i
].sel
;
852 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
856 r
= r600_bc_add_literal(ctx
->bc
, &ctx
->literals
[inst
->Src
[i
].Register
.Index
* 4]);
859 r600_src
[i
].sel
= treg
;
866 static int tgsi_op2_s(struct r600_shader_ctx
*ctx
, int swap
)
868 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
869 struct r600_bc_alu_src r600_src
[3];
870 struct r600_bc_alu alu
;
874 for (i
= 0; i
< 4; i
++) {
875 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
)) {
880 r
= tgsi_split_constant(ctx
, r600_src
);
883 r
= tgsi_split_literal_constant(ctx
, r600_src
);
886 for (i
= 0; i
< lasti
+ 1; i
++) {
887 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
890 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
891 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
895 alu
.inst
= ctx
->inst_info
->r600_opcode
;
897 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
898 alu
.src
[j
] = r600_src
[j
];
899 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
902 alu
.src
[0] = r600_src
[1];
903 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], i
);
905 alu
.src
[1] = r600_src
[0];
906 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
908 /* handle some special cases */
909 switch (ctx
->inst_info
->tgsi_opcode
) {
910 case TGSI_OPCODE_SUB
:
913 case TGSI_OPCODE_ABS
:
922 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
929 static int tgsi_op2(struct r600_shader_ctx
*ctx
)
931 return tgsi_op2_s(ctx
, 0);
934 static int tgsi_op2_swap(struct r600_shader_ctx
*ctx
)
936 return tgsi_op2_s(ctx
, 1);
940 * r600 - trunc to -PI..PI range
941 * r700 - normalize by dividing by 2PI
944 static int tgsi_setup_trig(struct r600_shader_ctx
*ctx
,
945 struct r600_bc_alu_src r600_src
[3])
947 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
949 uint32_t lit_vals
[4];
950 struct r600_bc_alu alu
;
952 memset(lit_vals
, 0, 4*4);
953 r
= tgsi_split_constant(ctx
, r600_src
);
956 r
= tgsi_split_literal_constant(ctx
, r600_src
);
960 r
= tgsi_split_literal_constant(ctx
, r600_src
);
964 lit_vals
[0] = fui(1.0 /(3.1415926535 * 2));
965 lit_vals
[1] = fui(0.5f
);
967 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
968 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
972 alu
.dst
.sel
= ctx
->temp_reg
;
975 alu
.src
[0] = r600_src
[0];
976 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
978 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
980 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
983 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
986 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
990 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
991 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
994 alu
.dst
.sel
= ctx
->temp_reg
;
997 alu
.src
[0].sel
= ctx
->temp_reg
;
1000 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1004 if (ctx
->bc
->chiprev
== 0) {
1005 lit_vals
[0] = fui(3.1415926535897f
* 2.0f
);
1006 lit_vals
[1] = fui(-3.1415926535897f
);
1008 lit_vals
[0] = fui(1.0f
);
1009 lit_vals
[1] = fui(-0.5f
);
1012 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1013 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1017 alu
.dst
.sel
= ctx
->temp_reg
;
1020 alu
.src
[0].sel
= ctx
->temp_reg
;
1021 alu
.src
[0].chan
= 0;
1023 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
1024 alu
.src
[1].chan
= 0;
1025 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1026 alu
.src
[2].chan
= 1;
1028 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1031 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1037 static int tgsi_trig(struct r600_shader_ctx
*ctx
)
1039 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1040 struct r600_bc_alu_src r600_src
[3];
1041 struct r600_bc_alu alu
;
1045 r
= tgsi_setup_trig(ctx
, r600_src
);
1049 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1050 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1052 alu
.dst
.sel
= ctx
->temp_reg
;
1055 alu
.src
[0].sel
= ctx
->temp_reg
;
1056 alu
.src
[0].chan
= 0;
1058 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1062 /* replicate result */
1063 for (i
= 0; i
< 4; i
++) {
1064 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
))
1067 for (i
= 0; i
< lasti
+ 1; i
++) {
1068 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1071 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1072 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1074 alu
.src
[0].sel
= ctx
->temp_reg
;
1075 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1080 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1087 static int tgsi_scs(struct r600_shader_ctx
*ctx
)
1089 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1090 struct r600_bc_alu_src r600_src
[3];
1091 struct r600_bc_alu alu
;
1094 /* We'll only need the trig stuff if we are going to write to the
1095 * X or Y components of the destination vector.
1097 if (likely(inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_XY
)) {
1098 r
= tgsi_setup_trig(ctx
, r600_src
);
1104 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_X
) {
1105 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1106 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
);
1107 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1111 alu
.src
[0].sel
= ctx
->temp_reg
;
1112 alu
.src
[0].chan
= 0;
1114 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1120 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Y
) {
1121 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1122 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
);
1123 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1127 alu
.src
[0].sel
= ctx
->temp_reg
;
1128 alu
.src
[0].chan
= 0;
1130 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1136 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Z
) {
1137 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1139 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1141 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1145 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1146 alu
.src
[0].chan
= 0;
1150 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1154 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1160 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_W
) {
1161 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1163 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1165 r
= 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
);
1178 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1186 static int tgsi_kill(struct r600_shader_ctx
*ctx
)
1188 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1189 struct r600_bc_alu alu
;
1192 for (i
= 0; i
< 4; i
++) {
1193 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1194 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1198 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1200 if (ctx
->inst_info
->tgsi_opcode
== TGSI_OPCODE_KILP
) {
1201 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1204 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1207 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1212 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1216 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1220 /* kill must be last in ALU */
1221 ctx
->bc
->force_add_cf
= 1;
1222 ctx
->shader
->uses_kill
= TRUE
;
1226 static int tgsi_lit(struct r600_shader_ctx
*ctx
)
1228 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1229 struct r600_bc_alu alu
;
1230 struct r600_bc_alu_src r600_src
[3];
1233 r
= tgsi_split_constant(ctx
, r600_src
);
1236 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1241 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1242 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1243 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
; /*1.0*/
1244 alu
.src
[0].chan
= 0;
1245 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1248 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 0) & 1;
1249 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1253 /* dst.y = max(src.x, 0.0) */
1254 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1255 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
);
1256 alu
.src
[0] = r600_src
[0];
1257 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
1258 alu
.src
[1].chan
= 0;
1259 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1262 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 1) & 1;
1263 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1268 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1269 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1270 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1271 alu
.src
[0].chan
= 0;
1272 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1275 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 3) & 1;
1277 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1281 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1285 if (inst
->Dst
[0].Register
.WriteMask
& (1 << 2))
1290 /* dst.z = log(src.y) */
1291 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1292 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
);
1293 alu
.src
[0] = r600_src
[0];
1294 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
1295 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1299 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1303 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1307 chan
= alu
.dst
.chan
;
1310 /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
1311 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1312 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT
);
1313 alu
.src
[0] = r600_src
[0];
1314 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1315 alu
.src
[1].sel
= sel
;
1316 alu
.src
[1].chan
= chan
;
1318 alu
.src
[2] = r600_src
[0];
1319 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], 0);
1320 alu
.dst
.sel
= ctx
->temp_reg
;
1325 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1329 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1332 /* dst.z = exp(tmp.x) */
1333 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1334 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1335 alu
.src
[0].sel
= ctx
->temp_reg
;
1336 alu
.src
[0].chan
= 0;
1337 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1341 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1348 static int tgsi_rsq(struct r600_shader_ctx
*ctx
)
1350 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1351 struct r600_bc_alu alu
;
1354 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1357 * For state trackers other than OpenGL, we'll want to use
1358 * _RECIPSQRT_IEEE instead.
1360 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED
);
1362 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1363 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1366 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1369 alu
.dst
.sel
= ctx
->temp_reg
;
1372 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1375 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1378 /* replicate result */
1379 return tgsi_helper_tempx_replicate(ctx
);
1382 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
)
1384 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1385 struct r600_bc_alu alu
;
1388 for (i
= 0; i
< 4; i
++) {
1389 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1390 alu
.src
[0].sel
= ctx
->temp_reg
;
1391 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1393 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1396 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1399 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1406 static int tgsi_trans_srcx_replicate(struct r600_shader_ctx
*ctx
)
1408 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1409 struct r600_bc_alu alu
;
1412 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1413 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1414 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1415 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1418 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1420 alu
.dst
.sel
= ctx
->temp_reg
;
1423 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1426 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1429 /* replicate result */
1430 return tgsi_helper_tempx_replicate(ctx
);
1433 static int tgsi_pow(struct r600_shader_ctx
*ctx
)
1435 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1436 struct r600_bc_alu alu
;
1440 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1441 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
1442 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1445 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
1446 alu
.dst
.sel
= ctx
->temp_reg
;
1449 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1452 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1456 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1457 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE
);
1458 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[0]);
1461 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], 0);
1462 alu
.src
[1].sel
= ctx
->temp_reg
;
1463 alu
.dst
.sel
= ctx
->temp_reg
;
1466 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1469 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1472 /* POW(a,b) = EXP2(b * LOG2(a))*/
1473 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1474 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1475 alu
.src
[0].sel
= ctx
->temp_reg
;
1476 alu
.dst
.sel
= ctx
->temp_reg
;
1479 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1482 r
= r600_bc_add_literal(ctx
->bc
,ctx
->value
);
1485 return tgsi_helper_tempx_replicate(ctx
);
1488 static int tgsi_ssg(struct r600_shader_ctx
*ctx
)
1490 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1491 struct r600_bc_alu alu
;
1492 struct r600_bc_alu_src r600_src
[3];
1495 r
= tgsi_split_constant(ctx
, r600_src
);
1498 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1502 /* tmp = (src > 0 ? 1 : src) */
1503 for (i
= 0; i
< 4; i
++) {
1504 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1505 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1508 alu
.dst
.sel
= ctx
->temp_reg
;
1511 alu
.src
[0] = r600_src
[0];
1512 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1514 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1516 alu
.src
[2] = r600_src
[0];
1517 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], i
);
1520 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1524 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1528 /* dst = (-tmp > 0 ? -1 : tmp) */
1529 for (i
= 0; i
< 4; i
++) {
1530 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1531 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
1533 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1537 alu
.src
[0].sel
= ctx
->temp_reg
;
1538 alu
.src
[0].chan
= i
;
1541 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1544 alu
.src
[2].sel
= ctx
->temp_reg
;
1545 alu
.src
[2].chan
= i
;
1549 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1556 static int tgsi_helper_copy(struct r600_shader_ctx
*ctx
, struct tgsi_full_instruction
*inst
)
1558 struct r600_bc_alu alu
;
1561 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1564 for (i
= 0; i
< 4; i
++) {
1565 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1566 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
1567 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
);
1570 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1571 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1574 alu
.src
[0].sel
= ctx
->temp_reg
;
1575 alu
.src
[0].chan
= i
;
1580 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1587 static int tgsi_op3(struct r600_shader_ctx
*ctx
)
1589 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1590 struct r600_bc_alu_src r600_src
[3];
1591 struct r600_bc_alu alu
;
1594 r
= tgsi_split_constant(ctx
, r600_src
);
1597 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1600 /* do it in 2 step as op3 doesn't support writemask */
1601 for (i
= 0; i
< 4; i
++) {
1602 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1603 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1604 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1605 alu
.src
[j
] = r600_src
[j
];
1606 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1608 alu
.dst
.sel
= ctx
->temp_reg
;
1615 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1619 return tgsi_helper_copy(ctx
, inst
);
1622 static int tgsi_dp(struct r600_shader_ctx
*ctx
)
1624 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1625 struct r600_bc_alu_src r600_src
[3];
1626 struct r600_bc_alu alu
;
1629 r
= tgsi_split_constant(ctx
, r600_src
);
1632 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1635 for (i
= 0; i
< 4; i
++) {
1636 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1637 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1638 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1639 alu
.src
[j
] = r600_src
[j
];
1640 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1642 alu
.dst
.sel
= ctx
->temp_reg
;
1645 /* handle some special cases */
1646 switch (ctx
->inst_info
->tgsi_opcode
) {
1647 case TGSI_OPCODE_DP2
:
1649 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1650 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1653 case TGSI_OPCODE_DP3
:
1655 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1656 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1659 case TGSI_OPCODE_DPH
:
1661 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1662 alu
.src
[0].chan
= 0;
1672 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1676 return tgsi_helper_copy(ctx
, inst
);
1679 static int tgsi_tex(struct r600_shader_ctx
*ctx
)
1681 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1682 struct r600_bc_tex tex
;
1683 struct r600_bc_alu alu
;
1687 boolean src_not_temp
= inst
->Src
[0].Register
.File
!= TGSI_FILE_TEMPORARY
;
1688 uint32_t lit_vals
[4];
1690 src_gpr
= ctx
->file_offset
[inst
->Src
[0].Register
.File
] + inst
->Src
[0].Register
.Index
;
1692 if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXP
) {
1693 /* Add perspective divide */
1694 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1695 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1696 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1700 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1701 alu
.dst
.sel
= ctx
->temp_reg
;
1705 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1709 for (i
= 0; i
< 3; i
++) {
1710 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1711 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1712 alu
.src
[0].sel
= ctx
->temp_reg
;
1713 alu
.src
[0].chan
= 3;
1714 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1717 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1718 alu
.dst
.sel
= ctx
->temp_reg
;
1721 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1725 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1726 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1727 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1728 alu
.src
[0].chan
= 0;
1729 alu
.dst
.sel
= ctx
->temp_reg
;
1733 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1736 src_not_temp
= FALSE
;
1737 src_gpr
= ctx
->temp_reg
;
1740 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1741 int src_chan
, src2_chan
;
1743 /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
1744 for (i
= 0; i
< 4; i
++) {
1745 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1746 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE
);
1770 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1773 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], src_chan
);
1774 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
1777 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], src2_chan
);
1778 alu
.dst
.sel
= ctx
->temp_reg
;
1783 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1788 /* tmp1.z = RCP_e(|tmp1.z|) */
1789 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1790 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
1791 alu
.src
[0].sel
= ctx
->temp_reg
;
1792 alu
.src
[0].chan
= 2;
1794 alu
.dst
.sel
= ctx
->temp_reg
;
1798 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1802 /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x
1803 * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x
1804 * muladd has no writemask, have to use another temp
1806 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1807 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1810 alu
.src
[0].sel
= ctx
->temp_reg
;
1811 alu
.src
[0].chan
= 0;
1812 alu
.src
[1].sel
= ctx
->temp_reg
;
1813 alu
.src
[1].chan
= 2;
1815 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1816 alu
.src
[2].chan
= 0;
1818 alu
.dst
.sel
= ctx
->temp_reg
;
1822 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1826 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1827 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1830 alu
.src
[0].sel
= ctx
->temp_reg
;
1831 alu
.src
[0].chan
= 1;
1832 alu
.src
[1].sel
= ctx
->temp_reg
;
1833 alu
.src
[1].chan
= 2;
1835 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1836 alu
.src
[2].chan
= 0;
1838 alu
.dst
.sel
= ctx
->temp_reg
;
1843 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1847 lit_vals
[0] = fui(1.5f
);
1849 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
1852 src_not_temp
= FALSE
;
1853 src_gpr
= ctx
->temp_reg
;
1857 for (i
= 0; i
< 4; i
++) {
1858 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1859 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1860 alu
.src
[0].sel
= src_gpr
;
1861 alu
.src
[0].chan
= i
;
1862 alu
.dst
.sel
= ctx
->temp_reg
;
1867 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1871 src_gpr
= ctx
->temp_reg
;
1874 opcode
= ctx
->inst_info
->r600_opcode
;
1875 if (opcode
== SQ_TEX_INST_SAMPLE
&&
1876 (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
))
1877 opcode
= SQ_TEX_INST_SAMPLE_C
;
1879 memset(&tex
, 0, sizeof(struct r600_bc_tex
));
1881 tex
.sampler_id
= ctx
->file_offset
[inst
->Src
[1].Register
.File
] + inst
->Src
[1].Register
.Index
;
1882 tex
.resource_id
= tex
.sampler_id
;
1883 if (ctx
->shader
->processor_type
== TGSI_PROCESSOR_VERTEX
)
1884 tex
.resource_id
+= PIPE_MAX_ATTRIBS
;
1885 tex
.src_gpr
= src_gpr
;
1886 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
1887 tex
.dst_sel_x
= (inst
->Dst
[0].Register
.WriteMask
& 1) ? 0 : 7;
1888 tex
.dst_sel_y
= (inst
->Dst
[0].Register
.WriteMask
& 2) ? 1 : 7;
1889 tex
.dst_sel_z
= (inst
->Dst
[0].Register
.WriteMask
& 4) ? 2 : 7;
1890 tex
.dst_sel_w
= (inst
->Dst
[0].Register
.WriteMask
& 8) ? 3 : 7;
1896 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
1903 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
) {
1904 tex
.coord_type_x
= 1;
1905 tex
.coord_type_y
= 1;
1906 tex
.coord_type_z
= 1;
1907 tex
.coord_type_w
= 1;
1910 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
|| inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
)
1913 r
= r600_bc_add_tex(ctx
->bc
, &tex
);
1917 /* add shadow ambient support - gallium doesn't do it yet */
1922 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
1924 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1925 struct r600_bc_alu_src r600_src
[3];
1926 struct r600_bc_alu alu
;
1930 r
= tgsi_split_constant(ctx
, r600_src
);
1933 r
= tgsi_split_literal_constant(ctx
, r600_src
);
1937 for (i
= 0; i
< 4; i
++) {
1938 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1939 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
1940 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1941 alu
.src
[0].chan
= 0;
1942 alu
.src
[1] = r600_src
[0];
1943 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1945 alu
.dst
.sel
= ctx
->temp_reg
;
1951 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1955 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1959 /* (1 - src0) * src2 */
1960 for (i
= 0; i
< 4; i
++) {
1961 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1962 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
1963 alu
.src
[0].sel
= ctx
->temp_reg
;
1964 alu
.src
[0].chan
= i
;
1965 alu
.src
[1] = r600_src
[2];
1966 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
1967 alu
.dst
.sel
= ctx
->temp_reg
;
1973 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1977 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1981 /* src0 * src1 + (1 - src0) * src2 */
1982 for (i
= 0; i
< 4; i
++) {
1983 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1984 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1986 alu
.src
[0] = r600_src
[0];
1987 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1988 alu
.src
[1] = r600_src
[1];
1989 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
1990 alu
.src
[2].sel
= ctx
->temp_reg
;
1991 alu
.src
[2].chan
= i
;
1992 alu
.dst
.sel
= ctx
->temp_reg
;
1997 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2001 return tgsi_helper_copy(ctx
, inst
);
2004 static int tgsi_cmp(struct r600_shader_ctx
*ctx
)
2006 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2007 struct r600_bc_alu_src r600_src
[3];
2008 struct r600_bc_alu alu
;
2012 r
= tgsi_split_constant(ctx
, r600_src
);
2015 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2019 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
2022 for (i
= 0; i
< 4; i
++) {
2023 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2024 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE
);
2025 alu
.src
[0] = r600_src
[0];
2026 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2028 alu
.src
[1] = r600_src
[2];
2029 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
2031 alu
.src
[2] = r600_src
[1];
2032 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[1], i
);
2035 alu
.dst
.sel
= ctx
->temp_reg
;
2037 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2046 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2051 return tgsi_helper_copy(ctx
, inst
);
2055 static int tgsi_xpd(struct r600_shader_ctx
*ctx
)
2057 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2058 struct r600_bc_alu_src r600_src
[3];
2059 struct r600_bc_alu alu
;
2060 uint32_t use_temp
= 0;
2063 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
2066 r
= tgsi_split_constant(ctx
, r600_src
);
2069 r
= tgsi_split_literal_constant(ctx
, r600_src
);
2073 for (i
= 0; i
< 4; i
++) {
2074 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2075 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2077 alu
.src
[0] = r600_src
[0];
2080 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 2);
2083 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2086 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
2089 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2090 alu
.src
[0].chan
= i
;
2093 alu
.src
[1] = r600_src
[1];
2096 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2099 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2102 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2105 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2106 alu
.src
[1].chan
= i
;
2109 alu
.dst
.sel
= ctx
->temp_reg
;
2115 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2119 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2124 for (i
= 0; i
< 4; i
++) {
2125 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2126 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
2128 alu
.src
[0] = r600_src
[0];
2131 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
2134 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 2);
2137 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2140 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2141 alu
.src
[0].chan
= i
;
2144 alu
.src
[1] = r600_src
[1];
2147 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 2);
2150 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 0);
2153 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], 1);
2156 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2157 alu
.src
[1].chan
= i
;
2160 alu
.src
[2].sel
= ctx
->temp_reg
;
2162 alu
.src
[2].chan
= i
;
2165 alu
.dst
.sel
= ctx
->temp_reg
;
2167 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2176 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2180 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2185 return tgsi_helper_copy(ctx
, inst
);
2189 static int tgsi_exp(struct r600_shader_ctx
*ctx
)
2191 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2192 struct r600_bc_alu_src r600_src
[3];
2193 struct r600_bc_alu alu
;
2196 /* result.x = 2^floor(src); */
2197 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2198 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2200 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2201 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2205 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2207 alu
.dst
.sel
= ctx
->temp_reg
;
2211 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2215 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2219 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2220 alu
.src
[0].sel
= ctx
->temp_reg
;
2221 alu
.src
[0].chan
= 0;
2223 alu
.dst
.sel
= ctx
->temp_reg
;
2227 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2231 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2236 /* result.y = tmp - floor(tmp); */
2237 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2238 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2240 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
2241 alu
.src
[0] = r600_src
[0];
2242 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2245 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2247 alu
.dst
.sel
= ctx
->temp_reg
;
2248 // r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
2256 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2259 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2264 /* result.z = RoughApprox2ToX(tmp);*/
2265 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 0x1) {
2266 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2267 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2268 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2271 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2273 alu
.dst
.sel
= ctx
->temp_reg
;
2279 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2282 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2287 /* result.w = 1.0;*/
2288 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 0x1) {
2289 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2291 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2292 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2293 alu
.src
[0].chan
= 0;
2295 alu
.dst
.sel
= ctx
->temp_reg
;
2299 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2302 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2306 return tgsi_helper_copy(ctx
, inst
);
2309 static int tgsi_log(struct r600_shader_ctx
*ctx
)
2311 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2312 struct r600_bc_alu alu
;
2315 /* result.x = floor(log2(src)); */
2316 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
2317 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2319 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2320 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2324 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2326 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
);
2338 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2339 alu
.src
[0].sel
= ctx
->temp_reg
;
2340 alu
.src
[0].chan
= 0;
2342 alu
.dst
.sel
= ctx
->temp_reg
;
2347 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2351 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2356 /* result.y = src.x / (2 ^ floor(log2(src.x))); */
2357 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
2358 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2360 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2361 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2365 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2367 alu
.dst
.sel
= ctx
->temp_reg
;
2372 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2376 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2380 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2382 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
2383 alu
.src
[0].sel
= ctx
->temp_reg
;
2384 alu
.src
[0].chan
= 1;
2386 alu
.dst
.sel
= ctx
->temp_reg
;
2391 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2395 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2399 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2401 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2402 alu
.src
[0].sel
= ctx
->temp_reg
;
2403 alu
.src
[0].chan
= 1;
2405 alu
.dst
.sel
= ctx
->temp_reg
;
2410 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2414 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2418 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2420 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
2421 alu
.src
[0].sel
= ctx
->temp_reg
;
2422 alu
.src
[0].chan
= 1;
2424 alu
.dst
.sel
= ctx
->temp_reg
;
2429 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2433 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2437 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2439 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2441 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2445 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2447 alu
.src
[1].sel
= ctx
->temp_reg
;
2448 alu
.src
[1].chan
= 1;
2450 alu
.dst
.sel
= ctx
->temp_reg
;
2455 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2459 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2464 /* result.z = log2(src);*/
2465 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 1) {
2466 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2468 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2469 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2473 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2475 alu
.dst
.sel
= ctx
->temp_reg
;
2480 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2484 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2489 /* result.w = 1.0; */
2490 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 1) {
2491 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2493 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2494 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2495 alu
.src
[0].chan
= 0;
2497 alu
.dst
.sel
= ctx
->temp_reg
;
2502 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2506 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
2511 return tgsi_helper_copy(ctx
, inst
);
2514 /* r6/7 only for now */
2515 static int tgsi_arl(struct r600_shader_ctx
*ctx
)
2517 /* TODO from r600c, ar values don't persist between clauses */
2518 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2519 struct r600_bc_alu alu
;
2521 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2523 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR
;
2525 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2528 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2532 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
));
2535 ctx
->bc
->cf_last
->r6xx_uses_waterfall
= 1;
2539 static int tgsi_opdst(struct r600_shader_ctx
*ctx
)
2541 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2542 struct r600_bc_alu alu
;
2545 for (i
= 0; i
< 4; i
++) {
2546 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2548 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2549 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2553 if (i
== 0 || i
== 3) {
2554 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
2556 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2559 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
2562 if (i
== 0 || i
== 2) {
2563 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
2565 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[1]);
2568 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
2572 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
2579 static int emit_logic_pred(struct r600_shader_ctx
*ctx
, int opcode
)
2581 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2582 struct r600_bc_alu alu
;
2585 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
2589 alu
.dst
.sel
= ctx
->temp_reg
;
2593 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
2596 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
2597 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2598 alu
.src
[1].chan
= 0;
2602 r
= r600_bc_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE
));
2608 static int pops(struct r600_shader_ctx
*ctx
, int pops
)
2610 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP
));
2611 ctx
->bc
->cf_last
->pop_count
= pops
;
2615 static inline void callstack_decrease_current(struct r600_shader_ctx
*ctx
, unsigned reason
)
2619 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2623 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
-= 4;
2626 /* TOODO : for 16 vp asic should -= 2; */
2627 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
2632 static inline void callstack_check_depth(struct r600_shader_ctx
*ctx
, unsigned reason
, unsigned check_max_only
)
2634 if (check_max_only
) {
2647 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
) >
2648 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2649 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2650 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
;
2656 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2660 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+= 4;
2663 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
2667 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
) >
2668 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
2669 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
2670 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
;
2674 static void fc_set_mid(struct r600_shader_ctx
*ctx
, int fc_sp
)
2676 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[fc_sp
];
2678 sp
->mid
= (struct r600_bc_cf
**)realloc((void *)sp
->mid
,
2679 sizeof(struct r600_bc_cf
*) * (sp
->num_mid
+ 1));
2680 sp
->mid
[sp
->num_mid
] = ctx
->bc
->cf_last
;
2684 static void fc_pushlevel(struct r600_shader_ctx
*ctx
, int type
)
2687 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
= type
;
2688 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
= ctx
->bc
->cf_last
;
2691 static void fc_poplevel(struct r600_shader_ctx
*ctx
)
2693 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
];
2705 static int emit_return(struct r600_shader_ctx
*ctx
)
2707 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_RETURN
);
2711 static int emit_jump_to_offset(struct r600_shader_ctx
*ctx
, int pops
, int offset
)
2714 r600_bc_add_cfinst(ctx
->bc
, V_SQ_CF_WORD1_SQ_CF_INST_JUMP
);
2715 ctx
->bc
->cf_last
->pop_count
= pops
;
2716 /* TODO work out offset */
2720 static int emit_setret_in_loop_flag(struct r600_shader_ctx
*ctx
, unsigned flag_value
)
2725 static void emit_testflag(struct r600_shader_ctx
*ctx
)
2730 static void emit_return_on_flag(struct r600_shader_ctx
*ctx
, unsigned ifidx
)
2733 emit_jump_to_offset(ctx
, 1, 4);
2734 emit_setret_in_loop_flag(ctx
, V_SQ_ALU_SRC_0
);
2735 pops(ctx
, ifidx
+ 1);
2739 static void break_loop_on_flag(struct r600_shader_ctx
*ctx
, unsigned fc_sp
)
2743 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2744 ctx
->bc
->cf_last
->pop_count
= 1;
2746 fc_set_mid(ctx
, fc_sp
);
2752 static int tgsi_if(struct r600_shader_ctx
*ctx
)
2754 emit_logic_pred(ctx
, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE
));
2756 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
2758 fc_pushlevel(ctx
, FC_IF
);
2760 callstack_check_depth(ctx
, FC_PUSH_VPM
, 0);
2764 static int tgsi_else(struct r600_shader_ctx
*ctx
)
2766 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE
));
2767 ctx
->bc
->cf_last
->pop_count
= 1;
2769 fc_set_mid(ctx
, ctx
->bc
->fc_sp
);
2770 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
;
2774 static int tgsi_endif(struct r600_shader_ctx
*ctx
)
2777 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_IF
) {
2778 R600_ERR("if/endif unbalanced in shader\n");
2782 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
== NULL
) {
2783 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2784 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->pop_count
= 1;
2786 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[0]->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2790 callstack_decrease_current(ctx
, FC_PUSH_VPM
);
2794 static int tgsi_bgnloop(struct r600_shader_ctx
*ctx
)
2796 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL
));
2798 fc_pushlevel(ctx
, FC_LOOP
);
2800 /* check stack depth */
2801 callstack_check_depth(ctx
, FC_LOOP
, 0);
2805 static int tgsi_endloop(struct r600_shader_ctx
*ctx
)
2809 r600_bc_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END
));
2811 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_LOOP
) {
2812 R600_ERR("loop/endloop in shader code are not paired.\n");
2816 /* fixup loop pointers - from r600isa
2817 LOOP END points to CF after LOOP START,
2818 LOOP START point to CF after LOOP END
2819 BRK/CONT point to LOOP END CF
2821 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->id
+ 2;
2823 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
2825 for (i
= 0; i
< ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].num_mid
; i
++) {
2826 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[i
]->cf_addr
= ctx
->bc
->cf_last
->id
;
2828 /* TODO add LOOPRET support */
2830 callstack_decrease_current(ctx
, FC_LOOP
);
2834 static int tgsi_loop_brk_cont(struct r600_shader_ctx
*ctx
)
2838 for (fscp
= ctx
->bc
->fc_sp
; fscp
> 0; fscp
--)
2840 if (FC_LOOP
== ctx
->bc
->fc_stack
[fscp
].type
)
2845 R600_ERR("Break not inside loop/endloop pair\n");
2849 r600_bc_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
2850 ctx
->bc
->cf_last
->pop_count
= 1;
2852 fc_set_mid(ctx
, fscp
);
2855 callstack_check_depth(ctx
, FC_PUSH_VPM
, 1);
2859 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
2860 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_arl
},
2861 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2862 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
2865 * For state trackers other than OpenGL, we'll want to use
2866 * _RECIP_IEEE instead.
2868 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED
, tgsi_trans_srcx_replicate
},
2870 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_rsq
},
2871 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
2872 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
2873 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
2874 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2875 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2876 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2877 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
2878 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
2879 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
2880 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
2881 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
2882 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
2883 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
2884 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
2885 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2887 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2888 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2890 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2891 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2892 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
2893 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2894 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
2895 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2896 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
2897 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
2898 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
2899 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
2901 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2902 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
2903 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2904 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2905 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
2906 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
2907 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
2908 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
2909 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2910 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2911 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2912 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2913 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2914 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
2915 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2916 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
2917 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
2918 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
2919 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
2920 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2921 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2922 {TGSI_OPCODE_TXD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2923 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
2924 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2925 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2926 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2927 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2928 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2929 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2930 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2931 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2932 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2933 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2934 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
2935 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
2936 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
2937 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2938 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2939 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2940 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
2941 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
2942 {TGSI_OPCODE_BRK
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
2943 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
2945 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2946 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2947 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
2948 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
2950 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2951 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2952 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2953 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2954 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2955 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2956 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2957 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
2958 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2960 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2961 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2962 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2963 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2964 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2965 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2966 {TGSI_OPCODE_TXF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2967 {TGSI_OPCODE_TXQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2968 {TGSI_OPCODE_CONT
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
2969 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2970 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2971 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
2972 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2973 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
2974 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2976 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2977 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2978 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2979 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2980 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2982 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2983 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2984 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2985 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2986 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2987 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2988 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2989 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2990 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
2991 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
2993 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2994 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2995 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2996 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2997 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2998 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
2999 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3000 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3001 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3002 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3003 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3004 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3005 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3006 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3007 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3008 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3009 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3010 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3011 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3012 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3013 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3014 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3015 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3016 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3017 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3018 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3019 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3020 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3023 static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction
[] = {
3024 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3025 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3026 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
3027 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
3028 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_trans_srcx_replicate
},
3029 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
3030 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3031 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
3032 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3033 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3034 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3035 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
3036 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
3037 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
3038 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
3039 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
3040 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
3041 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
3042 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
3043 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3045 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3046 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3048 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3049 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3050 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
3051 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3052 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
3053 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3054 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
3055 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
3056 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
3057 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
3059 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3060 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
3061 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3062 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3063 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
3064 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
3065 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
3066 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
3067 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3068 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3069 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3070 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3071 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3072 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
3073 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3074 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
3075 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
3076 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
3077 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
3078 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3079 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3080 {TGSI_OPCODE_TXD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3081 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
3082 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3083 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3084 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3085 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3086 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3087 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3088 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3089 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3090 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3091 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3092 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
3093 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
3094 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
3095 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3096 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3097 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3098 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
3099 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
3100 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
3101 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
3103 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3104 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3105 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
3106 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
3108 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3109 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3110 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3111 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3112 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3113 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3114 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3115 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
3116 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3118 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3119 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3120 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3121 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3122 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3123 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3124 {TGSI_OPCODE_TXF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3125 {TGSI_OPCODE_TXQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3126 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
3127 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3128 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3129 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
3130 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3131 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
3132 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3134 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3135 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3136 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3137 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3138 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3140 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3141 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3142 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3143 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3144 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3145 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3146 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3147 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3148 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
3149 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
3151 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3152 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3153 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3154 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3155 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3156 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3157 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3158 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3159 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3160 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3161 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3162 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3163 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3164 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3165 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3166 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3167 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3168 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3169 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3170 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3171 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3172 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3173 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3174 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3175 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3176 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3177 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
3178 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},