2 * Copyright (c) 2013 Rob Clark <robdclark@gmail.com>
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 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * 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 NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 #define PACKED __attribute__((__packed__))
34 /* size of largest OPC field of all the instruction categories: */
37 #define _OPC(cat, opc) (((cat) << NOPC_BITS) | opc)
43 OPC_JUMP
= _OPC(0, 2),
44 OPC_CALL
= _OPC(0, 3),
46 OPC_KILL
= _OPC(0, 5),
48 OPC_EMIT
= _OPC(0, 7),
50 OPC_CHMASK
= _OPC(0, 9),
51 OPC_CHSH
= _OPC(0, 10),
52 OPC_FLOW_REV
= _OPC(0, 11),
55 OPC_ELSE
= _OPC(0, 14),
56 OPC_ENDIF
= _OPC(0, 15),
62 OPC_ADD_F
= _OPC(2, 0),
63 OPC_MIN_F
= _OPC(2, 1),
64 OPC_MAX_F
= _OPC(2, 2),
65 OPC_MUL_F
= _OPC(2, 3),
66 OPC_SIGN_F
= _OPC(2, 4),
67 OPC_CMPS_F
= _OPC(2, 5),
68 OPC_ABSNEG_F
= _OPC(2, 6),
69 OPC_CMPV_F
= _OPC(2, 7),
71 OPC_FLOOR_F
= _OPC(2, 9),
72 OPC_CEIL_F
= _OPC(2, 10),
73 OPC_RNDNE_F
= _OPC(2, 11),
74 OPC_RNDAZ_F
= _OPC(2, 12),
75 OPC_TRUNC_F
= _OPC(2, 13),
77 OPC_ADD_U
= _OPC(2, 16),
78 OPC_ADD_S
= _OPC(2, 17),
79 OPC_SUB_U
= _OPC(2, 18),
80 OPC_SUB_S
= _OPC(2, 19),
81 OPC_CMPS_U
= _OPC(2, 20),
82 OPC_CMPS_S
= _OPC(2, 21),
83 OPC_MIN_U
= _OPC(2, 22),
84 OPC_MIN_S
= _OPC(2, 23),
85 OPC_MAX_U
= _OPC(2, 24),
86 OPC_MAX_S
= _OPC(2, 25),
87 OPC_ABSNEG_S
= _OPC(2, 26),
89 OPC_AND_B
= _OPC(2, 28),
90 OPC_OR_B
= _OPC(2, 29),
91 OPC_NOT_B
= _OPC(2, 30),
92 OPC_XOR_B
= _OPC(2, 31),
94 OPC_CMPV_U
= _OPC(2, 33),
95 OPC_CMPV_S
= _OPC(2, 34),
97 OPC_MUL_U24
= _OPC(2, 48), /* 24b mul into 32b result */
98 OPC_MUL_S24
= _OPC(2, 49), /* 24b mul into 32b result with sign extension */
99 OPC_MULL_U
= _OPC(2, 50),
100 OPC_BFREV_B
= _OPC(2, 51),
101 OPC_CLZ_S
= _OPC(2, 52),
102 OPC_CLZ_B
= _OPC(2, 53),
103 OPC_SHL_B
= _OPC(2, 54),
104 OPC_SHR_B
= _OPC(2, 55),
105 OPC_ASHR_B
= _OPC(2, 56),
106 OPC_BARY_F
= _OPC(2, 57),
107 OPC_MGEN_B
= _OPC(2, 58),
108 OPC_GETBIT_B
= _OPC(2, 59),
109 OPC_SETRM
= _OPC(2, 60),
110 OPC_CBITS_B
= _OPC(2, 61),
111 OPC_SHB
= _OPC(2, 62),
112 OPC_MSAD
= _OPC(2, 63),
115 OPC_MAD_U16
= _OPC(3, 0),
116 OPC_MADSH_U16
= _OPC(3, 1),
117 OPC_MAD_S16
= _OPC(3, 2),
118 OPC_MADSH_M16
= _OPC(3, 3), /* should this be .s16? */
119 OPC_MAD_U24
= _OPC(3, 4),
120 OPC_MAD_S24
= _OPC(3, 5),
121 OPC_MAD_F16
= _OPC(3, 6),
122 OPC_MAD_F32
= _OPC(3, 7),
123 OPC_SEL_B16
= _OPC(3, 8),
124 OPC_SEL_B32
= _OPC(3, 9),
125 OPC_SEL_S16
= _OPC(3, 10),
126 OPC_SEL_S32
= _OPC(3, 11),
127 OPC_SEL_F16
= _OPC(3, 12),
128 OPC_SEL_F32
= _OPC(3, 13),
129 OPC_SAD_S16
= _OPC(3, 14),
130 OPC_SAD_S32
= _OPC(3, 15),
133 OPC_RCP
= _OPC(4, 0),
134 OPC_RSQ
= _OPC(4, 1),
135 OPC_LOG2
= _OPC(4, 2),
136 OPC_EXP2
= _OPC(4, 3),
137 OPC_SIN
= _OPC(4, 4),
138 OPC_COS
= _OPC(4, 5),
139 OPC_SQRT
= _OPC(4, 6),
140 /* NOTE that these are 8+opc from their highp equivs, so it's possible
141 * that the high order bit in the opc field has been repurposed for
142 * half-precision use? But note that other ops (rcp/lsin/cos/sqrt)
143 * still use the same opc as highp
145 OPC_HRSQ
= _OPC(4, 9),
146 OPC_HLOG2
= _OPC(4, 10),
147 OPC_HEXP2
= _OPC(4, 11),
150 OPC_ISAM
= _OPC(5, 0),
151 OPC_ISAML
= _OPC(5, 1),
152 OPC_ISAMM
= _OPC(5, 2),
153 OPC_SAM
= _OPC(5, 3),
154 OPC_SAMB
= _OPC(5, 4),
155 OPC_SAML
= _OPC(5, 5),
156 OPC_SAMGQ
= _OPC(5, 6),
157 OPC_GETLOD
= _OPC(5, 7),
158 OPC_CONV
= _OPC(5, 8),
159 OPC_CONVM
= _OPC(5, 9),
160 OPC_GETSIZE
= _OPC(5, 10),
161 OPC_GETBUF
= _OPC(5, 11),
162 OPC_GETPOS
= _OPC(5, 12),
163 OPC_GETINFO
= _OPC(5, 13),
164 OPC_DSX
= _OPC(5, 14),
165 OPC_DSY
= _OPC(5, 15),
166 OPC_GATHER4R
= _OPC(5, 16),
167 OPC_GATHER4G
= _OPC(5, 17),
168 OPC_GATHER4B
= _OPC(5, 18),
169 OPC_GATHER4A
= _OPC(5, 19),
170 OPC_SAMGP0
= _OPC(5, 20),
171 OPC_SAMGP1
= _OPC(5, 21),
172 OPC_SAMGP2
= _OPC(5, 22),
173 OPC_SAMGP3
= _OPC(5, 23),
174 OPC_DSXPP_1
= _OPC(5, 24),
175 OPC_DSYPP_1
= _OPC(5, 25),
176 OPC_RGETPOS
= _OPC(5, 26),
177 OPC_RGETINFO
= _OPC(5, 27),
180 OPC_LDG
= _OPC(6, 0), /* load-global */
181 OPC_LDL
= _OPC(6, 1),
182 OPC_LDP
= _OPC(6, 2),
183 OPC_STG
= _OPC(6, 3), /* store-global */
184 OPC_STL
= _OPC(6, 4),
185 OPC_STP
= _OPC(6, 5),
186 OPC_LDIB
= _OPC(6, 6),
187 OPC_G2L
= _OPC(6, 7),
188 OPC_L2G
= _OPC(6, 8),
189 OPC_PREFETCH
= _OPC(6, 9),
190 OPC_LDLW
= _OPC(6, 10),
191 OPC_STLW
= _OPC(6, 11),
192 OPC_RESFMT
= _OPC(6, 14),
193 OPC_RESINFO
= _OPC(6, 15),
194 OPC_ATOMIC_ADD
= _OPC(6, 16),
195 OPC_ATOMIC_SUB
= _OPC(6, 17),
196 OPC_ATOMIC_XCHG
= _OPC(6, 18),
197 OPC_ATOMIC_INC
= _OPC(6, 19),
198 OPC_ATOMIC_DEC
= _OPC(6, 20),
199 OPC_ATOMIC_CMPXCHG
= _OPC(6, 21),
200 OPC_ATOMIC_MIN
= _OPC(6, 22),
201 OPC_ATOMIC_MAX
= _OPC(6, 23),
202 OPC_ATOMIC_AND
= _OPC(6, 24),
203 OPC_ATOMIC_OR
= _OPC(6, 25),
204 OPC_ATOMIC_XOR
= _OPC(6, 26),
205 OPC_LDGB
= _OPC(6, 27),
206 OPC_STGB
= _OPC(6, 28),
207 OPC_STIB
= _OPC(6, 29),
208 OPC_LDC
= _OPC(6, 30),
209 OPC_LDLV
= _OPC(6, 31),
212 OPC_BAR
= _OPC(7, 0),
213 OPC_FENCE
= _OPC(7, 1),
215 /* meta instructions (category -1): */
216 /* placeholder instr to mark shader inputs: */
217 OPC_META_INPUT
= _OPC(-1, 0),
218 /* The "collect" and "split" instructions are used for keeping
219 * track of instructions that write to multiple dst registers
220 * (split) like texture sample instructions, or read multiple
221 * consecutive scalar registers (collect) (bary.f, texture samp)
223 * A "split" extracts a scalar component from a vecN, and a
224 * "collect" gathers multiple scalar components into a vecN
226 OPC_META_SPLIT
= _OPC(-1, 2),
227 OPC_META_COLLECT
= _OPC(-1, 3),
229 /* placeholder for texture fetches that run before FS invocation
232 OPC_META_TEX_PREFETCH
= _OPC(-1, 4),
236 #define opc_cat(opc) ((int)((opc) >> NOPC_BITS))
237 #define opc_op(opc) ((unsigned)((opc) & ((1 << NOPC_BITS) - 1)))
247 TYPE_S8
= 7, // XXX I assume?
250 static inline uint32_t type_size(type_t type
)
265 assert(0); /* invalid type */
270 static inline int type_float(type_t type
)
272 return (type
== TYPE_F32
) || (type
== TYPE_F16
);
275 static inline int type_uint(type_t type
)
277 return (type
== TYPE_U32
) || (type
== TYPE_U16
) || (type
== TYPE_U8
);
280 static inline int type_sint(type_t type
)
282 return (type
== TYPE_S32
) || (type
== TYPE_S16
) || (type
== TYPE_S8
);
285 typedef union PACKED
{
286 /* normal gpr or const src register: */
291 /* for immediate val: */
292 int32_t iim_val
: 11;
293 /* to make compiler happy: */
295 uint32_t dummy10
: 10;
296 int32_t idummy10
: 10;
297 uint32_t dummy11
: 11;
298 uint32_t dummy12
: 12;
299 uint32_t dummy13
: 13;
301 int32_t idummy13
: 13;
305 /* special registers: */
306 #define REG_A0 61 /* address register */
307 #define REG_P0 62 /* predicate register */
309 static inline int reg_special(reg_t reg
)
311 return (reg
.num
== REG_A0
) || (reg
.num
== REG_P0
);
314 typedef struct PACKED
{
319 uint32_t dummy1
: 16;
323 uint32_t dummy1
: 12;
339 uint32_t jmp_tgt
: 1;
341 uint32_t opc_cat
: 3;
344 typedef struct PACKED
{
347 /* for normal src register: */
350 /* at least low bit of pad must be zero or it will
351 * look like a address relative src
355 /* for address relative: */
358 uint32_t src_rel_c
: 1;
359 uint32_t src_rel
: 1;
360 uint32_t unknown
: 20;
374 uint32_t dst_type
: 3;
375 uint32_t dst_rel
: 1;
376 uint32_t src_type
: 3;
380 uint32_t pos_inf
: 1;
381 uint32_t must_be_0
: 2;
382 uint32_t jmp_tgt
: 1;
384 uint32_t opc_cat
: 3;
387 typedef struct PACKED
{
392 uint32_t must_be_zero1
: 2;
393 uint32_t src1_im
: 1; /* immediate */
394 uint32_t src1_neg
: 1; /* negate */
395 uint32_t src1_abs
: 1; /* absolute value */
399 uint32_t src1_c
: 1; /* relative-const */
400 uint32_t src1_rel
: 1; /* relative address */
401 uint32_t must_be_zero
: 1;
406 uint32_t src1_c
: 1; /* const */
414 uint32_t must_be_zero2
: 2;
415 uint32_t src2_im
: 1; /* immediate */
416 uint32_t src2_neg
: 1; /* negate */
417 uint32_t src2_abs
: 1; /* absolute value */
421 uint32_t src2_c
: 1; /* relative-const */
422 uint32_t src2_rel
: 1; /* relative address */
423 uint32_t must_be_zero
: 1;
428 uint32_t src2_c
: 1; /* const */
437 uint32_t src1_r
: 1; /* doubles as nop0 if repeat==0 */
439 uint32_t ul
: 1; /* dunno */
440 uint32_t dst_half
: 1; /* or widen/narrow.. ie. dst hrN <-> rN */
443 uint32_t src2_r
: 1; /* doubles as nop1 if repeat==0 */
444 uint32_t full
: 1; /* not half */
446 uint32_t jmp_tgt
: 1;
448 uint32_t opc_cat
: 3;
451 typedef struct PACKED
{
456 uint32_t must_be_zero1
: 2;
458 uint32_t src1_neg
: 1;
459 uint32_t src2_r
: 1; /* doubles as nop1 if repeat==0 */
464 uint32_t src1_rel
: 1;
465 uint32_t must_be_zero
: 1;
478 uint32_t must_be_zero2
: 2;
480 uint32_t src2_neg
: 1;
481 uint32_t src3_neg
: 1;
486 uint32_t src3_rel
: 1;
487 uint32_t must_be_zero
: 1;
501 uint32_t src1_r
: 1; /* doubles as nop0 if repeat==0 */
504 uint32_t dst_half
: 1; /* or widen/narrow.. ie. dst hrN <-> rN */
507 uint32_t jmp_tgt
: 1;
509 uint32_t opc_cat
: 3;
512 static inline bool instr_cat3_full(instr_cat3_t
*cat3
)
514 switch (_OPC(3, cat3
->opc
)) {
522 case OPC_SAD_S32
: // really??
529 typedef struct PACKED
{
534 uint32_t must_be_zero1
: 2;
535 uint32_t src_im
: 1; /* immediate */
536 uint32_t src_neg
: 1; /* negate */
537 uint32_t src_abs
: 1; /* absolute value */
541 uint32_t src_c
: 1; /* relative-const */
542 uint32_t src_rel
: 1; /* relative address */
543 uint32_t must_be_zero
: 1;
548 uint32_t src_c
: 1; /* const */
552 uint32_t dummy1
: 16; /* seem to be ignored */
561 uint32_t dst_half
: 1; /* or widen/narrow.. ie. dst hrN <-> rN */
562 uint32_t dummy2
: 5; /* seem to be ignored */
563 uint32_t full
: 1; /* not half */
565 uint32_t jmp_tgt
: 1;
567 uint32_t opc_cat
: 3;
570 /* With is_bindless_s2en = 1, this determines whether bindless is enabled and
571 * if so, how to get the (base, index) pair for both sampler and texture.
572 * There is a single base embedded in the instruction, which is always used
576 /* Use traditional GL binding model, get texture and sampler index
577 * from src3 which is not presumed to be uniform. This is
578 * backwards-compatible with earlier generations, where this field was
579 * always 0 and nonuniform-indexed sampling always worked.
583 /* The sampler base comes from the low 3 bits of a1.x, and the sampler
584 * and texture index come from src3 which is presumed to be uniform.
586 CAT5_BINDLESS_A1_UNIFORM
= 1,
588 /* The texture and sampler share the same base, and the sampler and
589 * texture index come from src3 which is *not* presumed to be uniform.
591 CAT5_BINDLESS_NONUNIFORM
= 2,
593 /* The sampler base comes from the low 3 bits of a1.x, and the sampler
594 * and texture index come from src3 which is *not* presumed to be
597 CAT5_BINDLESS_A1_NONUNIFORM
= 3,
599 /* Use traditional GL binding model, get texture and sampler index
600 * from src3 which is presumed to be uniform.
604 /* The texture and sampler share the same base, and the sampler and
605 * texture index come from src3 which is presumed to be uniform.
607 CAT5_BINDLESS_UNIFORM
= 5,
609 /* The texture and sampler share the same base, get sampler index from low
610 * 4 bits of src3 and texture index from high 4 bits.
612 CAT5_BINDLESS_IMM
= 6,
614 /* The sampler base comes from the low 3 bits of a1.x, and the texture
615 * index comes from the next 8 bits of a1.x. The sampler index is an
618 CAT5_BINDLESS_A1_IMM
= 7,
621 typedef struct PACKED
{
626 uint32_t full
: 1; /* not half */
629 uint32_t dummy1
: 4; /* seem to be ignored */
635 uint32_t full
: 1; /* not half */
639 uint32_t base_hi
: 2;
641 uint32_t desc_mode
: 3;
643 /* same in either case: */
644 // XXX I think, confirm this
646 uint32_t full
: 1; /* not half */
655 uint32_t wrmask
: 4; /* write-mask */
657 uint32_t base_lo
: 1; /* used with bindless */
662 uint32_t is_s2en_bindless
: 1;
667 uint32_t jmp_tgt
: 1;
669 uint32_t opc_cat
: 3;
672 /* dword0 encoding for src_off: [src1 + off], src2: */
673 typedef struct PACKED
{
675 uint32_t mustbe1
: 1;
678 uint32_t src1_im
: 1;
679 uint32_t src2_im
: 1;
686 /* dword0 encoding for !src_off: [src1], src2 */
687 typedef struct PACKED
{
689 uint32_t mustbe0
: 1;
691 uint32_t ignore0
: 8;
692 uint32_t src1_im
: 1;
693 uint32_t src2_im
: 1;
700 /* dword1 encoding for dst_off: */
701 typedef struct PACKED
{
705 /* note: there is some weird stuff going on where sometimes
706 * cat6->a.off is involved.. but that seems like a bug in
707 * the blob, since it is used even if !cat6->src_off
708 * It would make sense for there to be some more bits to
709 * bring us to 11 bits worth of offset, but not sure..
712 uint32_t mustbe1
: 1;
717 /* dword1 encoding for !dst_off: */
718 typedef struct PACKED
{
723 uint32_t mustbe0
: 1;
728 /* ldgb and atomics..
730 * ldgb: pad0=0, pad3=1
731 * atomic .g: pad0=1, pad3=1
734 typedef struct PACKED
{
740 uint32_t type_size
: 2;
742 uint32_t src1_im
: 1;
743 uint32_t src2_im
: 1;
748 uint32_t mustbe0
: 1;
749 uint32_t src_ssbo
: 8;
750 uint32_t pad2
: 3; // type
753 uint32_t pad4
: 10; // opc/jmp_tgt/sync/opc_cat
756 /* stgb, pad0=0, pad3=2
758 typedef struct PACKED
{
760 uint32_t mustbe1
: 1; // ???
764 uint32_t type_size
: 2;
766 uint32_t src2_im
: 1;
771 uint32_t src3_im
: 1;
772 uint32_t dst_ssbo
: 8;
773 uint32_t pad2
: 3; // type
775 uint32_t pad4
: 10; // opc/jmp_tgt/sync/opc_cat
778 typedef union PACKED
{
783 instr_cat6ldgb_t ldgb
;
784 instr_cat6stgb_t stgb
;
787 uint32_t src_off
: 1;
792 uint32_t dst_off
: 1;
795 uint32_t g
: 1; /* or in some cases it means dst immed */
798 uint32_t jmp_tgt
: 1;
800 uint32_t opc_cat
: 3;
804 /* Similar to cat5_desc_mode_t, describes how the descriptor is loaded.
807 /* Use old GL binding model with an immediate index.
808 * TODO: find CAT6_UNIFORM and CAT6_NONUNIFORM
812 /* Use the bindless model, with an immediate index.
814 CAT6_BINDLESS_IMM
= 4,
816 /* Use the bindless model, with a uniform register index.
818 CAT6_BINDLESS_UNIFORM
= 5,
820 /* Use the bindless model, with a register index that isn't guaranteed
821 * to be uniform. This presumably checks if the indices are equal and
822 * splits up the load/store, because it works the way you would
825 CAT6_BINDLESS_NONUNIFORM
= 6,
829 * For atomic ops (which return a value):
831 * pad1=1, pad3=c, pad5=3
832 * src1 - vecN offset/coords
833 * src2.x - is actually dest register
834 * src2.y - is 'data' except for cmpxchg where src2.y is 'compare'
835 * and src2.z is 'data'
837 * For stib (which does not return a value):
838 * pad1=0, pad3=c, pad5=2
839 * src1 - vecN offset/coords
840 * src2 - value to store
843 * pad1=1, pad3=c, pad5=2
844 * src1 - vecN offset/coords
846 * for ldc (load from UBO using descriptor):
847 * pad1=0, pad3=8, pad5=2
849 * pad2 and pad5 are only observed to be 0.
851 typedef struct PACKED
{
856 uint32_t desc_mode
: 3;
859 uint32_t type_size
: 2;
862 uint32_t src1
: 8; /* coordinate/offset */
865 uint32_t src2
: 8; /* or the dst for load instructions */
866 uint32_t pad4
: 1; //mustbe0 ??
867 uint32_t ssbo
: 8; /* ssbo/image binding point */
870 uint32_t jmp_tgt
: 1;
872 uint32_t opc_cat
: 3;
875 typedef struct PACKED
{
881 uint32_t ss
: 1; /* maybe in the encoding, but blob only uses (sy) */
883 uint32_t w
: 1; /* write */
884 uint32_t r
: 1; /* read */
885 uint32_t l
: 1; /* local */
886 uint32_t g
: 1; /* global */
887 uint32_t opc
: 4; /* presumed, but only a couple known OPCs */
888 uint32_t jmp_tgt
: 1; /* (jp) */
889 uint32_t sync
: 1; /* (sy) */
890 uint32_t opc_cat
: 3;
893 typedef union PACKED
{
901 instr_cat6_a6xx_t cat6_a6xx
;
909 uint32_t ss
: 1; /* cat1-cat4 (cat0??) and cat7 (?) */
910 uint32_t ul
: 1; /* cat2-cat4 (and cat1 in blob.. which may be bug??) */
912 uint32_t jmp_tgt
: 1;
914 uint32_t opc_cat
: 3;
919 static inline uint32_t instr_repeat(instr_t
*instr
)
921 switch (instr
->opc_cat
) {
922 case 0: return instr
->cat0
.repeat
;
923 case 1: return instr
->cat1
.repeat
;
924 case 2: return instr
->cat2
.repeat
;
925 case 3: return instr
->cat3
.repeat
;
926 case 4: return instr
->cat4
.repeat
;
931 static inline bool instr_sat(instr_t
*instr
)
933 switch (instr
->opc_cat
) {
934 case 2: return instr
->cat2
.sat
;
935 case 3: return instr
->cat3
.sat
;
936 case 4: return instr
->cat4
.sat
;
937 default: return false;
941 /* We can probably drop the gpu_id arg, but keeping it for now so we can
942 * assert if we see something we think should be new encoding on an older
945 static inline bool is_cat6_legacy(instr_t
*instr
, unsigned gpu_id
)
947 instr_cat6_a6xx_t
*cat6
= &instr
->cat6_a6xx
;
949 /* At least one of these two bits is pad in all the possible
950 * "legacy" cat6 encodings, and a analysis of all the pre-a6xx
951 * cmdstream traces I have indicates that the pad bit is zero
952 * in all cases. So we can use this to detect new encoding:
954 if ((cat6
->pad3
& 0x8) && (cat6
->pad5
& 0x2)) {
955 assert(gpu_id
>= 600);
956 assert(instr
->cat6
.opc
== 0);
963 static inline uint32_t instr_opc(instr_t
*instr
, unsigned gpu_id
)
965 switch (instr
->opc_cat
) {
966 case 0: return instr
->cat0
.opc
;
968 case 2: return instr
->cat2
.opc
;
969 case 3: return instr
->cat3
.opc
;
970 case 4: return instr
->cat4
.opc
;
971 case 5: return instr
->cat5
.opc
;
973 if (!is_cat6_legacy(instr
, gpu_id
))
974 return instr
->cat6_a6xx
.opc
;
975 return instr
->cat6
.opc
;
976 case 7: return instr
->cat7
.opc
;
981 static inline bool is_mad(opc_t opc
)
996 static inline bool is_madsh(opc_t opc
)
1007 static inline bool is_atomic(opc_t opc
)
1010 case OPC_ATOMIC_ADD
:
1011 case OPC_ATOMIC_SUB
:
1012 case OPC_ATOMIC_XCHG
:
1013 case OPC_ATOMIC_INC
:
1014 case OPC_ATOMIC_DEC
:
1015 case OPC_ATOMIC_CMPXCHG
:
1016 case OPC_ATOMIC_MIN
:
1017 case OPC_ATOMIC_MAX
:
1018 case OPC_ATOMIC_AND
:
1020 case OPC_ATOMIC_XOR
:
1027 static inline bool is_ssbo(opc_t opc
)
1041 static inline bool is_isam(opc_t opc
)
1054 static inline bool is_cat2_float(opc_t opc
)
1077 static inline bool is_cat3_float(opc_t opc
)
1090 int disasm_a3xx(uint32_t *dwords
, int sizedwords
, int level
, FILE *out
, unsigned gpu_id
);
1092 #endif /* INSTR_A3XX_H_ */