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_screen.h"
29 #include "r600_context.h"
30 #include "r600_shader.h"
38 struct r600_shader_tgsi_instruction
;
40 struct r600_shader_ctx
{
41 struct tgsi_shader_info info
;
42 struct tgsi_parse_context parse
;
43 const struct tgsi_token
*tokens
;
45 unsigned file_offset
[TGSI_FILE_COUNT
];
47 struct r600_shader_tgsi_instruction
*inst_info
;
49 struct r600_shader
*shader
;
53 struct r600_shader_tgsi_instruction
{
57 int (*process
)(struct r600_shader_ctx
*ctx
);
60 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[];
61 static int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
);
63 static int r600_shader_update(struct pipe_context
*ctx
, struct r600_shader
*shader
)
65 struct r600_context
*rctx
= r600_context(ctx
);
66 const struct util_format_description
*desc
;
67 enum pipe_format resource_format
[160];
68 unsigned i
, nresources
= 0;
69 struct r600_bc
*bc
= &shader
->bc
;
70 struct r600_bc_cf
*cf
;
71 struct r600_bc_vtx
*vtx
;
73 if (shader
->processor_type
!= TGSI_PROCESSOR_VERTEX
)
75 for (i
= 0; i
< rctx
->vertex_elements
->count
; i
++) {
76 resource_format
[nresources
++] = rctx
->vertex_elements
->elements
[i
].src_format
;
78 LIST_FOR_EACH_ENTRY(cf
, &bc
->cf
, list
) {
80 case V_SQ_CF_WORD1_SQ_CF_INST_VTX
:
81 case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC
:
82 LIST_FOR_EACH_ENTRY(vtx
, &cf
->vtx
, list
) {
83 desc
= util_format_description(resource_format
[vtx
->buffer_id
]);
85 R600_ERR("unknown format %d\n", resource_format
[vtx
->buffer_id
]);
88 vtx
->dst_sel_x
= desc
->swizzle
[0];
89 vtx
->dst_sel_y
= desc
->swizzle
[1];
90 vtx
->dst_sel_z
= desc
->swizzle
[2];
91 vtx
->dst_sel_w
= desc
->swizzle
[3];
98 return r600_bc_build(&shader
->bc
);
101 int r600_pipe_shader_create(struct pipe_context
*ctx
,
102 struct r600_context_state
*rpshader
,
103 const struct tgsi_token
*tokens
)
105 struct r600_screen
*rscreen
= r600_screen(ctx
->screen
);
108 //fprintf(stderr, "--------------------------------------------------------------\n");
109 //tgsi_dump(tokens, 0);
110 if (rpshader
== NULL
)
112 rpshader
->shader
.family
= radeon_get_family(rscreen
->rw
);
113 r
= r600_shader_from_tgsi(tokens
, &rpshader
->shader
);
115 R600_ERR("translation from TGSI failed !\n");
118 r
= r600_bc_build(&rpshader
->shader
.bc
);
120 R600_ERR("building bytecode failed !\n");
123 //fprintf(stderr, "______________________________________________________________\n");
127 static int r600_pipe_shader_vs(struct pipe_context
*ctx
, struct r600_context_state
*rpshader
)
129 struct r600_screen
*rscreen
= r600_screen(ctx
->screen
);
130 struct r600_shader
*rshader
= &rpshader
->shader
;
131 struct radeon_state
*state
;
134 rpshader
->rstate
= radeon_state_decref(rpshader
->rstate
);
135 state
= radeon_state(rscreen
->rw
, R600_VS_SHADER_TYPE
, R600_VS_SHADER
);
138 for (i
= 0; i
< 10; i
++) {
139 state
->states
[R600_VS_SHADER__SPI_VS_OUT_ID_0
+ i
] = 0;
141 /* so far never got proper semantic id from tgsi */
142 for (i
= 0; i
< 32; i
++) {
143 tmp
= i
<< ((i
& 3) * 8);
144 state
->states
[R600_VS_SHADER__SPI_VS_OUT_ID_0
+ i
/ 4] |= tmp
;
146 state
->states
[R600_VS_SHADER__SPI_VS_OUT_CONFIG
] = S_0286C4_VS_EXPORT_COUNT(rshader
->noutput
- 2);
147 state
->states
[R600_VS_SHADER__SQ_PGM_RESOURCES_VS
] = S_028868_NUM_GPRS(rshader
->bc
.ngpr
);
148 rpshader
->rstate
= state
;
149 rpshader
->rstate
->bo
[0] = radeon_bo_incref(rscreen
->rw
, rpshader
->bo
);
150 rpshader
->rstate
->bo
[1] = radeon_bo_incref(rscreen
->rw
, rpshader
->bo
);
151 rpshader
->rstate
->nbo
= 2;
152 rpshader
->rstate
->placement
[0] = RADEON_GEM_DOMAIN_GTT
;
153 return radeon_state_pm4(state
);
156 static int r600_pipe_shader_ps(struct pipe_context
*ctx
, struct r600_context_state
*rpshader
)
158 const struct pipe_rasterizer_state
*rasterizer
;
159 struct r600_screen
*rscreen
= r600_screen(ctx
->screen
);
160 struct r600_shader
*rshader
= &rpshader
->shader
;
161 struct r600_context
*rctx
= r600_context(ctx
);
162 struct radeon_state
*state
;
163 unsigned i
, tmp
, exports_ps
, num_cout
;
165 rasterizer
= &rctx
->rasterizer
->state
.rasterizer
;
166 rpshader
->rstate
= radeon_state_decref(rpshader
->rstate
);
167 state
= radeon_state(rscreen
->rw
, R600_PS_SHADER_TYPE
, R600_PS_SHADER
);
170 for (i
= 0; i
< rshader
->ninput
; i
++) {
171 tmp
= S_028644_SEMANTIC(i
);
172 tmp
|= S_028644_SEL_CENTROID(1);
173 if (rshader
->input
[i
].name
== TGSI_SEMANTIC_COLOR
||
174 rshader
->input
[i
].name
== TGSI_SEMANTIC_BCOLOR
) {
175 tmp
|= S_028644_FLAT_SHADE(rshader
->flat_shade
);
177 if (rasterizer
->sprite_coord_enable
& (1 << i
)) {
178 tmp
|= S_028644_PT_SPRITE_TEX(1);
180 state
->states
[R600_PS_SHADER__SPI_PS_INPUT_CNTL_0
+ i
] = tmp
;
185 for (i
= 0; i
< rshader
->noutput
; i
++) {
186 if (rshader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
)
188 else if (rshader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
189 exports_ps
|= (1 << (num_cout
+1));
193 state
->states
[R600_PS_SHADER__SPI_PS_IN_CONTROL_0
] = S_0286CC_NUM_INTERP(rshader
->ninput
) |
194 S_0286CC_PERSP_GRADIENT_ENA(1);
195 state
->states
[R600_PS_SHADER__SPI_PS_IN_CONTROL_1
] = 0x00000000;
196 state
->states
[R600_PS_SHADER__SQ_PGM_RESOURCES_PS
] = S_028868_NUM_GPRS(rshader
->bc
.ngpr
);
197 state
->states
[R600_PS_SHADER__SQ_PGM_EXPORTS_PS
] = exports_ps
;
198 rpshader
->rstate
= state
;
199 rpshader
->rstate
->bo
[0] = radeon_bo_incref(rscreen
->rw
, rpshader
->bo
);
200 rpshader
->rstate
->nbo
= 1;
201 rpshader
->rstate
->placement
[0] = RADEON_GEM_DOMAIN_GTT
;
202 return radeon_state_pm4(state
);
205 static int r600_pipe_shader(struct pipe_context
*ctx
, struct r600_context_state
*rpshader
)
207 struct r600_screen
*rscreen
= r600_screen(ctx
->screen
);
208 struct r600_context
*rctx
= r600_context(ctx
);
209 struct r600_shader
*rshader
= &rpshader
->shader
;
212 /* copy new shader */
213 radeon_bo_decref(rscreen
->rw
, rpshader
->bo
);
215 rpshader
->bo
= radeon_bo(rscreen
->rw
, 0, rshader
->bc
.ndw
* 4,
217 if (rpshader
->bo
== NULL
) {
220 radeon_bo_map(rscreen
->rw
, rpshader
->bo
);
221 memcpy(rpshader
->bo
->data
, rshader
->bc
.bytecode
, rshader
->bc
.ndw
* 4);
222 radeon_bo_unmap(rscreen
->rw
, rpshader
->bo
);
224 rshader
->flat_shade
= rctx
->flat_shade
;
225 switch (rshader
->processor_type
) {
226 case TGSI_PROCESSOR_VERTEX
:
227 r
= r600_pipe_shader_vs(ctx
, rpshader
);
229 case TGSI_PROCESSOR_FRAGMENT
:
230 r
= r600_pipe_shader_ps(ctx
, rpshader
);
239 int r600_pipe_shader_update(struct pipe_context
*ctx
, struct r600_context_state
*rpshader
)
241 struct r600_context
*rctx
= r600_context(ctx
);
244 if (rpshader
== NULL
)
246 /* there should be enough input */
247 if (rctx
->vertex_elements
->count
< rpshader
->shader
.bc
.nresource
) {
248 R600_ERR("%d resources provided, expecting %d\n",
249 rctx
->vertex_elements
->count
, rpshader
->shader
.bc
.nresource
);
252 r
= r600_shader_update(ctx
, &rpshader
->shader
);
255 return r600_pipe_shader(ctx
, rpshader
);
258 static int tgsi_is_supported(struct r600_shader_ctx
*ctx
)
260 struct tgsi_full_instruction
*i
= &ctx
->parse
.FullToken
.FullInstruction
;
263 if (i
->Instruction
.NumDstRegs
> 1) {
264 R600_ERR("too many dst (%d)\n", i
->Instruction
.NumDstRegs
);
267 if (i
->Instruction
.Predicate
) {
268 R600_ERR("predicate unsupported\n");
271 if (i
->Instruction
.Label
) {
272 R600_ERR("label unsupported\n");
275 for (j
= 0; j
< i
->Instruction
.NumSrcRegs
; j
++) {
276 if (i
->Src
[j
].Register
.Indirect
||
277 i
->Src
[j
].Register
.Dimension
||
278 i
->Src
[j
].Register
.Absolute
) {
279 R600_ERR("unsupported src (indirect|dimension|absolute)\n");
283 for (j
= 0; j
< i
->Instruction
.NumDstRegs
; j
++) {
284 if (i
->Dst
[j
].Register
.Indirect
|| i
->Dst
[j
].Register
.Dimension
) {
285 R600_ERR("unsupported dst (indirect|dimension)\n");
292 static int tgsi_declaration(struct r600_shader_ctx
*ctx
)
294 struct tgsi_full_declaration
*d
= &ctx
->parse
.FullToken
.FullDeclaration
;
295 struct r600_bc_vtx vtx
;
299 switch (d
->Declaration
.File
) {
300 case TGSI_FILE_INPUT
:
301 i
= ctx
->shader
->ninput
++;
302 ctx
->shader
->input
[i
].name
= d
->Semantic
.Name
;
303 ctx
->shader
->input
[i
].sid
= d
->Semantic
.Index
;
304 ctx
->shader
->input
[i
].interpolate
= d
->Declaration
.Interpolate
;
305 ctx
->shader
->input
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_INPUT
] + i
;
306 if (ctx
->type
== TGSI_PROCESSOR_VERTEX
) {
307 /* turn input into fetch */
308 memset(&vtx
, 0, sizeof(struct r600_bc_vtx
));
312 /* register containing the index into the buffer */
315 vtx
.mega_fetch_count
= 0x1F;
316 vtx
.dst_gpr
= ctx
->shader
->input
[i
].gpr
;
321 r
= r600_bc_add_vtx(ctx
->bc
, &vtx
);
326 case TGSI_FILE_OUTPUT
:
327 i
= ctx
->shader
->noutput
++;
328 ctx
->shader
->output
[i
].name
= d
->Semantic
.Name
;
329 ctx
->shader
->output
[i
].sid
= d
->Semantic
.Index
;
330 ctx
->shader
->output
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_OUTPUT
] + i
;
331 ctx
->shader
->output
[i
].interpolate
= d
->Declaration
.Interpolate
;
333 case TGSI_FILE_CONSTANT
:
334 case TGSI_FILE_TEMPORARY
:
335 case TGSI_FILE_SAMPLER
:
338 R600_ERR("unsupported file %d declaration\n", d
->Declaration
.File
);
344 int r600_shader_from_tgsi(const struct tgsi_token
*tokens
, struct r600_shader
*shader
)
346 struct tgsi_full_immediate
*immediate
;
347 struct r600_shader_ctx ctx
;
348 struct r600_bc_output output
[32];
349 unsigned output_done
, noutput
;
353 ctx
.bc
= &shader
->bc
;
355 r
= r600_bc_init(ctx
.bc
, shader
->family
);
359 tgsi_scan_shader(tokens
, &ctx
.info
);
360 tgsi_parse_init(&ctx
.parse
, tokens
);
361 ctx
.type
= ctx
.parse
.FullHeader
.Processor
.Processor
;
362 shader
->processor_type
= ctx
.type
;
364 /* register allocations */
365 /* Values [0,127] correspond to GPR[0..127].
366 * Values [128,159] correspond to constant buffer bank 0
367 * Values [160,191] correspond to constant buffer bank 1
368 * Values [256,511] correspond to cfile constants c[0..255].
369 * Other special values are shown in the list below.
370 * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
371 * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
372 * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
373 * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
374 * 248 SQ_ALU_SRC_0: special constant 0.0.
375 * 249 SQ_ALU_SRC_1: special constant 1.0 float.
376 * 250 SQ_ALU_SRC_1_INT: special constant 1 integer.
377 * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer.
378 * 252 SQ_ALU_SRC_0_5: special constant 0.5 float.
379 * 253 SQ_ALU_SRC_LITERAL: literal constant.
380 * 254 SQ_ALU_SRC_PV: previous vector result.
381 * 255 SQ_ALU_SRC_PS: previous scalar result.
383 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
384 ctx
.file_offset
[i
] = 0;
386 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
387 ctx
.file_offset
[TGSI_FILE_INPUT
] = 1;
389 ctx
.file_offset
[TGSI_FILE_OUTPUT
] = ctx
.file_offset
[TGSI_FILE_INPUT
] +
390 ctx
.info
.file_count
[TGSI_FILE_INPUT
];
391 ctx
.file_offset
[TGSI_FILE_TEMPORARY
] = ctx
.file_offset
[TGSI_FILE_OUTPUT
] +
392 ctx
.info
.file_count
[TGSI_FILE_OUTPUT
];
393 ctx
.file_offset
[TGSI_FILE_CONSTANT
] = 256;
394 ctx
.file_offset
[TGSI_FILE_IMMEDIATE
] = 253;
395 ctx
.temp_reg
= ctx
.file_offset
[TGSI_FILE_TEMPORARY
] +
396 ctx
.info
.file_count
[TGSI_FILE_TEMPORARY
];
398 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
399 tgsi_parse_token(&ctx
.parse
);
400 switch (ctx
.parse
.FullToken
.Token
.Type
) {
401 case TGSI_TOKEN_TYPE_IMMEDIATE
:
402 immediate
= &ctx
.parse
.FullToken
.FullImmediate
;
403 ctx
.value
[0] = immediate
->u
[0].Uint
;
404 ctx
.value
[1] = immediate
->u
[1].Uint
;
405 ctx
.value
[2] = immediate
->u
[2].Uint
;
406 ctx
.value
[3] = immediate
->u
[3].Uint
;
408 case TGSI_TOKEN_TYPE_DECLARATION
:
409 r
= tgsi_declaration(&ctx
);
413 case TGSI_TOKEN_TYPE_INSTRUCTION
:
414 r
= tgsi_is_supported(&ctx
);
417 opcode
= ctx
.parse
.FullToken
.FullInstruction
.Instruction
.Opcode
;
418 ctx
.inst_info
= &r600_shader_tgsi_instruction
[opcode
];
419 r
= ctx
.inst_info
->process(&ctx
);
422 r
= r600_bc_add_literal(ctx
.bc
, ctx
.value
);
427 R600_ERR("unsupported token type %d\n", ctx
.parse
.FullToken
.Token
.Type
);
433 noutput
= shader
->noutput
;
434 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
435 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
436 output
[i
].gpr
= shader
->output
[i
].gpr
;
437 output
[i
].elem_size
= 3;
438 output
[i
].swizzle_x
= 0;
439 output
[i
].swizzle_y
= 1;
440 output
[i
].swizzle_z
= 2;
441 output
[i
].swizzle_w
= 3;
442 output
[i
].barrier
= 1;
443 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
444 output
[i
].array_base
= i
- pos0
;
445 output
[i
].inst
= V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
;
447 case TGSI_PROCESSOR_VERTEX
:
448 if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
449 output
[i
].array_base
= 60;
450 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
451 /* position doesn't count in array_base */
454 if (shader
->output
[i
].name
== TGSI_SEMANTIC_PSIZE
) {
455 output
[i
].array_base
= 61;
456 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
457 /* position doesn't count in array_base */
461 case TGSI_PROCESSOR_FRAGMENT
:
462 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
463 output
[i
].array_base
= shader
->output
[i
].sid
;
464 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
465 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
466 output
[i
].array_base
= 61;
467 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
469 R600_ERR("unsupported fragment output name %d\n", shader
->output
[i
].name
);
475 R600_ERR("unsupported processor type %d\n", ctx
.type
);
480 /* add fake param output for vertex shader if no param is exported */
481 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
482 for (i
= 0, pos0
= 0; i
< noutput
; i
++) {
483 if (output
[i
].type
== V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
) {
489 memset(&output
[i
], 0, sizeof(struct r600_bc_output
));
491 output
[i
].elem_size
= 3;
492 output
[i
].swizzle_x
= 0;
493 output
[i
].swizzle_y
= 1;
494 output
[i
].swizzle_z
= 2;
495 output
[i
].swizzle_w
= 3;
496 output
[i
].barrier
= 1;
497 output
[i
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
498 output
[i
].array_base
= 0;
499 output
[i
].inst
= V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
;
503 /* add fake pixel export */
504 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& !noutput
) {
505 memset(&output
[0], 0, sizeof(struct r600_bc_output
));
507 output
[0].elem_size
= 3;
508 output
[0].swizzle_x
= 7;
509 output
[0].swizzle_y
= 7;
510 output
[0].swizzle_z
= 7;
511 output
[0].swizzle_w
= 7;
512 output
[0].barrier
= 1;
513 output
[0].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
514 output
[0].array_base
= 0;
515 output
[0].inst
= V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
;
518 /* set export done on last export of each type */
519 for (i
= noutput
- 1, output_done
= 0; i
>= 0; i
--) {
520 if (i
== (noutput
- 1)) {
521 output
[i
].end_of_program
= 1;
523 if (!(output_done
& (1 << output
[i
].type
))) {
524 output_done
|= (1 << output
[i
].type
);
525 output
[i
].inst
= V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE
;
528 /* add output to bytecode */
529 for (i
= 0; i
< noutput
; i
++) {
530 r
= r600_bc_add_output(ctx
.bc
, &output
[i
]);
534 tgsi_parse_free(&ctx
.parse
);
537 tgsi_parse_free(&ctx
.parse
);
541 static int tgsi_unsupported(struct r600_shader_ctx
*ctx
)
543 R600_ERR("%d tgsi opcode unsupported\n", ctx
->inst_info
->tgsi_opcode
);
547 static int tgsi_end(struct r600_shader_ctx
*ctx
)
552 static int tgsi_src(struct r600_shader_ctx
*ctx
,
553 const struct tgsi_full_src_register
*tgsi_src
,
554 struct r600_bc_alu_src
*r600_src
)
556 memset(r600_src
, 0, sizeof(struct r600_bc_alu_src
));
557 r600_src
->sel
= tgsi_src
->Register
.Index
;
558 if (tgsi_src
->Register
.File
== TGSI_FILE_IMMEDIATE
) {
561 r600_src
->neg
= tgsi_src
->Register
.Negate
;
562 r600_src
->sel
+= ctx
->file_offset
[tgsi_src
->Register
.File
];
566 static int tgsi_dst(struct r600_shader_ctx
*ctx
,
567 const struct tgsi_full_dst_register
*tgsi_dst
,
569 struct r600_bc_alu_dst
*r600_dst
)
571 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
573 r600_dst
->sel
= tgsi_dst
->Register
.Index
;
574 r600_dst
->sel
+= ctx
->file_offset
[tgsi_dst
->Register
.File
];
575 r600_dst
->chan
= swizzle
;
577 if (inst
->Instruction
.Saturate
) {
583 static unsigned tgsi_chan(const struct tgsi_full_src_register
*tgsi_src
, unsigned swizzle
)
587 return tgsi_src
->Register
.SwizzleX
;
589 return tgsi_src
->Register
.SwizzleY
;
591 return tgsi_src
->Register
.SwizzleZ
;
593 return tgsi_src
->Register
.SwizzleW
;
599 static int tgsi_split_constant(struct r600_shader_ctx
*ctx
, struct r600_bc_alu_src r600_src
[3])
601 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
602 struct r600_bc_alu alu
;
603 int i
, j
, k
, nconst
, r
;
605 for (i
= 0, nconst
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
606 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
609 r
= tgsi_src(ctx
, &inst
->Src
[i
], &r600_src
[i
]);
614 for (i
= 0, j
= nconst
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
615 if (inst
->Src
[j
].Register
.File
== TGSI_FILE_CONSTANT
&& j
> 0) {
616 for (k
= 0; k
< 4; k
++) {
617 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
618 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
619 alu
.src
[0].sel
= r600_src
[0].sel
;
621 alu
.dst
.sel
= ctx
->temp_reg
+ j
;
626 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
630 r600_src
[0].sel
= ctx
->temp_reg
+ j
;
637 static int tgsi_op2(struct r600_shader_ctx
*ctx
)
639 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
640 struct r600_bc_alu_src r600_src
[3];
641 struct r600_bc_alu alu
;
644 r
= tgsi_split_constant(ctx
, r600_src
);
647 for (i
= 0; i
< 4; i
++) {
648 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
649 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
650 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
;
653 alu
.inst
= ctx
->inst_info
->r600_opcode
;
654 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
655 alu
.src
[j
] = r600_src
[j
];
656 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
658 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
662 /* handle some special cases */
663 switch (ctx
->inst_info
->tgsi_opcode
) {
664 case TGSI_OPCODE_SUB
:
667 case TGSI_OPCODE_ABS
:
676 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
684 * r600 - trunc to -PI..PI range
685 * r700 - normalize by dividing by 2PI
688 static int tgsi_trig(struct r600_shader_ctx
*ctx
)
690 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
691 struct r600_bc_alu_src r600_src
[3];
692 struct r600_bc_alu alu
;
694 uint32_t lit_vals
[4];
696 memset(lit_vals
, 0, 4*4);
697 r
= tgsi_split_constant(ctx
, r600_src
);
700 lit_vals
[0] = fui(1.0 /(3.1415926535 * 2));
701 lit_vals
[1] = fui(0.5f
);
703 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
704 alu
.inst
= V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
;
708 alu
.dst
.sel
= ctx
->temp_reg
;
711 alu
.src
[0] = r600_src
[0];
712 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
714 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
716 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
719 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
722 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
726 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
727 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
;
730 alu
.dst
.sel
= ctx
->temp_reg
;
733 alu
.src
[0].sel
= ctx
->temp_reg
;
736 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
740 if (ctx
->bc
->chiprev
== 0) {
741 lit_vals
[0] = fui(3.1415926535897f
* 2.0f
);
742 lit_vals
[1] = fui(-3.1415926535897f
);
744 lit_vals
[0] = fui(1.0f
);
745 lit_vals
[1] = fui(-0.5f
);
748 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
749 alu
.inst
= V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
;
753 alu
.dst
.sel
= ctx
->temp_reg
;
756 alu
.src
[0].sel
= ctx
->temp_reg
;
759 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
761 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
764 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
767 r
= r600_bc_add_literal(ctx
->bc
, lit_vals
);
771 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
772 alu
.inst
= ctx
->inst_info
->r600_opcode
;
774 alu
.dst
.sel
= ctx
->temp_reg
;
777 alu
.src
[0].sel
= ctx
->temp_reg
;
780 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
784 /* replicate result */
785 for (i
= 0; i
< 4; i
++) {
786 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
787 alu
.src
[0].sel
= ctx
->temp_reg
;
788 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
790 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
793 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
796 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
803 static int tgsi_kill(struct r600_shader_ctx
*ctx
)
805 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
806 struct r600_bc_alu alu
;
809 for (i
= 0; i
< 4; i
++) {
810 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
811 alu
.inst
= ctx
->inst_info
->r600_opcode
;
813 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
814 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[1]);
817 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
821 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
828 static int tgsi_slt(struct r600_shader_ctx
*ctx
)
830 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
831 struct r600_bc_alu_src r600_src
[3];
832 struct r600_bc_alu alu
;
835 r
= tgsi_split_constant(ctx
, r600_src
);
838 for (i
= 0; i
< 4; i
++) {
839 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
840 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
841 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
;
844 alu
.inst
= ctx
->inst_info
->r600_opcode
;
845 alu
.src
[1] = r600_src
[0];
846 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
847 alu
.src
[0] = r600_src
[1];
848 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], i
);
849 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
856 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
863 static int tgsi_lit(struct r600_shader_ctx
*ctx
)
865 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
866 struct r600_bc_alu alu
;
870 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
871 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
872 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
; /*1.0*/
874 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
877 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 0) & 1;
878 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
882 /* dst.y = max(src.x, 0.0) */
883 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
884 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
;
885 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
888 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
889 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], 0);
890 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
893 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 1) & 1;
894 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
898 /* dst.z = NOP - fill Z slot */
899 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
900 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
;
902 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
907 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
908 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
909 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
911 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
914 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 3) & 1;
916 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
920 if (inst
->Dst
[0].Register
.WriteMask
& (1 << 2))
925 /* dst.z = log(src.y) */
926 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
927 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
;
928 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
931 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 1);
932 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
936 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
943 /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
944 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
945 alu
.inst
= V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT
;
946 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
949 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
950 alu
.src
[1].sel
= sel
;
951 alu
.src
[1].chan
= chan
;
952 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[2]);
955 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], 0);
956 alu
.dst
.sel
= ctx
->temp_reg
;
961 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
965 /* dst.z = exp(tmp.x) */
966 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
967 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
;
968 alu
.src
[0].sel
= ctx
->temp_reg
;
970 r
= tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
974 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
981 static int tgsi_trans(struct r600_shader_ctx
*ctx
)
983 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
984 struct r600_bc_alu alu
;
987 for (i
= 0; i
< 4; i
++) {
988 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
989 if (inst
->Dst
[0].Register
.WriteMask
& (1 << i
)) {
990 alu
.inst
= ctx
->inst_info
->r600_opcode
;
991 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
992 r
= tgsi_src(ctx
, &inst
->Src
[j
], &alu
.src
[j
]);
995 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
997 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1001 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1009 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
)
1011 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1012 struct r600_bc_alu alu
;
1015 for (i
= 0; i
< 4; i
++) {
1016 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1017 alu
.src
[0].sel
= ctx
->temp_reg
;
1018 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
1020 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1023 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1026 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1033 static int tgsi_trans_srcx_replicate(struct r600_shader_ctx
*ctx
)
1035 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1036 struct r600_bc_alu alu
;
1039 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1040 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1041 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1042 r
= tgsi_src(ctx
, &inst
->Src
[i
], &alu
.src
[i
]);
1045 alu
.src
[i
].chan
= tgsi_chan(&inst
->Src
[i
], 0);
1047 alu
.dst
.sel
= ctx
->temp_reg
;
1050 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1053 /* replicate result */
1054 return tgsi_helper_tempx_replicate(ctx
);
1057 static int tgsi_pow(struct r600_shader_ctx
*ctx
)
1059 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1060 struct r600_bc_alu alu
;
1064 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1065 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
;
1066 r
= tgsi_src(ctx
, &inst
->Src
[0], &alu
.src
[0]);
1069 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 0);
1070 alu
.dst
.sel
= ctx
->temp_reg
;
1073 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1077 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1078 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE
;
1079 r
= tgsi_src(ctx
, &inst
->Src
[1], &alu
.src
[0]);
1082 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[1], 0);
1083 alu
.src
[1].sel
= ctx
->temp_reg
;
1084 alu
.dst
.sel
= ctx
->temp_reg
;
1087 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1090 /* POW(a,b) = EXP2(b * LOG2(a))*/
1091 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1092 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
;
1093 alu
.src
[0].sel
= ctx
->temp_reg
;
1094 alu
.dst
.sel
= ctx
->temp_reg
;
1097 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1100 return tgsi_helper_tempx_replicate(ctx
);
1103 static int tgsi_ssg(struct r600_shader_ctx
*ctx
)
1105 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1106 struct r600_bc_alu alu
;
1107 struct r600_bc_alu_src r600_src
[3];
1110 r
= tgsi_split_constant(ctx
, r600_src
);
1114 /* tmp = (src > 0 ? 1 : src) */
1115 for (i
= 0; i
< 4; i
++) {
1116 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1117 alu
.inst
= V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
;
1119 alu
.dst
.sel
= ctx
->temp_reg
;
1122 alu
.src
[0] = r600_src
[0];
1123 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1125 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1127 alu
.src
[2] = r600_src
[0];
1128 alu
.src
[2].chan
= tgsi_chan(&inst
->Src
[0], i
);
1131 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1136 /* dst = (-tmp > 0 ? -1 : tmp) */
1137 for (i
= 0; i
< 4; i
++) {
1138 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1139 alu
.inst
= V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
;
1141 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1145 alu
.src
[0].sel
= ctx
->temp_reg
;
1148 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1151 alu
.src
[2].sel
= ctx
->temp_reg
;
1156 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1163 static int tgsi_helper_copy(struct r600_shader_ctx
*ctx
, struct tgsi_full_instruction
*inst
)
1165 struct r600_bc_alu alu
;
1168 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1171 for (i
= 0; i
< 4; i
++) {
1172 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1173 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
1174 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
;
1177 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
1178 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1181 alu
.src
[0].sel
= ctx
->temp_reg
;
1182 alu
.src
[0].chan
= i
;
1187 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1194 static int tgsi_op3(struct r600_shader_ctx
*ctx
)
1196 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1197 struct r600_bc_alu_src r600_src
[3];
1198 struct r600_bc_alu alu
;
1201 r
= tgsi_split_constant(ctx
, r600_src
);
1204 /* do it in 2 step as op3 doesn't support writemask */
1205 for (i
= 0; i
< 4; i
++) {
1206 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1207 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1208 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1209 alu
.src
[j
] = r600_src
[j
];
1210 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1212 alu
.dst
.sel
= ctx
->temp_reg
;
1219 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1223 return tgsi_helper_copy(ctx
, inst
);
1226 static int tgsi_dp(struct r600_shader_ctx
*ctx
)
1228 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1229 struct r600_bc_alu_src r600_src
[3];
1230 struct r600_bc_alu alu
;
1233 r
= tgsi_split_constant(ctx
, r600_src
);
1236 for (i
= 0; i
< 4; i
++) {
1237 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1238 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1239 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1240 alu
.src
[j
] = r600_src
[j
];
1241 alu
.src
[j
].chan
= tgsi_chan(&inst
->Src
[j
], i
);
1243 alu
.dst
.sel
= ctx
->temp_reg
;
1246 /* handle some special cases */
1247 switch (ctx
->inst_info
->tgsi_opcode
) {
1248 case TGSI_OPCODE_DP2
:
1250 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1251 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1254 case TGSI_OPCODE_DP3
:
1256 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
1257 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
1266 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1270 return tgsi_helper_copy(ctx
, inst
);
1273 static int tgsi_tex(struct r600_shader_ctx
*ctx
)
1275 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1276 struct r600_bc_tex tex
;
1277 struct r600_bc_alu alu
;
1281 src_gpr
= ctx
->file_offset
[inst
->Src
[0].Register
.File
] + inst
->Src
[0].Register
.Index
;
1283 if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXP
) {
1284 /* Add perspective divide */
1285 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1286 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
;
1287 alu
.src
[0].sel
= src_gpr
;
1288 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], 3);
1289 alu
.dst
.sel
= ctx
->temp_reg
;
1293 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1297 for (i
= 0; i
< 3; i
++) {
1298 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1299 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
;
1300 alu
.src
[0].sel
= ctx
->temp_reg
;
1301 alu
.src
[0].chan
= 3;
1302 alu
.src
[1].sel
= src_gpr
;
1303 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1304 alu
.dst
.sel
= ctx
->temp_reg
;
1307 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1311 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1312 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
1313 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1314 alu
.src
[0].chan
= 0;
1315 alu
.dst
.sel
= ctx
->temp_reg
;
1319 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1322 src_gpr
= ctx
->temp_reg
;
1323 } else if (inst
->Src
[0].Register
.File
!= TGSI_FILE_TEMPORARY
) {
1324 for (i
= 0; i
< 4; i
++) {
1325 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1326 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
1327 alu
.src
[0].sel
= src_gpr
;
1328 alu
.src
[0].chan
= i
;
1329 alu
.dst
.sel
= ctx
->temp_reg
;
1334 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1338 src_gpr
= ctx
->temp_reg
;
1341 memset(&tex
, 0, sizeof(struct r600_bc_tex
));
1342 tex
.inst
= ctx
->inst_info
->r600_opcode
;
1343 tex
.resource_id
= ctx
->file_offset
[inst
->Src
[1].Register
.File
] + inst
->Src
[1].Register
.Index
;
1344 tex
.sampler_id
= tex
.resource_id
;
1345 tex
.src_gpr
= src_gpr
;
1346 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
1356 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
) {
1357 tex
.coord_type_x
= 1;
1358 tex
.coord_type_y
= 1;
1359 tex
.coord_type_z
= 1;
1360 tex
.coord_type_w
= 1;
1362 return r600_bc_add_tex(ctx
->bc
, &tex
);
1365 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
1367 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1368 struct r600_bc_alu_src r600_src
[3];
1369 struct r600_bc_alu alu
;
1373 r
= tgsi_split_constant(ctx
, r600_src
);
1377 for (i
= 0; i
< 4; i
++) {
1378 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1379 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
;
1380 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1381 alu
.src
[0].chan
= 0;
1382 alu
.src
[1] = r600_src
[0];
1383 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[0], i
);
1385 alu
.dst
.sel
= ctx
->temp_reg
;
1391 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1395 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1399 /* (1 - src0) * src2 */
1400 for (i
= 0; i
< 4; i
++) {
1401 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1402 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
;
1403 alu
.src
[0].sel
= ctx
->temp_reg
;
1404 alu
.src
[0].chan
= i
;
1405 alu
.src
[1] = r600_src
[2];
1406 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[2], i
);
1407 alu
.dst
.sel
= ctx
->temp_reg
;
1413 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1417 r
= r600_bc_add_literal(ctx
->bc
, ctx
->value
);
1421 /* src0 * src1 + (1 - src0) * src2 */
1422 for (i
= 0; i
< 4; i
++) {
1423 memset(&alu
, 0, sizeof(struct r600_bc_alu
));
1424 alu
.inst
= V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
;
1426 alu
.src
[0] = r600_src
[0];
1427 alu
.src
[0].chan
= tgsi_chan(&inst
->Src
[0], i
);
1428 alu
.src
[1] = r600_src
[1];
1429 alu
.src
[1].chan
= tgsi_chan(&inst
->Src
[1], i
);
1430 alu
.src
[2].sel
= ctx
->temp_reg
;
1431 alu
.src
[2].chan
= i
;
1432 alu
.dst
.sel
= ctx
->temp_reg
;
1437 r
= r600_bc_add_alu(ctx
->bc
, &alu
);
1441 return tgsi_helper_copy(ctx
, inst
);
1444 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
1445 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1446 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
1447 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
1448 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
1449 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_trans_srcx_replicate
},
1450 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1451 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1452 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
1453 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
1454 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
1455 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
1456 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1457 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
1458 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
1459 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_slt
},
1460 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
1461 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
1462 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
1463 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
1464 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1466 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1467 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1469 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1470 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1471 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
1472 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1473 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
1474 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1475 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
1476 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
1477 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
1478 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1480 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1481 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
1482 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1483 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1484 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
1485 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
1486 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
1487 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
}, /* predicated kill */
1488 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1489 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1490 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1491 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1492 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1493 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
1494 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1495 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
1496 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
1497 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_slt
},
1498 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
1499 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1500 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
1501 {TGSI_OPCODE_TXD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1502 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
1503 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1504 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1505 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1506 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1507 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1508 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1509 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1510 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1511 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1512 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1513 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
1514 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1515 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1516 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
1517 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1518 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1519 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
1520 {TGSI_OPCODE_TXL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1521 {TGSI_OPCODE_BRK
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1522 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1524 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1525 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1526 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1527 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1529 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1530 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1531 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1532 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1533 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1534 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1535 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1536 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_trans_srcx_replicate
},
1537 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1539 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1540 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1541 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1542 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1543 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1544 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1545 {TGSI_OPCODE_TXF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1546 {TGSI_OPCODE_TXQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1547 {TGSI_OPCODE_CONT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1548 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1549 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1550 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1551 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1552 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1553 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1555 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1556 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1557 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1558 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1559 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1561 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1562 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1563 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1564 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1565 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1566 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1567 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1568 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1569 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
1570 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
1572 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1573 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1574 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1575 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1576 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1577 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1578 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1579 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1580 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1581 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1582 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1583 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1584 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1585 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1586 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1587 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1588 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1589 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1590 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1591 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1592 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1593 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1594 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1595 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1596 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1597 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1598 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
1599 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},