1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright (c) 2012 Rob Clark <robdclark@gmail.com>
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20bf215546Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21bf215546Sopenharmony_ci * SOFTWARE.
22bf215546Sopenharmony_ci */
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ci#ifndef INSTR_A2XX_H_
25bf215546Sopenharmony_ci#define INSTR_A2XX_H_
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ci#define PACKED __attribute__((__packed__))
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ci#include "util/u_math.h"
30bf215546Sopenharmony_ci#include "adreno_common.xml.h"
31bf215546Sopenharmony_ci#include "adreno_pm4.xml.h"
32bf215546Sopenharmony_ci#include "a2xx.xml.h"
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci/*
35bf215546Sopenharmony_ci * ALU instructions:
36bf215546Sopenharmony_ci */
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_citypedef enum {
39bf215546Sopenharmony_ci   ADDs = 0,
40bf215546Sopenharmony_ci   ADD_PREVs = 1,
41bf215546Sopenharmony_ci   MULs = 2,
42bf215546Sopenharmony_ci   MUL_PREVs = 3,
43bf215546Sopenharmony_ci   MUL_PREV2s = 4,
44bf215546Sopenharmony_ci   MAXs = 5,
45bf215546Sopenharmony_ci   MINs = 6,
46bf215546Sopenharmony_ci   SETEs = 7,
47bf215546Sopenharmony_ci   SETGTs = 8,
48bf215546Sopenharmony_ci   SETGTEs = 9,
49bf215546Sopenharmony_ci   SETNEs = 10,
50bf215546Sopenharmony_ci   FRACs = 11,
51bf215546Sopenharmony_ci   TRUNCs = 12,
52bf215546Sopenharmony_ci   FLOORs = 13,
53bf215546Sopenharmony_ci   EXP_IEEE = 14,
54bf215546Sopenharmony_ci   LOG_CLAMP = 15,
55bf215546Sopenharmony_ci   LOG_IEEE = 16,
56bf215546Sopenharmony_ci   RECIP_CLAMP = 17,
57bf215546Sopenharmony_ci   RECIP_FF = 18,
58bf215546Sopenharmony_ci   RECIP_IEEE = 19,
59bf215546Sopenharmony_ci   RECIPSQ_CLAMP = 20,
60bf215546Sopenharmony_ci   RECIPSQ_FF = 21,
61bf215546Sopenharmony_ci   RECIPSQ_IEEE = 22,
62bf215546Sopenharmony_ci   MOVAs = 23,
63bf215546Sopenharmony_ci   MOVA_FLOORs = 24,
64bf215546Sopenharmony_ci   SUBs = 25,
65bf215546Sopenharmony_ci   SUB_PREVs = 26,
66bf215546Sopenharmony_ci   PRED_SETEs = 27,
67bf215546Sopenharmony_ci   PRED_SETNEs = 28,
68bf215546Sopenharmony_ci   PRED_SETGTs = 29,
69bf215546Sopenharmony_ci   PRED_SETGTEs = 30,
70bf215546Sopenharmony_ci   PRED_SET_INVs = 31,
71bf215546Sopenharmony_ci   PRED_SET_POPs = 32,
72bf215546Sopenharmony_ci   PRED_SET_CLRs = 33,
73bf215546Sopenharmony_ci   PRED_SET_RESTOREs = 34,
74bf215546Sopenharmony_ci   KILLEs = 35,
75bf215546Sopenharmony_ci   KILLGTs = 36,
76bf215546Sopenharmony_ci   KILLGTEs = 37,
77bf215546Sopenharmony_ci   KILLNEs = 38,
78bf215546Sopenharmony_ci   KILLONEs = 39,
79bf215546Sopenharmony_ci   SQRT_IEEE = 40,
80bf215546Sopenharmony_ci   MUL_CONST_0 = 42,
81bf215546Sopenharmony_ci   MUL_CONST_1 = 43,
82bf215546Sopenharmony_ci   ADD_CONST_0 = 44,
83bf215546Sopenharmony_ci   ADD_CONST_1 = 45,
84bf215546Sopenharmony_ci   SUB_CONST_0 = 46,
85bf215546Sopenharmony_ci   SUB_CONST_1 = 47,
86bf215546Sopenharmony_ci   SIN = 48,
87bf215546Sopenharmony_ci   COS = 49,
88bf215546Sopenharmony_ci   RETAIN_PREV = 50,
89bf215546Sopenharmony_ci   SCALAR_NONE = 63,
90bf215546Sopenharmony_ci} instr_scalar_opc_t;
91bf215546Sopenharmony_ci
92bf215546Sopenharmony_citypedef enum {
93bf215546Sopenharmony_ci   ADDv = 0,
94bf215546Sopenharmony_ci   MULv = 1,
95bf215546Sopenharmony_ci   MAXv = 2,
96bf215546Sopenharmony_ci   MINv = 3,
97bf215546Sopenharmony_ci   SETEv = 4,
98bf215546Sopenharmony_ci   SETGTv = 5,
99bf215546Sopenharmony_ci   SETGTEv = 6,
100bf215546Sopenharmony_ci   SETNEv = 7,
101bf215546Sopenharmony_ci   FRACv = 8,
102bf215546Sopenharmony_ci   TRUNCv = 9,
103bf215546Sopenharmony_ci   FLOORv = 10,
104bf215546Sopenharmony_ci   MULADDv = 11,
105bf215546Sopenharmony_ci   CNDEv = 12,
106bf215546Sopenharmony_ci   CNDGTEv = 13,
107bf215546Sopenharmony_ci   CNDGTv = 14,
108bf215546Sopenharmony_ci   DOT4v = 15,
109bf215546Sopenharmony_ci   DOT3v = 16,
110bf215546Sopenharmony_ci   DOT2ADDv = 17,
111bf215546Sopenharmony_ci   CUBEv = 18,
112bf215546Sopenharmony_ci   MAX4v = 19,
113bf215546Sopenharmony_ci   PRED_SETE_PUSHv = 20,
114bf215546Sopenharmony_ci   PRED_SETNE_PUSHv = 21,
115bf215546Sopenharmony_ci   PRED_SETGT_PUSHv = 22,
116bf215546Sopenharmony_ci   PRED_SETGTE_PUSHv = 23,
117bf215546Sopenharmony_ci   KILLEv = 24,
118bf215546Sopenharmony_ci   KILLGTv = 25,
119bf215546Sopenharmony_ci   KILLGTEv = 26,
120bf215546Sopenharmony_ci   KILLNEv = 27,
121bf215546Sopenharmony_ci   DSTv = 28,
122bf215546Sopenharmony_ci   MOVAv = 29,
123bf215546Sopenharmony_ci   VECTOR_NONE = 31,
124bf215546Sopenharmony_ci} instr_vector_opc_t;
125bf215546Sopenharmony_ci
126bf215546Sopenharmony_citypedef struct PACKED {
127bf215546Sopenharmony_ci   /* dword0: */
128bf215546Sopenharmony_ci   uint8_t vector_dest : 6;
129bf215546Sopenharmony_ci   uint8_t vector_dest_rel : 1;
130bf215546Sopenharmony_ci   uint8_t low_precision_16b_fp : 1;
131bf215546Sopenharmony_ci   uint8_t scalar_dest : 6;
132bf215546Sopenharmony_ci   uint8_t scalar_dest_rel : 1;
133bf215546Sopenharmony_ci   uint8_t export_data : 1;
134bf215546Sopenharmony_ci   uint8_t vector_write_mask : 4;
135bf215546Sopenharmony_ci   uint8_t scalar_write_mask : 4;
136bf215546Sopenharmony_ci   uint8_t vector_clamp : 1;
137bf215546Sopenharmony_ci   uint8_t scalar_clamp : 1;
138bf215546Sopenharmony_ci   instr_scalar_opc_t scalar_opc : 6;
139bf215546Sopenharmony_ci   /* dword1: */
140bf215546Sopenharmony_ci   uint8_t src3_swiz : 8;
141bf215546Sopenharmony_ci   uint8_t src2_swiz : 8;
142bf215546Sopenharmony_ci   uint8_t src1_swiz : 8;
143bf215546Sopenharmony_ci   uint8_t src3_reg_negate : 1;
144bf215546Sopenharmony_ci   uint8_t src2_reg_negate : 1;
145bf215546Sopenharmony_ci   uint8_t src1_reg_negate : 1;
146bf215546Sopenharmony_ci   uint8_t pred_select : 2;
147bf215546Sopenharmony_ci   uint8_t relative_addr : 1;
148bf215546Sopenharmony_ci   uint8_t const_1_rel_abs : 1;
149bf215546Sopenharmony_ci   uint8_t const_0_rel_abs : 1;
150bf215546Sopenharmony_ci   /* dword2: */
151bf215546Sopenharmony_ci   union {
152bf215546Sopenharmony_ci      struct {
153bf215546Sopenharmony_ci         uint8_t src3_reg : 6;
154bf215546Sopenharmony_ci         uint8_t src3_reg_select : 1;
155bf215546Sopenharmony_ci         uint8_t src3_reg_abs : 1;
156bf215546Sopenharmony_ci         uint8_t src2_reg : 6;
157bf215546Sopenharmony_ci         uint8_t src2_reg_select : 1;
158bf215546Sopenharmony_ci         uint8_t src2_reg_abs : 1;
159bf215546Sopenharmony_ci         uint8_t src1_reg : 6;
160bf215546Sopenharmony_ci         uint8_t src1_reg_select : 1;
161bf215546Sopenharmony_ci         uint8_t src1_reg_abs : 1;
162bf215546Sopenharmony_ci      };
163bf215546Sopenharmony_ci      /* constants have full 8-bit index */
164bf215546Sopenharmony_ci      struct {
165bf215546Sopenharmony_ci         uint8_t src3_reg_byte : 8;
166bf215546Sopenharmony_ci         uint8_t src2_reg_byte : 8;
167bf215546Sopenharmony_ci         uint8_t src1_reg_byte : 8;
168bf215546Sopenharmony_ci      };
169bf215546Sopenharmony_ci   };
170bf215546Sopenharmony_ci   instr_vector_opc_t vector_opc : 5;
171bf215546Sopenharmony_ci   uint8_t src3_sel : 1;
172bf215546Sopenharmony_ci   uint8_t src2_sel : 1;
173bf215546Sopenharmony_ci   uint8_t src1_sel : 1;
174bf215546Sopenharmony_ci} instr_alu_t;
175bf215546Sopenharmony_ci
176bf215546Sopenharmony_ci/*
177bf215546Sopenharmony_ci * CF instructions:
178bf215546Sopenharmony_ci */
179bf215546Sopenharmony_ci
180bf215546Sopenharmony_citypedef enum {
181bf215546Sopenharmony_ci   NOP = 0,
182bf215546Sopenharmony_ci   EXEC = 1,
183bf215546Sopenharmony_ci   EXEC_END = 2,
184bf215546Sopenharmony_ci   COND_EXEC = 3,
185bf215546Sopenharmony_ci   COND_EXEC_END = 4,
186bf215546Sopenharmony_ci   COND_PRED_EXEC = 5,
187bf215546Sopenharmony_ci   COND_PRED_EXEC_END = 6,
188bf215546Sopenharmony_ci   LOOP_START = 7,
189bf215546Sopenharmony_ci   LOOP_END = 8,
190bf215546Sopenharmony_ci   COND_CALL = 9,
191bf215546Sopenharmony_ci   RETURN = 10,
192bf215546Sopenharmony_ci   COND_JMP = 11,
193bf215546Sopenharmony_ci   ALLOC = 12,
194bf215546Sopenharmony_ci   COND_EXEC_PRED_CLEAN = 13,
195bf215546Sopenharmony_ci   COND_EXEC_PRED_CLEAN_END = 14,
196bf215546Sopenharmony_ci   MARK_VS_FETCH_DONE = 15,
197bf215546Sopenharmony_ci} instr_cf_opc_t;
198bf215546Sopenharmony_ci
199bf215546Sopenharmony_citypedef enum {
200bf215546Sopenharmony_ci   RELATIVE_ADDR = 0,
201bf215546Sopenharmony_ci   ABSOLUTE_ADDR = 1,
202bf215546Sopenharmony_ci} instr_addr_mode_t;
203bf215546Sopenharmony_ci
204bf215546Sopenharmony_citypedef enum {
205bf215546Sopenharmony_ci   SQ_NO_ALLOC = 0,
206bf215546Sopenharmony_ci   SQ_POSITION = 1,
207bf215546Sopenharmony_ci   SQ_PARAMETER_PIXEL = 2,
208bf215546Sopenharmony_ci   SQ_MEMORY = 3,
209bf215546Sopenharmony_ci} instr_alloc_type_t;
210bf215546Sopenharmony_ci
211bf215546Sopenharmony_citypedef struct PACKED {
212bf215546Sopenharmony_ci   uint16_t address : 9;
213bf215546Sopenharmony_ci   uint8_t reserved0 : 3;
214bf215546Sopenharmony_ci   uint8_t count : 3;
215bf215546Sopenharmony_ci   uint8_t yeild : 1;
216bf215546Sopenharmony_ci   uint16_t serialize : 12;
217bf215546Sopenharmony_ci   uint32_t vc : 6; /* vertex cache? */
218bf215546Sopenharmony_ci   uint32_t bool_addr : 8;
219bf215546Sopenharmony_ci   uint8_t condition : 1;
220bf215546Sopenharmony_ci   instr_addr_mode_t address_mode : 1;
221bf215546Sopenharmony_ci   instr_cf_opc_t opc : 4;
222bf215546Sopenharmony_ci} instr_cf_exec_t;
223bf215546Sopenharmony_ci
224bf215546Sopenharmony_citypedef struct PACKED {
225bf215546Sopenharmony_ci   uint16_t address : 10;
226bf215546Sopenharmony_ci   uint8_t reserved0 : 6;
227bf215546Sopenharmony_ci   uint8_t loop_id : 5;
228bf215546Sopenharmony_ci   uint32_t reserved1 : 22;
229bf215546Sopenharmony_ci   instr_addr_mode_t address_mode : 1;
230bf215546Sopenharmony_ci   instr_cf_opc_t opc : 4;
231bf215546Sopenharmony_ci} instr_cf_loop_t;
232bf215546Sopenharmony_ci
233bf215546Sopenharmony_citypedef struct PACKED {
234bf215546Sopenharmony_ci   uint16_t address : 10;
235bf215546Sopenharmony_ci   uint8_t reserved0 : 3;
236bf215546Sopenharmony_ci   uint8_t force_call : 1;
237bf215546Sopenharmony_ci   uint8_t predicated_jmp : 1;
238bf215546Sopenharmony_ci   uint32_t reserved1 : 18;
239bf215546Sopenharmony_ci   uint8_t direction : 1;
240bf215546Sopenharmony_ci   uint32_t bool_addr : 8;
241bf215546Sopenharmony_ci   uint8_t condition : 1;
242bf215546Sopenharmony_ci   instr_addr_mode_t address_mode : 1;
243bf215546Sopenharmony_ci   instr_cf_opc_t opc : 4;
244bf215546Sopenharmony_ci} instr_cf_jmp_call_t;
245bf215546Sopenharmony_ci
246bf215546Sopenharmony_citypedef struct PACKED {
247bf215546Sopenharmony_ci   uint8_t size : 4;
248bf215546Sopenharmony_ci   uint64_t reserved0 : 36;
249bf215546Sopenharmony_ci   uint8_t no_serial : 1;
250bf215546Sopenharmony_ci   instr_alloc_type_t buffer_select : 2;
251bf215546Sopenharmony_ci   uint8_t alloc_mode : 1;
252bf215546Sopenharmony_ci   instr_cf_opc_t opc : 4;
253bf215546Sopenharmony_ci} instr_cf_alloc_t;
254bf215546Sopenharmony_ci
255bf215546Sopenharmony_citypedef union PACKED {
256bf215546Sopenharmony_ci   instr_cf_exec_t exec;
257bf215546Sopenharmony_ci   instr_cf_loop_t loop;
258bf215546Sopenharmony_ci   instr_cf_jmp_call_t jmp_call;
259bf215546Sopenharmony_ci   instr_cf_alloc_t alloc;
260bf215546Sopenharmony_ci   struct PACKED {
261bf215546Sopenharmony_ci      uint64_t dummy : 44;
262bf215546Sopenharmony_ci      instr_cf_opc_t opc : 4;
263bf215546Sopenharmony_ci   };
264bf215546Sopenharmony_ci} instr_cf_t;
265bf215546Sopenharmony_ci
266bf215546Sopenharmony_ci/*
267bf215546Sopenharmony_ci * FETCH instructions:
268bf215546Sopenharmony_ci */
269bf215546Sopenharmony_ci
270bf215546Sopenharmony_citypedef enum {
271bf215546Sopenharmony_ci   VTX_FETCH = 0,
272bf215546Sopenharmony_ci   TEX_FETCH = 1,
273bf215546Sopenharmony_ci   TEX_GET_BORDER_COLOR_FRAC = 16,
274bf215546Sopenharmony_ci   TEX_GET_COMP_TEX_LOD = 17,
275bf215546Sopenharmony_ci   TEX_GET_GRADIENTS = 18,
276bf215546Sopenharmony_ci   TEX_GET_WEIGHTS = 19,
277bf215546Sopenharmony_ci   TEX_SET_TEX_LOD = 24,
278bf215546Sopenharmony_ci   TEX_SET_GRADIENTS_H = 25,
279bf215546Sopenharmony_ci   TEX_SET_GRADIENTS_V = 26,
280bf215546Sopenharmony_ci   TEX_RESERVED_4 = 27,
281bf215546Sopenharmony_ci} instr_fetch_opc_t;
282bf215546Sopenharmony_ci
283bf215546Sopenharmony_citypedef enum {
284bf215546Sopenharmony_ci   TEX_FILTER_POINT = 0,
285bf215546Sopenharmony_ci   TEX_FILTER_LINEAR = 1,
286bf215546Sopenharmony_ci   TEX_FILTER_BASEMAP = 2, /* only applicable for mip-filter */
287bf215546Sopenharmony_ci   TEX_FILTER_USE_FETCH_CONST = 3,
288bf215546Sopenharmony_ci} instr_tex_filter_t;
289bf215546Sopenharmony_ci
290bf215546Sopenharmony_citypedef enum {
291bf215546Sopenharmony_ci   ANISO_FILTER_DISABLED = 0,
292bf215546Sopenharmony_ci   ANISO_FILTER_MAX_1_1 = 1,
293bf215546Sopenharmony_ci   ANISO_FILTER_MAX_2_1 = 2,
294bf215546Sopenharmony_ci   ANISO_FILTER_MAX_4_1 = 3,
295bf215546Sopenharmony_ci   ANISO_FILTER_MAX_8_1 = 4,
296bf215546Sopenharmony_ci   ANISO_FILTER_MAX_16_1 = 5,
297bf215546Sopenharmony_ci   ANISO_FILTER_USE_FETCH_CONST = 7,
298bf215546Sopenharmony_ci} instr_aniso_filter_t;
299bf215546Sopenharmony_ci
300bf215546Sopenharmony_citypedef enum {
301bf215546Sopenharmony_ci   ARBITRARY_FILTER_2X4_SYM = 0,
302bf215546Sopenharmony_ci   ARBITRARY_FILTER_2X4_ASYM = 1,
303bf215546Sopenharmony_ci   ARBITRARY_FILTER_4X2_SYM = 2,
304bf215546Sopenharmony_ci   ARBITRARY_FILTER_4X2_ASYM = 3,
305bf215546Sopenharmony_ci   ARBITRARY_FILTER_4X4_SYM = 4,
306bf215546Sopenharmony_ci   ARBITRARY_FILTER_4X4_ASYM = 5,
307bf215546Sopenharmony_ci   ARBITRARY_FILTER_USE_FETCH_CONST = 7,
308bf215546Sopenharmony_ci} instr_arbitrary_filter_t;
309bf215546Sopenharmony_ci
310bf215546Sopenharmony_citypedef enum {
311bf215546Sopenharmony_ci   SAMPLE_CENTROID = 0,
312bf215546Sopenharmony_ci   SAMPLE_CENTER = 1,
313bf215546Sopenharmony_ci} instr_sample_loc_t;
314bf215546Sopenharmony_ci
315bf215546Sopenharmony_citypedef enum a2xx_sq_surfaceformat instr_surf_fmt_t;
316bf215546Sopenharmony_ci
317bf215546Sopenharmony_citypedef struct PACKED {
318bf215546Sopenharmony_ci   /* dword0: */
319bf215546Sopenharmony_ci   instr_fetch_opc_t opc : 5;
320bf215546Sopenharmony_ci   uint32_t src_reg : 6;
321bf215546Sopenharmony_ci   uint8_t src_reg_am : 1;
322bf215546Sopenharmony_ci   uint32_t dst_reg : 6;
323bf215546Sopenharmony_ci   uint8_t dst_reg_am : 1;
324bf215546Sopenharmony_ci   uint8_t fetch_valid_only : 1;
325bf215546Sopenharmony_ci   uint32_t const_idx : 5;
326bf215546Sopenharmony_ci   uint8_t tx_coord_denorm : 1;
327bf215546Sopenharmony_ci   uint8_t src_swiz : 6;
328bf215546Sopenharmony_ci   /* dword1: */
329bf215546Sopenharmony_ci   uint16_t dst_swiz : 12;
330bf215546Sopenharmony_ci   instr_tex_filter_t mag_filter : 2;
331bf215546Sopenharmony_ci   instr_tex_filter_t min_filter : 2;
332bf215546Sopenharmony_ci   instr_tex_filter_t mip_filter : 2;
333bf215546Sopenharmony_ci   instr_aniso_filter_t aniso_filter : 3;
334bf215546Sopenharmony_ci   instr_arbitrary_filter_t arbitrary_filter : 3;
335bf215546Sopenharmony_ci   instr_tex_filter_t vol_mag_filter : 2;
336bf215546Sopenharmony_ci   instr_tex_filter_t vol_min_filter : 2;
337bf215546Sopenharmony_ci   uint8_t use_comp_lod : 1;
338bf215546Sopenharmony_ci   uint8_t use_reg_lod : 2; /* 0 for cube, 1 for 2d */
339bf215546Sopenharmony_ci   uint8_t pred_select : 1;
340bf215546Sopenharmony_ci   /* dword2: */
341bf215546Sopenharmony_ci   uint8_t use_reg_gradients : 1;
342bf215546Sopenharmony_ci   instr_sample_loc_t sample_location : 1;
343bf215546Sopenharmony_ci   uint32_t lod_bias : 7;
344bf215546Sopenharmony_ci   uint8_t unused : 7;
345bf215546Sopenharmony_ci   uint8_t offset_x : 5;
346bf215546Sopenharmony_ci   uint32_t offset_y : 5;
347bf215546Sopenharmony_ci   uint8_t offset_z : 5;
348bf215546Sopenharmony_ci   uint8_t pred_condition : 1;
349bf215546Sopenharmony_ci} instr_fetch_tex_t;
350bf215546Sopenharmony_ci
351bf215546Sopenharmony_citypedef struct PACKED {
352bf215546Sopenharmony_ci   /* dword0: */
353bf215546Sopenharmony_ci   instr_fetch_opc_t opc : 5;
354bf215546Sopenharmony_ci   uint32_t src_reg : 6;
355bf215546Sopenharmony_ci   uint8_t src_reg_am : 1;
356bf215546Sopenharmony_ci   uint32_t dst_reg : 6;
357bf215546Sopenharmony_ci   uint8_t dst_reg_am : 1;
358bf215546Sopenharmony_ci   uint8_t must_be_one : 1;
359bf215546Sopenharmony_ci   uint32_t const_index : 5;
360bf215546Sopenharmony_ci   uint8_t const_index_sel : 2;
361bf215546Sopenharmony_ci   uint8_t reserved0 : 3;
362bf215546Sopenharmony_ci   uint8_t src_swiz : 2;
363bf215546Sopenharmony_ci   /* dword1: */
364bf215546Sopenharmony_ci   uint16_t dst_swiz : 12;
365bf215546Sopenharmony_ci   uint8_t format_comp_all : 1; /* '1' for signed, '0' for unsigned? */
366bf215546Sopenharmony_ci   uint8_t num_format_all : 1;  /* '0' for normalized, '1' for unnormalized */
367bf215546Sopenharmony_ci   uint8_t signed_rf_mode_all : 1;
368bf215546Sopenharmony_ci   uint8_t reserved1 : 1;
369bf215546Sopenharmony_ci   instr_surf_fmt_t format : 6;
370bf215546Sopenharmony_ci   uint8_t reserved2 : 2;
371bf215546Sopenharmony_ci   uint8_t exp_adjust_all : 6;
372bf215546Sopenharmony_ci   uint8_t reserved3 : 1;
373bf215546Sopenharmony_ci   uint8_t pred_select : 1;
374bf215546Sopenharmony_ci   /* dword2: */
375bf215546Sopenharmony_ci   uint8_t stride : 8;
376bf215546Sopenharmony_ci   uint32_t offset : 22;
377bf215546Sopenharmony_ci   uint8_t reserved4 : 1;
378bf215546Sopenharmony_ci   uint8_t pred_condition : 1;
379bf215546Sopenharmony_ci} instr_fetch_vtx_t;
380bf215546Sopenharmony_ci
381bf215546Sopenharmony_citypedef union PACKED {
382bf215546Sopenharmony_ci   instr_fetch_tex_t tex;
383bf215546Sopenharmony_ci   instr_fetch_vtx_t vtx;
384bf215546Sopenharmony_ci   struct PACKED {
385bf215546Sopenharmony_ci      /* dword0: */
386bf215546Sopenharmony_ci      instr_fetch_opc_t opc : 5;
387bf215546Sopenharmony_ci      uint32_t dummy0 : 27;
388bf215546Sopenharmony_ci      /* dword1: */
389bf215546Sopenharmony_ci      uint32_t dummy1 : 31;
390bf215546Sopenharmony_ci      uint8_t pred_select : 1;
391bf215546Sopenharmony_ci      /* dword2: */
392bf215546Sopenharmony_ci      uint32_t dummy2 : 31;
393bf215546Sopenharmony_ci      uint8_t pred_condition : 1;
394bf215546Sopenharmony_ci   };
395bf215546Sopenharmony_ci} instr_fetch_t;
396bf215546Sopenharmony_ci
397bf215546Sopenharmony_citypedef union PACKED {
398bf215546Sopenharmony_ci   instr_alu_t alu;
399bf215546Sopenharmony_ci   instr_fetch_t fetch;
400bf215546Sopenharmony_ci} instr_t;
401bf215546Sopenharmony_ci
402bf215546Sopenharmony_ci#endif /* INSTR_H_ */
403