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
->Texture
.Texture
== TGSI_TEXTURE_SHADOWCUBE
) &&
3181 inst
->Instruction
.Opcode
!= TGSI_OPCODE_TXQ
) {
3183 static const unsigned src0_swizzle
[] = {2, 2, 0, 1};
3184 static const unsigned src1_swizzle
[] = {1, 0, 2, 2};
3186 /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
3187 for (i
= 0; i
< 4; i
++) {
3188 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3189 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE
);
3190 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], src0_swizzle
[i
]);
3191 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], src1_swizzle
[i
]);
3192 alu
.dst
.sel
= ctx
->temp_reg
;
3197 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3202 /* tmp1.z = RCP_e(|tmp1.z|) */
3203 if (ctx
->bc
->chip_class
== CAYMAN
) {
3204 for (i
= 0; i
< 3; i
++) {
3205 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3206 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
3207 alu
.src
[0].sel
= ctx
->temp_reg
;
3208 alu
.src
[0].chan
= 2;
3210 alu
.dst
.sel
= ctx
->temp_reg
;
3216 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3221 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3222 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
3223 alu
.src
[0].sel
= ctx
->temp_reg
;
3224 alu
.src
[0].chan
= 2;
3226 alu
.dst
.sel
= ctx
->temp_reg
;
3230 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3235 /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x
3236 * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x
3237 * muladd has no writemask, have to use another temp
3239 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3240 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
3243 alu
.src
[0].sel
= ctx
->temp_reg
;
3244 alu
.src
[0].chan
= 0;
3245 alu
.src
[1].sel
= ctx
->temp_reg
;
3246 alu
.src
[1].chan
= 2;
3248 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
3249 alu
.src
[2].chan
= 0;
3250 alu
.src
[2].value
= *(uint32_t *)&one_point_five
;
3252 alu
.dst
.sel
= ctx
->temp_reg
;
3256 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3260 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3261 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
3264 alu
.src
[0].sel
= ctx
->temp_reg
;
3265 alu
.src
[0].chan
= 1;
3266 alu
.src
[1].sel
= ctx
->temp_reg
;
3267 alu
.src
[1].chan
= 2;
3269 alu
.src
[2].sel
= V_SQ_ALU_SRC_LITERAL
;
3270 alu
.src
[2].chan
= 0;
3271 alu
.src
[2].value
= *(uint32_t *)&one_point_five
;
3273 alu
.dst
.sel
= ctx
->temp_reg
;
3278 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3281 /* write initial W value into Z component */
3282 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOWCUBE
) {
3283 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3284 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
3285 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 3);
3286 alu
.dst
.sel
= ctx
->temp_reg
;
3290 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3295 src_gpr
= ctx
->temp_reg
;
3298 if (src_requires_loading
&& !src_loaded
) {
3299 for (i
= 0; i
< 4; i
++) {
3300 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3301 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
3302 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
3303 alu
.dst
.sel
= ctx
->temp_reg
;
3308 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3313 src_gpr
= ctx
->temp_reg
;
3316 opcode
= ctx
->inst_info
->r600_opcode
;
3317 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
||
3318 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
||
3319 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOWRECT
||
3320 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOWCUBE
||
3321 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D_ARRAY
||
3322 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D_ARRAY
) {
3324 case SQ_TEX_INST_SAMPLE
:
3325 opcode
= SQ_TEX_INST_SAMPLE_C
;
3327 case SQ_TEX_INST_SAMPLE_L
:
3328 opcode
= SQ_TEX_INST_SAMPLE_C_L
;
3330 case SQ_TEX_INST_SAMPLE_LB
:
3331 opcode
= SQ_TEX_INST_SAMPLE_C_LB
;
3333 case SQ_TEX_INST_SAMPLE_G
:
3334 opcode
= SQ_TEX_INST_SAMPLE_C_G
;
3339 memset(&tex
, 0, sizeof(struct r600_bytecode_tex
));
3342 tex
.sampler_id
= tgsi_tex_get_src_gpr(ctx
, sampler_src_reg
);
3343 tex
.resource_id
= tex
.sampler_id
+ R600_MAX_CONST_BUFFERS
;
3344 tex
.src_gpr
= src_gpr
;
3345 tex
.dst_gpr
= ctx
->file_offset
[inst
->Dst
[0].Register
.File
] + inst
->Dst
[0].Register
.Index
;
3346 tex
.dst_sel_x
= (inst
->Dst
[0].Register
.WriteMask
& 1) ? 0 : 7;
3347 tex
.dst_sel_y
= (inst
->Dst
[0].Register
.WriteMask
& 2) ? 1 : 7;
3348 tex
.dst_sel_z
= (inst
->Dst
[0].Register
.WriteMask
& 4) ? 2 : 7;
3349 tex
.dst_sel_w
= (inst
->Dst
[0].Register
.WriteMask
& 8) ? 3 : 7;
3356 tex
.src_sel_x
= ctx
->src
[0].swizzle
[0];
3357 tex
.src_sel_y
= ctx
->src
[0].swizzle
[1];
3358 tex
.src_sel_z
= ctx
->src
[0].swizzle
[2];
3359 tex
.src_sel_w
= ctx
->src
[0].swizzle
[3];
3360 tex
.src_rel
= ctx
->src
[0].rel
;
3363 if (inst
->Texture
.Texture
== TGSI_TEXTURE_CUBE
) {
3369 if (inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOWCUBE
) {
3373 tex
.src_sel_w
= 2; /* route Z compare value into W */
3376 if (inst
->Texture
.Texture
!= TGSI_TEXTURE_RECT
&&
3377 inst
->Texture
.Texture
!= TGSI_TEXTURE_SHADOWRECT
) {
3378 tex
.coord_type_x
= 1;
3379 tex
.coord_type_y
= 1;
3381 tex
.coord_type_z
= 1;
3382 tex
.coord_type_w
= 1;
3384 tex
.offset_x
= offset_x
;
3385 tex
.offset_y
= offset_y
;
3386 tex
.offset_z
= offset_z
;
3388 /* Put the depth for comparison in W.
3389 * TGSI_TEXTURE_SHADOW2D_ARRAY already has the depth in W.
3390 * Some instructions expect the depth in Z. */
3391 if ((inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D
||
3392 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D
||
3393 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOWRECT
||
3394 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D_ARRAY
) &&
3395 opcode
!= SQ_TEX_INST_SAMPLE_C_L
&&
3396 opcode
!= SQ_TEX_INST_SAMPLE_C_LB
) {
3397 tex
.src_sel_w
= tex
.src_sel_z
;
3400 if (inst
->Texture
.Texture
== TGSI_TEXTURE_1D_ARRAY
||
3401 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW1D_ARRAY
) {
3402 if (opcode
== SQ_TEX_INST_SAMPLE_C_L
||
3403 opcode
== SQ_TEX_INST_SAMPLE_C_LB
) {
3404 /* the array index is read from Y */
3405 tex
.coord_type_y
= 0;
3407 /* the array index is read from Z */
3408 tex
.coord_type_z
= 0;
3409 tex
.src_sel_z
= tex
.src_sel_y
;
3411 } else if (inst
->Texture
.Texture
== TGSI_TEXTURE_2D_ARRAY
||
3412 inst
->Texture
.Texture
== TGSI_TEXTURE_SHADOW2D_ARRAY
)
3413 /* the array index is read from Z */
3414 tex
.coord_type_z
= 0;
3416 r
= r600_bytecode_add_tex(ctx
->bc
, &tex
);
3420 /* add shadow ambient support - gallium doesn't do it yet */
3424 static int tgsi_lrp(struct r600_shader_ctx
*ctx
)
3426 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3427 struct r600_bytecode_alu alu
;
3428 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
3432 /* optimize if it's just an equal balance */
3433 if (ctx
->src
[0].sel
== V_SQ_ALU_SRC_0_5
) {
3434 for (i
= 0; i
< lasti
+ 1; i
++) {
3435 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
3438 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3439 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
3440 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[1], i
);
3441 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[2], i
);
3443 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
3448 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3456 for (i
= 0; i
< lasti
+ 1; i
++) {
3457 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
3460 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3461 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
);
3462 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
3463 alu
.src
[0].chan
= 0;
3464 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[0], i
);
3465 r600_bytecode_src_toggle_neg(&alu
.src
[1]);
3466 alu
.dst
.sel
= ctx
->temp_reg
;
3472 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3477 /* (1 - src0) * src2 */
3478 for (i
= 0; i
< lasti
+ 1; i
++) {
3479 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
3482 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3483 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
3484 alu
.src
[0].sel
= ctx
->temp_reg
;
3485 alu
.src
[0].chan
= i
;
3486 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[2], i
);
3487 alu
.dst
.sel
= ctx
->temp_reg
;
3493 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3498 /* src0 * src1 + (1 - src0) * src2 */
3499 for (i
= 0; i
< lasti
+ 1; i
++) {
3500 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
3503 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3504 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
3506 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
3507 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
3508 alu
.src
[2].sel
= ctx
->temp_reg
;
3509 alu
.src
[2].chan
= i
;
3511 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
3516 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3523 static int tgsi_cmp(struct r600_shader_ctx
*ctx
)
3525 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3526 struct r600_bytecode_alu alu
;
3528 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
3530 for (i
= 0; i
< lasti
+ 1; i
++) {
3531 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
3534 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3535 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE
);
3536 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
3537 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[2], i
);
3538 r600_bytecode_src(&alu
.src
[2], &ctx
->src
[1], i
);
3539 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
3545 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3552 static int tgsi_xpd(struct r600_shader_ctx
*ctx
)
3554 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3555 static const unsigned int src0_swizzle
[] = {2, 0, 1};
3556 static const unsigned int src1_swizzle
[] = {1, 2, 0};
3557 struct r600_bytecode_alu alu
;
3558 uint32_t use_temp
= 0;
3561 if (inst
->Dst
[0].Register
.WriteMask
!= 0xf)
3564 for (i
= 0; i
< 4; i
++) {
3565 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3566 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
3568 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], src0_swizzle
[i
]);
3569 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], src1_swizzle
[i
]);
3571 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
3572 alu
.src
[0].chan
= i
;
3573 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
3574 alu
.src
[1].chan
= i
;
3577 alu
.dst
.sel
= ctx
->temp_reg
;
3583 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3588 for (i
= 0; i
< 4; i
++) {
3589 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3590 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
);
3593 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], src1_swizzle
[i
]);
3594 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], src0_swizzle
[i
]);
3596 alu
.src
[0].sel
= V_SQ_ALU_SRC_0
;
3597 alu
.src
[0].chan
= i
;
3598 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
3599 alu
.src
[1].chan
= i
;
3602 alu
.src
[2].sel
= ctx
->temp_reg
;
3604 alu
.src
[2].chan
= i
;
3607 alu
.dst
.sel
= ctx
->temp_reg
;
3609 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
3615 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3620 return tgsi_helper_copy(ctx
, inst
);
3624 static int tgsi_exp(struct r600_shader_ctx
*ctx
)
3626 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3627 struct r600_bytecode_alu alu
;
3631 /* result.x = 2^floor(src); */
3632 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
3633 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3635 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
3636 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3638 alu
.dst
.sel
= ctx
->temp_reg
;
3642 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3646 if (ctx
->bc
->chip_class
== CAYMAN
) {
3647 for (i
= 0; i
< 3; i
++) {
3648 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3649 alu
.src
[0].sel
= ctx
->temp_reg
;
3650 alu
.src
[0].chan
= 0;
3652 alu
.dst
.sel
= ctx
->temp_reg
;
3658 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3663 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3664 alu
.src
[0].sel
= ctx
->temp_reg
;
3665 alu
.src
[0].chan
= 0;
3667 alu
.dst
.sel
= ctx
->temp_reg
;
3671 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3677 /* result.y = tmp - floor(tmp); */
3678 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
3679 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3681 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
);
3682 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3684 alu
.dst
.sel
= ctx
->temp_reg
;
3686 r
= tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
3695 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3700 /* result.z = RoughApprox2ToX(tmp);*/
3701 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 0x1) {
3702 if (ctx
->bc
->chip_class
== CAYMAN
) {
3703 for (i
= 0; i
< 3; i
++) {
3704 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3705 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3706 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3708 alu
.dst
.sel
= ctx
->temp_reg
;
3715 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3720 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3721 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3722 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3724 alu
.dst
.sel
= ctx
->temp_reg
;
3730 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3736 /* result.w = 1.0;*/
3737 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 0x1) {
3738 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3740 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
3741 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
3742 alu
.src
[0].chan
= 0;
3744 alu
.dst
.sel
= ctx
->temp_reg
;
3748 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3752 return tgsi_helper_copy(ctx
, inst
);
3755 static int tgsi_log(struct r600_shader_ctx
*ctx
)
3757 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
3758 struct r600_bytecode_alu alu
;
3762 /* result.x = floor(log2(|src|)); */
3763 if (inst
->Dst
[0].Register
.WriteMask
& 1) {
3764 if (ctx
->bc
->chip_class
== CAYMAN
) {
3765 for (i
= 0; i
< 3; i
++) {
3766 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3768 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3769 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3770 r600_bytecode_src_set_abs(&alu
.src
[0]);
3772 alu
.dst
.sel
= ctx
->temp_reg
;
3778 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3784 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3786 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3787 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3788 r600_bytecode_src_set_abs(&alu
.src
[0]);
3790 alu
.dst
.sel
= ctx
->temp_reg
;
3794 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3799 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
3800 alu
.src
[0].sel
= ctx
->temp_reg
;
3801 alu
.src
[0].chan
= 0;
3803 alu
.dst
.sel
= ctx
->temp_reg
;
3808 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3813 /* result.y = |src.x| / (2 ^ floor(log2(|src.x|))); */
3814 if ((inst
->Dst
[0].Register
.WriteMask
>> 1) & 1) {
3816 if (ctx
->bc
->chip_class
== CAYMAN
) {
3817 for (i
= 0; i
< 3; i
++) {
3818 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3820 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3821 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3822 r600_bytecode_src_set_abs(&alu
.src
[0]);
3824 alu
.dst
.sel
= ctx
->temp_reg
;
3831 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3836 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3838 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3839 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3840 r600_bytecode_src_set_abs(&alu
.src
[0]);
3842 alu
.dst
.sel
= ctx
->temp_reg
;
3847 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3852 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3854 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
);
3855 alu
.src
[0].sel
= ctx
->temp_reg
;
3856 alu
.src
[0].chan
= 1;
3858 alu
.dst
.sel
= ctx
->temp_reg
;
3863 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3867 if (ctx
->bc
->chip_class
== CAYMAN
) {
3868 for (i
= 0; i
< 3; i
++) {
3869 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3870 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3871 alu
.src
[0].sel
= ctx
->temp_reg
;
3872 alu
.src
[0].chan
= 1;
3874 alu
.dst
.sel
= ctx
->temp_reg
;
3881 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3886 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3887 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
);
3888 alu
.src
[0].sel
= ctx
->temp_reg
;
3889 alu
.src
[0].chan
= 1;
3891 alu
.dst
.sel
= ctx
->temp_reg
;
3896 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3901 if (ctx
->bc
->chip_class
== CAYMAN
) {
3902 for (i
= 0; i
< 3; i
++) {
3903 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3904 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
3905 alu
.src
[0].sel
= ctx
->temp_reg
;
3906 alu
.src
[0].chan
= 1;
3908 alu
.dst
.sel
= ctx
->temp_reg
;
3915 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3920 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3921 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
);
3922 alu
.src
[0].sel
= ctx
->temp_reg
;
3923 alu
.src
[0].chan
= 1;
3925 alu
.dst
.sel
= ctx
->temp_reg
;
3930 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3935 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3937 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
3939 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3940 r600_bytecode_src_set_abs(&alu
.src
[0]);
3942 alu
.src
[1].sel
= ctx
->temp_reg
;
3943 alu
.src
[1].chan
= 1;
3945 alu
.dst
.sel
= ctx
->temp_reg
;
3950 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3955 /* result.z = log2(|src|);*/
3956 if ((inst
->Dst
[0].Register
.WriteMask
>> 2) & 1) {
3957 if (ctx
->bc
->chip_class
== CAYMAN
) {
3958 for (i
= 0; i
< 3; i
++) {
3959 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3961 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3962 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3963 r600_bytecode_src_set_abs(&alu
.src
[0]);
3965 alu
.dst
.sel
= ctx
->temp_reg
;
3972 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3977 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3979 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
);
3980 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
3981 r600_bytecode_src_set_abs(&alu
.src
[0]);
3983 alu
.dst
.sel
= ctx
->temp_reg
;
3988 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
3994 /* result.w = 1.0; */
3995 if ((inst
->Dst
[0].Register
.WriteMask
>> 3) & 1) {
3996 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
3998 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
);
3999 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
4000 alu
.src
[0].chan
= 0;
4002 alu
.dst
.sel
= ctx
->temp_reg
;
4007 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
4012 return tgsi_helper_copy(ctx
, inst
);
4015 static int tgsi_eg_arl(struct r600_shader_ctx
*ctx
)
4017 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
4018 struct r600_bytecode_alu alu
;
4021 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
4023 switch (inst
->Instruction
.Opcode
) {
4024 case TGSI_OPCODE_ARL
:
4025 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR
;
4027 case TGSI_OPCODE_ARR
:
4028 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
4030 case TGSI_OPCODE_UARL
:
4031 alu
.inst
= EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
4038 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
4040 alu
.dst
.sel
= ctx
->bc
->ar_reg
;
4042 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
4046 ctx
->bc
->ar_loaded
= 0;
4049 static int tgsi_r600_arl(struct r600_shader_ctx
*ctx
)
4051 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
4052 struct r600_bytecode_alu alu
;
4055 switch (inst
->Instruction
.Opcode
) {
4056 case TGSI_OPCODE_ARL
:
4057 memset(&alu
, 0, sizeof(alu
));
4058 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
;
4059 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
4060 alu
.dst
.sel
= ctx
->bc
->ar_reg
;
4064 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
4067 memset(&alu
, 0, sizeof(alu
));
4068 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
4069 alu
.src
[0].sel
= ctx
->bc
->ar_reg
;
4070 alu
.dst
.sel
= ctx
->bc
->ar_reg
;
4074 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
4077 case TGSI_OPCODE_ARR
:
4078 memset(&alu
, 0, sizeof(alu
));
4079 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
;
4080 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
4081 alu
.dst
.sel
= ctx
->bc
->ar_reg
;
4085 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
4088 case TGSI_OPCODE_UARL
:
4089 memset(&alu
, 0, sizeof(alu
));
4090 alu
.inst
= V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
;
4091 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
4092 alu
.dst
.sel
= ctx
->bc
->ar_reg
;
4096 if ((r
= r600_bytecode_add_alu(ctx
->bc
, &alu
)))
4104 ctx
->bc
->ar_loaded
= 0;
4108 static int tgsi_opdst(struct r600_shader_ctx
*ctx
)
4110 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
4111 struct r600_bytecode_alu alu
;
4114 for (i
= 0; i
< 4; i
++) {
4115 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
4117 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
);
4118 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
4120 if (i
== 0 || i
== 3) {
4121 alu
.src
[0].sel
= V_SQ_ALU_SRC_1
;
4123 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], i
);
4126 if (i
== 0 || i
== 2) {
4127 alu
.src
[1].sel
= V_SQ_ALU_SRC_1
;
4129 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[1], i
);
4133 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
4140 static int emit_logic_pred(struct r600_shader_ctx
*ctx
, int opcode
)
4142 struct r600_bytecode_alu alu
;
4145 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
4149 alu
.dst
.sel
= ctx
->temp_reg
;
4153 r600_bytecode_src(&alu
.src
[0], &ctx
->src
[0], 0);
4154 alu
.src
[1].sel
= V_SQ_ALU_SRC_0
;
4155 alu
.src
[1].chan
= 0;
4159 r
= r600_bytecode_add_alu_type(ctx
->bc
, &alu
, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE
));
4165 static int pops(struct r600_shader_ctx
*ctx
, int pops
)
4167 unsigned force_pop
= ctx
->bc
->force_add_cf
;
4171 if (ctx
->bc
->cf_last
) {
4172 if (ctx
->bc
->cf_last
->inst
== CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU
))
4174 else if (ctx
->bc
->cf_last
->inst
== CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER
))
4179 ctx
->bc
->cf_last
->inst
= CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER
);
4180 ctx
->bc
->force_add_cf
= 1;
4181 } else if (alu_pop
== 2) {
4182 ctx
->bc
->cf_last
->inst
= CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER
);
4183 ctx
->bc
->force_add_cf
= 1;
4190 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP
));
4191 ctx
->bc
->cf_last
->pop_count
= pops
;
4192 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
4198 static inline void callstack_decrease_current(struct r600_shader_ctx
*ctx
, unsigned reason
)
4202 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
4206 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
-= 4;
4209 /* TOODO : for 16 vp asic should -= 2; */
4210 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
--;
4215 static inline void callstack_check_depth(struct r600_shader_ctx
*ctx
, unsigned reason
, unsigned check_max_only
)
4217 if (check_max_only
) {
4230 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+ diff
) >
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
+ diff
;
4239 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
4243 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
+= 4;
4246 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
++;
4250 if ((ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
) >
4251 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
) {
4252 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].max
=
4253 ctx
->bc
->callstack
[ctx
->bc
->call_sp
].current
;
4257 static void fc_set_mid(struct r600_shader_ctx
*ctx
, int fc_sp
)
4259 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[fc_sp
];
4261 sp
->mid
= (struct r600_bytecode_cf
**)realloc((void *)sp
->mid
,
4262 sizeof(struct r600_bytecode_cf
*) * (sp
->num_mid
+ 1));
4263 sp
->mid
[sp
->num_mid
] = ctx
->bc
->cf_last
;
4267 static void fc_pushlevel(struct r600_shader_ctx
*ctx
, int type
)
4270 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
= type
;
4271 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
= ctx
->bc
->cf_last
;
4274 static void fc_poplevel(struct r600_shader_ctx
*ctx
)
4276 struct r600_cf_stack_entry
*sp
= &ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
];
4288 static int emit_return(struct r600_shader_ctx
*ctx
)
4290 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_RETURN
));
4294 static int emit_jump_to_offset(struct r600_shader_ctx
*ctx
, int pops
, int offset
)
4297 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
4298 ctx
->bc
->cf_last
->pop_count
= pops
;
4299 /* TODO work out offset */
4303 static int emit_setret_in_loop_flag(struct r600_shader_ctx
*ctx
, unsigned flag_value
)
4308 static void emit_testflag(struct r600_shader_ctx
*ctx
)
4313 static void emit_return_on_flag(struct r600_shader_ctx
*ctx
, unsigned ifidx
)
4316 emit_jump_to_offset(ctx
, 1, 4);
4317 emit_setret_in_loop_flag(ctx
, V_SQ_ALU_SRC_0
);
4318 pops(ctx
, ifidx
+ 1);
4322 static void break_loop_on_flag(struct r600_shader_ctx
*ctx
, unsigned fc_sp
)
4326 r600_bytecode_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
4327 ctx
->bc
->cf_last
->pop_count
= 1;
4329 fc_set_mid(ctx
, fc_sp
);
4335 static int tgsi_if(struct r600_shader_ctx
*ctx
)
4337 emit_logic_pred(ctx
, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_INT
));
4339 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP
));
4341 fc_pushlevel(ctx
, FC_IF
);
4343 callstack_check_depth(ctx
, FC_PUSH_VPM
, 0);
4347 static int tgsi_else(struct r600_shader_ctx
*ctx
)
4349 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE
));
4350 ctx
->bc
->cf_last
->pop_count
= 1;
4352 fc_set_mid(ctx
, ctx
->bc
->fc_sp
);
4353 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
;
4357 static int tgsi_endif(struct r600_shader_ctx
*ctx
)
4360 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_IF
) {
4361 R600_ERR("if/endif unbalanced in shader\n");
4365 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
== NULL
) {
4366 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
4367 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->pop_count
= 1;
4369 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[0]->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
4373 callstack_decrease_current(ctx
, FC_PUSH_VPM
);
4377 static int tgsi_bgnloop(struct r600_shader_ctx
*ctx
)
4379 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL
));
4381 fc_pushlevel(ctx
, FC_LOOP
);
4383 /* check stack depth */
4384 callstack_check_depth(ctx
, FC_LOOP
, 0);
4388 static int tgsi_endloop(struct r600_shader_ctx
*ctx
)
4392 r600_bytecode_add_cfinst(ctx
->bc
, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END
));
4394 if (ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].type
!= FC_LOOP
) {
4395 R600_ERR("loop/endloop in shader code are not paired.\n");
4399 /* fixup loop pointers - from r600isa
4400 LOOP END points to CF after LOOP START,
4401 LOOP START point to CF after LOOP END
4402 BRK/CONT point to LOOP END CF
4404 ctx
->bc
->cf_last
->cf_addr
= ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->id
+ 2;
4406 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].start
->cf_addr
= ctx
->bc
->cf_last
->id
+ 2;
4408 for (i
= 0; i
< ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].num_mid
; i
++) {
4409 ctx
->bc
->fc_stack
[ctx
->bc
->fc_sp
].mid
[i
]->cf_addr
= ctx
->bc
->cf_last
->id
;
4411 /* TODO add LOOPRET support */
4413 callstack_decrease_current(ctx
, FC_LOOP
);
4417 static int tgsi_loop_brk_cont(struct r600_shader_ctx
*ctx
)
4421 for (fscp
= ctx
->bc
->fc_sp
; fscp
> 0; fscp
--)
4423 if (FC_LOOP
== ctx
->bc
->fc_stack
[fscp
].type
)
4428 R600_ERR("Break not inside loop/endloop pair\n");
4432 r600_bytecode_add_cfinst(ctx
->bc
, ctx
->inst_info
->r600_opcode
);
4433 ctx
->bc
->cf_last
->pop_count
= 1;
4435 fc_set_mid(ctx
, fscp
);
4438 callstack_check_depth(ctx
, FC_PUSH_VPM
, 1);
4442 static int tgsi_umad(struct r600_shader_ctx
*ctx
)
4444 struct tgsi_full_instruction
*inst
= &ctx
->parse
.FullToken
.FullInstruction
;
4445 struct r600_bytecode_alu alu
;
4447 int lasti
= tgsi_last_instruction(inst
->Dst
[0].Register
.WriteMask
);
4450 for (i
= 0; i
< lasti
+ 1; i
++) {
4451 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
4454 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
4457 alu
.dst
.sel
= ctx
->temp_reg
;
4460 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT
);
4461 for (j
= 0; j
< 2; j
++) {
4462 r600_bytecode_src(&alu
.src
[j
], &ctx
->src
[j
], i
);
4466 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
4472 for (i
= 0; i
< lasti
+ 1; i
++) {
4473 if (!(inst
->Dst
[0].Register
.WriteMask
& (1 << i
)))
4476 memset(&alu
, 0, sizeof(struct r600_bytecode_alu
));
4477 tgsi_dst(ctx
, &inst
->Dst
[0], i
, &alu
.dst
);
4479 alu
.inst
= CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
);
4481 alu
.src
[0].sel
= ctx
->temp_reg
;
4482 alu
.src
[0].chan
= i
;
4484 r600_bytecode_src(&alu
.src
[1], &ctx
->src
[2], i
);
4488 r
= r600_bytecode_add_alu(ctx
->bc
, &alu
);
4495 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction
[] = {
4496 {TGSI_OPCODE_ARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
4497 {TGSI_OPCODE_MOV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4498 {TGSI_OPCODE_LIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
4501 * For state trackers other than OpenGL, we'll want to use
4502 * _RECIP_IEEE instead.
4504 {TGSI_OPCODE_RCP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED
, tgsi_trans_srcx_replicate
},
4506 {TGSI_OPCODE_RSQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_rsq
},
4507 {TGSI_OPCODE_EXP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
4508 {TGSI_OPCODE_LOG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
4509 {TGSI_OPCODE_MUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
4510 {TGSI_OPCODE_ADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4511 {TGSI_OPCODE_DP3
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4512 {TGSI_OPCODE_DP4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4513 {TGSI_OPCODE_DST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
4514 {TGSI_OPCODE_MIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
4515 {TGSI_OPCODE_MAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
4516 {TGSI_OPCODE_SLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
4517 {TGSI_OPCODE_SGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
4518 {TGSI_OPCODE_MAD
, 1, V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
4519 {TGSI_OPCODE_SUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4520 {TGSI_OPCODE_LRP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
4521 {TGSI_OPCODE_CND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4523 {20, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4524 {TGSI_OPCODE_DP2A
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4526 {22, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4527 {23, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4528 {TGSI_OPCODE_FRC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
4529 {TGSI_OPCODE_CLAMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4530 {TGSI_OPCODE_FLR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
4531 {TGSI_OPCODE_ROUND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE
, tgsi_op2
},
4532 {TGSI_OPCODE_EX2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
4533 {TGSI_OPCODE_LG2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
4534 {TGSI_OPCODE_POW
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
4535 {TGSI_OPCODE_XPD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
4537 {32, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4538 {TGSI_OPCODE_ABS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4539 {TGSI_OPCODE_RCC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4540 {TGSI_OPCODE_DPH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4541 {TGSI_OPCODE_COS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
4542 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
4543 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
4544 {TGSI_OPCODE_KILP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
4545 {TGSI_OPCODE_PK2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4546 {TGSI_OPCODE_PK2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4547 {TGSI_OPCODE_PK4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4548 {TGSI_OPCODE_PK4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4549 {TGSI_OPCODE_RFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4550 {TGSI_OPCODE_SEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
4551 {TGSI_OPCODE_SFL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4552 {TGSI_OPCODE_SGT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
4553 {TGSI_OPCODE_SIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
4554 {TGSI_OPCODE_SLE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
4555 {TGSI_OPCODE_SNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
4556 {TGSI_OPCODE_STR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4557 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4558 {TGSI_OPCODE_TXD
, 0, SQ_TEX_INST_SAMPLE_G
, tgsi_tex
},
4559 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4560 {TGSI_OPCODE_UP2H
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4561 {TGSI_OPCODE_UP2US
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4562 {TGSI_OPCODE_UP4B
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4563 {TGSI_OPCODE_UP4UB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4564 {TGSI_OPCODE_X2D
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4565 {TGSI_OPCODE_ARA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4566 {TGSI_OPCODE_ARR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_r600_arl
},
4567 {TGSI_OPCODE_BRA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4568 {TGSI_OPCODE_CAL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4569 {TGSI_OPCODE_RET
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4570 {TGSI_OPCODE_SSG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
4571 {TGSI_OPCODE_CMP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
4572 {TGSI_OPCODE_SCS
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
4573 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_LB
, tgsi_tex
},
4574 {TGSI_OPCODE_NRM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4575 {TGSI_OPCODE_DIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4576 {TGSI_OPCODE_DP2
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4577 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
4578 {TGSI_OPCODE_BRK
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
4579 {TGSI_OPCODE_IF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
4581 {75, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4582 {76, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4583 {TGSI_OPCODE_ELSE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
4584 {TGSI_OPCODE_ENDIF
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
4586 {79, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4587 {80, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4588 {TGSI_OPCODE_PUSHA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4589 {TGSI_OPCODE_POPA
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4590 {TGSI_OPCODE_CEIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4591 {TGSI_OPCODE_I2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT
, tgsi_op2_trans
},
4592 {TGSI_OPCODE_NOT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOT_INT
, tgsi_op2
},
4593 {TGSI_OPCODE_TRUNC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_op2
},
4594 {TGSI_OPCODE_SHL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT
, tgsi_op2_trans
},
4596 {88, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4597 {TGSI_OPCODE_AND
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_AND_INT
, tgsi_op2
},
4598 {TGSI_OPCODE_OR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_OR_INT
, tgsi_op2
},
4599 {TGSI_OPCODE_MOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_imod
},
4600 {TGSI_OPCODE_XOR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_XOR_INT
, tgsi_op2
},
4601 {TGSI_OPCODE_SAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4602 {TGSI_OPCODE_TXF
, 0, SQ_TEX_INST_LD
, tgsi_tex
},
4603 {TGSI_OPCODE_TXQ
, 0, SQ_TEX_INST_GET_TEXTURE_RESINFO
, tgsi_tex
},
4604 {TGSI_OPCODE_CONT
, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
4605 {TGSI_OPCODE_EMIT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4606 {TGSI_OPCODE_ENDPRIM
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4607 {TGSI_OPCODE_BGNLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
4608 {TGSI_OPCODE_BGNSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4609 {TGSI_OPCODE_ENDLOOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
4610 {TGSI_OPCODE_ENDSUB
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4612 {103, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4613 {104, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4614 {105, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4615 {106, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4616 {TGSI_OPCODE_NOP
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4618 {108, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4619 {109, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4620 {110, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4621 {111, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4622 {TGSI_OPCODE_NRM4
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4623 {TGSI_OPCODE_CALLNZ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4624 {TGSI_OPCODE_IFC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4625 {TGSI_OPCODE_BREAKC
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4626 {TGSI_OPCODE_KIL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
4627 {TGSI_OPCODE_END
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
4629 {118, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4630 {TGSI_OPCODE_F2I
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
, tgsi_op2_trans
},
4631 {TGSI_OPCODE_IDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_idiv
},
4632 {TGSI_OPCODE_IMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_INT
, tgsi_op2
},
4633 {TGSI_OPCODE_IMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_INT
, tgsi_op2
},
4634 {TGSI_OPCODE_INEG
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
, tgsi_ineg
},
4635 {TGSI_OPCODE_ISGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_INT
, tgsi_op2
},
4636 {TGSI_OPCODE_ISHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT
, tgsi_op2_trans
},
4637 {TGSI_OPCODE_ISLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_INT
, tgsi_op2_swap
},
4638 {TGSI_OPCODE_F2U
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_UINT
, tgsi_op2
},
4639 {TGSI_OPCODE_U2F
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_UINT_TO_FLT
, tgsi_op2_trans
},
4640 {TGSI_OPCODE_UADD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
, tgsi_op2
},
4641 {TGSI_OPCODE_UDIV
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_udiv
},
4642 {TGSI_OPCODE_UMAD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_umad
},
4643 {TGSI_OPCODE_UMAX
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_UINT
, tgsi_op2
},
4644 {TGSI_OPCODE_UMIN
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_UINT
, tgsi_op2
},
4645 {TGSI_OPCODE_UMOD
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_umod
},
4646 {TGSI_OPCODE_UMUL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT
, tgsi_op2_trans
},
4647 {TGSI_OPCODE_USEQ
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE_INT
, tgsi_op2
},
4648 {TGSI_OPCODE_USGE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_UINT
, tgsi_op2
},
4649 {TGSI_OPCODE_USHR
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT
, tgsi_op2_trans
},
4650 {TGSI_OPCODE_USLT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_UINT
, tgsi_op2_swap
},
4651 {TGSI_OPCODE_USNE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE_INT
, tgsi_op2_swap
},
4652 {TGSI_OPCODE_SWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4653 {TGSI_OPCODE_CASE
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4654 {TGSI_OPCODE_DEFAULT
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4655 {TGSI_OPCODE_ENDSWITCH
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4656 {TGSI_OPCODE_LOAD
, 0, 0, tgsi_unsupported
},
4657 {TGSI_OPCODE_LOAD_MS
, 0, 0, tgsi_unsupported
},
4658 {TGSI_OPCODE_SAMPLE
, 0, 0, tgsi_unsupported
},
4659 {TGSI_OPCODE_SAMPLE_B
, 0, 0, tgsi_unsupported
},
4660 {TGSI_OPCODE_SAMPLE_C
, 0, 0, tgsi_unsupported
},
4661 {TGSI_OPCODE_SAMPLE_C_LZ
, 0, 0, tgsi_unsupported
},
4662 {TGSI_OPCODE_SAMPLE_D
, 0, 0, tgsi_unsupported
},
4663 {TGSI_OPCODE_SAMPLE_L
, 0, 0, tgsi_unsupported
},
4664 {TGSI_OPCODE_GATHER4
, 0, 0, tgsi_unsupported
},
4665 {TGSI_OPCODE_RESINFO
, 0, 0, tgsi_unsupported
},
4666 {TGSI_OPCODE_SAMPLE_POS
, 0, 0, tgsi_unsupported
},
4667 {TGSI_OPCODE_SAMPLE_INFO
, 0, 0, tgsi_unsupported
},
4668 {TGSI_OPCODE_UARL
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
, tgsi_r600_arl
},
4669 {TGSI_OPCODE_UCMP
, 0, 0, tgsi_unsupported
},
4670 {TGSI_OPCODE_IABS
, 0, 0, tgsi_iabs
},
4671 {TGSI_OPCODE_ISSG
, 0, 0, tgsi_issg
},
4672 {TGSI_OPCODE_LAST
, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4675 static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction
[] = {
4676 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
4677 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4678 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
4679 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, tgsi_trans_srcx_replicate
},
4680 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, tgsi_rsq
},
4681 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
4682 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
4683 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
4684 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4685 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4686 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4687 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
4688 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
4689 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
4690 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
4691 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
4692 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
4693 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4694 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
4695 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4697 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4698 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4700 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4701 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4702 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
4703 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4704 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
4705 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE
, tgsi_op2
},
4706 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, tgsi_trans_srcx_replicate
},
4707 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, tgsi_trans_srcx_replicate
},
4708 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_pow
},
4709 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
4711 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4712 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4713 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4714 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4715 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, tgsi_trig
},
4716 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
4717 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
4718 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
4719 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4720 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4721 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4722 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4723 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4724 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
4725 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4726 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
4727 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, tgsi_trig
},
4728 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
4729 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
4730 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4731 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4732 {TGSI_OPCODE_TXD
, 0, SQ_TEX_INST_SAMPLE_G
, tgsi_tex
},
4733 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4734 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4735 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4736 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4737 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4738 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4739 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4740 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
4741 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4742 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4743 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4744 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
4745 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
4746 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
4747 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_LB
, tgsi_tex
},
4748 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4749 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4750 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4751 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
4752 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
4753 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
4755 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4756 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4757 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
4758 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
4760 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4761 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4762 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4763 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4764 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4765 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT
, tgsi_op2_trans
},
4766 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOT_INT
, tgsi_op2
},
4767 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_op2
},
4768 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT
, tgsi_op2
},
4770 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4771 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_AND_INT
, tgsi_op2
},
4772 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_OR_INT
, tgsi_op2
},
4773 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_imod
},
4774 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_XOR_INT
, tgsi_op2
},
4775 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4776 {TGSI_OPCODE_TXF
, 0, SQ_TEX_INST_LD
, tgsi_tex
},
4777 {TGSI_OPCODE_TXQ
, 0, SQ_TEX_INST_GET_TEXTURE_RESINFO
, tgsi_tex
},
4778 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
4779 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4780 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4781 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
4782 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4783 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
4784 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4786 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4787 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4788 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4789 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4790 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4792 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4793 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4794 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4795 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4796 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4797 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4798 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4799 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4800 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
4801 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
4803 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4804 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT
, tgsi_op2
},
4805 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_idiv
},
4806 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_INT
, tgsi_op2
},
4807 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_INT
, tgsi_op2
},
4808 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT
, tgsi_ineg
},
4809 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_INT
, tgsi_op2
},
4810 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT
, tgsi_op2
},
4811 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_INT
, tgsi_op2_swap
},
4812 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_UINT
, tgsi_op2_trans
},
4813 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_UINT_TO_FLT
, tgsi_op2_trans
},
4814 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT
, tgsi_op2
},
4815 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_udiv
},
4816 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_umad
},
4817 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_UINT
, tgsi_op2
},
4818 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_UINT
, tgsi_op2
},
4819 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_umod
},
4820 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT
, tgsi_op2_trans
},
4821 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE_INT
, tgsi_op2
},
4822 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_UINT
, tgsi_op2
},
4823 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT
, tgsi_op2
},
4824 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_UINT
, tgsi_op2_swap
},
4825 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE_INT
, tgsi_op2
},
4826 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4827 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4828 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4829 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4830 {TGSI_OPCODE_LOAD
, 0, 0, tgsi_unsupported
},
4831 {TGSI_OPCODE_LOAD_MS
, 0, 0, tgsi_unsupported
},
4832 {TGSI_OPCODE_SAMPLE
, 0, 0, tgsi_unsupported
},
4833 {TGSI_OPCODE_SAMPLE_B
, 0, 0, tgsi_unsupported
},
4834 {TGSI_OPCODE_SAMPLE_C
, 0, 0, tgsi_unsupported
},
4835 {TGSI_OPCODE_SAMPLE_C_LZ
, 0, 0, tgsi_unsupported
},
4836 {TGSI_OPCODE_SAMPLE_D
, 0, 0, tgsi_unsupported
},
4837 {TGSI_OPCODE_SAMPLE_L
, 0, 0, tgsi_unsupported
},
4838 {TGSI_OPCODE_GATHER4
, 0, 0, tgsi_unsupported
},
4839 {TGSI_OPCODE_RESINFO
, 0, 0, tgsi_unsupported
},
4840 {TGSI_OPCODE_SAMPLE_POS
, 0, 0, tgsi_unsupported
},
4841 {TGSI_OPCODE_SAMPLE_INFO
, 0, 0, tgsi_unsupported
},
4842 {TGSI_OPCODE_UARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT
, tgsi_eg_arl
},
4843 {TGSI_OPCODE_UCMP
, 0, 0, tgsi_unsupported
},
4844 {TGSI_OPCODE_IABS
, 0, 0, tgsi_iabs
},
4845 {TGSI_OPCODE_ISSG
, 0, 0, tgsi_issg
},
4846 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4849 static struct r600_shader_tgsi_instruction cm_shader_tgsi_instruction
[] = {
4850 {TGSI_OPCODE_ARL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
4851 {TGSI_OPCODE_MOV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4852 {TGSI_OPCODE_LIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lit
},
4853 {TGSI_OPCODE_RCP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE
, cayman_emit_float_instr
},
4854 {TGSI_OPCODE_RSQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE
, cayman_emit_float_instr
},
4855 {TGSI_OPCODE_EXP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_exp
},
4856 {TGSI_OPCODE_LOG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_log
},
4857 {TGSI_OPCODE_MUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL
, tgsi_op2
},
4858 {TGSI_OPCODE_ADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4859 {TGSI_OPCODE_DP3
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4860 {TGSI_OPCODE_DP4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4861 {TGSI_OPCODE_DST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_opdst
},
4862 {TGSI_OPCODE_MIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN
, tgsi_op2
},
4863 {TGSI_OPCODE_MAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX
, tgsi_op2
},
4864 {TGSI_OPCODE_SLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2_swap
},
4865 {TGSI_OPCODE_SGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2
},
4866 {TGSI_OPCODE_MAD
, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD
, tgsi_op3
},
4867 {TGSI_OPCODE_SUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD
, tgsi_op2
},
4868 {TGSI_OPCODE_LRP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_lrp
},
4869 {TGSI_OPCODE_CND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4871 {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4872 {TGSI_OPCODE_DP2A
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4874 {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4875 {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4876 {TGSI_OPCODE_FRC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT
, tgsi_op2
},
4877 {TGSI_OPCODE_CLAMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4878 {TGSI_OPCODE_FLR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR
, tgsi_op2
},
4879 {TGSI_OPCODE_ROUND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE
, tgsi_op2
},
4880 {TGSI_OPCODE_EX2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE
, cayman_emit_float_instr
},
4881 {TGSI_OPCODE_LG2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE
, cayman_emit_float_instr
},
4882 {TGSI_OPCODE_POW
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, cayman_pow
},
4883 {TGSI_OPCODE_XPD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_xpd
},
4885 {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4886 {TGSI_OPCODE_ABS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV
, tgsi_op2
},
4887 {TGSI_OPCODE_RCC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4888 {TGSI_OPCODE_DPH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4889 {TGSI_OPCODE_COS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS
, cayman_trig
},
4890 {TGSI_OPCODE_DDX
, 0, SQ_TEX_INST_GET_GRADIENTS_H
, tgsi_tex
},
4891 {TGSI_OPCODE_DDY
, 0, SQ_TEX_INST_GET_GRADIENTS_V
, tgsi_tex
},
4892 {TGSI_OPCODE_KILP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* predicated kill */
4893 {TGSI_OPCODE_PK2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4894 {TGSI_OPCODE_PK2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4895 {TGSI_OPCODE_PK4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4896 {TGSI_OPCODE_PK4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4897 {TGSI_OPCODE_RFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4898 {TGSI_OPCODE_SEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE
, tgsi_op2
},
4899 {TGSI_OPCODE_SFL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4900 {TGSI_OPCODE_SGT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT
, tgsi_op2
},
4901 {TGSI_OPCODE_SIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN
, cayman_trig
},
4902 {TGSI_OPCODE_SLE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE
, tgsi_op2_swap
},
4903 {TGSI_OPCODE_SNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE
, tgsi_op2
},
4904 {TGSI_OPCODE_STR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4905 {TGSI_OPCODE_TEX
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4906 {TGSI_OPCODE_TXD
, 0, SQ_TEX_INST_SAMPLE_G
, tgsi_tex
},
4907 {TGSI_OPCODE_TXP
, 0, SQ_TEX_INST_SAMPLE
, tgsi_tex
},
4908 {TGSI_OPCODE_UP2H
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4909 {TGSI_OPCODE_UP2US
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4910 {TGSI_OPCODE_UP4B
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4911 {TGSI_OPCODE_UP4UB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4912 {TGSI_OPCODE_X2D
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4913 {TGSI_OPCODE_ARA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4914 {TGSI_OPCODE_ARR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_eg_arl
},
4915 {TGSI_OPCODE_BRA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4916 {TGSI_OPCODE_CAL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4917 {TGSI_OPCODE_RET
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4918 {TGSI_OPCODE_SSG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_ssg
},
4919 {TGSI_OPCODE_CMP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_cmp
},
4920 {TGSI_OPCODE_SCS
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_scs
},
4921 {TGSI_OPCODE_TXB
, 0, SQ_TEX_INST_SAMPLE_LB
, tgsi_tex
},
4922 {TGSI_OPCODE_NRM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4923 {TGSI_OPCODE_DIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4924 {TGSI_OPCODE_DP2
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4
, tgsi_dp
},
4925 {TGSI_OPCODE_TXL
, 0, SQ_TEX_INST_SAMPLE_L
, tgsi_tex
},
4926 {TGSI_OPCODE_BRK
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK
, tgsi_loop_brk_cont
},
4927 {TGSI_OPCODE_IF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_if
},
4929 {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4930 {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4931 {TGSI_OPCODE_ELSE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_else
},
4932 {TGSI_OPCODE_ENDIF
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endif
},
4934 {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4935 {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4936 {TGSI_OPCODE_PUSHA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4937 {TGSI_OPCODE_POPA
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4938 {TGSI_OPCODE_CEIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4939 {TGSI_OPCODE_I2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4940 {TGSI_OPCODE_NOT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOT_INT
, tgsi_op2
},
4941 {TGSI_OPCODE_TRUNC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC
, tgsi_op2
},
4942 {TGSI_OPCODE_SHL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4944 {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4945 {TGSI_OPCODE_AND
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4946 {TGSI_OPCODE_OR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4947 {TGSI_OPCODE_MOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4948 {TGSI_OPCODE_XOR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_XOR_INT
, tgsi_op2
},
4949 {TGSI_OPCODE_SAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4950 {TGSI_OPCODE_TXF
, 0, SQ_TEX_INST_LD
, tgsi_tex
},
4951 {TGSI_OPCODE_TXQ
, 0, SQ_TEX_INST_GET_TEXTURE_RESINFO
, tgsi_tex
},
4952 {TGSI_OPCODE_CONT
, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE
, tgsi_loop_brk_cont
},
4953 {TGSI_OPCODE_EMIT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4954 {TGSI_OPCODE_ENDPRIM
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4955 {TGSI_OPCODE_BGNLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_bgnloop
},
4956 {TGSI_OPCODE_BGNSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4957 {TGSI_OPCODE_ENDLOOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_endloop
},
4958 {TGSI_OPCODE_ENDSUB
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4960 {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4961 {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4962 {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4963 {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4964 {TGSI_OPCODE_NOP
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4966 {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4967 {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4968 {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4969 {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4970 {TGSI_OPCODE_NRM4
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4971 {TGSI_OPCODE_CALLNZ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4972 {TGSI_OPCODE_IFC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4973 {TGSI_OPCODE_BREAKC
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4974 {TGSI_OPCODE_KIL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT
, tgsi_kill
}, /* conditional kill */
4975 {TGSI_OPCODE_END
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_end
}, /* aka HALT */
4977 {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4978 {TGSI_OPCODE_F2I
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4979 {TGSI_OPCODE_IDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4980 {TGSI_OPCODE_IMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_INT
, tgsi_op2
},
4981 {TGSI_OPCODE_IMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_INT
, tgsi_op2
},
4982 {TGSI_OPCODE_INEG
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4983 {TGSI_OPCODE_ISGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4984 {TGSI_OPCODE_ISHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4985 {TGSI_OPCODE_ISLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4986 {TGSI_OPCODE_F2U
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4987 {TGSI_OPCODE_U2F
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4988 {TGSI_OPCODE_UADD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4989 {TGSI_OPCODE_UDIV
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4990 {TGSI_OPCODE_UMAD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4991 {TGSI_OPCODE_UMAX
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4992 {TGSI_OPCODE_UMIN
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4993 {TGSI_OPCODE_UMOD
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4994 {TGSI_OPCODE_UMUL
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4995 {TGSI_OPCODE_USEQ
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4996 {TGSI_OPCODE_USGE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4997 {TGSI_OPCODE_USHR
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4998 {TGSI_OPCODE_USLT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
4999 {TGSI_OPCODE_USNE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
5000 {TGSI_OPCODE_SWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
5001 {TGSI_OPCODE_CASE
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
5002 {TGSI_OPCODE_DEFAULT
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
5003 {TGSI_OPCODE_ENDSWITCH
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},
5004 {TGSI_OPCODE_LOAD
, 0, 0, tgsi_unsupported
},
5005 {TGSI_OPCODE_LOAD_MS
, 0, 0, tgsi_unsupported
},
5006 {TGSI_OPCODE_SAMPLE
, 0, 0, tgsi_unsupported
},
5007 {TGSI_OPCODE_SAMPLE_B
, 0, 0, tgsi_unsupported
},
5008 {TGSI_OPCODE_SAMPLE_C
, 0, 0, tgsi_unsupported
},
5009 {TGSI_OPCODE_SAMPLE_C_LZ
, 0, 0, tgsi_unsupported
},
5010 {TGSI_OPCODE_SAMPLE_D
, 0, 0, tgsi_unsupported
},
5011 {TGSI_OPCODE_SAMPLE_L
, 0, 0, tgsi_unsupported
},
5012 {TGSI_OPCODE_GATHER4
, 0, 0, tgsi_unsupported
},
5013 {TGSI_OPCODE_RESINFO
, 0, 0, tgsi_unsupported
},
5014 {TGSI_OPCODE_SAMPLE_POS
, 0, 0, tgsi_unsupported
},
5015 {TGSI_OPCODE_SAMPLE_INFO
, 0, 0, tgsi_unsupported
},
5016 {TGSI_OPCODE_UARL
, 0, 0, tgsi_unsupported
},
5017 {TGSI_OPCODE_UCMP
, 0, 0, tgsi_unsupported
},
5018 {TGSI_OPCODE_LAST
, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP
, tgsi_unsupported
},