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
30 #include "brw_context.h"
31 #include "brw_defines.h"
35 const struct opcode_desc opcode_descs
[128] = {
36 [BRW_OPCODE_MOV
] = { .name
= "mov", .nsrc
= 1, .ndst
= 1 },
37 [BRW_OPCODE_FRC
] = { .name
= "frc", .nsrc
= 1, .ndst
= 1 },
38 [BRW_OPCODE_RNDU
] = { .name
= "rndu", .nsrc
= 1, .ndst
= 1 },
39 [BRW_OPCODE_RNDD
] = { .name
= "rndd", .nsrc
= 1, .ndst
= 1 },
40 [BRW_OPCODE_RNDE
] = { .name
= "rnde", .nsrc
= 1, .ndst
= 1 },
41 [BRW_OPCODE_RNDZ
] = { .name
= "rndz", .nsrc
= 1, .ndst
= 1 },
42 [BRW_OPCODE_NOT
] = { .name
= "not", .nsrc
= 1, .ndst
= 1 },
43 [BRW_OPCODE_LZD
] = { .name
= "lzd", .nsrc
= 1, .ndst
= 1 },
44 [BRW_OPCODE_F32TO16
] = { .name
= "f32to16", .nsrc
= 1, .ndst
= 1 },
45 [BRW_OPCODE_F16TO32
] = { .name
= "f16to32", .nsrc
= 1, .ndst
= 1 },
46 [BRW_OPCODE_BFREV
] = { .name
= "bfrev", .nsrc
= 1, .ndst
= 1},
47 [BRW_OPCODE_FBH
] = { .name
= "fbh", .nsrc
= 1, .ndst
= 1},
48 [BRW_OPCODE_FBL
] = { .name
= "fbl", .nsrc
= 1, .ndst
= 1},
49 [BRW_OPCODE_CBIT
] = { .name
= "cbit", .nsrc
= 1, .ndst
= 1},
51 [BRW_OPCODE_MUL
] = { .name
= "mul", .nsrc
= 2, .ndst
= 1 },
52 [BRW_OPCODE_MAC
] = { .name
= "mac", .nsrc
= 2, .ndst
= 1 },
53 [BRW_OPCODE_MACH
] = { .name
= "mach", .nsrc
= 2, .ndst
= 1 },
54 [BRW_OPCODE_LINE
] = { .name
= "line", .nsrc
= 2, .ndst
= 1 },
55 [BRW_OPCODE_PLN
] = { .name
= "pln", .nsrc
= 2, .ndst
= 1 },
56 [BRW_OPCODE_MAD
] = { .name
= "mad", .nsrc
= 3, .ndst
= 1 },
57 [BRW_OPCODE_LRP
] = { .name
= "lrp", .nsrc
= 3, .ndst
= 1 },
58 [BRW_OPCODE_SAD2
] = { .name
= "sad2", .nsrc
= 2, .ndst
= 1 },
59 [BRW_OPCODE_SADA2
] = { .name
= "sada2", .nsrc
= 2, .ndst
= 1 },
60 [BRW_OPCODE_DP4
] = { .name
= "dp4", .nsrc
= 2, .ndst
= 1 },
61 [BRW_OPCODE_DPH
] = { .name
= "dph", .nsrc
= 2, .ndst
= 1 },
62 [BRW_OPCODE_DP3
] = { .name
= "dp3", .nsrc
= 2, .ndst
= 1 },
63 [BRW_OPCODE_DP2
] = { .name
= "dp2", .nsrc
= 2, .ndst
= 1 },
64 [BRW_OPCODE_MATH
] = { .name
= "math", .nsrc
= 2, .ndst
= 1 },
66 [BRW_OPCODE_AVG
] = { .name
= "avg", .nsrc
= 2, .ndst
= 1 },
67 [BRW_OPCODE_ADD
] = { .name
= "add", .nsrc
= 2, .ndst
= 1 },
68 [BRW_OPCODE_SEL
] = { .name
= "sel", .nsrc
= 2, .ndst
= 1 },
69 [BRW_OPCODE_AND
] = { .name
= "and", .nsrc
= 2, .ndst
= 1 },
70 [BRW_OPCODE_OR
] = { .name
= "or", .nsrc
= 2, .ndst
= 1 },
71 [BRW_OPCODE_XOR
] = { .name
= "xor", .nsrc
= 2, .ndst
= 1 },
72 [BRW_OPCODE_SHR
] = { .name
= "shr", .nsrc
= 2, .ndst
= 1 },
73 [BRW_OPCODE_SHL
] = { .name
= "shl", .nsrc
= 2, .ndst
= 1 },
74 [BRW_OPCODE_ASR
] = { .name
= "asr", .nsrc
= 2, .ndst
= 1 },
75 [BRW_OPCODE_CMP
] = { .name
= "cmp", .nsrc
= 2, .ndst
= 1 },
76 [BRW_OPCODE_CMPN
] = { .name
= "cmpn", .nsrc
= 2, .ndst
= 1 },
77 [BRW_OPCODE_BFE
] = { .name
= "bfe", .nsrc
= 3, .ndst
= 1},
78 [BRW_OPCODE_BFI1
] = { .name
= "bfi1", .nsrc
= 2, .ndst
= 1},
79 [BRW_OPCODE_BFI2
] = { .name
= "bfi2", .nsrc
= 3, .ndst
= 1},
80 [BRW_OPCODE_ADDC
] = { .name
= "addc", .nsrc
= 2, .ndst
= 1},
81 [BRW_OPCODE_SUBB
] = { .name
= "subb", .nsrc
= 2, .ndst
= 1},
83 [BRW_OPCODE_SEND
] = { .name
= "send", .nsrc
= 1, .ndst
= 1 },
84 [BRW_OPCODE_SENDC
] = { .name
= "sendc", .nsrc
= 1, .ndst
= 1 },
85 [BRW_OPCODE_NOP
] = { .name
= "nop", .nsrc
= 0, .ndst
= 0 },
86 [BRW_OPCODE_JMPI
] = { .name
= "jmpi", .nsrc
= 0, .ndst
= 0 },
87 [BRW_OPCODE_IF
] = { .name
= "if", .nsrc
= 2, .ndst
= 0 },
88 [BRW_OPCODE_IFF
] = { .name
= "iff", .nsrc
= 2, .ndst
= 1 },
89 [BRW_OPCODE_WHILE
] = { .name
= "while", .nsrc
= 2, .ndst
= 0 },
90 [BRW_OPCODE_ELSE
] = { .name
= "else", .nsrc
= 2, .ndst
= 0 },
91 [BRW_OPCODE_BREAK
] = { .name
= "break", .nsrc
= 2, .ndst
= 0 },
92 [BRW_OPCODE_CONTINUE
] = { .name
= "cont", .nsrc
= 1, .ndst
= 0 },
93 [BRW_OPCODE_HALT
] = { .name
= "halt", .nsrc
= 1, .ndst
= 0 },
94 [BRW_OPCODE_MSAVE
] = { .name
= "msave", .nsrc
= 1, .ndst
= 1 },
95 [BRW_OPCODE_PUSH
] = { .name
= "push", .nsrc
= 1, .ndst
= 1 },
96 [BRW_OPCODE_MRESTORE
] = { .name
= "mrest", .nsrc
= 1, .ndst
= 1 },
97 [BRW_OPCODE_POP
] = { .name
= "pop", .nsrc
= 2, .ndst
= 0 },
98 [BRW_OPCODE_WAIT
] = { .name
= "wait", .nsrc
= 1, .ndst
= 0 },
99 [BRW_OPCODE_DO
] = { .name
= "do", .nsrc
= 0, .ndst
= 0 },
100 [BRW_OPCODE_ENDIF
] = { .name
= "endif", .nsrc
= 2, .ndst
= 0 },
102 static const struct opcode_desc
*opcode
= opcode_descs
;
104 const char * const conditional_modifier
[16] = {
105 [BRW_CONDITIONAL_NONE
] = "",
106 [BRW_CONDITIONAL_Z
] = ".e",
107 [BRW_CONDITIONAL_NZ
] = ".ne",
108 [BRW_CONDITIONAL_G
] = ".g",
109 [BRW_CONDITIONAL_GE
] = ".ge",
110 [BRW_CONDITIONAL_L
] = ".l",
111 [BRW_CONDITIONAL_LE
] = ".le",
112 [BRW_CONDITIONAL_R
] = ".r",
113 [BRW_CONDITIONAL_O
] = ".o",
114 [BRW_CONDITIONAL_U
] = ".u",
117 static const char * const m_negate
[2] = {
122 static const char * const _abs
[2] = {
127 static const char * const vert_stride
[16] = {
138 static const char * const width
[8] = {
146 static const char * const horiz_stride
[4] = {
153 static const char * const chan_sel
[4] = {
160 static const char * const debug_ctrl
[2] = {
165 static const char * const saturate
[2] = {
170 static const char * const cmpt_ctrl
[2] = {
175 static const char * const accwr
[2] = {
180 static const char * const wectrl
[2] = {
185 static const char * const exec_size
[8] = {
194 static const char * const pred_inv
[2] = {
199 static const char * const pred_ctrl_align16
[16] = {
209 static const char * const pred_ctrl_align1
[16] = {
223 static const char * const thread_ctrl
[4] = {
228 static const char * const compr_ctrl
[4] = {
235 static const char * const dep_ctrl
[4] = {
239 [3] = "NoDDClr,NoDDChk",
242 static const char * const mask_ctrl
[4] = {
247 static const char * const access_mode
[2] = {
252 static const char * const reg_encoding
[8] = {
262 static const char * const three_source_reg_encoding
[] = {
263 [BRW_3SRC_TYPE_F
] = "F",
264 [BRW_3SRC_TYPE_D
] = "D",
265 [BRW_3SRC_TYPE_UD
] = "UD",
268 const int reg_type_size
[8] = {
278 static const char * const reg_file
[4] = {
285 static const char * const writemask
[16] = {
304 static const char * const end_of_thread
[2] = {
309 static const char * const target_function
[16] = {
310 [BRW_SFID_NULL
] = "null",
311 [BRW_SFID_MATH
] = "math",
312 [BRW_SFID_SAMPLER
] = "sampler",
313 [BRW_SFID_MESSAGE_GATEWAY
] = "gateway",
314 [BRW_SFID_DATAPORT_READ
] = "read",
315 [BRW_SFID_DATAPORT_WRITE
] = "write",
316 [BRW_SFID_URB
] = "urb",
317 [BRW_SFID_THREAD_SPAWNER
] = "thread_spawner",
318 [BRW_SFID_VME
] = "vme",
321 static const char * const target_function_gen6
[16] = {
322 [BRW_SFID_NULL
] = "null",
323 [BRW_SFID_MATH
] = "math",
324 [BRW_SFID_SAMPLER
] = "sampler",
325 [BRW_SFID_MESSAGE_GATEWAY
] = "gateway",
326 [BRW_SFID_URB
] = "urb",
327 [BRW_SFID_THREAD_SPAWNER
] = "thread_spawner",
328 [GEN6_SFID_DATAPORT_SAMPLER_CACHE
] = "sampler",
329 [GEN6_SFID_DATAPORT_RENDER_CACHE
] = "render",
330 [GEN6_SFID_DATAPORT_CONSTANT_CACHE
] = "const",
331 [GEN7_SFID_DATAPORT_DATA_CACHE
] = "data",
332 [GEN7_SFID_PIXEL_INTERPOLATOR
] = "pixel interp",
333 [HSW_SFID_DATAPORT_DATA_CACHE_1
] = "dp data 1",
334 [HSW_SFID_CRE
] = "cre",
337 static const char * const dp_rc_msg_type_gen6
[16] = {
338 [BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ
] = "OWORD block read",
339 [GEN6_DATAPORT_READ_MESSAGE_RENDER_UNORM_READ
] = "RT UNORM read",
340 [GEN6_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ
] = "OWORD dual block read",
341 [GEN6_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ
] = "media block read",
342 [GEN6_DATAPORT_READ_MESSAGE_OWORD_UNALIGN_BLOCK_READ
] = "OWORD unaligned block read",
343 [GEN6_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ
] = "DWORD scattered read",
344 [GEN6_DATAPORT_WRITE_MESSAGE_DWORD_ATOMIC_WRITE
] = "DWORD atomic write",
345 [GEN6_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE
] = "OWORD block write",
346 [GEN6_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE
] = "OWORD dual block write",
347 [GEN6_DATAPORT_WRITE_MESSAGE_MEDIA_BLOCK_WRITE
] = "media block write",
348 [GEN6_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE
] = "DWORD scattered write",
349 [GEN6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE
] = "RT write",
350 [GEN6_DATAPORT_WRITE_MESSAGE_STREAMED_VB_WRITE
] = "streamed VB write",
351 [GEN6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_UNORM_WRITE
] = "RT UNORMc write",
354 static const char *const dp_dc0_msg_type_gen7
[16] = {
355 [GEN7_DATAPORT_DC_OWORD_BLOCK_READ
] = "DC OWORD block read",
356 [GEN7_DATAPORT_DC_UNALIGNED_OWORD_BLOCK_READ
] = "DC unaligned OWORD block read",
357 [GEN7_DATAPORT_DC_OWORD_DUAL_BLOCK_READ
] = "DC OWORD dual block read",
358 [GEN7_DATAPORT_DC_DWORD_SCATTERED_READ
] = "DC DWORD scattered read",
359 [GEN7_DATAPORT_DC_BYTE_SCATTERED_READ
] = "DC byte scattered read",
360 [GEN7_DATAPORT_DC_UNTYPED_ATOMIC_OP
] = "DC untyped atomic",
361 [GEN7_DATAPORT_DC_MEMORY_FENCE
] = "DC mfence",
362 [GEN7_DATAPORT_DC_OWORD_BLOCK_WRITE
] = "DC OWORD block write",
363 [GEN7_DATAPORT_DC_OWORD_DUAL_BLOCK_WRITE
] = "DC OWORD dual block write",
364 [GEN7_DATAPORT_DC_DWORD_SCATTERED_WRITE
] = "DC DWORD scatterd write",
365 [GEN7_DATAPORT_DC_BYTE_SCATTERED_WRITE
] = "DC byte scattered write",
366 [GEN7_DATAPORT_DC_UNTYPED_SURFACE_WRITE
] = "DC untyped surface write",
369 static const char *const dp_dc1_msg_type_hsw
[16] = {
370 [HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_READ
] = "untyped surface read",
371 [HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP
] = "DC untyped atomic op",
372 [HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP_SIMD4X2
] = "DC untyped 4x2 atomic op",
373 [HSW_DATAPORT_DC_PORT1_MEDIA_BLOCK_READ
] = "DC media block read",
374 [HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_READ
] = "DC typed surface read",
375 [HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP
] = "DC typed atomic",
376 [HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP_SIMD4X2
] = "DC typed 4x2 atomic op",
377 [HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_WRITE
] = "DC untyped surface write",
378 [HSW_DATAPORT_DC_PORT1_MEDIA_BLOCK_WRITE
] = "DC media block write",
379 [HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP
] = "DC atomic counter op",
380 [HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP_SIMD4X2
] = "DC 4x2 atomic counter op",
381 [HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_WRITE
] = "DC typed surface write",
384 static const char * const aop
[16] = {
385 [BRW_AOP_AND
] = "and",
387 [BRW_AOP_XOR
] = "xor",
388 [BRW_AOP_MOV
] = "mov",
389 [BRW_AOP_INC
] = "inc",
390 [BRW_AOP_DEC
] = "dec",
391 [BRW_AOP_ADD
] = "add",
392 [BRW_AOP_SUB
] = "sub",
393 [BRW_AOP_REVSUB
] = "revsub",
394 [BRW_AOP_IMAX
] = "imax",
395 [BRW_AOP_IMIN
] = "imin",
396 [BRW_AOP_UMAX
] = "umax",
397 [BRW_AOP_UMIN
] = "umin",
398 [BRW_AOP_CMPWR
] = "cmpwr",
399 [BRW_AOP_PREDEC
] = "predec",
402 static const char * const math_function
[16] = {
403 [BRW_MATH_FUNCTION_INV
] = "inv",
404 [BRW_MATH_FUNCTION_LOG
] = "log",
405 [BRW_MATH_FUNCTION_EXP
] = "exp",
406 [BRW_MATH_FUNCTION_SQRT
] = "sqrt",
407 [BRW_MATH_FUNCTION_RSQ
] = "rsq",
408 [BRW_MATH_FUNCTION_SIN
] = "sin",
409 [BRW_MATH_FUNCTION_COS
] = "cos",
410 [BRW_MATH_FUNCTION_SINCOS
] = "sincos",
411 [BRW_MATH_FUNCTION_FDIV
] = "fdiv",
412 [BRW_MATH_FUNCTION_POW
] = "pow",
413 [BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER
] = "intdivmod",
414 [BRW_MATH_FUNCTION_INT_DIV_QUOTIENT
] = "intdiv",
415 [BRW_MATH_FUNCTION_INT_DIV_REMAINDER
] = "intmod",
418 static const char * const math_saturate
[2] = {
423 static const char * const math_signed
[2] = {
428 static const char * const math_scalar
[2] = {
433 static const char * const math_precision
[2] = {
435 [1] = "partial_precision"
438 static const char * const urb_opcode
[2] = {
443 static const char * const urb_swizzle
[4] = {
444 [BRW_URB_SWIZZLE_NONE
] = "",
445 [BRW_URB_SWIZZLE_INTERLEAVE
] = "interleave",
446 [BRW_URB_SWIZZLE_TRANSPOSE
] = "transpose",
449 static const char * const urb_allocate
[2] = {
454 static const char * const urb_used
[2] = {
459 static const char * const urb_complete
[2] = {
464 static const char * const sampler_target_format
[4] = {
473 static int string (FILE *file
, const char *string
)
475 fputs (string
, file
);
476 column
+= strlen (string
);
480 static int format (FILE *f
, const char *format
, ...)
484 va_start (args
, format
);
486 vsnprintf (buf
, sizeof (buf
) - 1, format
, args
);
492 static int newline (FILE *f
)
499 static int pad (FILE *f
, int c
)
507 static int control (FILE *file
, const char *name
, const char * const ctrl
[],
508 unsigned id
, int *space
)
511 fprintf (file
, "*** invalid %s value %d ",
519 string (file
, ctrl
[id
]);
526 static int print_opcode (FILE *file
, int id
)
528 if (!opcode
[id
].name
) {
529 format (file
, "*** invalid opcode value %d ", id
);
532 string (file
, opcode
[id
].name
);
536 static int reg (FILE *file
, unsigned _reg_file
, unsigned _reg_nr
)
540 /* Clear the Compr4 instruction compression bit. */
541 if (_reg_file
== BRW_MESSAGE_REGISTER_FILE
)
542 _reg_nr
&= ~(1 << 7);
544 if (_reg_file
== BRW_ARCHITECTURE_REGISTER_FILE
) {
545 switch (_reg_nr
& 0xf0) {
547 string (file
, "null");
549 case BRW_ARF_ADDRESS
:
550 format (file
, "a%d", _reg_nr
& 0x0f);
552 case BRW_ARF_ACCUMULATOR
:
553 format (file
, "acc%d", _reg_nr
& 0x0f);
556 format (file
, "f%d", _reg_nr
& 0x0f);
559 format (file
, "mask%d", _reg_nr
& 0x0f);
561 case BRW_ARF_MASK_STACK
:
562 format (file
, "msd%d", _reg_nr
& 0x0f);
565 format (file
, "sr%d", _reg_nr
& 0x0f);
567 case BRW_ARF_CONTROL
:
568 format (file
, "cr%d", _reg_nr
& 0x0f);
570 case BRW_ARF_NOTIFICATION_COUNT
:
571 format (file
, "n%d", _reg_nr
& 0x0f);
578 format (file
, "ARF%d", _reg_nr
);
582 err
|= control (file
, "src reg file", reg_file
, _reg_file
, NULL
);
583 format (file
, "%d", _reg_nr
);
588 static int dest (FILE *file
, struct brw_context
*brw
, brw_inst
*inst
)
592 if (brw_inst_access_mode(brw
, inst
) == BRW_ALIGN_1
)
594 if (brw_inst_dst_address_mode(brw
, inst
) == BRW_ADDRESS_DIRECT
)
596 err
|= reg (file
, brw_inst_dst_reg_file(brw
, inst
), brw_inst_dst_da_reg_nr(brw
, inst
));
599 if (brw_inst_dst_da1_subreg_nr(brw
, inst
))
600 format (file
, ".%d", brw_inst_dst_da1_subreg_nr(brw
, inst
) /
601 reg_type_size
[brw_inst_dst_reg_type(brw
, inst
)]);
603 err
|= control (file
, "horiz stride", horiz_stride
, brw_inst_dst_hstride(brw
, inst
), NULL
);
605 err
|= control (file
, "dest reg encoding", reg_encoding
, brw_inst_dst_reg_type(brw
, inst
), NULL
);
609 string (file
, "g[a0");
610 if (brw_inst_dst_ia_subreg_nr(brw
, inst
))
611 format (file
, ".%d", brw_inst_dst_ia_subreg_nr(brw
, inst
) /
612 reg_type_size
[brw_inst_dst_reg_type(brw
, inst
)]);
613 if (brw_inst_dst_ia1_addr_imm(brw
, inst
))
614 format (file
, " %d", brw_inst_dst_ia1_addr_imm(brw
, inst
));
616 err
|= control (file
, "horiz stride", horiz_stride
, brw_inst_dst_hstride(brw
, inst
), NULL
);
618 err
|= control (file
, "dest reg encoding", reg_encoding
, brw_inst_dst_reg_type(brw
, inst
), NULL
);
623 if (brw_inst_dst_address_mode(brw
, inst
) == BRW_ADDRESS_DIRECT
)
625 err
|= reg (file
, brw_inst_dst_reg_file(brw
, inst
), brw_inst_dst_da_reg_nr(brw
, inst
));
628 if (brw_inst_dst_da16_subreg_nr(brw
, inst
))
629 format (file
, ".%d", brw_inst_dst_da16_subreg_nr(brw
, inst
) /
630 reg_type_size
[brw_inst_dst_reg_type(brw
, inst
)]);
631 string (file
, "<1>");
632 err
|= control (file
, "writemask", writemask
, brw_inst_da16_writemask(brw
, inst
), NULL
);
633 err
|= control (file
, "dest reg encoding", reg_encoding
, brw_inst_dst_reg_type(brw
, inst
), NULL
);
638 string (file
, "Indirect align16 address mode not supported");
645 static int dest_3src (FILE *file
, struct brw_context
*brw
, brw_inst
*inst
)
650 if (brw
->gen
== 6 && brw_inst_3src_dst_reg_file(brw
, inst
))
651 reg_file
= BRW_MESSAGE_REGISTER_FILE
;
653 reg_file
= BRW_GENERAL_REGISTER_FILE
;
655 err
|= reg (file
, reg_file
, brw_inst_3src_dst_reg_nr(brw
, inst
));
658 if (brw_inst_3src_dst_subreg_nr(brw
, inst
))
659 format (file
, ".%d", brw_inst_3src_dst_subreg_nr(brw
, inst
));
660 string (file
, "<1>");
661 err
|= control (file
, "writemask", writemask
, brw_inst_3src_dst_writemask(brw
, inst
), NULL
);
662 err
|= control (file
, "dest reg encoding", three_source_reg_encoding
,
663 brw_inst_3src_dst_type(brw
, inst
), NULL
);
668 static int src_align1_region (FILE *file
,
669 unsigned _vert_stride
, unsigned _width
, unsigned _horiz_stride
)
673 err
|= control (file
, "vert stride", vert_stride
, _vert_stride
, NULL
);
675 err
|= control (file
, "width", width
, _width
, NULL
);
677 err
|= control (file
, "horiz_stride", horiz_stride
, _horiz_stride
, NULL
);
682 static int src_da1 (FILE *file
, unsigned type
, unsigned _reg_file
,
683 unsigned _vert_stride
, unsigned _width
, unsigned _horiz_stride
,
684 unsigned reg_num
, unsigned sub_reg_num
, unsigned __abs
, unsigned _negate
)
687 err
|= control (file
, "negate", m_negate
, _negate
, NULL
);
688 err
|= control (file
, "abs", _abs
, __abs
, NULL
);
690 err
|= reg (file
, _reg_file
, reg_num
);
694 format (file
, ".%d", sub_reg_num
/ reg_type_size
[type
]); /* use formal style like spec */
695 src_align1_region (file
, _vert_stride
, _width
, _horiz_stride
);
696 err
|= control (file
, "src reg encoding", reg_encoding
, type
, NULL
);
700 static int src_ia1 (FILE *file
,
704 unsigned _addr_subreg_nr
,
708 unsigned _horiz_stride
,
710 unsigned _vert_stride
)
713 err
|= control (file
, "negate", m_negate
, _negate
, NULL
);
714 err
|= control (file
, "abs", _abs
, __abs
, NULL
);
716 string (file
, "g[a0");
718 format (file
, ".%d", _addr_subreg_nr
);
720 format (file
, " %d", _addr_imm
);
722 src_align1_region (file
, _vert_stride
, _width
, _horiz_stride
);
723 err
|= control (file
, "src reg encoding", reg_encoding
, type
, NULL
);
727 static int src_da16 (FILE *file
,
730 unsigned _vert_stride
,
741 err
|= control (file
, "negate", m_negate
, _negate
, NULL
);
742 err
|= control (file
, "abs", _abs
, __abs
, NULL
);
744 err
|= reg (file
, _reg_file
, _reg_nr
);
748 /* bit4 for subreg number byte addressing. Make this same meaning as
749 in da1 case, so output looks consistent. */
750 format (file
, ".%d", 16 / reg_type_size
[_reg_type
]);
752 err
|= control (file
, "vert stride", vert_stride
, _vert_stride
, NULL
);
753 string (file
, ",4,1>");
755 * Three kinds of swizzle display:
756 * identity - nothing printed
757 * 1->all - print the single channel
758 * 1->1 - print the mapping
760 if (swz_x
== BRW_CHANNEL_X
&&
761 swz_y
== BRW_CHANNEL_Y
&&
762 swz_z
== BRW_CHANNEL_Z
&&
763 swz_w
== BRW_CHANNEL_W
)
767 else if (swz_x
== swz_y
&& swz_x
== swz_z
&& swz_x
== swz_w
)
770 err
|= control (file
, "channel select", chan_sel
, swz_x
, NULL
);
775 err
|= control (file
, "channel select", chan_sel
, swz_x
, NULL
);
776 err
|= control (file
, "channel select", chan_sel
, swz_y
, NULL
);
777 err
|= control (file
, "channel select", chan_sel
, swz_z
, NULL
);
778 err
|= control (file
, "channel select", chan_sel
, swz_w
, NULL
);
780 err
|= control (file
, "src da16 reg type", reg_encoding
, _reg_type
, NULL
);
784 static int src0_3src (FILE *file
, struct brw_context
*brw
, brw_inst
*inst
)
787 unsigned swz
= brw_inst_3src_src0_swizzle(brw
, inst
);
788 unsigned swz_x
= BRW_GET_SWZ(swz
, BRW_CHANNEL_X
);
789 unsigned swz_y
= BRW_GET_SWZ(swz
, BRW_CHANNEL_Y
);
790 unsigned swz_z
= BRW_GET_SWZ(swz
, BRW_CHANNEL_Z
);
791 unsigned swz_w
= BRW_GET_SWZ(swz
, BRW_CHANNEL_W
);
792 unsigned src0_subreg_nr
= brw_inst_3src_src0_subreg_nr(brw
, inst
);
794 err
|= control (file
, "negate", m_negate
, brw_inst_3src_src0_negate(brw
, inst
), NULL
);
795 err
|= control (file
, "abs", _abs
, brw_inst_3src_src0_abs(brw
, inst
), NULL
);
797 err
|= reg (file
, BRW_GENERAL_REGISTER_FILE
, brw_inst_3src_src0_reg_nr(brw
, inst
));
801 format (file
, ".%d", src0_subreg_nr
);
802 if (brw_inst_3src_src0_rep_ctrl(brw
, inst
))
803 string (file
, "<0,1,0>");
805 string (file
, "<4,4,1>");
806 err
|= control (file
, "src da16 reg type", three_source_reg_encoding
,
807 brw_inst_3src_src_type(brw
, inst
), NULL
);
809 * Three kinds of swizzle display:
810 * identity - nothing printed
811 * 1->all - print the single channel
812 * 1->1 - print the mapping
814 if (swz
== BRW_SWIZZLE_XYZW
)
818 else if (swz_x
== swz_y
&& swz_x
== swz_z
&& swz_x
== swz_w
)
821 err
|= control (file
, "channel select", chan_sel
, swz_x
, NULL
);
826 err
|= control (file
, "channel select", chan_sel
, swz_x
, NULL
);
827 err
|= control (file
, "channel select", chan_sel
, swz_y
, NULL
);
828 err
|= control (file
, "channel select", chan_sel
, swz_z
, NULL
);
829 err
|= control (file
, "channel select", chan_sel
, swz_w
, NULL
);
834 static int src1_3src (FILE *file
, struct brw_context
*brw
, brw_inst
*inst
)
837 unsigned swz
= brw_inst_3src_src1_swizzle(brw
, inst
);
838 unsigned swz_x
= BRW_GET_SWZ(swz
, BRW_CHANNEL_X
);
839 unsigned swz_y
= BRW_GET_SWZ(swz
, BRW_CHANNEL_Y
);
840 unsigned swz_z
= BRW_GET_SWZ(swz
, BRW_CHANNEL_Z
);
841 unsigned swz_w
= BRW_GET_SWZ(swz
, BRW_CHANNEL_W
);
842 unsigned src1_subreg_nr
= brw_inst_3src_src1_subreg_nr(brw
, inst
);
844 err
|= control (file
, "negate", m_negate
, brw_inst_3src_src1_negate(brw
, inst
), NULL
);
845 err
|= control (file
, "abs", _abs
, brw_inst_3src_src1_abs(brw
, inst
), NULL
);
847 err
|= reg (file
, BRW_GENERAL_REGISTER_FILE
, brw_inst_3src_src1_reg_nr(brw
, inst
));
851 format (file
, ".%d", src1_subreg_nr
);
852 if (brw_inst_3src_src1_rep_ctrl(brw
, inst
))
853 string (file
, "<0,1,0>");
855 string (file
, "<4,4,1>");
856 err
|= control (file
, "src da16 reg type", three_source_reg_encoding
,
857 brw_inst_3src_src_type(brw
, inst
), NULL
);
859 * Three kinds of swizzle display:
860 * identity - nothing printed
861 * 1->all - print the single channel
862 * 1->1 - print the mapping
864 if (swz
== BRW_SWIZZLE_XYZW
)
868 else if (swz_x
== swz_y
&& swz_x
== swz_z
&& swz_x
== swz_w
)
871 err
|= control (file
, "channel select", chan_sel
, swz_x
, NULL
);
876 err
|= control (file
, "channel select", chan_sel
, swz_x
, NULL
);
877 err
|= control (file
, "channel select", chan_sel
, swz_y
, NULL
);
878 err
|= control (file
, "channel select", chan_sel
, swz_z
, NULL
);
879 err
|= control (file
, "channel select", chan_sel
, swz_w
, NULL
);
885 static int src2_3src (FILE *file
, struct brw_context
*brw
, brw_inst
*inst
)
888 unsigned swz
= brw_inst_3src_src2_swizzle(brw
, inst
);
889 unsigned swz_x
= BRW_GET_SWZ(swz
, BRW_CHANNEL_X
);
890 unsigned swz_y
= BRW_GET_SWZ(swz
, BRW_CHANNEL_Y
);
891 unsigned swz_z
= BRW_GET_SWZ(swz
, BRW_CHANNEL_Z
);
892 unsigned swz_w
= BRW_GET_SWZ(swz
, BRW_CHANNEL_W
);
893 unsigned src2_subreg_nr
= brw_inst_3src_src2_subreg_nr(brw
, inst
);
895 err
|= control (file
, "negate", m_negate
, brw_inst_3src_src2_negate(brw
, inst
), NULL
);
896 err
|= control (file
, "abs", _abs
, brw_inst_3src_src2_abs(brw
, inst
), NULL
);
898 err
|= reg (file
, BRW_GENERAL_REGISTER_FILE
, brw_inst_3src_src2_reg_nr(brw
, inst
));
902 format (file
, ".%d", src2_subreg_nr
);
903 if (brw_inst_3src_src2_rep_ctrl(brw
, inst
))
904 string (file
, "<0,1,0>");
906 string (file
, "<4,4,1>");
907 err
|= control (file
, "src da16 reg type", three_source_reg_encoding
,
908 brw_inst_3src_src_type(brw
, inst
), NULL
);
910 * Three kinds of swizzle display:
911 * identity - nothing printed
912 * 1->all - print the single channel
913 * 1->1 - print the mapping
915 if (swz
== BRW_SWIZZLE_XYZW
)
919 else if (swz_x
== swz_y
&& swz_x
== swz_z
&& swz_x
== swz_w
)
922 err
|= control (file
, "channel select", chan_sel
, swz_x
, NULL
);
927 err
|= control (file
, "channel select", chan_sel
, swz_x
, NULL
);
928 err
|= control (file
, "channel select", chan_sel
, swz_y
, NULL
);
929 err
|= control (file
, "channel select", chan_sel
, swz_z
, NULL
);
930 err
|= control (file
, "channel select", chan_sel
, swz_w
, NULL
);
935 static int imm (FILE *file
, struct brw_context
*brw
, unsigned type
,
938 case BRW_HW_REG_TYPE_UD
:
939 format (file
, "0x%08xUD", brw_inst_imm_ud(brw
, inst
));
941 case BRW_HW_REG_TYPE_D
:
942 format (file
, "%dD", brw_inst_imm_d(brw
, inst
));
944 case BRW_HW_REG_TYPE_UW
:
945 format (file
, "0x%04xUW", (uint16_t) brw_inst_imm_ud(brw
, inst
));
947 case BRW_HW_REG_TYPE_W
:
948 format (file
, "%dW", (int16_t) brw_inst_imm_d(brw
, inst
));
950 case BRW_HW_REG_IMM_TYPE_UV
:
951 format (file
, "0x%08xUV", brw_inst_imm_ud(brw
, inst
));
953 case BRW_HW_REG_IMM_TYPE_VF
:
954 format (file
, "Vector Float");
956 case BRW_HW_REG_IMM_TYPE_V
:
957 format (file
, "0x%08xV", brw_inst_imm_ud(brw
, inst
));
959 case BRW_HW_REG_TYPE_F
:
960 format (file
, "%-gF", brw_inst_imm_f(brw
, inst
));
965 static int src0 (FILE *file
, struct brw_context
*brw
, brw_inst
*inst
)
967 if (brw_inst_src0_reg_file(brw
, inst
) == BRW_IMMEDIATE_VALUE
)
968 return imm (file
, brw
, brw_inst_src0_reg_type(brw
, inst
), inst
);
969 else if (brw_inst_access_mode(brw
, inst
) == BRW_ALIGN_1
)
971 if (brw_inst_src0_address_mode(brw
, inst
) == BRW_ADDRESS_DIRECT
)
973 return src_da1 (file
,
974 brw_inst_src0_reg_type(brw
, inst
),
975 brw_inst_src0_reg_file(brw
, inst
),
976 brw_inst_src0_vstride(brw
, inst
),
977 brw_inst_src0_width(brw
, inst
),
978 brw_inst_src0_hstride(brw
, inst
),
979 brw_inst_src0_da_reg_nr(brw
, inst
),
980 brw_inst_src0_da1_subreg_nr(brw
, inst
),
981 brw_inst_src0_abs(brw
, inst
),
982 brw_inst_src0_negate(brw
, inst
));
986 return src_ia1 (file
,
987 brw_inst_src0_reg_type(brw
, inst
),
988 brw_inst_src0_reg_file(brw
, inst
),
989 brw_inst_src0_ia1_addr_imm(brw
, inst
),
990 brw_inst_src0_ia_subreg_nr(brw
, inst
),
991 brw_inst_src0_negate(brw
, inst
),
992 brw_inst_src0_abs(brw
, inst
),
993 brw_inst_src0_address_mode(brw
, inst
),
994 brw_inst_src0_hstride(brw
, inst
),
995 brw_inst_src0_width(brw
, inst
),
996 brw_inst_src0_vstride(brw
, inst
));
1001 if (brw_inst_src0_address_mode(brw
, inst
) == BRW_ADDRESS_DIRECT
)
1003 return src_da16 (file
,
1004 brw_inst_src0_reg_type(brw
, inst
),
1005 brw_inst_src0_reg_file(brw
, inst
),
1006 brw_inst_src0_vstride(brw
, inst
),
1007 brw_inst_src0_da_reg_nr(brw
, inst
),
1008 brw_inst_src0_da16_subreg_nr(brw
, inst
),
1009 brw_inst_src0_abs(brw
, inst
),
1010 brw_inst_src0_negate(brw
, inst
),
1011 brw_inst_src0_da16_swiz_x(brw
, inst
),
1012 brw_inst_src0_da16_swiz_y(brw
, inst
),
1013 brw_inst_src0_da16_swiz_z(brw
, inst
),
1014 brw_inst_src0_da16_swiz_w(brw
, inst
));
1018 string (file
, "Indirect align16 address mode not supported");
1024 static int src1 (FILE *file
, struct brw_context
*brw
, brw_inst
*inst
)
1026 if (brw_inst_src1_reg_file(brw
, inst
) == BRW_IMMEDIATE_VALUE
)
1027 return imm (file
, brw
, brw_inst_src1_reg_type(brw
, inst
), inst
);
1028 else if (brw_inst_access_mode(brw
, inst
) == BRW_ALIGN_1
)
1030 if (brw_inst_src1_address_mode(brw
, inst
) == BRW_ADDRESS_DIRECT
)
1032 return src_da1 (file
,
1033 brw_inst_src1_reg_type(brw
, inst
),
1034 brw_inst_src1_reg_file(brw
, inst
),
1035 brw_inst_src1_vstride(brw
, inst
),
1036 brw_inst_src1_width(brw
, inst
),
1037 brw_inst_src1_hstride(brw
, inst
),
1038 brw_inst_src1_da_reg_nr(brw
, inst
),
1039 brw_inst_src1_da1_subreg_nr(brw
, inst
),
1040 brw_inst_src1_abs(brw
, inst
),
1041 brw_inst_src1_negate(brw
, inst
));
1045 return src_ia1 (file
,
1046 brw_inst_src1_reg_type(brw
, inst
),
1047 brw_inst_src1_reg_file(brw
, inst
),
1048 brw_inst_src1_ia1_addr_imm(brw
, inst
),
1049 brw_inst_src1_ia_subreg_nr(brw
, inst
),
1050 brw_inst_src1_negate(brw
, inst
),
1051 brw_inst_src1_abs(brw
, inst
),
1052 brw_inst_src1_address_mode(brw
, inst
),
1053 brw_inst_src1_hstride(brw
, inst
),
1054 brw_inst_src1_width(brw
, inst
),
1055 brw_inst_src1_vstride(brw
, inst
));
1060 if (brw_inst_src1_address_mode(brw
, inst
) == BRW_ADDRESS_DIRECT
)
1062 return src_da16 (file
,
1063 brw_inst_src1_reg_type(brw
, inst
),
1064 brw_inst_src1_reg_file(brw
, inst
),
1065 brw_inst_src1_vstride(brw
, inst
),
1066 brw_inst_src1_da_reg_nr(brw
, inst
),
1067 brw_inst_src1_da16_subreg_nr(brw
, inst
),
1068 brw_inst_src1_abs(brw
, inst
),
1069 brw_inst_src1_negate(brw
, inst
),
1070 brw_inst_src1_da16_swiz_x(brw
, inst
),
1071 brw_inst_src1_da16_swiz_y(brw
, inst
),
1072 brw_inst_src1_da16_swiz_z(brw
, inst
),
1073 brw_inst_src1_da16_swiz_w(brw
, inst
));
1077 string (file
, "Indirect align16 address mode not supported");
1083 static int qtr_ctrl(FILE *file
, struct brw_context
*brw
, brw_inst
*inst
)
1085 int qtr_ctl
= brw_inst_qtr_control(brw
, inst
);
1086 int exec_size
= 1 << brw_inst_exec_size(brw
, inst
);
1088 if (exec_size
== 8) {
1091 string (file
, " 1Q");
1094 string (file
, " 2Q");
1097 string (file
, " 3Q");
1100 string (file
, " 4Q");
1103 } else if (exec_size
== 16){
1105 string (file
, " 1H");
1107 string (file
, " 2H");
1113 brw_disassemble_inst(FILE *file
, struct brw_context
*brw
, brw_inst
*inst
,
1119 if (brw_inst_pred_control(brw
, inst
)) {
1121 err
|= control (file
, "predicate inverse", pred_inv
,
1122 brw_inst_pred_inv(brw
, inst
), NULL
);
1123 format (file
, "f%d", brw
->gen
>= 7 ? brw_inst_flag_reg_nr(brw
, inst
) : 0);
1124 if (brw_inst_flag_subreg_nr(brw
, inst
))
1125 format (file
, ".%d", brw_inst_flag_subreg_nr(brw
, inst
));
1126 if (brw_inst_access_mode(brw
, inst
) == BRW_ALIGN_1
)
1127 err
|= control (file
, "predicate control align1", pred_ctrl_align1
,
1128 brw_inst_pred_control(brw
, inst
), NULL
);
1130 err
|= control (file
, "predicate control align16", pred_ctrl_align16
,
1131 brw_inst_pred_control(brw
, inst
), NULL
);
1132 string (file
, ") ");
1135 err
|= print_opcode (file
, brw_inst_opcode(brw
, inst
));
1136 err
|= control (file
, "saturate", saturate
, brw_inst_saturate(brw
, inst
),
1139 err
|= control (file
, "debug control", debug_ctrl
,
1140 brw_inst_debug_control(brw
, inst
), NULL
);
1142 if (brw_inst_opcode(brw
, inst
) == BRW_OPCODE_MATH
) {
1144 err
|= control (file
, "function", math_function
,
1145 brw_inst_math_function(brw
, inst
), NULL
);
1146 } else if (brw_inst_opcode(brw
, inst
) != BRW_OPCODE_SEND
&&
1147 brw_inst_opcode(brw
, inst
) != BRW_OPCODE_SENDC
) {
1148 err
|= control (file
, "conditional modifier", conditional_modifier
,
1149 brw_inst_cond_modifier(brw
, inst
), NULL
);
1151 /* If we're using the conditional modifier, print which flags reg is
1152 * used for it. Note that on gen6+, the embedded-condition SEL and
1153 * control flow doesn't update flags.
1155 if (brw_inst_cond_modifier(brw
, inst
) &&
1156 (brw
->gen
< 6 || (brw_inst_opcode(brw
, inst
) != BRW_OPCODE_SEL
&&
1157 brw_inst_opcode(brw
, inst
) != BRW_OPCODE_IF
&&
1158 brw_inst_opcode(brw
, inst
) != BRW_OPCODE_WHILE
))) {
1159 format (file
, ".f%d", brw
->gen
>= 7 ? brw_inst_flag_reg_nr(brw
, inst
) : 0);
1160 if (brw_inst_flag_subreg_nr(brw
, inst
))
1161 format (file
, ".%d", brw_inst_flag_subreg_nr(brw
, inst
));
1165 if (brw_inst_opcode(brw
, inst
) != BRW_OPCODE_NOP
) {
1167 err
|= control (file
, "execution size", exec_size
, brw_inst_exec_size(brw
, inst
), NULL
);
1171 if (brw_inst_opcode(brw
, inst
) == BRW_OPCODE_SEND
&& brw
->gen
< 6)
1172 format (file
, " %d", brw_inst_base_mrf(brw
, inst
));
1174 if (opcode
[brw_inst_opcode(brw
, inst
)].nsrc
== 3) {
1176 err
|= dest_3src (file
, brw
, inst
);
1179 err
|= src0_3src (file
, brw
, inst
);
1182 err
|= src1_3src (file
, brw
, inst
);
1185 err
|= src2_3src (file
, brw
, inst
);
1187 if (opcode
[brw_inst_opcode(brw
, inst
)].ndst
> 0) {
1189 err
|= dest (file
, brw
, inst
);
1190 } else if (brw
->gen
== 7 && (brw_inst_opcode(brw
, inst
) == BRW_OPCODE_ELSE
||
1191 brw_inst_opcode(brw
, inst
) == BRW_OPCODE_ENDIF
||
1192 brw_inst_opcode(brw
, inst
) == BRW_OPCODE_WHILE
)) {
1193 format (file
, " %d", brw_inst_jip(brw
, inst
));
1194 } else if (brw
->gen
== 6 && (brw_inst_opcode(brw
, inst
) == BRW_OPCODE_IF
||
1195 brw_inst_opcode(brw
, inst
) == BRW_OPCODE_ELSE
||
1196 brw_inst_opcode(brw
, inst
) == BRW_OPCODE_ENDIF
||
1197 brw_inst_opcode(brw
, inst
) == BRW_OPCODE_WHILE
)) {
1198 format (file
, " %d", brw_inst_gen6_jump_count(brw
, inst
));
1199 } else if ((brw
->gen
>= 6 && (brw_inst_opcode(brw
, inst
) == BRW_OPCODE_BREAK
||
1200 brw_inst_opcode(brw
, inst
) == BRW_OPCODE_CONTINUE
||
1201 brw_inst_opcode(brw
, inst
) == BRW_OPCODE_HALT
)) ||
1202 (brw
->gen
== 7 && brw_inst_opcode(brw
, inst
) == BRW_OPCODE_IF
)) {
1203 format (file
, " %d %d", brw_inst_uip(brw
, inst
), brw_inst_jip(brw
, inst
));
1204 } else if (brw_inst_opcode(brw
, inst
) == BRW_OPCODE_JMPI
) {
1205 format (file
, " %d", brw_inst_imm_d(brw
, inst
));
1208 if (opcode
[brw_inst_opcode(brw
, inst
)].nsrc
> 0) {
1210 err
|= src0 (file
, brw
, inst
);
1212 if (opcode
[brw_inst_opcode(brw
, inst
)].nsrc
> 1) {
1214 err
|= src1 (file
, brw
, inst
);
1218 if (brw_inst_opcode(brw
, inst
) == BRW_OPCODE_SEND
||
1219 brw_inst_opcode(brw
, inst
) == BRW_OPCODE_SENDC
) {
1220 enum brw_message_target target
= brw_inst_sfid(brw
, inst
);
1226 fprintf (file
, " ");
1227 if (brw
->gen
>= 6) {
1228 err
|= control (file
, "target function", target_function_gen6
,
1231 err
|= control (file
, "target function", target_function
,
1237 err
|= control (file
, "math function", math_function
,
1238 brw_inst_math_msg_function(brw
, inst
), &space
);
1239 err
|= control (file
, "math saturate", math_saturate
,
1240 brw_inst_math_msg_saturate(brw
, inst
), &space
);
1241 err
|= control (file
, "math signed", math_signed
,
1242 brw_inst_math_msg_signed_int(brw
, inst
), &space
);
1243 err
|= control (file
, "math scalar", math_scalar
,
1244 brw_inst_math_msg_data_type(brw
, inst
), &space
);
1245 err
|= control (file
, "math precision", math_precision
,
1246 brw_inst_math_msg_precision(brw
, inst
), &space
);
1248 case BRW_SFID_SAMPLER
:
1249 if (brw
->gen
>= 5) {
1250 format (file
, " (%d, %d, %d, %d)",
1251 brw_inst_binding_table_index(brw
, inst
),
1252 brw_inst_sampler(brw
, inst
),
1253 brw_inst_sampler_msg_type(brw
, inst
),
1254 brw_inst_sampler_simd_mode(brw
, inst
));
1256 format (file
, " (%d, %d, %d, ",
1257 brw_inst_binding_table_index(brw
, inst
),
1258 brw_inst_sampler(brw
, inst
),
1259 brw_inst_sampler_msg_type(brw
, inst
));
1261 err
|= control (file
, "sampler target format",
1262 sampler_target_format
,
1263 brw_inst_sampler_return_format(brw
, inst
), NULL
);
1268 case BRW_SFID_DATAPORT_READ
:
1269 if (brw
->gen
>= 6) {
1270 format (file
, " (%d, %d, %d, %d)",
1271 brw_inst_binding_table_index(brw
, inst
),
1272 brw_inst_dp_msg_control(brw
, inst
),
1273 brw_inst_dp_msg_type(brw
, inst
),
1274 brw
->gen
>= 7 ? 0 : brw_inst_dp_write_commit(brw
, inst
));
1276 format (file
, " (%d, %d, %d)",
1277 brw_inst_binding_table_index(brw
, inst
),
1278 brw_inst_dp_read_msg_control(brw
, inst
),
1279 brw_inst_dp_read_msg_type(brw
, inst
));
1283 case BRW_SFID_DATAPORT_WRITE
:
1284 if (brw
->gen
>= 7) {
1285 format (file
, " (");
1287 err
|= control (file
, "DP rc message type",
1288 dp_rc_msg_type_gen6
,
1289 brw_inst_dp_msg_type(brw
, inst
), &space
);
1291 format (file
, ", %d, %d, %d)",
1292 brw_inst_binding_table_index(brw
, inst
),
1293 brw_inst_dp_msg_control(brw
, inst
),
1294 brw_inst_dp_msg_type(brw
, inst
));
1295 } else if (brw
->gen
== 6) {
1296 format (file
, " (");
1298 err
|= control (file
, "DP rc message type",
1299 dp_rc_msg_type_gen6
,
1300 brw_inst_dp_msg_type(brw
, inst
), &space
);
1302 format (file
, ", %d, %d, %d, %d)",
1303 brw_inst_binding_table_index(brw
, inst
),
1304 brw_inst_dp_msg_control(brw
, inst
) & 0x7,
1305 brw_inst_dp_msg_type(brw
, inst
),
1306 brw_inst_dp_write_commit(brw
, inst
));
1308 format (file
, " (%d, %d, %d, %d)",
1309 brw_inst_binding_table_index(brw
, inst
),
1310 (brw_inst_rt_last(brw
, inst
) << 3) |
1311 brw_inst_dp_write_msg_control(brw
, inst
),
1312 brw_inst_dp_write_msg_type(brw
, inst
),
1313 brw_inst_dp_write_commit(brw
, inst
));
1318 format (file
, " %d", brw_inst_urb_global_offset(brw
, inst
));
1321 if (brw
->gen
>= 5) {
1322 err
|= control (file
, "urb opcode", urb_opcode
,
1323 brw_inst_urb_opcode(brw
, inst
), &space
);
1325 err
|= control (file
, "urb swizzle", urb_swizzle
,
1326 brw_inst_urb_swizzle_control(brw
, inst
), &space
);
1328 err
|= control (file
, "urb allocate", urb_allocate
,
1329 brw_inst_urb_allocate(brw
, inst
), &space
);
1330 err
|= control (file
, "urb used", urb_used
,
1331 brw_inst_urb_used(brw
, inst
), &space
);
1333 err
|= control (file
, "urb complete", urb_complete
,
1334 brw_inst_urb_complete(brw
, inst
), &space
);
1336 case BRW_SFID_THREAD_SPAWNER
:
1338 case GEN7_SFID_DATAPORT_DATA_CACHE
:
1339 if (brw
->gen
>= 7) {
1340 format (file
, " (");
1342 err
|= control (file
, "DP DC0 message type",
1343 dp_dc0_msg_type_gen7
,
1344 brw_inst_dp_msg_type(brw
, inst
), &space
);
1346 format (file
, ", %d, ", brw_inst_binding_table_index(brw
, inst
));
1348 switch (brw_inst_dp_msg_type(brw
, inst
)) {
1349 case GEN7_DATAPORT_DC_UNTYPED_ATOMIC_OP
:
1350 control (file
, "atomic op", aop
, brw_inst_imm_ud(brw
, inst
) >> 8 & 0xf,
1354 format (file
, "%d", brw_inst_dp_msg_control(brw
, inst
));
1361 case HSW_SFID_DATAPORT_DATA_CACHE_1
:
1362 if (brw
->gen
>= 7) {
1363 format (file
, " (");
1365 err
|= control (file
, "DP DC1 message type",
1366 dp_dc1_msg_type_hsw
,
1367 brw_inst_dp_msg_type(brw
, inst
), &space
);
1369 format (file
, ", %d, ",
1370 brw_inst_binding_table_index(brw
, inst
));
1372 switch (brw_inst_dp_msg_type(brw
, inst
)) {
1373 case HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP
:
1374 case HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP_SIMD4X2
:
1375 case HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP
:
1376 case HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP_SIMD4X2
:
1377 case HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP
:
1378 case HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP_SIMD4X2
:
1379 control (file
, "atomic op", aop
,
1380 brw_inst_imm_ud(brw
, inst
) >> 8 & 0xf, &space
);
1383 format (file
, "%d", brw_inst_dp_msg_control(brw
, inst
));
1391 format (file
, "unsupported target %d", target
);
1396 format (file
, "mlen %d", brw_inst_mlen(brw
, inst
));
1397 format (file
, " rlen %d", brw_inst_rlen(brw
, inst
));
1400 if (brw_inst_opcode(brw
, inst
) != BRW_OPCODE_NOP
) {
1403 err
|= control(file
, "access mode", access_mode
, brw_inst_access_mode(brw
, inst
), &space
);
1405 err
|= control (file
, "write enable control", wectrl
, brw_inst_mask_control(brw
, inst
), &space
);
1407 err
|= control (file
, "mask control", mask_ctrl
, brw_inst_mask_control(brw
, inst
), &space
);
1408 err
|= control (file
, "dependency control", dep_ctrl
,
1409 ((brw_inst_no_dd_check(brw
, inst
) << 1) |
1410 brw_inst_no_dd_clear(brw
, inst
)), &space
);
1413 err
|= qtr_ctrl (file
, brw
, inst
);
1415 if (brw_inst_qtr_control(brw
, inst
) == BRW_COMPRESSION_COMPRESSED
&&
1416 opcode
[brw_inst_opcode(brw
, inst
)].ndst
> 0 &&
1417 brw_inst_dst_reg_file(brw
, inst
) == BRW_MESSAGE_REGISTER_FILE
&&
1418 brw_inst_dst_da_reg_nr(brw
, inst
) & (1 << 7)) {
1419 format (file
, " compr4");
1421 err
|= control (file
, "compression control", compr_ctrl
,
1422 brw_inst_qtr_control(brw
, inst
), &space
);
1426 err
|= control (file
, "compaction control", cmpt_ctrl
, is_compacted
, &space
);
1427 err
|= control (file
, "thread control", thread_ctrl
, brw_inst_thread_control(brw
, inst
), &space
);
1429 err
|= control (file
, "acc write control", accwr
, brw_inst_acc_wr_control(brw
, inst
), &space
);
1430 if (brw_inst_opcode(brw
, inst
) == BRW_OPCODE_SEND
||
1431 brw_inst_opcode(brw
, inst
) == BRW_OPCODE_SENDC
)
1432 err
|= control (file
, "end of thread", end_of_thread
,
1433 brw_inst_eot(brw
, inst
), &space
);