2 * Copyright © 2008 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
29 #include "brw_disasm.h"
30 #include "brw_structs.h"
32 #include "brw_defines.h"
39 [BRW_OPCODE_MOV] = { .name = "mov", .nsrc = 1, .ndst = 1 },
40 [BRW_OPCODE_FRC] = { .name = "frc", .nsrc = 1, .ndst = 1 },
41 [BRW_OPCODE_RNDU] = { .name = "rndu", .nsrc = 1, .ndst = 1 },
42 [BRW_OPCODE_RNDD] = { .name = "rndd", .nsrc = 1, .ndst = 1 },
43 [BRW_OPCODE_RNDE] = { .name = "rnde", .nsrc = 1, .ndst = 1 },
44 [BRW_OPCODE_RNDZ] = { .name = "rndz", .nsrc = 1, .ndst = 1 },
45 [BRW_OPCODE_NOT] = { .name = "not", .nsrc = 1, .ndst = 1 },
46 [BRW_OPCODE_LZD] = { .name = "lzd", .nsrc = 1, .ndst = 1 },
48 [BRW_OPCODE_MUL] = { .name = "mul", .nsrc = 2, .ndst = 1 },
49 [BRW_OPCODE_MAC] = { .name = "mac", .nsrc = 2, .ndst = 1 },
50 [BRW_OPCODE_MACH] = { .name = "mach", .nsrc = 2, .ndst = 1 },
51 [BRW_OPCODE_LINE] = { .name = "line", .nsrc = 2, .ndst = 1 },
52 [BRW_OPCODE_PLN] = { .name = "pln", .nsrc = 2, .ndst = 1 },
53 [BRW_OPCODE_SAD2] = { .name = "sad2", .nsrc = 2, .ndst = 1 },
54 [BRW_OPCODE_SADA2] = { .name = "sada2", .nsrc = 2, .ndst = 1 },
55 [BRW_OPCODE_DP4] = { .name = "dp4", .nsrc = 2, .ndst = 1 },
56 [BRW_OPCODE_DPH] = { .name = "dph", .nsrc = 2, .ndst = 1 },
57 [BRW_OPCODE_DP3] = { .name = "dp3", .nsrc = 2, .ndst = 1 },
58 [BRW_OPCODE_DP2] = { .name = "dp2", .nsrc = 2, .ndst = 1 },
59 [BRW_OPCODE_MATH] = { .name = "math", .nsrc = 2, .ndst = 1 },
61 [BRW_OPCODE_AVG] = { .name = "avg", .nsrc = 2, .ndst = 1 },
62 [BRW_OPCODE_ADD] = { .name = "add", .nsrc = 2, .ndst = 1 },
63 [BRW_OPCODE_SEL] = { .name = "sel", .nsrc = 2, .ndst = 1 },
64 [BRW_OPCODE_AND] = { .name = "and", .nsrc = 2, .ndst = 1 },
65 [BRW_OPCODE_OR] = { .name = "or", .nsrc = 2, .ndst = 1 },
66 [BRW_OPCODE_XOR] = { .name = "xor", .nsrc = 2, .ndst = 1 },
67 [BRW_OPCODE_SHR] = { .name = "shr", .nsrc = 2, .ndst = 1 },
68 [BRW_OPCODE_SHL] = { .name = "shl", .nsrc = 2, .ndst = 1 },
69 [BRW_OPCODE_ASR] = { .name = "asr", .nsrc = 2, .ndst = 1 },
70 [BRW_OPCODE_CMP] = { .name = "cmp", .nsrc = 2, .ndst = 1 },
71 [BRW_OPCODE_CMPN] = { .name = "cmpn", .nsrc = 2, .ndst = 1 },
73 [BRW_OPCODE_SEND] = { .name = "send", .nsrc = 1, .ndst = 1 },
74 [BRW_OPCODE_SENDC] = { .name = "sendc", .nsrc = 1, .ndst = 1 },
75 [BRW_OPCODE_NOP] = { .name = "nop", .nsrc = 0, .ndst = 0 },
76 [BRW_OPCODE_JMPI] = { .name = "jmpi", .nsrc = 1, .ndst = 0 },
77 [BRW_OPCODE_IF] = { .name = "if", .nsrc = 2, .ndst = 0 },
78 [BRW_OPCODE_IFF] = { .name = "iff", .nsrc = 2, .ndst = 1 },
79 [BRW_OPCODE_WHILE] = { .name = "while", .nsrc = 2, .ndst = 0 },
80 [BRW_OPCODE_ELSE] = { .name = "else", .nsrc = 2, .ndst = 0 },
81 [BRW_OPCODE_BREAK] = { .name = "break", .nsrc = 2, .ndst = 0 },
82 [BRW_OPCODE_CONTINUE] = { .name = "cont", .nsrc = 1, .ndst = 0 },
83 [BRW_OPCODE_HALT] = { .name = "halt", .nsrc = 1, .ndst = 0 },
84 [BRW_OPCODE_MSAVE] = { .name = "msave", .nsrc = 1, .ndst = 1 },
85 [BRW_OPCODE_PUSH] = { .name = "push", .nsrc = 1, .ndst = 1 },
86 [BRW_OPCODE_MRESTORE] = { .name = "mrest", .nsrc = 1, .ndst = 1 },
87 [BRW_OPCODE_POP] = { .name = "pop", .nsrc = 2, .ndst = 0 },
88 [BRW_OPCODE_WAIT] = { .name = "wait", .nsrc = 1, .ndst = 0 },
89 [BRW_OPCODE_DO] = { .name = "do", .nsrc = 0, .ndst = 0 },
90 [BRW_OPCODE_ENDIF] = { .name = "endif", .nsrc = 2, .ndst = 0 },
93 char *conditional_modifier[16] = {
94 [BRW_CONDITIONAL_NONE] = "",
95 [BRW_CONDITIONAL_Z] = ".e",
96 [BRW_CONDITIONAL_NZ] = ".ne",
97 [BRW_CONDITIONAL_G] = ".g",
98 [BRW_CONDITIONAL_GE] = ".ge",
99 [BRW_CONDITIONAL_L] = ".l",
100 [BRW_CONDITIONAL_LE] = ".le",
101 [BRW_CONDITIONAL_R] = ".r",
102 [BRW_CONDITIONAL_O] = ".o",
103 [BRW_CONDITIONAL_U] = ".u",
116 char *vert_stride[16] = {
135 char *horiz_stride[4] = {
142 char *chan_sel[4] = {
149 char *dest_condmod[16] = {
152 char *debug_ctrl[2] = {
157 char *saturate[2] = {
172 char *exec_size[8] = {
181 char *pred_inv[2] = {
186 char *pred_ctrl_align16[16] = {
196 char *pred_ctrl_align1[16] = {
210 char *thread_ctrl[4] = {
215 char *compr_ctrl[4] = {
222 char *dep_ctrl[4] = {
226 [3] = "NoDDClr,NoDDChk",
229 char *mask_ctrl[4] = {
234 char *access_mode[2] = {
239 char *reg_encoding[8] = {
249 int reg_type_size[8] = {
259 char *imm_encoding[8] = {
269 char *reg_file[4] = {
276 char *writemask[16] = {
295 char *end_of_thread[2] = {
300 char *target_function[16] = {
301 [BRW_MESSAGE_TARGET_NULL] = "null",
302 [BRW_MESSAGE_TARGET_MATH] = "math",
303 [BRW_MESSAGE_TARGET_SAMPLER] = "sampler",
304 [BRW_MESSAGE_TARGET_GATEWAY] = "gateway",
305 [BRW_MESSAGE_TARGET_DATAPORT_READ] = "read",
306 [BRW_MESSAGE_TARGET_DATAPORT_WRITE] = "write",
307 [BRW_MESSAGE_TARGET_URB] = "urb",
308 [BRW_MESSAGE_TARGET_THREAD_SPAWNER] = "thread_spawner"
311 char *math_function[16] = {
312 [BRW_MATH_FUNCTION_INV] = "inv",
313 [BRW_MATH_FUNCTION_LOG] = "log",
314 [BRW_MATH_FUNCTION_EXP] = "exp",
315 [BRW_MATH_FUNCTION_SQRT] = "sqrt",
316 [BRW_MATH_FUNCTION_RSQ] = "rsq",
317 [BRW_MATH_FUNCTION_SIN] = "sin",
318 [BRW_MATH_FUNCTION_COS] = "cos",
319 [BRW_MATH_FUNCTION_SINCOS] = "sincos",
320 [BRW_MATH_FUNCTION_TAN] = "tan",
321 [BRW_MATH_FUNCTION_POW] = "pow",
322 [BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER] = "intdivmod",
323 [BRW_MATH_FUNCTION_INT_DIV_QUOTIENT] = "intmod",
324 [BRW_MATH_FUNCTION_INT_DIV_REMAINDER] = "intdiv",
327 char *math_saturate[2] = {
332 char *math_signed[2] = {
337 char *math_scalar[2] = {
342 char *math_precision[2] = {
344 [1] = "partial_precision"
347 char *urb_opcode[2] = {
352 char *urb_swizzle[4] = {
353 [BRW_URB_SWIZZLE_NONE] = "",
354 [BRW_URB_SWIZZLE_INTERLEAVE] = "interleave",
355 [BRW_URB_SWIZZLE_TRANSPOSE] = "transpose",
358 char *urb_allocate[2] = {
363 char *urb_used[2] = {
368 char *urb_complete[2] = {
373 char *sampler_target_format[4] = {
382 static int string (FILE *file, char *string)
384 fputs (string, file);
385 column += strlen (string);
389 static int format (FILE *f, char *format, ...)
393 va_start (args, format);
395 vsnprintf (buf, sizeof (buf) - 1, format, args);
401 static int newline (FILE *f)
408 static int pad (FILE *f, int c)
416 static int control (FILE *file, char *name, char *ctrl[], GLuint id, int *space)
419 fprintf (file, "*** invalid %s value %d ",
427 string (file, ctrl[id]);
434 static int print_opcode (FILE *file, int id)
436 if (!opcode[id].name) {
437 format (file, "*** invalid opcode value %d ", id);
440 string (file, opcode[id].name);
444 static int reg (FILE *file, GLuint _reg_file, GLuint _reg_nr)
448 /* Clear the Compr4 instruction compression bit. */
449 if (_reg_file == BRW_MESSAGE_REGISTER_FILE)
450 _reg_nr &= ~(1 << 7);
452 if (_reg_file == BRW_ARCHITECTURE_REGISTER_FILE) {
453 switch (_reg_nr & 0xf0) {
455 string (file, "null");
457 case BRW_ARF_ADDRESS:
458 format (file, "a%d", _reg_nr & 0x0f);
460 case BRW_ARF_ACCUMULATOR:
461 format (file, "acc%d", _reg_nr & 0x0f);
464 format (file, "f%d", _reg_nr & 0x0f);
467 format (file, "mask%d", _reg_nr & 0x0f);
469 case BRW_ARF_MASK_STACK:
470 format (file, "msd%d", _reg_nr & 0x0f);
473 format (file, "sr%d", _reg_nr & 0x0f);
475 case BRW_ARF_CONTROL:
476 format (file, "cr%d", _reg_nr & 0x0f);
478 case BRW_ARF_NOTIFICATION_COUNT:
479 format (file, "n%d", _reg_nr & 0x0f);
486 format (file, "ARF%d", _reg_nr);
490 err |= control (file, "src reg file", reg_file, _reg_file, NULL);
491 format (file, "%d", _reg_nr);
496 static int dest (FILE *file, struct brw_instruction *inst)
500 if (inst->header.access_mode == BRW_ALIGN_1)
502 if (inst->bits1.da1.dest_address_mode == BRW_ADDRESS_DIRECT)
504 err |= reg (file, inst->bits1.da1.dest_reg_file, inst->bits1.da1.dest_reg_nr);
507 if (inst->bits1.da1.dest_subreg_nr)
508 format (file, ".%d", inst->bits1.da1.dest_subreg_nr /
509 reg_type_size[inst->bits1.da1.dest_reg_type]);
510 format (file, "<%d>", inst->bits1.da1.dest_horiz_stride);
511 err |= control (file, "dest reg encoding", reg_encoding, inst->bits1.da1.dest_reg_type, NULL);
515 string (file, "g[a0");
516 if (inst->bits1.ia1.dest_subreg_nr)
517 format (file, ".%d", inst->bits1.ia1.dest_subreg_nr /
518 reg_type_size[inst->bits1.ia1.dest_reg_type]);
519 if (inst->bits1.ia1.dest_indirect_offset)
520 format (file, " %d", inst->bits1.ia1.dest_indirect_offset);
522 format (file, "<%d>", inst->bits1.ia1.dest_horiz_stride);
523 err |= control (file, "dest reg encoding", reg_encoding, inst->bits1.ia1.dest_reg_type, NULL);
528 if (inst->bits1.da16.dest_address_mode == BRW_ADDRESS_DIRECT)
530 err |= reg (file, inst->bits1.da16.dest_reg_file, inst->bits1.da16.dest_reg_nr);
533 if (inst->bits1.da16.dest_subreg_nr)
534 format (file, ".%d", inst->bits1.da16.dest_subreg_nr /
535 reg_type_size[inst->bits1.da16.dest_reg_type]);
536 string (file, "<1>");
537 err |= control (file, "writemask", writemask, inst->bits1.da16.dest_writemask, NULL);
538 err |= control (file, "dest reg encoding", reg_encoding, inst->bits1.da16.dest_reg_type, NULL);
543 string (file, "Indirect align16 address mode not supported");
550 static int src_align1_region (FILE *file,
551 GLuint _vert_stride, GLuint _width, GLuint _horiz_stride)
555 err |= control (file, "vert stride", vert_stride, _vert_stride, NULL);
557 err |= control (file, "width", width, _width, NULL);
559 err |= control (file, "horiz_stride", horiz_stride, _horiz_stride, NULL);
564 static int src_da1 (FILE *file, GLuint type, GLuint _reg_file,
565 GLuint _vert_stride, GLuint _width, GLuint _horiz_stride,
566 GLuint reg_num, GLuint sub_reg_num, GLuint __abs, GLuint _negate)
569 err |= control (file, "negate", negate, _negate, NULL);
570 err |= control (file, "abs", _abs, __abs, NULL);
572 err |= reg (file, _reg_file, reg_num);
576 format (file, ".%d", sub_reg_num / reg_type_size[type]); /* use formal style like spec */
577 src_align1_region (file, _vert_stride, _width, _horiz_stride);
578 err |= control (file, "src reg encoding", reg_encoding, type, NULL);
582 static int src_ia1 (FILE *file,
586 GLuint _addr_subreg_nr,
590 GLuint _horiz_stride,
595 err |= control (file, "negate", negate, _negate, NULL);
596 err |= control (file, "abs", _abs, __abs, NULL);
598 string (file, "g[a0");
600 format (file, ".%d", _addr_subreg_nr);
602 format (file, " %d", _addr_imm);
604 src_align1_region (file, _vert_stride, _width, _horiz_stride);
605 err |= control (file, "src reg encoding", reg_encoding, type, NULL);
609 static int src_da16 (FILE *file,
623 err |= control (file, "negate", negate, _negate, NULL);
624 err |= control (file, "abs", _abs, __abs, NULL);
626 err |= reg (file, _reg_file, _reg_nr);
630 /* bit4 for subreg number byte addressing. Make this same meaning as
631 in da1 case, so output looks consistent. */
632 format (file, ".%d", 16 / reg_type_size[_reg_type]);
634 err |= control (file, "vert stride", vert_stride, _vert_stride, NULL);
635 string (file, ",4,1>");
637 * Three kinds of swizzle display:
638 * identity - nothing printed
639 * 1->all - print the single channel
640 * 1->1 - print the mapping
642 if (swz_x == BRW_CHANNEL_X &&
643 swz_y == BRW_CHANNEL_Y &&
644 swz_z == BRW_CHANNEL_Z &&
645 swz_w == BRW_CHANNEL_W)
649 else if (swz_x == swz_y && swz_x == swz_z && swz_x == swz_w)
652 err |= control (file, "channel select", chan_sel, swz_x, NULL);
657 err |= control (file, "channel select", chan_sel, swz_x, NULL);
658 err |= control (file, "channel select", chan_sel, swz_y, NULL);
659 err |= control (file, "channel select", chan_sel, swz_z, NULL);
660 err |= control (file, "channel select", chan_sel, swz_w, NULL);
662 err |= control (file, "src da16 reg type", reg_encoding, _reg_type, NULL);
667 static int imm (FILE *file, GLuint type, struct brw_instruction *inst) {
669 case BRW_REGISTER_TYPE_UD:
670 format (file, "0x%08xUD", inst->bits3.ud);
672 case BRW_REGISTER_TYPE_D:
673 format (file, "%dD", inst->bits3.d);
675 case BRW_REGISTER_TYPE_UW:
676 format (file, "0x%04xUW", (uint16_t) inst->bits3.ud);
678 case BRW_REGISTER_TYPE_W:
679 format (file, "%dW", (int16_t) inst->bits3.d);
681 case BRW_REGISTER_TYPE_UB:
682 format (file, "0x%02xUB", (int8_t) inst->bits3.ud);
684 case BRW_REGISTER_TYPE_VF:
685 format (file, "Vector Float");
687 case BRW_REGISTER_TYPE_V:
688 format (file, "0x%08xV", inst->bits3.ud);
690 case BRW_REGISTER_TYPE_F:
691 format (file, "%-gF", inst->bits3.f);
696 static int src0 (FILE *file, struct brw_instruction *inst)
698 if (inst->bits1.da1.src0_reg_file == BRW_IMMEDIATE_VALUE)
699 return imm (file, inst->bits1.da1.src0_reg_type,
701 else if (inst->header.access_mode == BRW_ALIGN_1)
703 if (inst->bits2.da1.src0_address_mode == BRW_ADDRESS_DIRECT)
705 return src_da1 (file,
706 inst->bits1.da1.src0_reg_type,
707 inst->bits1.da1.src0_reg_file,
708 inst->bits2.da1.src0_vert_stride,
709 inst->bits2.da1.src0_width,
710 inst->bits2.da1.src0_horiz_stride,
711 inst->bits2.da1.src0_reg_nr,
712 inst->bits2.da1.src0_subreg_nr,
713 inst->bits2.da1.src0_abs,
714 inst->bits2.da1.src0_negate);
718 return src_ia1 (file,
719 inst->bits1.ia1.src0_reg_type,
720 inst->bits1.ia1.src0_reg_file,
721 inst->bits2.ia1.src0_indirect_offset,
722 inst->bits2.ia1.src0_subreg_nr,
723 inst->bits2.ia1.src0_negate,
724 inst->bits2.ia1.src0_abs,
725 inst->bits2.ia1.src0_address_mode,
726 inst->bits2.ia1.src0_horiz_stride,
727 inst->bits2.ia1.src0_width,
728 inst->bits2.ia1.src0_vert_stride);
733 if (inst->bits2.da16.src0_address_mode == BRW_ADDRESS_DIRECT)
735 return src_da16 (file,
736 inst->bits1.da16.src0_reg_type,
737 inst->bits1.da16.src0_reg_file,
738 inst->bits2.da16.src0_vert_stride,
739 inst->bits2.da16.src0_reg_nr,
740 inst->bits2.da16.src0_subreg_nr,
741 inst->bits2.da16.src0_abs,
742 inst->bits2.da16.src0_negate,
743 inst->bits2.da16.src0_swz_x,
744 inst->bits2.da16.src0_swz_y,
745 inst->bits2.da16.src0_swz_z,
746 inst->bits2.da16.src0_swz_w);
750 string (file, "Indirect align16 address mode not supported");
756 static int src1 (FILE *file, struct brw_instruction *inst)
758 if (inst->bits1.da1.src1_reg_file == BRW_IMMEDIATE_VALUE)
759 return imm (file, inst->bits1.da1.src1_reg_type,
761 else if (inst->header.access_mode == BRW_ALIGN_1)
763 if (inst->bits3.da1.src1_address_mode == BRW_ADDRESS_DIRECT)
765 return src_da1 (file,
766 inst->bits1.da1.src1_reg_type,
767 inst->bits1.da1.src1_reg_file,
768 inst->bits3.da1.src1_vert_stride,
769 inst->bits3.da1.src1_width,
770 inst->bits3.da1.src1_horiz_stride,
771 inst->bits3.da1.src1_reg_nr,
772 inst->bits3.da1.src1_subreg_nr,
773 inst->bits3.da1.src1_abs,
774 inst->bits3.da1.src1_negate);
778 return src_ia1 (file,
779 inst->bits1.ia1.src1_reg_type,
780 inst->bits1.ia1.src1_reg_file,
781 inst->bits3.ia1.src1_indirect_offset,
782 inst->bits3.ia1.src1_subreg_nr,
783 inst->bits3.ia1.src1_negate,
784 inst->bits3.ia1.src1_abs,
785 inst->bits3.ia1.src1_address_mode,
786 inst->bits3.ia1.src1_horiz_stride,
787 inst->bits3.ia1.src1_width,
788 inst->bits3.ia1.src1_vert_stride);
793 if (inst->bits3.da16.src1_address_mode == BRW_ADDRESS_DIRECT)
795 return src_da16 (file,
796 inst->bits1.da16.src1_reg_type,
797 inst->bits1.da16.src1_reg_file,
798 inst->bits3.da16.src1_vert_stride,
799 inst->bits3.da16.src1_reg_nr,
800 inst->bits3.da16.src1_subreg_nr,
801 inst->bits3.da16.src1_abs,
802 inst->bits3.da16.src1_negate,
803 inst->bits3.da16.src1_swz_x,
804 inst->bits3.da16.src1_swz_y,
805 inst->bits3.da16.src1_swz_z,
806 inst->bits3.da16.src1_swz_w);
810 string (file, "Indirect align16 address mode not supported");
816 int brw_disasm_insn (FILE *file, struct brw_instruction *inst, int gen)
821 if (inst->header.predicate_control) {
823 err |= control (file, "predicate inverse", pred_inv, inst->header.predicate_inverse, NULL);
825 if (inst->bits2.da1.flag_reg_nr)
826 format (file, ".%d", inst->bits2.da1.flag_reg_nr);
827 if (inst->header.access_mode == BRW_ALIGN_1)
828 err |= control (file, "predicate control align1", pred_ctrl_align1,
829 inst->header.predicate_control, NULL);
831 err |= control (file, "predicate control align16", pred_ctrl_align16,
832 inst->header.predicate_control, NULL);
836 err |= print_opcode (file, inst->header.opcode);
837 err |= control (file, "saturate", saturate, inst->header.saturate, NULL);
838 err |= control (file, "debug control", debug_ctrl, inst->header.debug_control, NULL);
840 if (inst->header.opcode != BRW_OPCODE_SEND)
841 err |= control (file, "conditional modifier", conditional_modifier,
842 inst->header.destreg__conditionalmod, NULL);
844 if (inst->header.opcode != BRW_OPCODE_NOP) {
846 err |= control (file, "execution size", exec_size, inst->header.execution_size, NULL);
850 if (inst->header.opcode == BRW_OPCODE_SEND)
851 format (file, " %d", inst->header.destreg__conditionalmod);
853 if (opcode[inst->header.opcode].ndst > 0) {
855 err |= dest (file, inst);
857 if (opcode[inst->header.opcode].nsrc > 0) {
859 err |= src0 (file, inst);
861 if (opcode[inst->header.opcode].nsrc > 1) {
863 err |= src1 (file, inst);
866 if (inst->header.opcode == BRW_OPCODE_SEND ||
867 inst->header.opcode == BRW_OPCODE_SENDC) {
871 err |= control (file, "target function", target_function,
872 inst->bits3.generic.msg_target, &space);
873 switch (inst->bits3.generic.msg_target) {
874 case BRW_MESSAGE_TARGET_MATH:
875 err |= control (file, "math function", math_function,
876 inst->bits3.math.function, &space);
877 err |= control (file, "math saturate", math_saturate,
878 inst->bits3.math.saturate, &space);
879 err |= control (file, "math signed", math_signed,
880 inst->bits3.math.int_type, &space);
881 err |= control (file, "math scalar", math_scalar,
882 inst->bits3.math.data_type, &space);
883 err |= control (file, "math precision", math_precision,
884 inst->bits3.math.precision, &space);
886 case BRW_MESSAGE_TARGET_SAMPLER:
888 format (file, " (%d, %d, %d, %d)",
889 inst->bits3.sampler_gen5.binding_table_index,
890 inst->bits3.sampler_gen5.sampler,
891 inst->bits3.sampler_gen5.msg_type,
892 inst->bits3.sampler_gen5.simd_mode);
893 } else if (0 /* FINISHME: is_g4x */) {
894 format (file, " (%d, %d)",
895 inst->bits3.sampler_g4x.binding_table_index,
896 inst->bits3.sampler_g4x.sampler);
898 format (file, " (%d, %d, ",
899 inst->bits3.sampler.binding_table_index,
900 inst->bits3.sampler.sampler);
901 err |= control (file, "sampler target format", sampler_target_format,
902 inst->bits3.sampler.return_format, NULL);
906 case BRW_MESSAGE_TARGET_DATAPORT_READ:
908 format (file, " (%d, %d, %d, %d, %d, %d)",
909 inst->bits3.dp_render_cache.binding_table_index,
910 inst->bits3.dp_render_cache.msg_control,
911 inst->bits3.dp_render_cache.msg_type,
912 inst->bits3.dp_render_cache.send_commit_msg,
913 inst->bits3.dp_render_cache.msg_length,
914 inst->bits3.dp_render_cache.response_length);
915 } else if (gen >= 5 /* FINISHME: || is_g4x */) {
916 format (file, " (%d, %d, %d)",
917 inst->bits3.dp_read_gen5.binding_table_index,
918 inst->bits3.dp_read_gen5.msg_control,
919 inst->bits3.dp_read_gen5.msg_type);
921 format (file, " (%d, %d, %d)",
922 inst->bits3.dp_read.binding_table_index,
923 inst->bits3.dp_read.msg_control,
924 inst->bits3.dp_read.msg_type);
927 case BRW_MESSAGE_TARGET_DATAPORT_WRITE:
929 format (file, " (%d, %d, %d, %d, %d, %d)",
930 inst->bits3.dp_render_cache.binding_table_index,
931 inst->bits3.dp_render_cache.msg_control,
932 inst->bits3.dp_render_cache.msg_type,
933 inst->bits3.dp_render_cache.send_commit_msg,
934 inst->bits3.dp_render_cache.msg_length,
935 inst->bits3.dp_render_cache.response_length);
937 format (file, " (%d, %d, %d, %d)",
938 inst->bits3.dp_write.binding_table_index,
939 (inst->bits3.dp_write.pixel_scoreboard_clear << 3) |
940 inst->bits3.dp_write.msg_control,
941 inst->bits3.dp_write.msg_type,
942 inst->bits3.dp_write.send_commit_msg);
945 case BRW_MESSAGE_TARGET_URB:
947 format (file, " %d", inst->bits3.urb_gen5.offset);
949 format (file, " %d", inst->bits3.urb.offset);
951 err |= control (file, "urb swizzle", urb_swizzle,
952 inst->bits3.urb.swizzle_control, &space);
953 err |= control (file, "urb allocate", urb_allocate,
954 inst->bits3.urb.allocate, &space);
955 err |= control (file, "urb used", urb_used,
956 inst->bits3.urb.used, &space);
957 err |= control (file, "urb complete", urb_complete,
958 inst->bits3.urb.complete, &space);
960 format (file, " mlen %d, rlen %d\n",
961 inst->bits3.urb_gen5.msg_length,
962 inst->bits3.urb_gen5.response_length);
965 case BRW_MESSAGE_TARGET_THREAD_SPAWNER:
968 format (file, "unsupported target %d", inst->bits3.generic.msg_target);
974 format (file, "mlen %d",
975 inst->bits3.generic_gen5.msg_length);
976 format (file, " rlen %d",
977 inst->bits3.generic_gen5.response_length);
979 format (file, "mlen %d",
980 inst->bits3.generic.msg_length);
981 format (file, " rlen %d",
982 inst->bits3.generic.response_length);
986 if (inst->header.opcode != BRW_OPCODE_NOP) {
989 err |= control(file, "access mode", access_mode, inst->header.access_mode, &space);
990 err |= control (file, "mask control", mask_ctrl, inst->header.mask_control, &space);
991 err |= control (file, "dependency control", dep_ctrl, inst->header.dependency_control, &space);
992 err |= control (file, "compression control", compr_ctrl, inst->header.compression_control, &space);
993 err |= control (file, "thread control", thread_ctrl, inst->header.thread_control, &space);
994 if (inst->header.opcode == BRW_OPCODE_SEND ||
995 inst->header.opcode == BRW_OPCODE_SENDC)
996 err |= control (file, "end of thread", end_of_thread,
997 inst->bits3.generic.end_of_thread, &space);
1008 int brw_disasm (FILE *file,
1009 struct brw_instruction *inst,
1010 unsigned count, int gen)
1014 for (i = 0; i < count; i++) {
1015 err = brw_disasm_insn(stderr, &inst[i], gen);
1020 fprintf(file, "\n");