2 * Copyright © 2008 Keith Packard
3 * Copyright © 2009-2013 Intel Corporation
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that copyright
8 * notice and this permission notice appear in supporting documentation, and
9 * that the name of the copyright holders not be used in advertising or
10 * publicity pertaining to distribution of the software without specific,
11 * written prior permission. The copyright holders make no representations
12 * about the suitability of this software for any purpose. It is provided "as
13 * is" without express or implied warranty.
15 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
31 #include "brw_context.h"
32 #include "brw_defines.h"
33 #include "gen8_instruction.h"
35 static const struct opcode_desc
*m_opcode
= opcode_descs
;
37 static const char *const m_conditional_modifier
[16] = {
38 [BRW_CONDITIONAL_NONE
] = "",
39 [BRW_CONDITIONAL_Z
] = ".e",
40 [BRW_CONDITIONAL_NZ
] = ".ne",
41 [BRW_CONDITIONAL_G
] = ".g",
42 [BRW_CONDITIONAL_GE
] = ".ge",
43 [BRW_CONDITIONAL_L
] = ".l",
44 [BRW_CONDITIONAL_LE
] = ".le",
45 [BRW_CONDITIONAL_O
] = ".o",
46 [BRW_CONDITIONAL_U
] = ".u",
49 static const char *const m_negate
[2] = { "", "-" };
51 static const char *const m_abs
[2] = { "", "(abs)" };
53 static const char *const m_vert_stride
[16] = {
63 static const char *const width
[8] = {
71 static const char *const m_horiz_stride
[4] = {
78 static const char *const m_chan_sel
[4] = { "x", "y", "z", "w" };
80 static const char *const m_debug_ctrl
[2] = { "", ".breakpoint" };
82 static const char *const m_saturate
[2] = { "", ".sat" };
84 static const char *const m_accwr
[2] = { "", "AccWrEnable" };
86 static const char *const m_maskctrl
[2] = { "WE_normal", "WE_all" };
88 static const char *const m_exec_size
[8] = {
97 static const char *const m_pred_inv
[2] = { "+", "-" };
99 static const char *const m_pred_ctrl_align16
[16] = {
110 static const char *const m_pred_ctrl_align1
[16] = {
127 static const char *const m_thread_ctrl
[4] = {
133 static const char *const m_dep_clear
[4] = {
138 static const char *const m_dep_check
[4] = {
143 static const char *const m_mask_ctrl
[4] = {
148 static const char *const m_access_mode
[2] = { "align1", "align16" };
150 static const char *const m_reg_encoding
[] = {
151 [BRW_HW_REG_TYPE_UD
] = "UD",
152 [BRW_HW_REG_TYPE_D
] = "D",
153 [BRW_HW_REG_TYPE_UW
] = "UW",
154 [BRW_HW_REG_TYPE_W
] = "W",
155 [BRW_HW_REG_NON_IMM_TYPE_UB
] = "UB",
156 [BRW_HW_REG_NON_IMM_TYPE_B
] = "B",
157 [GEN7_HW_REG_NON_IMM_TYPE_DF
] = "DF",
158 [BRW_HW_REG_TYPE_F
] = "F",
159 [GEN8_HW_REG_TYPE_UQ
] = "UQ",
160 [GEN8_HW_REG_TYPE_Q
] = "Q",
161 [GEN8_HW_REG_NON_IMM_TYPE_HF
] = "HF",
164 static const char *const m_three_source_reg_encoding
[] = {
165 [BRW_3SRC_TYPE_F
] = "F",
166 [BRW_3SRC_TYPE_D
] = "D",
167 [BRW_3SRC_TYPE_UD
] = "UD",
170 static const int reg_type_size
[] = {
171 [BRW_HW_REG_TYPE_UD
] = 4,
172 [BRW_HW_REG_TYPE_D
] = 4,
173 [BRW_HW_REG_TYPE_UW
] = 2,
174 [BRW_HW_REG_TYPE_W
] = 2,
175 [BRW_HW_REG_NON_IMM_TYPE_UB
] = 1,
176 [BRW_HW_REG_NON_IMM_TYPE_B
] = 1,
177 [GEN7_HW_REG_NON_IMM_TYPE_DF
] = 8,
178 [BRW_HW_REG_TYPE_F
] = 4,
179 [GEN8_HW_REG_NON_IMM_TYPE_HF
] = 2,
182 static const char *const m_reg_file
[4] = {
183 [BRW_ARCHITECTURE_REGISTER_FILE
] = "A",
184 [BRW_GENERAL_REGISTER_FILE
] = "g",
185 [BRW_IMMEDIATE_VALUE
] = "imm",
188 static const char *const m_writemask
[16] = {
207 static const char *const m_eot
[2] = { "", "EOT" };
209 static const char *const m_sfid
[16] = {
210 [BRW_SFID_NULL
] = "null",
211 [BRW_SFID_SAMPLER
] = "sampler",
212 [BRW_SFID_MESSAGE_GATEWAY
] = "gateway",
213 [GEN6_SFID_DATAPORT_SAMPLER_CACHE
] = "dp/sampler_cache",
214 [GEN6_SFID_DATAPORT_RENDER_CACHE
] = "dp/render_cache",
215 [BRW_SFID_URB
] = "URB",
216 [BRW_SFID_THREAD_SPAWNER
] = "thread_spawner",
217 [BRW_SFID_VME
] = "vme",
218 [GEN6_SFID_DATAPORT_CONSTANT_CACHE
] = "dp/constant_cache",
219 [GEN7_SFID_DATAPORT_DATA_CACHE
] = "dp/data_cache",
220 [GEN7_SFID_PIXEL_INTERPOLATOR
] = "pi",
221 [HSW_SFID_DATAPORT_DATA_CACHE_1
] = "dp/data_cache:1",
222 [HSW_SFID_CRE
] = "cre",
225 static const char *const m_math_function
[16] = {
226 [BRW_MATH_FUNCTION_INV
] = "inv",
227 [BRW_MATH_FUNCTION_LOG
] = "log",
228 [BRW_MATH_FUNCTION_EXP
] = "exp",
229 [BRW_MATH_FUNCTION_SQRT
] = "sqrt",
230 [BRW_MATH_FUNCTION_RSQ
] = "rsq",
231 [BRW_MATH_FUNCTION_SIN
] = "sin",
232 [BRW_MATH_FUNCTION_COS
] = "cos",
233 [BRW_MATH_FUNCTION_FDIV
] = "fdiv",
234 [BRW_MATH_FUNCTION_POW
] = "pow",
235 [BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER
] = "intdivmod",
236 [BRW_MATH_FUNCTION_INT_DIV_QUOTIENT
] = "intdiv",
237 [BRW_MATH_FUNCTION_INT_DIV_REMAINDER
] = "intmod",
238 [GEN8_MATH_FUNCTION_INVM
] = "invm",
239 [GEN8_MATH_FUNCTION_RSQRTM
] = "rsqrtm",
242 static const char *const m_urb_opcode
[16] = {
252 /* [9-15] - reserved */
255 static const char *const m_urb_interleave
[2] = { "", "interleaved" };
257 static const char *const m_rt_opcode
[] = {
271 string(FILE *file
, const char *string
)
274 column
+= strlen(string
);
279 format(FILE *f
, const char *format
, ...)
283 va_start(args
, format
);
285 vsnprintf(buf
, sizeof(buf
) - 1, format
, args
);
309 control(FILE *file
, const char *name
, const char *const ctrl
[],
310 unsigned id
, int *space
)
313 fprintf(file
, "*** invalid %s value %d ", name
, id
);
319 string(file
, ctrl
[id
]);
327 print_opcode(FILE *file
, int id
)
329 if (!m_opcode
[id
].name
) {
330 format(file
, "*** invalid opcode value %d ", id
);
333 string(file
, m_opcode
[id
].name
);
338 reg(FILE *file
, unsigned reg_file
, unsigned _reg_nr
)
342 if (reg_file
== BRW_ARCHITECTURE_REGISTER_FILE
) {
343 switch (_reg_nr
& 0xf0) {
345 string(file
, "null");
347 case BRW_ARF_ADDRESS
:
348 format(file
, "a%d", _reg_nr
& 0x0f);
350 case BRW_ARF_ACCUMULATOR
:
351 format(file
, "acc%d", _reg_nr
& 0x0f);
354 format(file
, "f%d", _reg_nr
& 0x0f);
357 format(file
, "mask%d", _reg_nr
& 0x0f);
359 case BRW_ARF_MASK_STACK
:
360 format(file
, "msd%d", _reg_nr
& 0x0f);
363 format(file
, "sr%d", _reg_nr
& 0x0f);
365 case BRW_ARF_CONTROL
:
366 format(file
, "cr%d", _reg_nr
& 0x0f);
368 case BRW_ARF_NOTIFICATION_COUNT
:
369 format(file
, "n%d", _reg_nr
& 0x0f);
376 format(file
, "ARF%d", _reg_nr
);
380 err
|= control(file
, "src reg file", m_reg_file
, reg_file
, NULL
);
381 format(file
, "%d", _reg_nr
);
387 dest(FILE *file
, struct gen8_instruction
*inst
)
391 if (gen8_access_mode(inst
) == BRW_ALIGN_1
) {
392 assert(gen8_dst_address_mode(inst
) == BRW_ADDRESS_DIRECT
);
393 err
|= reg(file
, gen8_dst_reg_file(inst
), gen8_dst_da_reg_nr(inst
));
396 if (gen8_dst_da1_subreg_nr(inst
))
397 format(file
, ".%d", gen8_dst_da1_subreg_nr(inst
) /
398 reg_type_size
[gen8_dst_reg_type(inst
)]);
400 err
|= control(file
, "horiz stride", m_horiz_stride
, gen8_dst_da1_hstride(inst
), NULL
);
402 err
|= control(file
, "dest reg encoding", m_reg_encoding
, gen8_dst_reg_type(inst
), NULL
);
404 assert(gen8_dst_address_mode(inst
) == BRW_ADDRESS_DIRECT
);
405 err
|= reg(file
, gen8_dst_reg_file(inst
), gen8_dst_da_reg_nr(inst
));
408 if (gen8_dst_da16_subreg_nr(inst
))
409 format(file
, ".%d", gen8_dst_da16_subreg_nr(inst
) /
410 reg_type_size
[gen8_dst_reg_type(inst
)]);
412 err
|= control(file
, "writemask", m_writemask
, gen8_da16_writemask(inst
), NULL
);
413 err
|= control(file
, "dest reg encoding", m_reg_encoding
, gen8_dst_reg_type(inst
), NULL
);
420 dest_3src(FILE *file
, struct gen8_instruction
*inst
)
424 err
|= reg(file
, BRW_GENERAL_REGISTER_FILE
, gen8_dst_3src_reg_nr(inst
));
427 if (gen8_dst_3src_subreg_nr(inst
))
428 format(file
, ".%d", gen8_dst_3src_subreg_nr(inst
));
430 err
|= control(file
, "writemask", m_writemask
, gen8_dst_3src_writemask(inst
),
432 err
|= control(file
, "dest reg encoding", m_three_source_reg_encoding
,
433 gen8_dst_3src_type(inst
), NULL
);
439 src_align1_region(FILE *file
, unsigned vert_stride
, unsigned _width
,
440 unsigned horiz_stride
)
444 err
|= control(file
, "vert stride", m_vert_stride
, vert_stride
, NULL
);
446 err
|= control(file
, "width", width
, _width
, NULL
);
448 err
|= control(file
, "horiz_stride", m_horiz_stride
, horiz_stride
, NULL
);
454 src_swizzle(FILE *file
, unsigned x
, unsigned y
, unsigned z
, unsigned w
)
458 /* Three kinds of swizzle display:
459 * - identity - nothing printed
460 * - 1->all - print the single channel
461 * - 1->1 - print the mapping
463 if (x
== BRW_CHANNEL_X
&&
464 y
== BRW_CHANNEL_Y
&&
465 z
== BRW_CHANNEL_Z
&&
466 w
== BRW_CHANNEL_W
) {
467 ; /* Print nothing */
468 } else if (x
== y
&& x
== z
&& x
== w
) {
470 err
|= control(file
, "channel select", m_chan_sel
, x
, NULL
);
473 err
|= control(file
, "channel select", m_chan_sel
, x
, NULL
);
474 err
|= control(file
, "channel select", m_chan_sel
, y
, NULL
);
475 err
|= control(file
, "channel select", m_chan_sel
, z
, NULL
);
476 err
|= control(file
, "channel select", m_chan_sel
, w
, NULL
);
482 src_da1(FILE *file
, unsigned type
, unsigned reg_file
,
483 unsigned vert_stride
, unsigned _width
, unsigned horiz_stride
,
484 unsigned reg_num
, unsigned sub_reg_num
, unsigned _abs
, unsigned negate
)
487 err
|= control(file
, "negate", m_negate
, negate
, NULL
);
488 err
|= control(file
, "abs", m_abs
, _abs
, NULL
);
490 err
|= reg(file
, reg_file
, reg_num
);
494 format(file
, ".%d", sub_reg_num
/ reg_type_size
[type
]); /* use formal style like spec */
495 src_align1_region(file
, vert_stride
, _width
, horiz_stride
);
496 err
|= control(file
, "src reg encoding", m_reg_encoding
, type
, NULL
);
504 unsigned vert_stride
,
515 err
|= control(file
, "negate", m_negate
, negate
, NULL
);
516 err
|= control(file
, "abs", m_abs
, _abs
, NULL
);
518 err
|= reg(file
, reg_file
, _reg_nr
);
522 /* bit4 for subreg number byte addressing. Make this same meaning as
523 * in da1 case, so output looks consistent.
525 format(file
, ".%d", 16 / reg_type_size
[_reg_type
]);
527 err
|= control(file
, "vert stride", m_vert_stride
, vert_stride
, NULL
);
528 string(file
, ",4,1>");
530 * Three kinds of swizzle display:
531 * identity - nothing printed
532 * 1->all - print the single channel
533 * 1->1 - print the mapping
535 if (swz_x
== BRW_CHANNEL_X
&&
536 swz_y
== BRW_CHANNEL_Y
&&
537 swz_z
== BRW_CHANNEL_Z
&&
538 swz_w
== BRW_CHANNEL_W
) {
539 ; /* Print nothing */
540 } else if (swz_x
== swz_y
&& swz_x
== swz_z
&& swz_x
== swz_w
) {
542 err
|= control(file
, "channel select", m_chan_sel
, swz_x
, NULL
);
545 err
|= control(file
, "channel select", m_chan_sel
, swz_x
, NULL
);
546 err
|= control(file
, "channel select", m_chan_sel
, swz_y
, NULL
);
547 err
|= control(file
, "channel select", m_chan_sel
, swz_z
, NULL
);
548 err
|= control(file
, "channel select", m_chan_sel
, swz_w
, NULL
);
550 err
|= control(file
, "src da16 reg type", m_reg_encoding
, _reg_type
, NULL
);
555 src0_3src(FILE *file
, struct gen8_instruction
*inst
)
558 unsigned swiz
= gen8_src0_3src_swizzle(inst
);
559 unsigned swz_x
= (swiz
>> 0) & 0x3;
560 unsigned swz_y
= (swiz
>> 2) & 0x3;
561 unsigned swz_z
= (swiz
>> 4) & 0x3;
562 unsigned swz_w
= (swiz
>> 6) & 0x3;
564 err
|= control(file
, "negate", m_negate
, gen8_src0_3src_negate(inst
), NULL
);
565 err
|= control(file
, "abs", m_abs
, gen8_src0_3src_abs(inst
), NULL
);
567 err
|= reg(file
, BRW_GENERAL_REGISTER_FILE
, gen8_src0_3src_reg_nr(inst
));
570 if (gen8_src0_3src_subreg_nr(inst
))
571 format(file
, ".%d", gen8_src0_3src_subreg_nr(inst
));
572 string(file
, "<4,1,1>");
573 err
|= control(file
, "src da16 reg type", m_three_source_reg_encoding
,
574 gen8_src_3src_type(inst
), NULL
);
575 err
|= src_swizzle(file
, swz_x
, swz_y
, swz_z
, swz_w
);
580 src1_3src(FILE *file
, struct gen8_instruction
*inst
)
583 unsigned swiz
= gen8_src1_3src_swizzle(inst
);
584 unsigned swz_x
= (swiz
>> 0) & 0x3;
585 unsigned swz_y
= (swiz
>> 2) & 0x3;
586 unsigned swz_z
= (swiz
>> 4) & 0x3;
587 unsigned swz_w
= (swiz
>> 6) & 0x3;
588 unsigned src1_subreg_nr
= gen8_src1_3src_subreg_nr(inst
);
590 err
|= control(file
, "negate", m_negate
, gen8_src1_3src_negate(inst
), NULL
);
591 err
|= control(file
, "abs", m_abs
, gen8_src1_3src_abs(inst
), NULL
);
593 err
|= reg(file
, BRW_GENERAL_REGISTER_FILE
, gen8_src1_3src_reg_nr(inst
));
597 format(file
, ".%d", src1_subreg_nr
);
598 string(file
, "<4,1,1>");
599 err
|= control(file
, "src da16 reg type", m_three_source_reg_encoding
,
600 gen8_src_3src_type(inst
), NULL
);
601 err
|= src_swizzle(file
, swz_x
, swz_y
, swz_z
, swz_w
);
606 src2_3src(FILE *file
, struct gen8_instruction
*inst
)
609 unsigned swiz
= gen8_src2_3src_swizzle(inst
);
610 unsigned swz_x
= (swiz
>> 0) & 0x3;
611 unsigned swz_y
= (swiz
>> 2) & 0x3;
612 unsigned swz_z
= (swiz
>> 4) & 0x3;
613 unsigned swz_w
= (swiz
>> 6) & 0x3;
615 err
|= control(file
, "negate", m_negate
, gen8_src2_3src_negate(inst
), NULL
);
616 err
|= control(file
, "abs", m_abs
, gen8_src2_3src_abs(inst
), NULL
);
618 err
|= reg(file
, BRW_GENERAL_REGISTER_FILE
, gen8_src2_3src_reg_nr(inst
));
621 if (gen8_src2_3src_subreg_nr(inst
))
622 format(file
, ".%d", gen8_src2_3src_subreg_nr(inst
));
623 string(file
, "<4,1,1>");
624 err
|= control(file
, "src da16 reg type", m_three_source_reg_encoding
,
625 gen8_src_3src_type(inst
), NULL
);
626 err
|= src_swizzle(file
, swz_x
, swz_y
, swz_z
, swz_w
);
631 imm(FILE *file
, unsigned type
, struct gen8_instruction
*inst
)
634 case BRW_HW_REG_TYPE_UD
:
635 format(file
, "0x%08xUD", gen8_src1_imm_ud(inst
));
637 case BRW_HW_REG_TYPE_D
:
638 format(file
, "%dD", gen8_src1_imm_d(inst
));
640 case BRW_HW_REG_TYPE_UW
:
641 format(file
, "0x%04xUW", (uint16_t) gen8_src1_imm_ud(inst
));
643 case BRW_HW_REG_TYPE_W
:
644 format(file
, "%dW", (int16_t) gen8_src1_imm_d(inst
));
646 case BRW_HW_REG_IMM_TYPE_UV
:
647 format(file
, "0x%08xUV", gen8_src1_imm_ud(inst
));
649 case BRW_HW_REG_IMM_TYPE_VF
:
650 format(file
, "Vector Float");
652 case BRW_HW_REG_IMM_TYPE_V
:
653 format(file
, "0x%08xV", gen8_src1_imm_ud(inst
));
655 case BRW_HW_REG_TYPE_F
:
656 format(file
, "%-gF", gen8_src1_imm_f(inst
));
658 case GEN8_HW_REG_IMM_TYPE_DF
:
659 case GEN8_HW_REG_IMM_TYPE_HF
:
660 assert(!"Not implemented yet");
667 src0(FILE *file
, struct gen8_instruction
*inst
)
669 if (gen8_src0_reg_file(inst
) == BRW_IMMEDIATE_VALUE
)
670 return imm(file
, gen8_src0_reg_type(inst
), inst
);
672 if (gen8_access_mode(inst
) == BRW_ALIGN_1
) {
673 assert(gen8_src0_address_mode(inst
) == BRW_ADDRESS_DIRECT
);
675 gen8_src0_reg_type(inst
),
676 gen8_src0_reg_file(inst
),
677 gen8_src0_vert_stride(inst
),
678 gen8_src0_da1_width(inst
),
679 gen8_src0_da1_hstride(inst
),
680 gen8_src0_da_reg_nr(inst
),
681 gen8_src0_da1_subreg_nr(inst
),
683 gen8_src0_negate(inst
));
685 assert(gen8_src0_address_mode(inst
) == BRW_ADDRESS_DIRECT
);
686 return src_da16(file
,
687 gen8_src0_reg_type(inst
),
688 gen8_src0_reg_file(inst
),
689 gen8_src0_vert_stride(inst
),
690 gen8_src0_da_reg_nr(inst
),
691 gen8_src0_da16_subreg_nr(inst
),
693 gen8_src0_negate(inst
),
694 gen8_src0_da16_swiz_x(inst
),
695 gen8_src0_da16_swiz_y(inst
),
696 gen8_src0_da16_swiz_z(inst
),
697 gen8_src0_da16_swiz_w(inst
));
702 src1(FILE *file
, struct gen8_instruction
*inst
)
704 if (gen8_src1_reg_file(inst
) == BRW_IMMEDIATE_VALUE
)
705 return imm(file
, gen8_src1_reg_type(inst
), inst
);
707 if (gen8_access_mode(inst
) == BRW_ALIGN_1
) {
708 assert(gen8_src1_address_mode(inst
) == BRW_ADDRESS_DIRECT
);
710 gen8_src1_reg_type(inst
),
711 gen8_src1_reg_file(inst
),
712 gen8_src1_vert_stride(inst
),
713 gen8_src1_da1_width(inst
),
714 gen8_src1_da1_hstride(inst
),
715 gen8_src1_da_reg_nr(inst
),
716 gen8_src1_da1_subreg_nr(inst
),
718 gen8_src1_negate(inst
));
720 assert(gen8_src1_address_mode(inst
) == BRW_ADDRESS_DIRECT
);
721 return src_da16(file
,
722 gen8_src1_reg_type(inst
),
723 gen8_src1_reg_file(inst
),
724 gen8_src1_vert_stride(inst
),
725 gen8_src1_da_reg_nr(inst
),
726 gen8_src1_da16_subreg_nr(inst
),
728 gen8_src1_negate(inst
),
729 gen8_src1_da16_swiz_x(inst
),
730 gen8_src1_da16_swiz_y(inst
),
731 gen8_src1_da16_swiz_z(inst
),
732 gen8_src1_da16_swiz_w(inst
));
736 static int esize
[6] = { 1, 2, 4, 8, 16, 32 };
739 qtr_ctrl(FILE *file
, struct gen8_instruction
*inst
)
741 int qtr_ctl
= gen8_qtr_control(inst
);
742 int exec_size
= esize
[gen8_exec_size(inst
)];
744 if (exec_size
== 8) {
759 } else if (exec_size
== 16) {
769 gen8_disassemble(FILE *file
, struct gen8_instruction
*inst
, int gen
)
774 const int opcode
= gen8_opcode(inst
);
776 if (gen8_pred_control(inst
)) {
778 err
|= control(file
, "predicate inverse", m_pred_inv
, gen8_pred_inv(inst
), NULL
);
779 format(file
, "f%d", gen8_flag_reg_nr(inst
));
780 if (gen8_flag_subreg_nr(inst
))
781 format(file
, ".%d", gen8_flag_subreg_nr(inst
));
782 if (gen8_access_mode(inst
) == BRW_ALIGN_1
) {
783 err
|= control(file
, "predicate control align1", m_pred_ctrl_align1
,
784 gen8_pred_control(inst
), NULL
);
786 err
|= control(file
, "predicate control align16", m_pred_ctrl_align16
,
787 gen8_pred_control(inst
), NULL
);
792 err
|= print_opcode(file
, opcode
);
793 err
|= control(file
, "saturate", m_saturate
, gen8_saturate(inst
), NULL
);
794 err
|= control(file
, "debug control", m_debug_ctrl
, gen8_debug_control(inst
), NULL
);
796 if (opcode
== BRW_OPCODE_MATH
) {
798 err
|= control(file
, "function", m_math_function
, gen8_math_function(inst
),
800 } else if (opcode
!= BRW_OPCODE_SEND
&& opcode
!= BRW_OPCODE_SENDC
) {
801 err
|= control(file
, "conditional modifier", m_conditional_modifier
,
802 gen8_cond_modifier(inst
), NULL
);
804 /* If we're using the conditional modifier, print the flag reg used. */
805 if (gen8_cond_modifier(inst
) && opcode
!= BRW_OPCODE_SEL
) {
806 format(file
, ".f%d", gen8_flag_reg_nr(inst
));
807 if (gen8_flag_subreg_nr(inst
))
808 format(file
, ".%d", gen8_flag_subreg_nr(inst
));
812 if (opcode
!= BRW_OPCODE_NOP
) {
814 err
|= control(file
, "execution size", m_exec_size
, gen8_exec_size(inst
), NULL
);
818 if (m_opcode
[opcode
].nsrc
== 3) {
820 err
|= dest_3src(file
, inst
);
823 err
|= src0_3src(file
, inst
);
826 err
|= src1_3src(file
, inst
);
829 err
|= src2_3src(file
, inst
);
831 if (opcode
== BRW_OPCODE_ENDIF
|| opcode
== BRW_OPCODE_WHILE
) {
833 format(file
, "JIP: %d", gen8_jip(inst
));
834 } else if (opcode
== BRW_OPCODE_IF
||
835 opcode
== BRW_OPCODE_ELSE
||
836 opcode
== BRW_OPCODE_BREAK
||
837 opcode
== BRW_OPCODE_CONTINUE
||
838 opcode
== BRW_OPCODE_HALT
) {
840 format(file
, "JIP: %d", gen8_jip(inst
));
842 format(file
, "UIP: %d", gen8_uip(inst
));
844 if (m_opcode
[opcode
].ndst
> 0) {
846 err
|= dest(file
, inst
);
848 if (m_opcode
[opcode
].nsrc
> 0) {
850 err
|= src0(file
, inst
);
852 if (m_opcode
[opcode
].nsrc
> 1) {
854 err
|= src1(file
, inst
);
859 if (opcode
== BRW_OPCODE_SEND
|| opcode
== BRW_OPCODE_SENDC
) {
860 const int sfid
= gen8_sfid(inst
);
866 err
|= control(file
, "SFID", m_sfid
, sfid
, &space
);
869 case BRW_SFID_SAMPLER
:
870 format(file
, " (%d, %d, %d, %d)",
871 gen8_binding_table_index(inst
),
873 gen8_sampler_msg_type(inst
),
874 gen8_sampler_simd_mode(inst
));
879 err
|= control(file
, "urb opcode", m_urb_opcode
,
880 gen8_urb_opcode(inst
), &space
);
881 err
|= control(file
, "urb interleave", m_urb_interleave
,
882 gen8_urb_interleave(inst
), &space
);
883 format(file
, " %d %d",
884 gen8_urb_global_offset(inst
), gen8_urb_per_slot_offset(inst
));
887 case GEN6_SFID_DATAPORT_RENDER_CACHE
: {
888 err
|= control(file
, "rt message", m_rt_opcode
,
889 gen8_rt_message_type(inst
), &space
);
890 format(file
, " %s%sSurface = %d",
891 gen8_rt_slot_group(inst
) ? "Hi " : "",
892 gen8_rt_last(inst
) ? "LastRT " : "",
893 gen8_binding_table_index(inst
));
897 case GEN6_SFID_DATAPORT_SAMPLER_CACHE
:
898 case GEN6_SFID_DATAPORT_CONSTANT_CACHE
:
899 case GEN7_SFID_DATAPORT_DATA_CACHE
:
900 format(file
, " (%d, 0x%x)",
901 gen8_binding_table_index(inst
),
902 gen8_function_control(inst
));
906 format(file
, "unsupported shared function ID (%d)", sfid
);
911 format(file
, "mlen %d", gen8_mlen(inst
));
912 format(file
, " rlen %d", gen8_rlen(inst
));
915 if (opcode
!= BRW_OPCODE_NOP
) {
918 err
|= control(file
, "access mode", m_access_mode
, gen8_access_mode(inst
), &space
);
919 err
|= control(file
, "mask control", m_maskctrl
, gen8_mask_control(inst
), &space
);
920 err
|= control(file
, "DDClr", m_dep_clear
, gen8_no_dd_clear(inst
), &space
);
921 err
|= control(file
, "DDChk", m_dep_check
, gen8_no_dd_check(inst
), &space
);
923 err
|= qtr_ctrl(file
, inst
);
925 err
|= control(file
, "thread control", m_thread_ctrl
, gen8_thread_control(inst
), &space
);
926 err
|= control(file
, "acc write control", m_accwr
, gen8_acc_wr_control(inst
), &space
);
927 if (opcode
== BRW_OPCODE_SEND
|| opcode
== BRW_OPCODE_SENDC
)
928 err
|= control(file
, "end of thread", m_eot
, gen8_eot(inst
), &space
);