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_info.h"
25 #include "tgsi/tgsi_parse.h"
26 #include "tgsi/tgsi_scan.h"
27 #include "tgsi/tgsi_dump.h"
28 #include "util/u_format.h"
29 #include "r600_pipe.h"
32 #include "r600_formats.h"
33 #include "r600_opcodes.h"
40 Why CAYMAN got loops for lots of instructions is explained here.
42 -These 8xx t-slot only ops are implemented in all vector slots.
43 MUL_LIT, FLT_TO_UINT, INT_TO_FLT, UINT_TO_FLT
44 These 8xx t-slot only opcodes become vector ops, with all four
45 slots expecting the arguments on sources a and b. Result is
46 broadcast to all channels.
47 MULLO_INT, MULHI_INT, MULLO_UINT, MULHI_UINT
48 These 8xx t-slot only opcodes become vector ops in the z, y, and
50 EXP_IEEE, LOG_IEEE/CLAMPED, RECIP_IEEE/CLAMPED/FF/INT/UINT/_64/CLAMPED_64
51 RECIPSQRT_IEEE/CLAMPED/FF/_64/CLAMPED_64
54 The w slot may have an independent co-issued operation, or if the
55 result is required to be in the w slot, the opcode above may be
56 issued in the w slot as well.
57 The compiler must issue the source argument to slots z, y, and x
60 static int r600_pipe_shader(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
62 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
63 struct r600_shader
*rshader
= &shader
->shader
;
68 if (shader
->bo
== NULL
) {
69 shader
->bo
= (struct r600_resource
*)
70 pipe_buffer_create(ctx
->screen
, PIPE_BIND_CUSTOM
, PIPE_USAGE_IMMUTABLE
, rshader
->bc
.ndw
* 4);
71 if (shader
->bo
== NULL
) {
74 ptr
= (uint32_t*)rctx
->ws
->buffer_map(shader
->bo
->buf
, rctx
->ctx
.cs
, PIPE_TRANSFER_WRITE
);
75 if (R600_BIG_ENDIAN
) {
76 for (i
= 0; i
< rshader
->bc
.ndw
; ++i
) {
77 ptr
[i
] = bswap_32(rshader
->bc
.bytecode
[i
]);
80 memcpy(ptr
, rshader
->bc
.bytecode
, rshader
->bc
.ndw
* sizeof(*ptr
));
82 rctx
->ws
->buffer_unmap(shader
->bo
->buf
);
85 switch (rshader
->processor_type
) {
86 case TGSI_PROCESSOR_VERTEX
:
87 if (rctx
->chip_class
>= EVERGREEN
) {
88 evergreen_pipe_shader_vs(ctx
, shader
);
90 r600_pipe_shader_vs(ctx
, shader
);
93 case TGSI_PROCESSOR_FRAGMENT
:
94 if (rctx
->chip_class
>= EVERGREEN
) {
95 evergreen_pipe_shader_ps(ctx
, shader
);
97 r600_pipe_shader_ps(ctx
, shader
);
106 static int r600_shader_from_tgsi(struct r600_pipe_context
* rctx
, struct r600_pipe_shader
*pipeshader
);
108 int r600_pipe_shader_create(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
110 static int dump_shaders
= -1;
111 struct r600_pipe_context
*rctx
= (struct r600_pipe_context
*)ctx
;
114 /* Would like some magic "get_bool_option_once" routine.
116 if (dump_shaders
== -1)
117 dump_shaders
= debug_get_bool_option("R600_DUMP_SHADERS", FALSE
);
120 fprintf(stderr
, "--------------------------------------------------------------\n");
121 tgsi_dump(shader
->tokens
, 0);
123 if (shader
->so
.num_outputs
) {
125 fprintf(stderr
, "STREAMOUT\n");
126 for (i
= 0; i
< shader
->so
.num_outputs
; i
++) {
127 unsigned mask
= ((1 << shader
->so
.output
[i
].num_components
) - 1) <<
128 shader
->so
.output
[i
].start_component
;
129 fprintf(stderr
, " %i: MEM_STREAM0_BUF%i OUT[%i].%s%s%s%s\n", i
,
130 shader
->so
.output
[i
].output_buffer
, shader
->so
.output
[i
].register_index
,
131 mask
& 1 ? "x" : "_",
132 (mask
>> 1) & 1 ? "y" : "_",
133 (mask
>> 2) & 1 ? "z" : "_",
134 (mask
>> 3) & 1 ? "w" : "_");
138 r
= r600_shader_from_tgsi(rctx
, shader
);
140 R600_ERR("translation from TGSI failed !\n");
143 r
= r600_bytecode_build(&shader
->shader
.bc
);
145 R600_ERR("building bytecode failed !\n");
149 r600_bytecode_dump(&shader
->shader
.bc
);
150 fprintf(stderr
, "______________________________________________________________\n");
152 return r600_pipe_shader(ctx
, shader
);
155 void r600_pipe_shader_destroy(struct pipe_context
*ctx
, struct r600_pipe_shader
*shader
)
157 pipe_resource_reference((struct pipe_resource
**)&shader
->bo
, NULL
);
158 r600_bytecode_clear(&shader
->shader
.bc
);
160 memset(&shader
->shader
,0,sizeof(struct r600_shader
));
164 * tgsi -> r600 shader
166 struct r600_shader_tgsi_instruction
;
168 struct r600_shader_src
{
177 struct r600_shader_ctx
{
178 struct tgsi_shader_info info
;
179 struct tgsi_parse_context parse
;
180 const struct tgsi_token
*tokens
;
182 unsigned file_offset
[TGSI_FILE_COUNT
];
184 struct r600_shader_tgsi_instruction
*inst_info
;
185 struct r600_bytecode
*bc
;
186 struct r600_shader
*shader
;
187 struct r600_shader_src src
[4];
190 u32 max_driver_temp_used
;
191 /* needed for evergreen interpolation */
192 boolean input_centroid
;
193 boolean input_linear
;
194 boolean input_perspective
;
198 boolean clip_vertex_write
;
202 struct r600_shader_tgsi_instruction
{
203 unsigned tgsi_opcode
;
205 unsigned r600_opcode
;
206 int (*process
)(struct r600_shader_ctx
*ctx
);
209 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[], eg_shader_tgsi_instruction
[], cm_shader_tgsi_instruction
[];
210 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
);
212 static int tgsi_is_supported(struct r600_shader_ctx
*ctx
)
214 struct tgsi_full_instruction
*i
= &ctx
->parse
.FullToken
.FullInstruction
;
217 if (i
->Instruction
.NumDstRegs
> 1) {
218 R600_ERR("too many dst (%d)\n", i
->Instruction
.NumDstRegs
);
221 if (i
->Instruction
.Predicate
) {
222 R600_ERR("predicate unsupported\n");
226 if (i
->Instruction
.Label
) {
227 R600_ERR("label unsupported\n");
231 for (j
= 0; j
< i
->Instruction
.NumSrcRegs
; j
++) {
232 if (i
->Src
[j
].Register
.Dimension
) {
233 R600_ERR("unsupported src %d (dimension %d)\n", j
,
234 i
->Src
[j
].Register
.Dimension
);
238 for (j
= 0; j
< i
->Instruction
.NumDstRegs
; j
++) {
239 if (i
->Dst
[j
].Register
.Dimension
) {
240 R600_ERR("unsupported dst (dimension)\n");
247 static int evergreen_interp_alu(struct r600_shader_ctx
*ctx
, int input
)
250 struct r600_bytecode_alu alu
;
251 int gpr
= 0, base_chan
= 0;
254 if (ctx
->shader
->input
[input
].interpolate
== TGSI_INTERPOLATE_PERSPECTIVE
) {
256 if (ctx
->shader
->input
[input
].centroid
)
258 } else if (ctx
->shader
->input
[input
].interpolate
== TGSI_INTERPOLATE_LINEAR
) {
260 /* if we have perspective add one */
261 if (ctx
->input_perspective
) {
263 /* if we have perspective centroid */
264 if (ctx
->input_centroid
)
267 if (ctx
->shader
->input
[input
].centroid
)
271 /* work out gpr and base_chan from index */
273 base_chan
= (2 * (ij_index
% 2)) + 1;
275 for (i
= 0; i
< 8; i
++) {
276 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
279 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW
;
281 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY
;
283 if ((i
> 1) && (i
< 6)) {
284 alu
.dst
.sel
= ctx
->shader
->input
[input
].gpr
;
288 alu
.dst
.chan
= i
% 4;
290 alu
.src
[0].sel
= gpr
;
291 alu
.src
[0].chan
= (base_chan
- (i
% 2));
293 alu
.src
[1].sel
= V_SQ_ALU_SRC_PARAM_BASE
+ ctx
->shader
->input
[input
].lds_pos
;
295 alu
.bank_swizzle_force
= SQ_ALU_VEC_210
;
298 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
305 static int evergreen_interp_flat(struct r600_shader_ctx
*ctx
, int input
)
308 struct r600_bytecode_alu alu
;
310 for (i
= 0; i
< 4; i
++) {
311 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
313 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_LOAD_P0
;
315 alu
.dst
.sel
= ctx
->shader
->input
[input
].gpr
;
320 alu
.src
[0].sel
= V_SQ_ALU_SRC_PARAM_BASE
+ ctx
->shader
->input
[input
].lds_pos
;
325 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
333 * Special export handling in shaders
335 * shader export ARRAY_BASE for EXPORT_POS:
338 * 62, 63 are clip distance vectors
340 * The use of the values exported in 61-63 are controlled by PA_CL_VS_OUT_CNTL:
341 * VS_OUT_MISC_VEC_ENA - enables the use of all fields in export 61
342 * USE_VTX_POINT_SIZE - point size in the X channel of export 61
343 * USE_VTX_EDGE_FLAG - edge flag in the Y channel of export 61
344 * USE_VTX_RENDER_TARGET_INDX - render target index in the Z channel of export 61
345 * USE_VTX_VIEWPORT_INDX - viewport index in the W channel of export 61
346 * USE_VTX_KILL_FLAG - kill flag in the Z channel of export 61 (mutually
347 * exclusive from render target index)
348 * VS_OUT_CCDIST0_VEC_ENA/VS_OUT_CCDIST1_VEC_ENA - enable clip distance vectors
351 * shader export ARRAY_BASE for EXPORT_PIXEL:
353 * 61 computed Z vector
355 * The use of the values exported in the computed Z vector are controlled
356 * by DB_SHADER_CONTROL:
357 * Z_EXPORT_ENABLE - Z as a float in RED
358 * STENCIL_REF_EXPORT_ENABLE - stencil ref as int in GREEN
359 * COVERAGE_TO_MASK_ENABLE - alpha to mask in ALPHA
360 * MASK_EXPORT_ENABLE - pixel sample mask in BLUE
361 * DB_SOURCE_FORMAT - export control restrictions
366 /* Map name/sid pair from tgsi to the 8-bit semantic index for SPI setup */
367 static int r600_spi_sid(struct r600_shader_io
* io
)
369 int index
, name
= io
->name
;
371 /* These params are handled differently, they don't need
372 * semantic indices, so we'll use 0 for them.
374 if (name
== TGSI_SEMANTIC_POSITION
||
375 name
== TGSI_SEMANTIC_PSIZE
||
376 name
== TGSI_SEMANTIC_FACE
)
379 if (name
== TGSI_SEMANTIC_GENERIC
) {
380 /* For generic params simply use sid from tgsi */
383 /* For non-generic params - pack name and sid into 8 bits */
384 index
= 0x80 | (name
<<3) | (io
->sid
);
387 /* Make sure that all really used indices have nonzero value, so
388 * we can just compare it to 0 later instead of comparing the name
389 * with different values to detect special cases. */
396 /* turn input into interpolate on EG */
397 static int evergreen_interp_input(struct r600_shader_ctx
*ctx
, int index
)
401 if (ctx
->shader
->input
[index
].spi_sid
) {
402 ctx
->shader
->input
[index
].lds_pos
= ctx
->shader
->nlds
++;
403 if (ctx
->shader
->input
[index
].interpolate
> 0) {
404 r
= evergreen_interp_alu(ctx
, index
);
406 r
= evergreen_interp_flat(ctx
, index
);
412 static int select_twoside_color(struct r600_shader_ctx
*ctx
, int front
, int back
)
414 struct r600_bytecode_alu alu
;
416 int gpr_front
= ctx
->shader
->input
[front
].gpr
;
417 int gpr_back
= ctx
->shader
->input
[back
].gpr
;
419 for (i
= 0; i
< 4; i
++) {
420 memset(&alu
, 0, sizeof(alu
));
421 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
424 alu
.dst
.sel
= gpr_front
;
425 alu
.src
[0].sel
= ctx
->face_gpr
;
426 alu
.src
[1].sel
= gpr_front
;
427 alu
.src
[2].sel
= gpr_back
;
434 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
441 static int tgsi_declaration(struct r600_shader_ctx
*ctx
)
443 struct tgsi_full_declaration
*d
= &ctx
->parse
.FullToken
.FullDeclaration
;
447 switch (d
->Declaration
.File
) {
448 case TGSI_FILE_INPUT
:
449 i
= ctx
->shader
->ninput
++;
450 ctx
->shader
->input
[i
].name
= d
->Semantic
.Name
;
451 ctx
->shader
->input
[i
].sid
= d
->Semantic
.Index
;
452 ctx
->shader
->input
[i
].spi_sid
= r600_spi_sid(&ctx
->shader
->input
[i
]);
453 ctx
->shader
->input
[i
].interpolate
= d
->Declaration
.Interpolate
;
454 ctx
->shader
->input
[i
].centroid
= d
->Declaration
.Centroid
;
455 ctx
->shader
->input
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_INPUT
] + d
->Range
.First
;
456 if (ctx
->type
== TGSI_PROCESSOR_FRAGMENT
) {
457 if (ctx
->shader
->input
[i
].name
== TGSI_SEMANTIC_FACE
)
458 ctx
->face_gpr
= ctx
->shader
->input
[i
].gpr
;
459 else if (ctx
->shader
->input
[i
].name
== TGSI_SEMANTIC_COLOR
)
461 if (ctx
->bc
->chip_class
>= EVERGREEN
) {
462 r
= evergreen_interp_input(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
].spi_sid
= r600_spi_sid(&ctx
->shader
->output
[i
]);
473 ctx
->shader
->output
[i
].gpr
= ctx
->file_offset
[TGSI_FILE_OUTPUT
] + d
->Range
.First
;
474 ctx
->shader
->output
[i
].interpolate
= d
->Declaration
.Interpolate
;
475 ctx
->shader
->output
[i
].write_mask
= d
->Declaration
.UsageMask
;
476 if (ctx
->type
== TGSI_PROCESSOR_VERTEX
) {
477 switch (d
->Semantic
.Name
) {
478 case TGSI_SEMANTIC_CLIPDIST
:
479 ctx
->shader
->clip_dist_write
|= d
->Declaration
.UsageMask
<< (d
->Semantic
.Index
<< 2);
481 case TGSI_SEMANTIC_PSIZE
:
482 ctx
->shader
->vs_out_misc_write
= 1;
484 case TGSI_SEMANTIC_CLIPVERTEX
:
485 ctx
->clip_vertex_write
= TRUE
;
491 case TGSI_FILE_CONSTANT
:
492 case TGSI_FILE_TEMPORARY
:
493 case TGSI_FILE_SAMPLER
:
494 case TGSI_FILE_ADDRESS
:
497 case TGSI_FILE_SYSTEM_VALUE
:
498 if (d
->Semantic
.Name
== TGSI_SEMANTIC_INSTANCEID
) {
499 struct r600_bytecode_alu alu
;
500 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
502 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT
);
511 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
514 } else if (d
->Semantic
.Name
== TGSI_SEMANTIC_VERTEXID
)
517 R600_ERR("unsupported file %d declaration\n", d
->Declaration
.File
);
523 static int r600_get_temp(struct r600_shader_ctx
*ctx
)
525 return ctx
->temp_reg
+ ctx
->max_driver_temp_used
++;
529 * for evergreen we need to scan the shader to find the number of GPRs we need to
530 * reserve for interpolation.
532 * we need to know if we are going to emit
533 * any centroid inputs
534 * if perspective and linear are required
536 static int evergreen_gpr_count(struct r600_shader_ctx
*ctx
)
541 ctx
->input_linear
= FALSE
;
542 ctx
->input_perspective
= FALSE
;
543 ctx
->input_centroid
= FALSE
;
544 ctx
->num_interp_gpr
= 1;
546 /* any centroid inputs */
547 for (i
= 0; i
< ctx
->info
.num_inputs
; i
++) {
548 /* skip position/face */
549 if (ctx
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_POSITION
||
550 ctx
->info
.input_semantic_name
[i
] == TGSI_SEMANTIC_FACE
)
552 if (ctx
->info
.input_interpolate
[i
] == TGSI_INTERPOLATE_LINEAR
)
553 ctx
->input_linear
= TRUE
;
554 if (ctx
->info
.input_interpolate
[i
] == TGSI_INTERPOLATE_PERSPECTIVE
)
555 ctx
->input_perspective
= TRUE
;
556 if (ctx
->info
.input_centroid
[i
])
557 ctx
->input_centroid
= TRUE
;
561 /* ignoring sample for now */
562 if (ctx
->input_perspective
)
564 if (ctx
->input_linear
)
566 if (ctx
->input_centroid
)
569 ctx
->num_interp_gpr
+= (num_baryc
+ 1) >> 1;
571 /* TODO PULL MODEL and LINE STIPPLE, FIXED PT POS */
572 return ctx
->num_interp_gpr
;
575 static void tgsi_src(struct r600_shader_ctx
*ctx
,
576 const struct tgsi_full_src_register
*tgsi_src
,
577 struct r600_shader_src
*r600_src
)
579 memset(r600_src
, 0, sizeof(*r600_src
));
580 r600_src
->swizzle
[0] = tgsi_src
->Register
.SwizzleX
;
581 r600_src
->swizzle
[1] = tgsi_src
->Register
.SwizzleY
;
582 r600_src
->swizzle
[2] = tgsi_src
->Register
.SwizzleZ
;
583 r600_src
->swizzle
[3] = tgsi_src
->Register
.SwizzleW
;
584 r600_src
->neg
= tgsi_src
->Register
.Negate
;
585 r600_src
->abs
= tgsi_src
->Register
.Absolute
;
587 if (tgsi_src
->Register
.File
== TGSI_FILE_IMMEDIATE
) {
589 if ((tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleY
) &&
590 (tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleZ
) &&
591 (tgsi_src
->Register
.SwizzleX
== tgsi_src
->Register
.SwizzleW
)) {
593 index
= tgsi_src
->Register
.Index
* 4 + tgsi_src
->Register
.SwizzleX
;
594 r600_bytecode_special_constants(ctx
->literals
[index
], &r600_src
->sel
, &r600_src
->neg
);
595 if (r600_src
->sel
!= V_SQ_ALU_SRC_LITERAL
)
598 index
= tgsi_src
->Register
.Index
;
599 r600_src
->sel
= V_SQ_ALU_SRC_LITERAL
;
600 memcpy(r600_src
->value
, ctx
->literals
+ index
* 4, sizeof(r600_src
->value
));
601 } else if (tgsi_src
->Register
.File
== TGSI_FILE_SYSTEM_VALUE
) {
602 if (ctx
->info
.system_value_semantic_name
[tgsi_src
->Register
.Index
] == TGSI_SEMANTIC_INSTANCEID
) {
603 r600_src
->swizzle
[0] = 3;
604 r600_src
->swizzle
[1] = 3;
605 r600_src
->swizzle
[2] = 3;
606 r600_src
->swizzle
[3] = 3;
608 } else if (ctx
->info
.system_value_semantic_name
[tgsi_src
->Register
.Index
] == TGSI_SEMANTIC_VERTEXID
) {
609 r600_src
->swizzle
[0] = 0;
610 r600_src
->swizzle
[1] = 0;
611 r600_src
->swizzle
[2] = 0;
612 r600_src
->swizzle
[3] = 0;
616 if (tgsi_src
->Register
.Indirect
)
617 r600_src
->rel
= V_SQ_REL_RELATIVE
;
618 r600_src
->sel
= tgsi_src
->Register
.Index
;
619 r600_src
->sel
+= ctx
->file_offset
[tgsi_src
->Register
.File
];
623 static int tgsi_fetch_rel_const(struct r600_shader_ctx
*ctx
, unsigned int offset
, unsigned int dst_reg
)
625 struct r600_bytecode_vtx vtx
;
630 struct r600_bytecode_alu alu
;
632 memset(&alu
, 0, sizeof(alu
));
634 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
);
635 alu
.src
[0].sel
= ctx
->bc
->ar_reg
;
637 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
638 alu
.src
[1].value
= offset
;
640 alu
.dst
.sel
= dst_reg
;
644 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
649 ar_reg
= ctx
->bc
->ar_reg
;
652 memset(&vtx
, 0, sizeof(vtx
));
653 vtx
.fetch_type
= 2; /* VTX_FETCH_NO_INDEX_OFFSET */
654 vtx
.src_gpr
= ar_reg
;
655 vtx
.mega_fetch_count
= 16;
656 vtx
.dst_gpr
= dst_reg
;
657 vtx
.dst_sel_x
= 0; /* SEL_X */
658 vtx
.dst_sel_y
= 1; /* SEL_Y */
659 vtx
.dst_sel_z
= 2; /* SEL_Z */
660 vtx
.dst_sel_w
= 3; /* SEL_W */
661 vtx
.data_format
= FMT_32_32_32_32_FLOAT
;
662 vtx
.num_format_all
= 2; /* NUM_FORMAT_SCALED */
663 vtx
.format_comp_all
= 1; /* FORMAT_COMP_SIGNED */
664 vtx
.srf_mode_all
= 1; /* SRF_MODE_NO_ZERO */
665 vtx
.endian
= r600_endian_swap(32);
667 if ((r
= r600_bytecode_add_vtx(ctx
->bc
, &vtx
)))
673 static int tgsi_split_constant(struct r600_shader_ctx
*ctx
)
675 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
676 struct r600_bytecode_alu alu
;
677 int i
, j
, k
, nconst
, r
;
679 for (i
= 0, nconst
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
680 if (inst
->Src
[i
].Register
.File
== TGSI_FILE_CONSTANT
) {
683 tgsi_src(ctx
, &inst
->Src
[i
], &ctx
->src
[i
]);
685 for (i
= 0, j
= nconst
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
686 if (inst
->Src
[i
].Register
.File
!= TGSI_FILE_CONSTANT
) {
690 if (ctx
->src
[i
].rel
) {
691 int treg
= r600_get_temp(ctx
);
692 if ((r
= tgsi_fetch_rel_const(ctx
, ctx
->src
[i
].sel
- 512, treg
)))
695 ctx
->src
[i
].sel
= treg
;
699 int treg
= r600_get_temp(ctx
);
700 for (k
= 0; k
< 4; k
++) {
701 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
702 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
703 alu
.src
[0].sel
= ctx
->src
[i
].sel
;
705 alu
.src
[0].rel
= ctx
->src
[i
].rel
;
711 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
715 ctx
->src
[i
].sel
= treg
;
723 /* need to move any immediate into a temp - for trig functions which use literal for PI stuff */
724 static int tgsi_split_literal_constant(struct r600_shader_ctx
*ctx
)
726 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
727 struct r600_bytecode_alu alu
;
728 int i
, j
, k
, nliteral
, r
;
730 for (i
= 0, nliteral
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
731 if (ctx
->src
[i
].sel
== V_SQ_ALU_SRC_LITERAL
) {
735 for (i
= 0, j
= nliteral
- 1; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
736 if (j
> 0 && ctx
->src
[i
].sel
== V_SQ_ALU_SRC_LITERAL
) {
737 int treg
= r600_get_temp(ctx
);
738 for (k
= 0; k
< 4; k
++) {
739 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
740 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
741 alu
.src
[0].sel
= ctx
->src
[i
].sel
;
743 alu
.src
[0].value
= ctx
->src
[i
].value
[k
];
749 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
753 ctx
->src
[i
].sel
= treg
;
760 static int process_twoside_color_inputs(struct r600_shader_ctx
*ctx
)
762 int i
, r
, count
= ctx
->shader
->ninput
;
764 /* additional inputs will be allocated right after the existing inputs,
765 * we won't need them after the color selection, so we don't need to
766 * reserve these gprs for the rest of the shader code and to adjust
767 * output offsets etc. */
768 int gpr
= ctx
->file_offset
[TGSI_FILE_INPUT
] +
769 ctx
->info
.file_max
[TGSI_FILE_INPUT
] + 1;
771 if (ctx
->face_gpr
== -1) {
772 i
= ctx
->shader
->ninput
++;
773 ctx
->shader
->input
[i
].name
= TGSI_SEMANTIC_FACE
;
774 ctx
->shader
->input
[i
].spi_sid
= 0;
775 ctx
->shader
->input
[i
].gpr
= gpr
++;
776 ctx
->face_gpr
= ctx
->shader
->input
[i
].gpr
;
779 for (i
= 0; i
< count
; i
++) {
780 if (ctx
->shader
->input
[i
].name
== TGSI_SEMANTIC_COLOR
) {
781 int ni
= ctx
->shader
->ninput
++;
782 memcpy(&ctx
->shader
->input
[ni
],&ctx
->shader
->input
[i
], sizeof(struct r600_shader_io
));
783 ctx
->shader
->input
[ni
].name
= TGSI_SEMANTIC_BCOLOR
;
784 ctx
->shader
->input
[ni
].spi_sid
= r600_spi_sid(&ctx
->shader
->input
[ni
]);
785 ctx
->shader
->input
[ni
].gpr
= gpr
++;
787 if (ctx
->bc
->chip_class
>= EVERGREEN
) {
788 r
= evergreen_interp_input(ctx
, ni
);
793 r
= select_twoside_color(ctx
, i
, ni
);
801 static int r600_shader_from_tgsi(struct r600_pipe_context
* rctx
, struct r600_pipe_shader
*pipeshader
)
803 struct r600_shader
*shader
= &pipeshader
->shader
;
804 struct tgsi_token
*tokens
= pipeshader
->tokens
;
805 struct pipe_stream_output_info so
= pipeshader
->so
;
806 struct tgsi_full_immediate
*immediate
;
807 struct tgsi_full_property
*property
;
808 struct r600_shader_ctx ctx
;
809 struct r600_bytecode_output output
[32];
810 unsigned output_done
, noutput
;
813 int next_pixel_base
= 0, next_pos_base
= 60, next_param_base
= 0;
815 ctx
.bc
= &shader
->bc
;
817 r600_bytecode_init(ctx
.bc
, rctx
->chip_class
, rctx
->family
);
819 tgsi_scan_shader(tokens
, &ctx
.info
);
820 tgsi_parse_init(&ctx
.parse
, tokens
);
821 ctx
.type
= ctx
.parse
.FullHeader
.Processor
.Processor
;
822 shader
->processor_type
= ctx
.type
;
823 ctx
.bc
->type
= shader
->processor_type
;
827 ctx
.clip_vertex_write
= 0;
829 shader
->two_side
= (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
) && rctx
->two_side
;
831 shader
->clamp_color
= (((ctx
.type
== TGSI_PROCESSOR_FRAGMENT
) && rctx
->clamp_fragment_color
) ||
832 ((ctx
.type
== TGSI_PROCESSOR_VERTEX
) && rctx
->clamp_vertex_color
));
834 shader
->nr_cbufs
= rctx
->nr_cbufs
;
836 /* register allocations */
837 /* Values [0,127] correspond to GPR[0..127].
838 * Values [128,159] correspond to constant buffer bank 0
839 * Values [160,191] correspond to constant buffer bank 1
840 * Values [256,511] correspond to cfile constants c[0..255]. (Gone on EG)
841 * Values [256,287] correspond to constant buffer bank 2 (EG)
842 * Values [288,319] correspond to constant buffer bank 3 (EG)
843 * Other special values are shown in the list below.
844 * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
845 * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
846 * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
847 * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
848 * 248 SQ_ALU_SRC_0: special constant 0.0.
849 * 249 SQ_ALU_SRC_1: special constant 1.0 float.
850 * 250 SQ_ALU_SRC_1_INT: special constant 1 integer.
851 * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer.
852 * 252 SQ_ALU_SRC_0_5: special constant 0.5 float.
853 * 253 SQ_ALU_SRC_LITERAL: literal constant.
854 * 254 SQ_ALU_SRC_PV: previous vector result.
855 * 255 SQ_ALU_SRC_PS: previous scalar result.
857 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
858 ctx
.file_offset
[i
] = 0;
860 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
) {
861 ctx
.file_offset
[TGSI_FILE_INPUT
] = 1;
862 if (ctx
.bc
->chip_class
>= EVERGREEN
) {
863 r600_bytecode_add_cfinst(ctx
.bc
, EG_V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
865 r600_bytecode_add_cfinst(ctx
.bc
, V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS
);
868 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& ctx
.bc
->chip_class
>= EVERGREEN
) {
869 ctx
.file_offset
[TGSI_FILE_INPUT
] = evergreen_gpr_count(&ctx
);
871 ctx
.file_offset
[TGSI_FILE_OUTPUT
] = ctx
.file_offset
[TGSI_FILE_INPUT
] +
872 ctx
.info
.file_max
[TGSI_FILE_INPUT
] + 1;
873 ctx
.file_offset
[TGSI_FILE_TEMPORARY
] = ctx
.file_offset
[TGSI_FILE_OUTPUT
] +
874 ctx
.info
.file_max
[TGSI_FILE_OUTPUT
] + 1;
876 /* Outside the GPR range. This will be translated to one of the
877 * kcache banks later. */
878 ctx
.file_offset
[TGSI_FILE_CONSTANT
] = 512;
880 ctx
.file_offset
[TGSI_FILE_IMMEDIATE
] = V_SQ_ALU_SRC_LITERAL
;
881 ctx
.bc
->ar_reg
= ctx
.file_offset
[TGSI_FILE_TEMPORARY
] +
882 ctx
.info
.file_max
[TGSI_FILE_TEMPORARY
] + 1;
883 ctx
.temp_reg
= ctx
.bc
->ar_reg
+ 1;
887 shader
->fs_write_all
= FALSE
;
888 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
889 tgsi_parse_token(&ctx
.parse
);
890 switch (ctx
.parse
.FullToken
.Token
.Type
) {
891 case TGSI_TOKEN_TYPE_IMMEDIATE
:
892 immediate
= &ctx
.parse
.FullToken
.FullImmediate
;
893 ctx
.literals
= realloc(ctx
.literals
, (ctx
.nliterals
+ 1) * 16);
894 if(ctx
.literals
== NULL
) {
898 ctx
.literals
[ctx
.nliterals
* 4 + 0] = immediate
->u
[0].Uint
;
899 ctx
.literals
[ctx
.nliterals
* 4 + 1] = immediate
->u
[1].Uint
;
900 ctx
.literals
[ctx
.nliterals
* 4 + 2] = immediate
->u
[2].Uint
;
901 ctx
.literals
[ctx
.nliterals
* 4 + 3] = immediate
->u
[3].Uint
;
904 case TGSI_TOKEN_TYPE_DECLARATION
:
905 r
= tgsi_declaration(&ctx
);
909 case TGSI_TOKEN_TYPE_INSTRUCTION
:
911 case TGSI_TOKEN_TYPE_PROPERTY
:
912 property
= &ctx
.parse
.FullToken
.FullProperty
;
913 switch (property
->Property
.PropertyName
) {
914 case TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS
:
915 if (property
->u
[0].Data
== 1)
916 shader
->fs_write_all
= TRUE
;
918 case TGSI_PROPERTY_VS_PROHIBIT_UCPS
:
919 if (property
->u
[0].Data
== 1)
920 shader
->vs_prohibit_ucps
= TRUE
;
925 R600_ERR("unsupported token type %d\n", ctx
.parse
.FullToken
.Token
.Type
);
931 if (shader
->two_side
&& ctx
.colors_used
) {
932 if ((r
= process_twoside_color_inputs(&ctx
)))
936 tgsi_parse_init(&ctx
.parse
, tokens
);
937 while (!tgsi_parse_end_of_tokens(&ctx
.parse
)) {
938 tgsi_parse_token(&ctx
.parse
);
939 switch (ctx
.parse
.FullToken
.Token
.Type
) {
940 case TGSI_TOKEN_TYPE_INSTRUCTION
:
941 r
= tgsi_is_supported(&ctx
);
944 ctx
.max_driver_temp_used
= 0;
945 /* reserve first tmp for everyone */
948 opcode
= ctx
.parse
.FullToken
.FullInstruction
.Instruction
.Opcode
;
949 if ((r
= tgsi_split_constant(&ctx
)))
951 if ((r
= tgsi_split_literal_constant(&ctx
)))
953 if (ctx
.bc
->chip_class
== CAYMAN
)
954 ctx
.inst_info
= &cm_shader_tgsi_instruction
[opcode
];
955 else if (ctx
.bc
->chip_class
>= EVERGREEN
)
956 ctx
.inst_info
= &eg_shader_tgsi_instruction
[opcode
];
958 ctx
.inst_info
= &r600_shader_tgsi_instruction
[opcode
];
959 r
= ctx
.inst_info
->process(&ctx
);
968 noutput
= shader
->noutput
;
970 if (ctx
.clip_vertex_write
) {
971 /* need to convert a clipvertex write into clipdistance writes and not export
972 the clip vertex anymore */
974 memset(&shader
->output
[noutput
], 0, 2*sizeof(struct r600_shader_io
));
975 shader
->output
[noutput
].name
= TGSI_SEMANTIC_CLIPDIST
;
976 shader
->output
[noutput
].gpr
= ctx
.temp_reg
;
978 shader
->output
[noutput
].name
= TGSI_SEMANTIC_CLIPDIST
;
979 shader
->output
[noutput
].gpr
= ctx
.temp_reg
+1;
982 shader
->clip_dist_write
= 0xFF;
984 for (i
= 0; i
< 8; i
++) {
988 for (j
= 0; j
< 4; j
++) {
989 struct r600_bytecode_alu alu
;
990 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
991 alu
.inst
= BC_INST(ctx
.bc
, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
);
992 alu
.src
[0].sel
= shader
->output
[ctx
.cv_output
].gpr
;
995 alu
.src
[1].sel
= 512 + i
;
996 alu
.src
[1].kc_bank
= 1;
999 alu
.dst
.sel
= ctx
.temp_reg
+ oreg
;
1001 alu
.dst
.write
= (j
== ochan
);
1004 r
= r600_bytecode_add_alu(ctx
.bc
, &alu
);
1011 /* clamp color outputs */
1012 if (shader
->clamp_color
) {
1013 for (i
= 0; i
< noutput
; i
++) {
1014 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
||
1015 shader
->output
[i
].name
== TGSI_SEMANTIC_BCOLOR
) {
1018 for (j
= 0; j
< 4; j
++) {
1019 struct r600_bytecode_alu alu
;
1020 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1023 alu
.inst
= BC_INST(ctx
.bc
, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1024 alu
.dst
.sel
= shader
->output
[i
].gpr
;
1028 alu
.src
[0].sel
= alu
.dst
.sel
;
1029 alu
.src
[0].chan
= j
;
1034 r
= r600_bytecode_add_alu(ctx
.bc
, &alu
);
1042 /* Add stream outputs. */
1043 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
&& so
.num_outputs
) {
1044 for (i
= 0; i
< so
.num_outputs
; i
++) {
1045 struct r600_bytecode_output output
;
1047 if (so
.output
[i
].output_buffer
>= 4) {
1048 R600_ERR("exceeded the max number of stream output buffers, got: %d\n",
1049 so
.output
[i
].output_buffer
);
1053 if (so
.output
[i
].start_component
) {
1054 R600_ERR("stream_output - start_component cannot be non-zero\n");
1059 memset(&output
, 0, sizeof(struct r600_bytecode_output
));
1060 output
.gpr
= shader
->output
[so
.output
[i
].register_index
].gpr
;
1061 output
.elem_size
= 0;
1062 output
.array_base
= so
.output
[i
].dst_offset
;
1063 output
.type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE
;
1064 output
.burst_count
= 1;
1066 /* array_size is an upper limit for the burst_count
1067 * with MEM_STREAM instructions */
1068 output
.array_size
= 0xFFF;
1069 output
.comp_mask
= (1 << so
.output
[i
].num_components
) - 1;
1070 if (ctx
.bc
->chip_class
>= EVERGREEN
) {
1071 switch (so
.output
[i
].output_buffer
) {
1073 output
.inst
= EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0_BUF0
;
1076 output
.inst
= EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0_BUF1
;
1079 output
.inst
= EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0_BUF2
;
1082 output
.inst
= EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0_BUF3
;
1086 switch (so
.output
[i
].output_buffer
) {
1088 output
.inst
= V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0
;
1091 output
.inst
= V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM1
;
1094 output
.inst
= V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM2
;
1097 output
.inst
= V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM3
;
1101 r
= r600_bytecode_add_output(ctx
.bc
, &output
);
1108 for (i
= 0, j
= 0; i
< noutput
; i
++, j
++) {
1109 memset(&output
[j
], 0, sizeof(struct r600_bytecode_output
));
1110 output
[j
].gpr
= shader
->output
[i
].gpr
;
1111 output
[j
].elem_size
= 3;
1112 output
[j
].swizzle_x
= 0;
1113 output
[j
].swizzle_y
= 1;
1114 output
[j
].swizzle_z
= 2;
1115 output
[j
].swizzle_w
= 3;
1116 output
[j
].burst_count
= 1;
1117 output
[j
].barrier
= 1;
1118 output
[j
].type
= -1;
1119 output
[j
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
1121 case TGSI_PROCESSOR_VERTEX
:
1122 switch (shader
->output
[i
].name
) {
1123 case TGSI_SEMANTIC_POSITION
:
1124 output
[j
].array_base
= next_pos_base
++;
1125 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
1128 case TGSI_SEMANTIC_PSIZE
:
1129 output
[j
].array_base
= next_pos_base
++;
1130 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
1132 case TGSI_SEMANTIC_CLIPVERTEX
:
1135 case TGSI_SEMANTIC_CLIPDIST
:
1136 output
[j
].array_base
= next_pos_base
++;
1137 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS
;
1138 /* spi_sid is 0 for clipdistance outputs that were generated
1139 * for clipvertex - we don't need to pass them to PS */
1140 if (shader
->output
[i
].spi_sid
) {
1142 /* duplicate it as PARAM to pass to the pixel shader */
1143 memcpy(&output
[j
], &output
[j
-1], sizeof(struct r600_bytecode_output
));
1144 output
[j
].array_base
= next_param_base
++;
1145 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
1150 case TGSI_PROCESSOR_FRAGMENT
:
1151 if (shader
->output
[i
].name
== TGSI_SEMANTIC_COLOR
) {
1152 output
[j
].array_base
= next_pixel_base
++;
1153 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
1154 if (shader
->fs_write_all
&& (rctx
->chip_class
>= EVERGREEN
)) {
1155 for (k
= 1; k
< shader
->nr_cbufs
; k
++) {
1157 memset(&output
[j
], 0, sizeof(struct r600_bytecode_output
));
1158 output
[j
].gpr
= shader
->output
[i
].gpr
;
1159 output
[j
].elem_size
= 3;
1160 output
[j
].swizzle_x
= 0;
1161 output
[j
].swizzle_y
= 1;
1162 output
[j
].swizzle_z
= 2;
1163 output
[j
].swizzle_w
= 3;
1164 output
[j
].burst_count
= 1;
1165 output
[j
].barrier
= 1;
1166 output
[j
].array_base
= next_pixel_base
++;
1167 output
[j
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
1168 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
1171 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_POSITION
) {
1172 output
[j
].array_base
= 61;
1173 output
[j
].swizzle_x
= 2;
1174 output
[j
].swizzle_y
= 7;
1175 output
[j
].swizzle_z
= output
[j
].swizzle_w
= 7;
1176 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
1177 } else if (shader
->output
[i
].name
== TGSI_SEMANTIC_STENCIL
) {
1178 output
[j
].array_base
= 61;
1179 output
[j
].swizzle_x
= 7;
1180 output
[j
].swizzle_y
= 1;
1181 output
[j
].swizzle_z
= output
[j
].swizzle_w
= 7;
1182 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
1184 R600_ERR("unsupported fragment output name %d\n", shader
->output
[i
].name
);
1190 R600_ERR("unsupported processor type %d\n", ctx
.type
);
1195 if (output
[j
].type
==-1) {
1196 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
1197 output
[j
].array_base
= next_param_base
++;
1201 /* add fake param output for vertex shader if no param is exported */
1202 if (ctx
.type
== TGSI_PROCESSOR_VERTEX
&& next_param_base
== 0) {
1203 memset(&output
[j
], 0, sizeof(struct r600_bytecode_output
));
1205 output
[j
].elem_size
= 3;
1206 output
[j
].swizzle_x
= 7;
1207 output
[j
].swizzle_y
= 7;
1208 output
[j
].swizzle_z
= 7;
1209 output
[j
].swizzle_w
= 7;
1210 output
[j
].burst_count
= 1;
1211 output
[j
].barrier
= 1;
1212 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM
;
1213 output
[j
].array_base
= 0;
1214 output
[j
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
1218 /* add fake pixel export */
1219 if (ctx
.type
== TGSI_PROCESSOR_FRAGMENT
&& j
== 0) {
1220 memset(&output
[j
], 0, sizeof(struct r600_bytecode_output
));
1222 output
[j
].elem_size
= 3;
1223 output
[j
].swizzle_x
= 7;
1224 output
[j
].swizzle_y
= 7;
1225 output
[j
].swizzle_z
= 7;
1226 output
[j
].swizzle_w
= 7;
1227 output
[j
].burst_count
= 1;
1228 output
[j
].barrier
= 1;
1229 output
[j
].type
= V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL
;
1230 output
[j
].array_base
= 0;
1231 output
[j
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT
);
1237 /* set export done on last export of each type */
1238 for (i
= noutput
- 1, output_done
= 0; i
>= 0; i
--) {
1239 if (ctx
.bc
->chip_class
< CAYMAN
) {
1240 if (i
== (noutput
- 1)) {
1241 output
[i
].end_of_program
= 1;
1244 if (!(output_done
& (1 << output
[i
].type
))) {
1245 output_done
|= (1 << output
[i
].type
);
1246 output
[i
].inst
= BC_INST(ctx
.bc
, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE
);
1249 /* add output to bytecode */
1250 for (i
= 0; i
< noutput
; i
++) {
1251 r
= r600_bytecode_add_output(ctx
.bc
, &output
[i
]);
1255 /* add program end */
1256 if (ctx
.bc
->chip_class
== CAYMAN
)
1257 cm_bytecode_add_cf_end(ctx
.bc
);
1260 tgsi_parse_free(&ctx
.parse
);
1264 tgsi_parse_free(&ctx
.parse
);
1268 static int tgsi_unsupported(struct r600_shader_ctx
*ctx
)
1270 R600_ERR("%s tgsi opcode unsupported\n",
1271 tgsi_get_opcode_name(ctx
->inst_info
->tgsi_opcode
));
1275 static int tgsi_end(struct r600_shader_ctx
*ctx
)
1280 static void r600_bytecode_src(struct r600_bytecode_alu_src
*bc_src
,
1281 const struct r600_shader_src
*shader_src
,
1284 bc_src
->sel
= shader_src
->sel
;
1285 bc_src
->chan
= shader_src
->swizzle
[chan
];
1286 bc_src
->neg
= shader_src
->neg
;
1287 bc_src
->abs
= shader_src
->abs
;
1288 bc_src
->rel
= shader_src
->rel
;
1289 bc_src
->value
= shader_src
->value
[bc_src
->chan
];
1292 static void r600_bytecode_src_set_abs(struct r600_bytecode_alu_src
*bc_src
)
1298 static void r600_bytecode_src_toggle_neg(struct r600_bytecode_alu_src
*bc_src
)
1300 bc_src
->neg
= !bc_src
->neg
;
1303 static void tgsi_dst(struct r600_shader_ctx
*ctx
,
1304 const struct tgsi_full_dst_register
*tgsi_dst
,
1306 struct r600_bytecode_alu_dst
*r600_dst
)
1308 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1310 r600_dst
->sel
= tgsi_dst
->Register
.Index
;
1311 r600_dst
->sel
+= ctx
->file_offset
[tgsi_dst
->Register
.File
];
1312 r600_dst
->chan
= swizzle
;
1313 r600_dst
->write
= 1;
1314 if (tgsi_dst
->Register
.Indirect
)
1315 r600_dst
->rel
= V_SQ_REL_RELATIVE
;
1316 if (inst
->Instruction
.Saturate
) {
1317 r600_dst
->clamp
= 1;
1321 static int tgsi_last_instruction(unsigned writemask
)
1325 for (i
= 0; i
< 4; i
++) {
1326 if (writemask
& (1 << i
)) {
1333 static int tgsi_op2_s(struct r600_shader_ctx
*ctx
, int swap
, int trans_only
)
1335 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1336 struct r600_bytecode_alu alu
;
1338 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1340 for (i
= 0; i
< lasti
+ 1; i
++) {
1341 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1344 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1345 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1347 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1349 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1350 r600_bytecode_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
1353 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[1], i
);
1354 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
1356 /* handle some special cases */
1357 switch (ctx
->inst_info
->tgsi_opcode
) {
1358 case TGSI_OPCODE_SUB
:
1359 r600_bytecode_src_toggle_neg(&alu
.src
[1]);
1361 case TGSI_OPCODE_ABS
:
1362 r600_bytecode_src_set_abs(&alu
.src
[0]);
1367 if (i
== lasti
|| trans_only
) {
1370 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1377 static int tgsi_op2(struct r600_shader_ctx
*ctx
)
1379 return tgsi_op2_s(ctx
, 0, 0);
1382 static int tgsi_op2_swap(struct r600_shader_ctx
*ctx
)
1384 return tgsi_op2_s(ctx
, 1, 0);
1387 static int tgsi_op2_trans(struct r600_shader_ctx
*ctx
)
1389 return tgsi_op2_s(ctx
, 0, 1);
1392 static int tgsi_ineg(struct r600_shader_ctx
*ctx
)
1394 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1395 struct r600_bytecode_alu alu
;
1397 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1399 for (i
= 0; i
< lasti
+ 1; i
++) {
1401 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1403 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1404 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1406 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1408 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
1410 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1415 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1423 static int cayman_emit_float_instr(struct r600_shader_ctx
*ctx
)
1425 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1427 struct r600_bytecode_alu alu
;
1428 int last_slot
= (inst
->Dst
[0].Register
.WriteMask
& 0x8) ? 4 : 3;
1430 for (i
= 0 ; i
< last_slot
; i
++) {
1431 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1432 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1433 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
1434 r600_bytecode_src(&alu
.src
[j
], &ctx
->src
[j
], 0);
1436 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1437 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1439 if (i
== last_slot
- 1)
1441 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1449 * r600 - trunc to -PI..PI range
1450 * r700 - normalize by dividing by 2PI
1453 static int tgsi_setup_trig(struct r600_shader_ctx
*ctx
)
1455 static float half_inv_pi
= 1.0 /(3.1415926535 * 2);
1456 static float double_pi
= 3.1415926535 * 2;
1457 static float neg_pi
= -3.1415926535;
1460 struct r600_bytecode_alu alu
;
1462 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1463 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1467 alu
.dst
.sel
= ctx
->temp_reg
;
1470 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
1472 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
1473 alu
.src
[1].chan
= 0;
1474 alu
.src
[1].value
= *(uint32_t *)&half_inv_pi
;
1475 alu
.src
[2].sel
= V_SQ_ALU_SRC_0_5
;
1476 alu
.src
[2].chan
= 0;
1478 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1482 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1483 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
1486 alu
.dst
.sel
= ctx
->temp_reg
;
1489 alu
.src
[0].sel
= ctx
->temp_reg
;
1490 alu
.src
[0].chan
= 0;
1492 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1496 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1497 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
1501 alu
.dst
.sel
= ctx
->temp_reg
;
1504 alu
.src
[0].sel
= ctx
->temp_reg
;
1505 alu
.src
[0].chan
= 0;
1507 alu
.src
[1].sel
= V_SQ_ALU_SRC_LITERAL
;
1508 alu
.src
[1].chan
= 0;
1509 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
1510 alu
.src
[2].chan
= 0;
1512 if (ctx
->bc
->chip_class
== R600
) {
1513 alu
.src
[1].value
= *(uint32_t *)&double_pi
;
1514 alu
.src
[2].value
= *(uint32_t *)&neg_pi
;
1516 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1517 alu
.src
[2].sel
= V_SQ_ALU_SRC_0_5
;
1522 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1528 static int cayman_trig(struct r600_shader_ctx
*ctx
)
1530 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1531 struct r600_bytecode_alu alu
;
1532 int last_slot
= (inst
->Dst
[0].Register
.WriteMask
& 0x8) ? 4 : 3;
1535 r
= tgsi_setup_trig(ctx
);
1540 for (i
= 0; i
< last_slot
; i
++) {
1541 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1542 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1545 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1546 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1548 alu
.src
[0].sel
= ctx
->temp_reg
;
1549 alu
.src
[0].chan
= 0;
1550 if (i
== last_slot
- 1)
1552 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1559 static int tgsi_trig(struct r600_shader_ctx
*ctx
)
1561 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1562 struct r600_bytecode_alu alu
;
1564 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
1566 r
= tgsi_setup_trig(ctx
);
1570 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1571 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1573 alu
.dst
.sel
= ctx
->temp_reg
;
1576 alu
.src
[0].sel
= ctx
->temp_reg
;
1577 alu
.src
[0].chan
= 0;
1579 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1583 /* replicate result */
1584 for (i
= 0; i
< lasti
+ 1; i
++) {
1585 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
1588 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1589 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1591 alu
.src
[0].sel
= ctx
->temp_reg
;
1592 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1595 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1602 static int tgsi_scs(struct r600_shader_ctx
*ctx
)
1604 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1605 struct r600_bytecode_alu alu
;
1608 /* We'll only need the trig stuff if we are going to write to the
1609 * X or Y components of the destination vector.
1611 if (likely(inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_XY
)) {
1612 r
= tgsi_setup_trig(ctx
);
1618 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_X
) {
1619 if (ctx
->bc
->chip_class
== CAYMAN
) {
1620 for (i
= 0 ; i
< 3; i
++) {
1621 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1622 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
);
1623 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1629 alu
.src
[0].sel
= ctx
->temp_reg
;
1630 alu
.src
[0].chan
= 0;
1633 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1638 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1639 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
);
1640 tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1642 alu
.src
[0].sel
= ctx
->temp_reg
;
1643 alu
.src
[0].chan
= 0;
1645 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1652 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Y
) {
1653 if (ctx
->bc
->chip_class
== CAYMAN
) {
1654 for (i
= 0 ; i
< 3; i
++) {
1655 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1656 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
);
1657 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1662 alu
.src
[0].sel
= ctx
->temp_reg
;
1663 alu
.src
[0].chan
= 0;
1666 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1671 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1672 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
);
1673 tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1675 alu
.src
[0].sel
= ctx
->temp_reg
;
1676 alu
.src
[0].chan
= 0;
1678 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1685 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_Z
) {
1686 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1688 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1690 tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1692 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1693 alu
.src
[0].chan
= 0;
1697 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1703 if (inst
->Dst
[0].Register
.WriteMask
& TGSI_WRITEMASK_W
) {
1704 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1706 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1708 tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1710 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1711 alu
.src
[0].chan
= 0;
1715 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1723 static int tgsi_kill(struct r600_shader_ctx
*ctx
)
1725 struct r600_bytecode_alu alu
;
1728 for (i
= 0; i
< 4; i
++) {
1729 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1730 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1734 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
1736 if (ctx
->inst_info
->tgsi_opcode
== TGSI_OPCODE_KILP
) {
1737 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
1740 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
1745 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1750 /* kill must be last in ALU */
1751 ctx
->bc
->force_add_cf
= 1;
1752 ctx
->shader
->uses_kill
= TRUE
;
1756 static int tgsi_lit(struct r600_shader_ctx
*ctx
)
1758 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1759 struct r600_bytecode_alu alu
;
1762 /* tmp.x = max(src.y, 0.0) */
1763 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1764 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
);
1765 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 1);
1766 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
1767 alu
.src
[1].chan
= 1;
1769 alu
.dst
.sel
= ctx
->temp_reg
;
1774 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1778 if (inst
->Dst
[0].Register
.WriteMask
& (1 << 2))
1784 if (ctx
->bc
->chip_class
== CAYMAN
) {
1785 for (i
= 0; i
< 3; i
++) {
1786 /* tmp.z = log(tmp.x) */
1787 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1788 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
);
1789 alu
.src
[0].sel
= ctx
->temp_reg
;
1790 alu
.src
[0].chan
= 0;
1791 alu
.dst
.sel
= ctx
->temp_reg
;
1799 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1804 /* tmp.z = log(tmp.x) */
1805 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1806 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED
);
1807 alu
.src
[0].sel
= ctx
->temp_reg
;
1808 alu
.src
[0].chan
= 0;
1809 alu
.dst
.sel
= ctx
->temp_reg
;
1813 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1818 chan
= alu
.dst
.chan
;
1821 /* tmp.x = amd MUL_LIT(tmp.z, src.w, src.x ) */
1822 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1823 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT
);
1824 alu
.src
[0].sel
= sel
;
1825 alu
.src
[0].chan
= chan
;
1826 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], 3);
1827 r600_bytecode_src(&alu
.src
[2], &ctx
->src
[0], 0);
1828 alu
.dst
.sel
= ctx
->temp_reg
;
1833 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1837 if (ctx
->bc
->chip_class
== CAYMAN
) {
1838 for (i
= 0; i
< 3; i
++) {
1839 /* dst.z = exp(tmp.x) */
1840 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1841 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1842 alu
.src
[0].sel
= ctx
->temp_reg
;
1843 alu
.src
[0].chan
= 0;
1844 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1850 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1855 /* dst.z = exp(tmp.x) */
1856 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1857 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
1858 alu
.src
[0].sel
= ctx
->temp_reg
;
1859 alu
.src
[0].chan
= 0;
1860 tgsi_dst(ctx
, &inst
->Dst
[0], 2, &alu
.dst
);
1862 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1869 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1870 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1871 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
; /*1.0*/
1872 alu
.src
[0].chan
= 0;
1873 tgsi_dst(ctx
, &inst
->Dst
[0], 0, &alu
.dst
);
1874 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 0) & 1;
1875 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1879 /* dst.y = max(src.x, 0.0) */
1880 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1881 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
);
1882 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
1883 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
; /*0.0*/
1884 alu
.src
[1].chan
= 0;
1885 tgsi_dst(ctx
, &inst
->Dst
[0], 1, &alu
.dst
);
1886 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 1) & 1;
1887 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1892 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1893 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1894 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
1895 alu
.src
[0].chan
= 0;
1896 tgsi_dst(ctx
, &inst
->Dst
[0], 3, &alu
.dst
);
1897 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> 3) & 1;
1899 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1906 static int tgsi_rsq(struct r600_shader_ctx
*ctx
)
1908 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1909 struct r600_bytecode_alu alu
;
1912 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1915 * For state trackers other than OpenGL, we'll want to use
1916 * _RECIPSQRT_IEEE instead.
1918 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED
);
1920 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1921 r600_bytecode_src(&alu
.src
[i
], &ctx
->src
[i
], 0);
1922 r600_bytecode_src_set_abs(&alu
.src
[i
]);
1924 alu
.dst
.sel
= ctx
->temp_reg
;
1927 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1930 /* replicate result */
1931 return tgsi_helper_tempx_replicate(ctx
);
1934 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx
*ctx
)
1936 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1937 struct r600_bytecode_alu alu
;
1940 for (i
= 0; i
< 4; i
++) {
1941 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1942 alu
.src
[0].sel
= ctx
->temp_reg
;
1943 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
1945 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
1946 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
1949 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1956 static int tgsi_trans_srcx_replicate(struct r600_shader_ctx
*ctx
)
1958 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1959 struct r600_bytecode_alu alu
;
1962 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1963 alu
.inst
= ctx
->inst_info
->r600_opcode
;
1964 for (i
= 0; i
< inst
->Instruction
.NumSrcRegs
; i
++) {
1965 r600_bytecode_src(&alu
.src
[i
], &ctx
->src
[i
], 0);
1967 alu
.dst
.sel
= ctx
->temp_reg
;
1970 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1973 /* replicate result */
1974 return tgsi_helper_tempx_replicate(ctx
);
1977 static int cayman_pow(struct r600_shader_ctx
*ctx
)
1979 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
1981 struct r600_bytecode_alu alu
;
1982 int last_slot
= (inst
->Dst
[0].Register
.WriteMask
& 0x8) ? 4 : 3;
1984 for (i
= 0; i
< 3; i
++) {
1985 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
1986 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
1987 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
1988 alu
.dst
.sel
= ctx
->temp_reg
;
1993 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
1999 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2000 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2001 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[1], 0);
2002 alu
.src
[1].sel
= ctx
->temp_reg
;
2003 alu
.dst
.sel
= ctx
->temp_reg
;
2006 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2010 for (i
= 0; i
< last_slot
; i
++) {
2011 /* POW(a,b) = EXP2(b * LOG2(a))*/
2012 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2013 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2014 alu
.src
[0].sel
= ctx
->temp_reg
;
2016 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2017 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
2018 if (i
== last_slot
- 1)
2020 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2027 static int tgsi_pow(struct r600_shader_ctx
*ctx
)
2029 struct r600_bytecode_alu alu
;
2033 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2034 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
2035 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
2036 alu
.dst
.sel
= ctx
->temp_reg
;
2039 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2043 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2044 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
2045 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[1], 0);
2046 alu
.src
[1].sel
= ctx
->temp_reg
;
2047 alu
.dst
.sel
= ctx
->temp_reg
;
2050 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2053 /* POW(a,b) = EXP2(b * LOG2(a))*/
2054 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2055 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
2056 alu
.src
[0].sel
= ctx
->temp_reg
;
2057 alu
.dst
.sel
= ctx
->temp_reg
;
2060 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2063 return tgsi_helper_tempx_replicate(ctx
);
2066 static int tgsi_divmod(struct r600_shader_ctx
*ctx
, int mod
, int signed_op
)
2068 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2069 struct r600_bytecode_alu alu
;
2071 unsigned write_mask
= inst
->Dst
[0].Register
.WriteMask
;
2072 int tmp0
= ctx
->temp_reg
;
2073 int tmp1
= r600_get_temp(ctx
);
2074 int tmp2
= r600_get_temp(ctx
);
2078 * we need to represent src1 as src2*q + r, where q - quotient, r - remainder
2080 * 1. tmp0.x = rcp (src2) = 2^32/src2 + e, where e is rounding error
2081 * 2. tmp0.z = lo (tmp0.x * src2)
2082 * 3. tmp0.w = -tmp0.z
2083 * 4. tmp0.y = hi (tmp0.x * src2)
2084 * 5. tmp0.z = (tmp0.y == 0 ? tmp0.w : tmp0.z) = abs(lo(rcp*src2))
2085 * 6. tmp0.w = hi (tmp0.z * tmp0.x) = e, rounding error
2086 * 7. tmp1.x = tmp0.x - tmp0.w
2087 * 8. tmp1.y = tmp0.x + tmp0.w
2088 * 9. tmp0.x = (tmp0.y == 0 ? tmp1.y : tmp1.x)
2089 * 10. tmp0.z = hi(tmp0.x * src1) = q
2090 * 11. tmp0.y = lo (tmp0.z * src2) = src2*q = src1 - r
2092 * 12. tmp0.w = src1 - tmp0.y = r
2093 * 13. tmp1.x = tmp0.w >= src2 = r >= src2 (uint comparison)
2094 * 14. tmp1.y = src1 >= tmp0.y = r >= 0 (uint comparison)
2098 * 15. tmp1.z = tmp0.z + 1 = q + 1
2099 * 16. tmp1.w = tmp0.z - 1 = q - 1
2103 * 15. tmp1.z = tmp0.w - src2 = r - src2
2104 * 16. tmp1.w = tmp0.w + src2 = r + src2
2108 * 17. tmp1.x = tmp1.x & tmp1.y
2110 * DIV: 18. tmp0.z = tmp1.x==0 ? tmp0.z : tmp1.z
2111 * MOD: 18. tmp0.z = tmp1.x==0 ? tmp0.w : tmp1.z
2113 * 19. tmp0.z = tmp1.y==0 ? tmp1.w : tmp0.z
2114 * 20. dst = src2==0 ? MAX_UINT : tmp0.z
2118 * Same as unsigned, using abs values of the operands,
2119 * and fixing the sign of the result in the end.
2122 for (i
= 0; i
< 4; i
++) {
2123 if (!(write_mask
& (1<<i
)))
2128 /* tmp2.x = -src0 */
2129 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2130 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
);
2136 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2138 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
2141 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2144 /* tmp2.y = -src1 */
2145 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2146 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
);
2152 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2154 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
2157 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2160 /* tmp2.z sign bit is set if src0 and src2 signs are different */
2161 /* it will be a sign of the quotient */
2164 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2165 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_XOR_INT
);
2171 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
2172 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
2175 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2179 /* tmp2.x = |src0| */
2180 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2181 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE_INT
);
2188 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
2189 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
2190 alu
.src
[2].sel
= tmp2
;
2191 alu
.src
[2].chan
= 0;
2194 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2197 /* tmp2.y = |src1| */
2198 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2199 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE_INT
);
2206 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[1], i
);
2207 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
2208 alu
.src
[2].sel
= tmp2
;
2209 alu
.src
[2].chan
= 1;
2212 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2217 /* 1. tmp0.x = rcp_u (src2) = 2^32/src2 + e, where e is rounding error */
2218 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2219 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_UINT
);
2226 alu
.src
[0].sel
= tmp2
;
2227 alu
.src
[0].chan
= 1;
2229 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[1], i
);
2233 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2236 /* 2. tmp0.z = lo (tmp0.x * src2) */
2237 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2238 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT
);
2244 alu
.src
[0].sel
= tmp0
;
2245 alu
.src
[0].chan
= 0;
2247 alu
.src
[1].sel
= tmp2
;
2248 alu
.src
[1].chan
= 1;
2250 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
2254 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2257 /* 3. tmp0.w = -tmp0.z */
2258 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2259 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
);
2265 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2266 alu
.src
[1].sel
= tmp0
;
2267 alu
.src
[1].chan
= 2;
2270 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2273 /* 4. tmp0.y = hi (tmp0.x * src2) */
2274 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2275 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT
);
2281 alu
.src
[0].sel
= tmp0
;
2282 alu
.src
[0].chan
= 0;
2285 alu
.src
[1].sel
= tmp2
;
2286 alu
.src
[1].chan
= 1;
2288 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
2292 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2295 /* 5. tmp0.z = (tmp0.y == 0 ? tmp0.w : tmp0.z) = abs(lo(rcp*src)) */
2296 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2297 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDE_INT
);
2304 alu
.src
[0].sel
= tmp0
;
2305 alu
.src
[0].chan
= 1;
2306 alu
.src
[1].sel
= tmp0
;
2307 alu
.src
[1].chan
= 3;
2308 alu
.src
[2].sel
= tmp0
;
2309 alu
.src
[2].chan
= 2;
2312 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2315 /* 6. tmp0.w = hi (tmp0.z * tmp0.x) = e, rounding error */
2316 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2317 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT
);
2323 alu
.src
[0].sel
= tmp0
;
2324 alu
.src
[0].chan
= 2;
2326 alu
.src
[1].sel
= tmp0
;
2327 alu
.src
[1].chan
= 0;
2330 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2333 /* 7. tmp1.x = tmp0.x - tmp0.w */
2334 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2335 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
);
2341 alu
.src
[0].sel
= tmp0
;
2342 alu
.src
[0].chan
= 0;
2343 alu
.src
[1].sel
= tmp0
;
2344 alu
.src
[1].chan
= 3;
2347 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2350 /* 8. tmp1.y = tmp0.x + tmp0.w */
2351 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2352 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
);
2358 alu
.src
[0].sel
= tmp0
;
2359 alu
.src
[0].chan
= 0;
2360 alu
.src
[1].sel
= tmp0
;
2361 alu
.src
[1].chan
= 3;
2364 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2367 /* 9. tmp0.x = (tmp0.y == 0 ? tmp1.y : tmp1.x) */
2368 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2369 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDE_INT
);
2376 alu
.src
[0].sel
= tmp0
;
2377 alu
.src
[0].chan
= 1;
2378 alu
.src
[1].sel
= tmp1
;
2379 alu
.src
[1].chan
= 1;
2380 alu
.src
[2].sel
= tmp1
;
2381 alu
.src
[2].chan
= 0;
2384 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2387 /* 10. tmp0.z = hi(tmp0.x * src1) = q */
2388 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2389 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT
);
2395 alu
.src
[0].sel
= tmp0
;
2396 alu
.src
[0].chan
= 0;
2399 alu
.src
[1].sel
= tmp2
;
2400 alu
.src
[1].chan
= 0;
2402 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
2406 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2409 /* 11. tmp0.y = lo (src2 * tmp0.z) = src2*q = src1 - r */
2410 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2411 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT
);
2418 alu
.src
[0].sel
= tmp2
;
2419 alu
.src
[0].chan
= 1;
2421 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[1], i
);
2424 alu
.src
[1].sel
= tmp0
;
2425 alu
.src
[1].chan
= 2;
2428 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2431 /* 12. tmp0.w = src1 - tmp0.y = r */
2432 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2433 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
);
2440 alu
.src
[0].sel
= tmp2
;
2441 alu
.src
[0].chan
= 0;
2443 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
2446 alu
.src
[1].sel
= tmp0
;
2447 alu
.src
[1].chan
= 1;
2450 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2453 /* 13. tmp1.x = tmp0.w >= src2 = r >= src2 */
2454 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2455 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_UINT
);
2461 alu
.src
[0].sel
= tmp0
;
2462 alu
.src
[0].chan
= 3;
2464 alu
.src
[1].sel
= tmp2
;
2465 alu
.src
[1].chan
= 1;
2467 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
2471 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2474 /* 14. tmp1.y = src1 >= tmp0.y = r >= 0 */
2475 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2476 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_UINT
);
2483 alu
.src
[0].sel
= tmp2
;
2484 alu
.src
[0].chan
= 0;
2486 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
2489 alu
.src
[1].sel
= tmp0
;
2490 alu
.src
[1].chan
= 1;
2493 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2496 if (mod
) { /* UMOD */
2498 /* 15. tmp1.z = tmp0.w - src2 = r - src2 */
2499 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2500 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
);
2506 alu
.src
[0].sel
= tmp0
;
2507 alu
.src
[0].chan
= 3;
2510 alu
.src
[1].sel
= tmp2
;
2511 alu
.src
[1].chan
= 1;
2513 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
2517 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2520 /* 16. tmp1.w = tmp0.w + src2 = r + src2 */
2521 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2522 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
);
2528 alu
.src
[0].sel
= tmp0
;
2529 alu
.src
[0].chan
= 3;
2531 alu
.src
[1].sel
= tmp2
;
2532 alu
.src
[1].chan
= 1;
2534 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
2538 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2543 /* 15. tmp1.z = tmp0.z + 1 = q + 1 DIV */
2544 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2545 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
);
2551 alu
.src
[0].sel
= tmp0
;
2552 alu
.src
[0].chan
= 2;
2553 alu
.src
[1].sel
= V_SQ_ALU_SRC_1_INT
;
2556 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2559 /* 16. tmp1.w = tmp0.z - 1 = q - 1 */
2560 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2561 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
);
2567 alu
.src
[0].sel
= tmp0
;
2568 alu
.src
[0].chan
= 2;
2569 alu
.src
[1].sel
= V_SQ_ALU_SRC_M_1_INT
;
2572 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2577 /* 17. tmp1.x = tmp1.x & tmp1.y */
2578 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2579 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_AND_INT
);
2585 alu
.src
[0].sel
= tmp1
;
2586 alu
.src
[0].chan
= 0;
2587 alu
.src
[1].sel
= tmp1
;
2588 alu
.src
[1].chan
= 1;
2591 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2594 /* 18. tmp0.z = tmp1.x==0 ? tmp0.z : tmp1.z DIV */
2595 /* 18. tmp0.z = tmp1.x==0 ? tmp0.w : tmp1.z MOD */
2596 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2597 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDE_INT
);
2604 alu
.src
[0].sel
= tmp1
;
2605 alu
.src
[0].chan
= 0;
2606 alu
.src
[1].sel
= tmp0
;
2607 alu
.src
[1].chan
= mod
? 3 : 2;
2608 alu
.src
[2].sel
= tmp1
;
2609 alu
.src
[2].chan
= 2;
2612 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2615 /* 19. tmp0.z = tmp1.y==0 ? tmp1.w : tmp0.z */
2616 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2617 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDE_INT
);
2625 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2628 alu
.src
[0].sel
= tmp1
;
2629 alu
.src
[0].chan
= 1;
2630 alu
.src
[1].sel
= tmp1
;
2631 alu
.src
[1].chan
= 3;
2632 alu
.src
[2].sel
= tmp0
;
2633 alu
.src
[2].chan
= 2;
2636 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2641 /* fix the sign of the result */
2645 /* tmp0.x = -tmp0.z */
2646 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2647 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
);
2653 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2654 alu
.src
[1].sel
= tmp0
;
2655 alu
.src
[1].chan
= 2;
2658 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2661 /* sign of the remainder is the same as the sign of src0 */
2662 /* tmp0.x = src0>=0 ? tmp0.z : tmp0.x */
2663 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2664 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE_INT
);
2667 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2669 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
2670 alu
.src
[1].sel
= tmp0
;
2671 alu
.src
[1].chan
= 2;
2672 alu
.src
[2].sel
= tmp0
;
2673 alu
.src
[2].chan
= 0;
2676 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2681 /* tmp0.x = -tmp0.z */
2682 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2683 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
);
2689 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2690 alu
.src
[1].sel
= tmp0
;
2691 alu
.src
[1].chan
= 2;
2694 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2697 /* fix the quotient sign (same as the sign of src0*src1) */
2698 /* tmp0.x = tmp2.z>=0 ? tmp0.z : tmp0.x */
2699 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2700 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE_INT
);
2703 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2705 alu
.src
[0].sel
= tmp2
;
2706 alu
.src
[0].chan
= 2;
2707 alu
.src
[1].sel
= tmp0
;
2708 alu
.src
[1].chan
= 2;
2709 alu
.src
[2].sel
= tmp0
;
2710 alu
.src
[2].chan
= 0;
2713 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
2721 static int tgsi_udiv(struct r600_shader_ctx
*ctx
)
2723 return tgsi_divmod(ctx
, 0, 0);
2726 static int tgsi_umod(struct r600_shader_ctx
*ctx
)
2728 return tgsi_divmod(ctx
, 1, 0);
2731 static int tgsi_idiv(struct r600_shader_ctx
*ctx
)
2733 return tgsi_divmod(ctx
, 0, 1);
2736 static int tgsi_imod(struct r600_shader_ctx
*ctx
)
2738 return tgsi_divmod(ctx
, 1, 1);
2741 static int tgsi_iabs(struct r600_shader_ctx
*ctx
)
2743 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2744 struct r600_bytecode_alu alu
;
2746 unsigned write_mask
= inst
->Dst
[0].Register
.WriteMask
;
2747 int last_inst
= tgsi_last_instruction(write_mask
);
2750 for (i
= 0; i
< 4; i
++) {
2751 if (!(write_mask
& (1<<i
)))
2754 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2755 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
);
2757 alu
.dst
.sel
= ctx
->temp_reg
;
2761 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
2762 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
2766 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2771 /* dst = (src >= 0 ? src : tmp) */
2772 for (i
= 0; i
< 4; i
++) {
2773 if (!(write_mask
& (1<<i
)))
2776 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2777 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE_INT
);
2781 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2783 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
2784 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
2785 alu
.src
[2].sel
= ctx
->temp_reg
;
2786 alu
.src
[2].chan
= i
;
2790 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2797 static int tgsi_issg(struct r600_shader_ctx
*ctx
)
2799 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2800 struct r600_bytecode_alu alu
;
2802 unsigned write_mask
= inst
->Dst
[0].Register
.WriteMask
;
2803 int last_inst
= tgsi_last_instruction(write_mask
);
2805 /* tmp = (src >= 0 ? src : -1) */
2806 for (i
= 0; i
< 4; i
++) {
2807 if (!(write_mask
& (1<<i
)))
2810 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2811 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE_INT
);
2814 alu
.dst
.sel
= ctx
->temp_reg
;
2818 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
2819 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
2820 alu
.src
[2].sel
= V_SQ_ALU_SRC_M_1_INT
;
2824 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2829 /* dst = (tmp > 0 ? 1 : tmp) */
2830 for (i
= 0; i
< 4; i
++) {
2831 if (!(write_mask
& (1<<i
)))
2834 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2835 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT_INT
);
2839 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2841 alu
.src
[0].sel
= ctx
->temp_reg
;
2842 alu
.src
[0].chan
= i
;
2844 alu
.src
[1].sel
= V_SQ_ALU_SRC_1_INT
;
2846 alu
.src
[2].sel
= ctx
->temp_reg
;
2847 alu
.src
[2].chan
= i
;
2851 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2860 static int tgsi_ssg(struct r600_shader_ctx
*ctx
)
2862 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2863 struct r600_bytecode_alu alu
;
2866 /* tmp = (src > 0 ? 1 : src) */
2867 for (i
= 0; i
< 4; i
++) {
2868 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2869 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
2872 alu
.dst
.sel
= ctx
->temp_reg
;
2875 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
2876 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
2877 r600_bytecode_src(&alu
.src
[2], &ctx
->src
[0], i
);
2881 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2886 /* dst = (-tmp > 0 ? -1 : tmp) */
2887 for (i
= 0; i
< 4; i
++) {
2888 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2889 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT
);
2891 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2893 alu
.src
[0].sel
= ctx
->temp_reg
;
2894 alu
.src
[0].chan
= i
;
2897 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
2900 alu
.src
[2].sel
= ctx
->temp_reg
;
2901 alu
.src
[2].chan
= i
;
2905 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2912 static int tgsi_helper_copy(struct r600_shader_ctx
*ctx
, struct tgsi_full_instruction
*inst
)
2914 struct r600_bytecode_alu alu
;
2917 for (i
= 0; i
< 4; i
++) {
2918 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2919 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
))) {
2920 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
);
2923 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
2924 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2925 alu
.src
[0].sel
= ctx
->temp_reg
;
2926 alu
.src
[0].chan
= i
;
2931 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2938 static int tgsi_op3(struct r600_shader_ctx
*ctx
)
2940 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2941 struct r600_bytecode_alu alu
;
2943 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
2945 for (i
= 0; i
< lasti
+ 1; i
++) {
2946 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
2949 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2950 alu
.inst
= ctx
->inst_info
->r600_opcode
;
2951 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
2952 r600_bytecode_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
2955 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2962 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
2969 static int tgsi_dp(struct r600_shader_ctx
*ctx
)
2971 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
2972 struct r600_bytecode_alu alu
;
2975 for (i
= 0; i
< 4; i
++) {
2976 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
2977 alu
.inst
= ctx
->inst_info
->r600_opcode
;
2978 for (j
= 0; j
< inst
->Instruction
.NumSrcRegs
; j
++) {
2979 r600_bytecode_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
2982 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
2984 alu
.dst
.write
= (inst
->Dst
[0].Register
.WriteMask
>> i
) & 1;
2985 /* handle some special cases */
2986 switch (ctx
->inst_info
->tgsi_opcode
) {
2987 case TGSI_OPCODE_DP2
:
2989 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2990 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
2993 case TGSI_OPCODE_DP3
:
2995 alu
.src
[0].sel
= alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
2996 alu
.src
[0].chan
= alu
.src
[1].chan
= 0;
2999 case TGSI_OPCODE_DPH
:
3001 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
3002 alu
.src
[0].chan
= 0;
3012 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3019 static inline boolean
tgsi_tex_src_requires_loading(struct r600_shader_ctx
*ctx
,
3022 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3023 return (inst
->Src
[index
].Register
.File
!= TGSI_FILE_TEMPORARY
&&
3024 inst
->Src
[index
].Register
.File
!= TGSI_FILE_INPUT
) ||
3025 ctx
->src
[index
].neg
|| ctx
->src
[index
].abs
;
3028 static inline unsigned tgsi_tex_get_src_gpr(struct r600_shader_ctx
*ctx
,
3031 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3032 return ctx
->file_offset
[inst
->Src
[index
].Register
.File
] + inst
->Src
[index
].Register
.Index
;
3035 static int tgsi_tex(struct r600_shader_ctx
*ctx
)
3037 static float one_point_five
= 1.5f
;
3038 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3039 struct r600_bytecode_tex tex
;
3040 struct r600_bytecode_alu alu
;
3044 /* Texture fetch instructions can only use gprs as source.
3045 * Also they cannot negate the source or take the absolute value */
3046 const boolean src_requires_loading
= tgsi_tex_src_requires_loading(ctx
, 0);
3047 boolean src_loaded
= FALSE
;
3048 unsigned sampler_src_reg
= 1;
3049 u8 offset_x
= 0, offset_y
= 0, offset_z
= 0;
3051 src_gpr
= tgsi_tex_get_src_gpr(ctx
, 0);
3053 if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXF
) {
3054 /* get offset values */
3055 if (inst
->Texture
.NumOffsets
) {
3056 assert(inst
->Texture
.NumOffsets
== 1);
3058 offset_x
= ctx
->literals
[inst
->TexOffsets
[0].Index
+ inst
->TexOffsets
[0].SwizzleX
] << 1;
3059 offset_y
= ctx
->literals
[inst
->TexOffsets
[0].Index
+ inst
->TexOffsets
[0].SwizzleY
] << 1;
3060 offset_z
= ctx
->literals
[inst
->TexOffsets
[0].Index
+ inst
->TexOffsets
[0].SwizzleZ
] << 1;
3062 } else if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXD
) {
3063 /* TGSI moves the sampler to src reg 3 for TXD */
3064 sampler_src_reg
= 3;
3066 for (i
= 1; i
< 3; i
++) {
3067 /* set gradients h/v */
3068 memset(&tex
, 0, sizeof(struct r600_bytecode_tex
));
3069 tex
.inst
= (i
== 1) ? SQ_TEX_INST_SET_GRADIENTS_H
:
3070 SQ_TEX_INST_SET_GRADIENTS_V
;
3071 tex
.sampler_id
= tgsi_tex_get_src_gpr(ctx
, sampler_src_reg
);
3072 tex
.resource_id
= tex
.sampler_id
+ R600_MAX_CONST_BUFFERS
;
3074 if (tgsi_tex_src_requires_loading(ctx
, i
)) {
3075 tex
.src_gpr
= r600_get_temp(ctx
);
3081 for (j
= 0; j
< 4; j
++) {
3082 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3083 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
3084 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[i
], j
);
3085 alu
.dst
.sel
= tex
.src_gpr
;
3090 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3096 tex
.src_gpr
= tgsi_tex_get_src_gpr(ctx
, i
);
3097 tex
.src_sel_x
= ctx
->src
[i
].swizzle
[0];
3098 tex
.src_sel_y
= ctx
->src
[i
].swizzle
[1];
3099 tex
.src_sel_z
= ctx
->src
[i
].swizzle
[2];
3100 tex
.src_sel_w
= ctx
->src
[i
].swizzle
[3];
3101 tex
.src_rel
= ctx
->src
[i
].rel
;
3103 tex
.dst_gpr
= ctx
->temp_reg
; /* just to avoid confusing the asm scheduler */
3104 tex
.dst_sel_x
= tex
.dst_sel_y
= tex
.dst_sel_z
= tex
.dst_sel_w
= 7;
3105 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
) {
3106 tex
.coord_type_x
= 1;
3107 tex
.coord_type_y
= 1;
3108 tex
.coord_type_z
= 1;
3109 tex
.coord_type_w
= 1;
3111 r
= r600_bytecode_add_tex(ctx
->bc
, &tex
);
3115 } else if (inst
->Instruction
.Opcode
== TGSI_OPCODE_TXP
) {
3117 /* Add perspective divide */
3118 if (ctx
->bc
->chip_class
== CAYMAN
) {
3120 for (i
= 0; i
< 3; i
++) {
3121 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3122 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
3123 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 3);
3125 alu
.dst
.sel
= ctx
->temp_reg
;
3131 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3138 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3139 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
3140 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 3);
3142 alu
.dst
.sel
= ctx
->temp_reg
;
3143 alu
.dst
.chan
= out_chan
;
3146 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3151 for (i
= 0; i
< 3; i
++) {
3152 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3153 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
3154 alu
.src
[0].sel
= ctx
->temp_reg
;
3155 alu
.src
[0].chan
= out_chan
;
3156 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
3157 alu
.dst
.sel
= ctx
->temp_reg
;
3160 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3164 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3165 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
3166 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
3167 alu
.src
[0].chan
= 0;
3168 alu
.dst
.sel
= ctx
->temp_reg
;
3172 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3176 src_gpr
= ctx
->temp_reg
;
3179 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
&&
3180 inst
->Instruction
.Opcode
!= TGSI_OPCODE_TXQ
) {
3182 static const unsigned src0_swizzle
[] = {2, 2, 0, 1};
3183 static const unsigned src1_swizzle
[] = {1, 0, 2, 2};
3185 /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
3186 for (i
= 0; i
< 4; i
++) {
3187 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3188 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE
);
3189 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], src0_swizzle
[i
]);
3190 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], src1_swizzle
[i
]);
3191 alu
.dst
.sel
= ctx
->temp_reg
;
3196 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3201 /* tmp1.z = RCP_e(|tmp1.z|) */
3202 if (ctx
->bc
->chip_class
== CAYMAN
) {
3203 for (i
= 0; i
< 3; i
++) {
3204 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3205 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
3206 alu
.src
[0].sel
= ctx
->temp_reg
;
3207 alu
.src
[0].chan
= 2;
3209 alu
.dst
.sel
= ctx
->temp_reg
;
3215 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3220 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3221 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
3222 alu
.src
[0].sel
= ctx
->temp_reg
;
3223 alu
.src
[0].chan
= 2;
3225 alu
.dst
.sel
= ctx
->temp_reg
;
3229 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3234 /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x
3235 * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x
3236 * muladd has no writemask, have to use another temp
3238 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3239 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
3242 alu
.src
[0].sel
= ctx
->temp_reg
;
3243 alu
.src
[0].chan
= 0;
3244 alu
.src
[1].sel
= ctx
->temp_reg
;
3245 alu
.src
[1].chan
= 2;
3247 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
3248 alu
.src
[2].chan
= 0;
3249 alu
.src
[2].value
= *(uint32_t *)&one_point_five
;
3251 alu
.dst
.sel
= ctx
->temp_reg
;
3255 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3259 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3260 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
3263 alu
.src
[0].sel
= ctx
->temp_reg
;
3264 alu
.src
[0].chan
= 1;
3265 alu
.src
[1].sel
= ctx
->temp_reg
;
3266 alu
.src
[1].chan
= 2;
3268 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
3269 alu
.src
[2].chan
= 0;
3270 alu
.src
[2].value
= *(uint32_t *)&one_point_five
;
3272 alu
.dst
.sel
= ctx
->temp_reg
;
3277 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3282 src_gpr
= ctx
->temp_reg
;
3285 if (src_requires_loading
&& !src_loaded
) {
3286 for (i
= 0; i
< 4; i
++) {
3287 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3288 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
3289 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
3290 alu
.dst
.sel
= ctx
->temp_reg
;
3295 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3300 src_gpr
= ctx
->temp_reg
;
3303 opcode
= ctx
->inst_info
->r600_opcode
;
3304 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
||
3305 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
||
3306 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOWRECT
||
3307 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D_ARRAY
||
3308 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D_ARRAY
) {
3310 case SQ_TEX_INST_SAMPLE
:
3311 opcode
= SQ_TEX_INST_SAMPLE_C
;
3313 case SQ_TEX_INST_SAMPLE_L
:
3314 opcode
= SQ_TEX_INST_SAMPLE_C_L
;
3316 case SQ_TEX_INST_SAMPLE_LB
:
3317 opcode
= SQ_TEX_INST_SAMPLE_C_LB
;
3319 case SQ_TEX_INST_SAMPLE_G
:
3320 opcode
= SQ_TEX_INST_SAMPLE_C_G
;
3325 memset(&tex
, 0, sizeof(struct r600_bytecode_tex
));
3328 tex
.sampler_id
= tgsi_tex_get_src_gpr(ctx
, sampler_src_reg
);
3329 tex
.resource_id
= tex
.sampler_id
+ R600_MAX_CONST_BUFFERS
;
3330 tex
.src_gpr
= src_gpr
;
3331 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
3332 tex
.dst_sel_x
= (inst
->Dst
[0].Register
.WriteMask
& 1) ? 0 : 7;
3333 tex
.dst_sel_y
= (inst
->Dst
[0].Register
.WriteMask
& 2) ? 1 : 7;
3334 tex
.dst_sel_z
= (inst
->Dst
[0].Register
.WriteMask
& 4) ? 2 : 7;
3335 tex
.dst_sel_w
= (inst
->Dst
[0].Register
.WriteMask
& 8) ? 3 : 7;
3342 tex
.src_sel_x
= ctx
->src
[0].swizzle
[0];
3343 tex
.src_sel_y
= ctx
->src
[0].swizzle
[1];
3344 tex
.src_sel_z
= ctx
->src
[0].swizzle
[2];
3345 tex
.src_sel_w
= ctx
->src
[0].swizzle
[3];
3346 tex
.src_rel
= ctx
->src
[0].rel
;
3349 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
3356 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
&&
3357 inst
->Texture
.Texture
!= TGSI_TEXTURE_SHADOWRECT
) {
3358 tex
.coord_type_x
= 1;
3359 tex
.coord_type_y
= 1;
3361 tex
.coord_type_z
= 1;
3362 tex
.coord_type_w
= 1;
3364 tex
.offset_x
= offset_x
;
3365 tex
.offset_y
= offset_y
;
3366 tex
.offset_z
= offset_z
;
3368 /* Put the depth for comparison in W.
3369 * TGSI_TEXTURE_SHADOW2D_ARRAY already has the depth in W.
3370 * Some instructions expect the depth in Z. */
3371 if ((inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
||
3372 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
||
3373 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOWRECT
||
3374 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D_ARRAY
) &&
3375 opcode
!= SQ_TEX_INST_SAMPLE_C_L
&&
3376 opcode
!= SQ_TEX_INST_SAMPLE_C_LB
) {
3377 tex
.src_sel_w
= tex
.src_sel_z
;
3380 if (inst
->Texture
.Texture
== TGSI_TEXTURE_1D_ARRAY
||
3381 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D_ARRAY
) {
3382 if (opcode
== SQ_TEX_INST_SAMPLE_C_L
||
3383 opcode
== SQ_TEX_INST_SAMPLE_C_LB
) {
3384 /* the array index is read from Y */
3385 tex
.coord_type_y
= 0;
3387 /* the array index is read from Z */
3388 tex
.coord_type_z
= 0;
3389 tex
.src_sel_z
= tex
.src_sel_y
;
3391 } else if (inst
->Texture
.Texture
== TGSI_TEXTURE_2D_ARRAY
||
3392 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D_ARRAY
)
3393 /* the array index is read from Z */
3394 tex
.coord_type_z
= 0;
3396 r
= r600_bytecode_add_tex(ctx
->bc
, &tex
);
3400 /* add shadow ambient support - gallium doesn't do it yet */
3404 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
3406 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3407 struct r600_bytecode_alu alu
;
3408 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
3412 /* optimize if it's just an equal balance */
3413 if (ctx
->src
[0].sel
== V_SQ_ALU_SRC_0_5
) {
3414 for (i
= 0; i
< lasti
+ 1; i
++) {
3415 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
3418 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3419 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
3420 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[1], i
);
3421 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[2], i
);
3423 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
3428 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3436 for (i
= 0; i
< lasti
+ 1; i
++) {
3437 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
3440 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3441 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
3442 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
3443 alu
.src
[0].chan
= 0;
3444 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
3445 r600_bytecode_src_toggle_neg(&alu
.src
[1]);
3446 alu
.dst
.sel
= ctx
->temp_reg
;
3452 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3457 /* (1 - src0) * src2 */
3458 for (i
= 0; i
< lasti
+ 1; i
++) {
3459 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
3462 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3463 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
3464 alu
.src
[0].sel
= ctx
->temp_reg
;
3465 alu
.src
[0].chan
= i
;
3466 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[2], i
);
3467 alu
.dst
.sel
= ctx
->temp_reg
;
3473 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3478 /* src0 * src1 + (1 - src0) * src2 */
3479 for (i
= 0; i
< lasti
+ 1; i
++) {
3480 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
3483 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3484 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
3486 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
3487 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
3488 alu
.src
[2].sel
= ctx
->temp_reg
;
3489 alu
.src
[2].chan
= i
;
3491 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
3496 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3503 static int tgsi_cmp(struct r600_shader_ctx
*ctx
)
3505 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3506 struct r600_bytecode_alu alu
;
3508 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
3510 for (i
= 0; i
< lasti
+ 1; i
++) {
3511 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
3514 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3515 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE
);
3516 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
3517 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[2], i
);
3518 r600_bytecode_src(&alu
.src
[2], &ctx
->src
[1], i
);
3519 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
3525 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3532 static int tgsi_xpd(struct r600_shader_ctx
*ctx
)
3534 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3535 static const unsigned int src0_swizzle
[] = {2, 0, 1};
3536 static const unsigned int src1_swizzle
[] = {1, 2, 0};
3537 struct r600_bytecode_alu alu
;
3538 uint32_t use_temp
= 0;
3541 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
3544 for (i
= 0; i
< 4; i
++) {
3545 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3546 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
3548 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], src0_swizzle
[i
]);
3549 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], src1_swizzle
[i
]);
3551 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
3552 alu
.src
[0].chan
= i
;
3553 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
3554 alu
.src
[1].chan
= i
;
3557 alu
.dst
.sel
= ctx
->temp_reg
;
3563 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3568 for (i
= 0; i
< 4; i
++) {
3569 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3570 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
3573 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], src1_swizzle
[i
]);
3574 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], src0_swizzle
[i
]);
3576 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
3577 alu
.src
[0].chan
= i
;
3578 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
3579 alu
.src
[1].chan
= i
;
3582 alu
.src
[2].sel
= ctx
->temp_reg
;
3584 alu
.src
[2].chan
= i
;
3587 alu
.dst
.sel
= ctx
->temp_reg
;
3589 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
3595 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3600 return tgsi_helper_copy(ctx
, inst
);
3604 static int tgsi_exp(struct r600_shader_ctx
*ctx
)
3606 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3607 struct r600_bytecode_alu alu
;
3611 /* result.x = 2^floor(src); */
3612 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
3613 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3615 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
3616 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3618 alu
.dst
.sel
= ctx
->temp_reg
;
3622 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3626 if (ctx
->bc
->chip_class
== CAYMAN
) {
3627 for (i
= 0; i
< 3; i
++) {
3628 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3629 alu
.src
[0].sel
= ctx
->temp_reg
;
3630 alu
.src
[0].chan
= 0;
3632 alu
.dst
.sel
= ctx
->temp_reg
;
3638 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3643 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3644 alu
.src
[0].sel
= ctx
->temp_reg
;
3645 alu
.src
[0].chan
= 0;
3647 alu
.dst
.sel
= ctx
->temp_reg
;
3651 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3657 /* result.y = tmp - floor(tmp); */
3658 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
3659 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3661 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
3662 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3664 alu
.dst
.sel
= ctx
->temp_reg
;
3666 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
3675 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3680 /* result.z = RoughApprox2ToX(tmp);*/
3681 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 0x1) {
3682 if (ctx
->bc
->chip_class
== CAYMAN
) {
3683 for (i
= 0; i
< 3; i
++) {
3684 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3685 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3686 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3688 alu
.dst
.sel
= ctx
->temp_reg
;
3695 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3700 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3701 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3702 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3704 alu
.dst
.sel
= ctx
->temp_reg
;
3710 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3716 /* result.w = 1.0;*/
3717 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 0x1) {
3718 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3720 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
3721 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
3722 alu
.src
[0].chan
= 0;
3724 alu
.dst
.sel
= ctx
->temp_reg
;
3728 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3732 return tgsi_helper_copy(ctx
, inst
);
3735 static int tgsi_log(struct r600_shader_ctx
*ctx
)
3737 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3738 struct r600_bytecode_alu alu
;
3742 /* result.x = floor(log2(|src|)); */
3743 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
3744 if (ctx
->bc
->chip_class
== CAYMAN
) {
3745 for (i
= 0; i
< 3; i
++) {
3746 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3748 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3749 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3750 r600_bytecode_src_set_abs(&alu
.src
[0]);
3752 alu
.dst
.sel
= ctx
->temp_reg
;
3758 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3764 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3766 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3767 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3768 r600_bytecode_src_set_abs(&alu
.src
[0]);
3770 alu
.dst
.sel
= ctx
->temp_reg
;
3774 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3779 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
3780 alu
.src
[0].sel
= ctx
->temp_reg
;
3781 alu
.src
[0].chan
= 0;
3783 alu
.dst
.sel
= ctx
->temp_reg
;
3788 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3793 /* result.y = |src.x| / (2 ^ floor(log2(|src.x|))); */
3794 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
3796 if (ctx
->bc
->chip_class
== CAYMAN
) {
3797 for (i
= 0; i
< 3; i
++) {
3798 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3800 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3801 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3802 r600_bytecode_src_set_abs(&alu
.src
[0]);
3804 alu
.dst
.sel
= ctx
->temp_reg
;
3811 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3816 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3818 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3819 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3820 r600_bytecode_src_set_abs(&alu
.src
[0]);
3822 alu
.dst
.sel
= ctx
->temp_reg
;
3827 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3832 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3834 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
3835 alu
.src
[0].sel
= ctx
->temp_reg
;
3836 alu
.src
[0].chan
= 1;
3838 alu
.dst
.sel
= ctx
->temp_reg
;
3843 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3847 if (ctx
->bc
->chip_class
== CAYMAN
) {
3848 for (i
= 0; i
< 3; i
++) {
3849 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3850 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3851 alu
.src
[0].sel
= ctx
->temp_reg
;
3852 alu
.src
[0].chan
= 1;
3854 alu
.dst
.sel
= ctx
->temp_reg
;
3861 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3866 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3867 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3868 alu
.src
[0].sel
= ctx
->temp_reg
;
3869 alu
.src
[0].chan
= 1;
3871 alu
.dst
.sel
= ctx
->temp_reg
;
3876 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3881 if (ctx
->bc
->chip_class
== CAYMAN
) {
3882 for (i
= 0; i
< 3; i
++) {
3883 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3884 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
3885 alu
.src
[0].sel
= ctx
->temp_reg
;
3886 alu
.src
[0].chan
= 1;
3888 alu
.dst
.sel
= ctx
->temp_reg
;
3895 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3900 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3901 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
3902 alu
.src
[0].sel
= ctx
->temp_reg
;
3903 alu
.src
[0].chan
= 1;
3905 alu
.dst
.sel
= ctx
->temp_reg
;
3910 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3915 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3917 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
3919 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3920 r600_bytecode_src_set_abs(&alu
.src
[0]);
3922 alu
.src
[1].sel
= ctx
->temp_reg
;
3923 alu
.src
[1].chan
= 1;
3925 alu
.dst
.sel
= ctx
->temp_reg
;
3930 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3935 /* result.z = log2(|src|);*/
3936 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 1) {
3937 if (ctx
->bc
->chip_class
== CAYMAN
) {
3938 for (i
= 0; i
< 3; i
++) {
3939 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3941 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3942 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3943 r600_bytecode_src_set_abs(&alu
.src
[0]);
3945 alu
.dst
.sel
= ctx
->temp_reg
;
3952 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3957 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3959 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3960 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3961 r600_bytecode_src_set_abs(&alu
.src
[0]);
3963 alu
.dst
.sel
= ctx
->temp_reg
;
3968 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3974 /* result.w = 1.0; */
3975 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 1) {
3976 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3978 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
3979 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
3980 alu
.src
[0].chan
= 0;
3982 alu
.dst
.sel
= ctx
->temp_reg
;
3987 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3992 return tgsi_helper_copy(ctx
, inst
);
3995 static int tgsi_eg_arl(struct r600_shader_ctx
*ctx
)
3997 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3998 struct r600_bytecode_alu alu
;
4001 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
4003 switch (inst
->Instruction
.Opcode
) {
4004 case TGSI_OPCODE_ARL
:
4005 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR
;
4007 case TGSI_OPCODE_ARR
:
4008 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
4010 case TGSI_OPCODE_UARL
:
4011 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
4018 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
4020 alu
.dst
.sel
= ctx
->bc
->ar_reg
;
4022 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
4026 ctx
->bc
->ar_loaded
= 0;
4029 static int tgsi_r600_arl(struct r600_shader_ctx
*ctx
)
4031 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
4032 struct r600_bytecode_alu alu
;
4035 switch (inst
->Instruction
.Opcode
) {
4036 case TGSI_OPCODE_ARL
:
4037 memset(&alu
, 0, sizeof(alu
));
4038 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
;
4039 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
4040 alu
.dst
.sel
= ctx
->bc
->ar_reg
;
4044 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
4047 memset(&alu
, 0, sizeof(alu
));
4048 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
4049 alu
.src
[0].sel
= ctx
->bc
->ar_reg
;
4050 alu
.dst
.sel
= ctx
->bc
->ar_reg
;
4054 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
4057 case TGSI_OPCODE_ARR
:
4058 memset(&alu
, 0, sizeof(alu
));
4059 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
4060 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
4061 alu
.dst
.sel
= ctx
->bc
->ar_reg
;
4065 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
4068 case TGSI_OPCODE_UARL
:
4069 memset(&alu
, 0, sizeof(alu
));
4070 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
4071 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
4072 alu
.dst
.sel
= ctx
->bc
->ar_reg
;
4076 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
4084 ctx
->bc
->ar_loaded
= 0;
4088 static int tgsi_opdst(struct r600_shader_ctx
*ctx
)
4090 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
4091 struct r600_bytecode_alu alu
;
4094 for (i
= 0; i
< 4; i
++) {
4095 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
4097 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
4098 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
4100 if (i
== 0 || i
== 3) {
4101 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
4103 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
4106 if (i
== 0 || i
== 2) {
4107 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
4109 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
4113 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
4120 static int emit_logic_pred(struct r600_shader_ctx
*ctx
, int opcode
)
4122 struct r600_bytecode_alu alu
;
4125 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
4129 alu
.dst
.sel
= ctx
->temp_reg
;
4133 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
4134 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
4135 alu
.src
[1].chan
= 0;
4139 r
= r600_bytecode_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE
));
4145 static int pops(struct r600_shader_ctx
*ctx
, int pops
)
4147 unsigned force_pop
= ctx
->bc
->force_add_cf
;
4151 if (ctx
->bc
->cf_last
) {
4152 if (ctx
->bc
->cf_last
->inst
== CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
))
4154 else if (ctx
->bc
->cf_last
->inst
== CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER
))
4159 ctx
->bc
->cf_last
->inst
= CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER
);
4160 ctx
->bc
->force_add_cf
= 1;
4161 } else if (alu_pop
== 2) {
4162 ctx
->bc
->cf_last
->inst
= CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER
);
4163 ctx
->bc
->force_add_cf
= 1;
4170 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP
));
4171 ctx
->bc
->cf_last
->pop_count
= pops
;
4172 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
4178 static inline void callstack_decrease_current(struct r600_shader_ctx
*ctx
, unsigned reason
)
4182 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
4186 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
-= 4;
4189 /* TOODO : for 16 vp asic should -= 2; */
4190 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
4195 static inline void callstack_check_depth(struct r600_shader_ctx
*ctx
, unsigned reason
, unsigned check_max_only
)
4197 if (check_max_only
) {
4210 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
) >
4211 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
4212 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
4213 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
;
4219 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
4223 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+= 4;
4226 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
4230 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
) >
4231 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
4232 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
4233 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
;
4237 static void fc_set_mid(struct r600_shader_ctx
*ctx
, int fc_sp
)
4239 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[fc_sp
];
4241 sp
->mid
= (struct r600_bytecode_cf
**)realloc((void *)sp
->mid
,
4242 sizeof(struct r600_bytecode_cf
*) * (sp
->num_mid
+ 1));
4243 sp
->mid
[sp
->num_mid
] = ctx
->bc
->cf_last
;
4247 static void fc_pushlevel(struct r600_shader_ctx
*ctx
, int type
)
4250 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
= type
;
4251 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
= ctx
->bc
->cf_last
;
4254 static void fc_poplevel(struct r600_shader_ctx
*ctx
)
4256 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
];
4268 static int emit_return(struct r600_shader_ctx
*ctx
)
4270 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_RETURN
));
4274 static int emit_jump_to_offset(struct r600_shader_ctx
*ctx
, int pops
, int offset
)
4277 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
4278 ctx
->bc
->cf_last
->pop_count
= pops
;
4279 /* TODO work out offset */
4283 static int emit_setret_in_loop_flag(struct r600_shader_ctx
*ctx
, unsigned flag_value
)
4288 static void emit_testflag(struct r600_shader_ctx
*ctx
)
4293 static void emit_return_on_flag(struct r600_shader_ctx
*ctx
, unsigned ifidx
)
4296 emit_jump_to_offset(ctx
, 1, 4);
4297 emit_setret_in_loop_flag(ctx
, V_SQ_ALU_SRC_0
);
4298 pops(ctx
, ifidx
+ 1);
4302 static void break_loop_on_flag(struct r600_shader_ctx
*ctx
, unsigned fc_sp
)
4306 r600_bytecode_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
4307 ctx
->bc
->cf_last
->pop_count
= 1;
4309 fc_set_mid(ctx
, fc_sp
);
4315 static int tgsi_if(struct r600_shader_ctx
*ctx
)
4317 emit_logic_pred(ctx
, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_INT
));
4319 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
4321 fc_pushlevel(ctx
, FC_IF
);
4323 callstack_check_depth(ctx
, FC_PUSH_VPM
, 0);
4327 static int tgsi_else(struct r600_shader_ctx
*ctx
)
4329 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE
));
4330 ctx
->bc
->cf_last
->pop_count
= 1;
4332 fc_set_mid(ctx
, ctx
->bc
->fc_sp
);
4333 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
;
4337 static int tgsi_endif(struct r600_shader_ctx
*ctx
)
4340 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_IF
) {
4341 R600_ERR("if/endif unbalanced in shader\n");
4345 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
== NULL
) {
4346 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
4347 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->pop_count
= 1;
4349 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[0]->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
4353 callstack_decrease_current(ctx
, FC_PUSH_VPM
);
4357 static int tgsi_bgnloop(struct r600_shader_ctx
*ctx
)
4359 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL
));
4361 fc_pushlevel(ctx
, FC_LOOP
);
4363 /* check stack depth */
4364 callstack_check_depth(ctx
, FC_LOOP
, 0);
4368 static int tgsi_endloop(struct r600_shader_ctx
*ctx
)
4372 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END
));
4374 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_LOOP
) {
4375 R600_ERR("loop/endloop in shader code are not paired.\n");
4379 /* fixup loop pointers - from r600isa
4380 LOOP END points to CF after LOOP START,
4381 LOOP START point to CF after LOOP END
4382 BRK/CONT point to LOOP END CF
4384 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->id
+ 2;
4386 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
4388 for (i
= 0; i
< ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].num_mid
; i
++) {
4389 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[i
]->cf_addr
= ctx
->bc
->cf_last
->id
;
4391 /* TODO add LOOPRET support */
4393 callstack_decrease_current(ctx
, FC_LOOP
);
4397 static int tgsi_loop_brk_cont(struct r600_shader_ctx
*ctx
)
4401 for (fscp
= ctx
->bc
->fc_sp
; fscp
> 0; fscp
--)
4403 if (FC_LOOP
== ctx
->bc
->fc_stack
[fscp
].type
)
4408 R600_ERR("Break not inside loop/endloop pair\n");
4412 r600_bytecode_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
4413 ctx
->bc
->cf_last
->pop_count
= 1;
4415 fc_set_mid(ctx
, fscp
);
4418 callstack_check_depth(ctx
, FC_PUSH_VPM
, 1);
4422 static int tgsi_umad(struct r600_shader_ctx
*ctx
)
4424 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
4425 struct r600_bytecode_alu alu
;
4427 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
4430 for (i
= 0; i
< lasti
+ 1; i
++) {
4431 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
4434 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
4437 alu
.dst
.sel
= ctx
->temp_reg
;
4440 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT
);
4441 for (j
= 0; j
< 2; j
++) {
4442 r600_bytecode_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
4446 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
4452 for (i
= 0; i
< lasti
+ 1; i
++) {
4453 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
4456 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
4457 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
4459 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
);
4461 alu
.src
[0].sel
= ctx
->temp_reg
;
4462 alu
.src
[0].chan
= i
;
4464 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[2], i
);
4468 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
4475 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
4476 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
4477 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4478 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
4481 * For state trackers other than OpenGL, we'll want to use
4482 * _RECIP_IEEE instead.
4484 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED
, tgsi_trans_srcx_replicate
},
4486 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_rsq
},
4487 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
4488 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
4489 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
4490 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4491 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4492 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4493 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
4494 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
4495 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
4496 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
4497 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
4498 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
4499 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4500 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
4501 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4503 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4504 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4506 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4507 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4508 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
4509 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4510 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
4511 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE
, tgsi_op2
},
4512 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
4513 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
4514 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
4515 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
4517 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4518 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4519 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4520 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4521 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
4522 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
4523 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
4524 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
4525 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4526 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4527 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4528 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4529 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4530 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
4531 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4532 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
4533 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
4534 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
4535 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
4536 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4537 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4538 {TGSI_OPCODE_TXD
, 0, SQ_TEX_INST_SAMPLE_G
, tgsi_tex
},
4539 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4540 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4541 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4542 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4543 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4544 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4545 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4546 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
4547 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4548 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4549 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4550 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
4551 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
4552 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
4553 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_LB
, tgsi_tex
},
4554 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4555 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4556 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4557 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
4558 {TGSI_OPCODE_BRK
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
4559 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
4561 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4562 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4563 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
4564 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
4566 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4567 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4568 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4569 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4570 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4571 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT
, tgsi_op2_trans
},
4572 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOT_INT
, tgsi_op2
},
4573 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_op2
},
4574 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT
, tgsi_op2_trans
},
4576 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4577 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_AND_INT
, tgsi_op2
},
4578 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_OR_INT
, tgsi_op2
},
4579 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_imod
},
4580 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_XOR_INT
, tgsi_op2
},
4581 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4582 {TGSI_OPCODE_TXF
, 0, SQ_TEX_INST_LD
, tgsi_tex
},
4583 {TGSI_OPCODE_TXQ
, 0, SQ_TEX_INST_GET_TEXTURE_RESINFO
, tgsi_tex
},
4584 {TGSI_OPCODE_CONT
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
4585 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4586 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4587 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
4588 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4589 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
4590 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4592 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4593 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4594 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4595 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4596 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4598 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4599 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4600 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4601 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4602 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4603 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4604 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4605 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4606 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
4607 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
4609 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4610 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
, tgsi_op2_trans
},
4611 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_idiv
},
4612 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_INT
, tgsi_op2
},
4613 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_INT
, tgsi_op2
},
4614 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
, tgsi_ineg
},
4615 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_INT
, tgsi_op2
},
4616 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT
, tgsi_op2_trans
},
4617 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_INT
, tgsi_op2_swap
},
4618 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_UINT
, tgsi_op2
},
4619 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_UINT_TO_FLT
, tgsi_op2_trans
},
4620 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
, tgsi_op2
},
4621 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_udiv
},
4622 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_umad
},
4623 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_UINT
, tgsi_op2
},
4624 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_UINT
, tgsi_op2
},
4625 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_umod
},
4626 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT
, tgsi_op2_trans
},
4627 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE_INT
, tgsi_op2
},
4628 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_UINT
, tgsi_op2
},
4629 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT
, tgsi_op2_trans
},
4630 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_UINT
, tgsi_op2_swap
},
4631 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE_INT
, tgsi_op2_swap
},
4632 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4633 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4634 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4635 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4636 {TGSI_OPCODE_LOAD
, 0, 0, tgsi_unsupported
},
4637 {TGSI_OPCODE_LOAD_MS
, 0, 0, tgsi_unsupported
},
4638 {TGSI_OPCODE_SAMPLE
, 0, 0, tgsi_unsupported
},
4639 {TGSI_OPCODE_SAMPLE_B
, 0, 0, tgsi_unsupported
},
4640 {TGSI_OPCODE_SAMPLE_C
, 0, 0, tgsi_unsupported
},
4641 {TGSI_OPCODE_SAMPLE_C_LZ
, 0, 0, tgsi_unsupported
},
4642 {TGSI_OPCODE_SAMPLE_D
, 0, 0, tgsi_unsupported
},
4643 {TGSI_OPCODE_SAMPLE_L
, 0, 0, tgsi_unsupported
},
4644 {TGSI_OPCODE_GATHER4
, 0, 0, tgsi_unsupported
},
4645 {TGSI_OPCODE_RESINFO
, 0, 0, tgsi_unsupported
},
4646 {TGSI_OPCODE_SAMPLE_POS
, 0, 0, tgsi_unsupported
},
4647 {TGSI_OPCODE_SAMPLE_INFO
, 0, 0, tgsi_unsupported
},
4648 {TGSI_OPCODE_UARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
, tgsi_r600_arl
},
4649 {TGSI_OPCODE_UCMP
, 0, 0, tgsi_unsupported
},
4650 {TGSI_OPCODE_IABS
, 0, 0, tgsi_iabs
},
4651 {TGSI_OPCODE_ISSG
, 0, 0, tgsi_issg
},
4652 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4655 static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction
[] = {
4656 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
4657 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4658 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
4659 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
4660 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_rsq
},
4661 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
4662 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
4663 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
4664 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4665 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4666 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4667 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
4668 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
4669 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
4670 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
4671 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
4672 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
4673 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4674 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
4675 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4677 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4678 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4680 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4681 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4682 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
4683 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4684 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
4685 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE
, tgsi_op2
},
4686 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
4687 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
4688 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
4689 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
4691 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4692 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4693 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4694 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4695 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
4696 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
4697 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
4698 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
4699 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4700 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4701 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4702 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4703 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4704 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
4705 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4706 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
4707 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
4708 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
4709 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
4710 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4711 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4712 {TGSI_OPCODE_TXD
, 0, SQ_TEX_INST_SAMPLE_G
, tgsi_tex
},
4713 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4714 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4715 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4716 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4717 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4718 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4719 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4720 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
4721 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4722 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4723 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4724 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
4725 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
4726 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
4727 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_LB
, tgsi_tex
},
4728 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4729 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4730 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4731 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
4732 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
4733 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
4735 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4736 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4737 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
4738 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
4740 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4741 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4742 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4743 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4744 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4745 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT
, tgsi_op2_trans
},
4746 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOT_INT
, tgsi_op2
},
4747 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_op2
},
4748 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT
, tgsi_op2
},
4750 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4751 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_AND_INT
, tgsi_op2
},
4752 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_OR_INT
, tgsi_op2
},
4753 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_imod
},
4754 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_XOR_INT
, tgsi_op2
},
4755 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4756 {TGSI_OPCODE_TXF
, 0, SQ_TEX_INST_LD
, tgsi_tex
},
4757 {TGSI_OPCODE_TXQ
, 0, SQ_TEX_INST_GET_TEXTURE_RESINFO
, tgsi_tex
},
4758 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
4759 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4760 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4761 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
4762 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4763 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
4764 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4766 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4767 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4768 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4769 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4770 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4772 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4773 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4774 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4775 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4776 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4777 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4778 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4779 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4780 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
4781 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
4783 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4784 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
, tgsi_op2
},
4785 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_idiv
},
4786 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_INT
, tgsi_op2
},
4787 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_INT
, tgsi_op2
},
4788 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
, tgsi_ineg
},
4789 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_INT
, tgsi_op2
},
4790 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT
, tgsi_op2
},
4791 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_INT
, tgsi_op2_swap
},
4792 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_UINT
, tgsi_op2_trans
},
4793 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_UINT_TO_FLT
, tgsi_op2_trans
},
4794 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
, tgsi_op2
},
4795 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_udiv
},
4796 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_umad
},
4797 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_UINT
, tgsi_op2
},
4798 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_UINT
, tgsi_op2
},
4799 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_umod
},
4800 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT
, tgsi_op2_trans
},
4801 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE_INT
, tgsi_op2
},
4802 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_UINT
, tgsi_op2
},
4803 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT
, tgsi_op2
},
4804 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_UINT
, tgsi_op2_swap
},
4805 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE_INT
, tgsi_op2
},
4806 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4807 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4808 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4809 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4810 {TGSI_OPCODE_LOAD
, 0, 0, tgsi_unsupported
},
4811 {TGSI_OPCODE_LOAD_MS
, 0, 0, tgsi_unsupported
},
4812 {TGSI_OPCODE_SAMPLE
, 0, 0, tgsi_unsupported
},
4813 {TGSI_OPCODE_SAMPLE_B
, 0, 0, tgsi_unsupported
},
4814 {TGSI_OPCODE_SAMPLE_C
, 0, 0, tgsi_unsupported
},
4815 {TGSI_OPCODE_SAMPLE_C_LZ
, 0, 0, tgsi_unsupported
},
4816 {TGSI_OPCODE_SAMPLE_D
, 0, 0, tgsi_unsupported
},
4817 {TGSI_OPCODE_SAMPLE_L
, 0, 0, tgsi_unsupported
},
4818 {TGSI_OPCODE_GATHER4
, 0, 0, tgsi_unsupported
},
4819 {TGSI_OPCODE_RESINFO
, 0, 0, tgsi_unsupported
},
4820 {TGSI_OPCODE_SAMPLE_POS
, 0, 0, tgsi_unsupported
},
4821 {TGSI_OPCODE_SAMPLE_INFO
, 0, 0, tgsi_unsupported
},
4822 {TGSI_OPCODE_UARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
, tgsi_eg_arl
},
4823 {TGSI_OPCODE_UCMP
, 0, 0, tgsi_unsupported
},
4824 {TGSI_OPCODE_IABS
, 0, 0, tgsi_iabs
},
4825 {TGSI_OPCODE_ISSG
, 0, 0, tgsi_issg
},
4826 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4829 static struct r600_shader_tgsi_instruction cm_shader_tgsi_instruction
[] = {
4830 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
4831 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4832 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
4833 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, cayman_emit_float_instr
},
4834 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, cayman_emit_float_instr
},
4835 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
4836 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
4837 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
4838 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4839 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4840 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4841 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
4842 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
4843 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
4844 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
4845 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
4846 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
4847 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4848 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
4849 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4851 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4852 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4854 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4855 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4856 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
4857 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4858 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
4859 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE
, tgsi_op2
},
4860 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, cayman_emit_float_instr
},
4861 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, cayman_emit_float_instr
},
4862 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, cayman_pow
},
4863 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
4865 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4866 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4867 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4868 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4869 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, cayman_trig
},
4870 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
4871 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
4872 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
4873 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4874 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4875 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4876 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4877 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4878 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
4879 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4880 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
4881 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, cayman_trig
},
4882 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
4883 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
4884 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4885 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4886 {TGSI_OPCODE_TXD
, 0, SQ_TEX_INST_SAMPLE_G
, tgsi_tex
},
4887 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4888 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4889 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4890 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4891 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4892 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4893 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4894 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
4895 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4896 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4897 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4898 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
4899 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
4900 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
4901 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_LB
, tgsi_tex
},
4902 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4903 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4904 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4905 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
4906 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
4907 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
4909 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4910 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4911 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
4912 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
4914 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4915 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4916 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4917 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4918 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4919 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4920 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOT_INT
, tgsi_op2
},
4921 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_op2
},
4922 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4924 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4925 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4926 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4927 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4928 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_XOR_INT
, tgsi_op2
},
4929 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4930 {TGSI_OPCODE_TXF
, 0, SQ_TEX_INST_LD
, tgsi_tex
},
4931 {TGSI_OPCODE_TXQ
, 0, SQ_TEX_INST_GET_TEXTURE_RESINFO
, tgsi_tex
},
4932 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
4933 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4934 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4935 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
4936 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4937 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
4938 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4940 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4941 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4942 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4943 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4944 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4946 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4947 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4948 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4949 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4950 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4951 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4952 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4953 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4954 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
4955 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
4957 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4958 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4959 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4960 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_INT
, tgsi_op2
},
4961 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_INT
, tgsi_op2
},
4962 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4963 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4964 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4965 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4966 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4967 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4968 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4969 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4970 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4971 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4972 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4973 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4974 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4975 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4976 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4977 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4978 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4979 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4980 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4981 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4982 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4983 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4984 {TGSI_OPCODE_LOAD
, 0, 0, tgsi_unsupported
},
4985 {TGSI_OPCODE_LOAD_MS
, 0, 0, tgsi_unsupported
},
4986 {TGSI_OPCODE_SAMPLE
, 0, 0, tgsi_unsupported
},
4987 {TGSI_OPCODE_SAMPLE_B
, 0, 0, tgsi_unsupported
},
4988 {TGSI_OPCODE_SAMPLE_C
, 0, 0, tgsi_unsupported
},
4989 {TGSI_OPCODE_SAMPLE_C_LZ
, 0, 0, tgsi_unsupported
},
4990 {TGSI_OPCODE_SAMPLE_D
, 0, 0, tgsi_unsupported
},
4991 {TGSI_OPCODE_SAMPLE_L
, 0, 0, tgsi_unsupported
},
4992 {TGSI_OPCODE_GATHER4
, 0, 0, tgsi_unsupported
},
4993 {TGSI_OPCODE_RESINFO
, 0, 0, tgsi_unsupported
},
4994 {TGSI_OPCODE_SAMPLE_POS
, 0, 0, tgsi_unsupported
},
4995 {TGSI_OPCODE_SAMPLE_INFO
, 0, 0, tgsi_unsupported
},
4996 {TGSI_OPCODE_UARL
, 0, 0, tgsi_unsupported
},
4997 {TGSI_OPCODE_UCMP
, 0, 0, tgsi_unsupported
},
4998 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},