1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
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 * on the rights to use, copy, modify, merge, publish, distribute, sub
8bf215546Sopenharmony_ci * license, and/or sell copies of the Software, and to permit persons to whom
9bf215546Sopenharmony_ci * the 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 NON-INFRINGEMENT. IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE.
22bf215546Sopenharmony_ci */
23bf215546Sopenharmony_ci#ifndef R600_ASM_H
24bf215546Sopenharmony_ci#define R600_ASM_H
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_ci#include "r600_pipe.h"
27bf215546Sopenharmony_ci#include "r600_isa.h"
28bf215546Sopenharmony_ci#include "tgsi/tgsi_exec.h"
29bf215546Sopenharmony_ci
30bf215546Sopenharmony_ci#ifdef __cplusplus
31bf215546Sopenharmony_ciextern "C" {
32bf215546Sopenharmony_ci#endif
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_cistruct r600_bytecode_alu_src {
35bf215546Sopenharmony_ci	unsigned			sel;
36bf215546Sopenharmony_ci	unsigned			chan;
37bf215546Sopenharmony_ci	unsigned			neg;
38bf215546Sopenharmony_ci	unsigned			abs;
39bf215546Sopenharmony_ci	unsigned			rel;
40bf215546Sopenharmony_ci	unsigned			kc_bank;
41bf215546Sopenharmony_ci	unsigned			kc_rel;
42bf215546Sopenharmony_ci	uint32_t			value;
43bf215546Sopenharmony_ci};
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_cistruct r600_bytecode_alu_dst {
46bf215546Sopenharmony_ci	unsigned			sel;
47bf215546Sopenharmony_ci	unsigned			chan;
48bf215546Sopenharmony_ci	unsigned			clamp;
49bf215546Sopenharmony_ci	unsigned			write;
50bf215546Sopenharmony_ci	unsigned			rel;
51bf215546Sopenharmony_ci};
52bf215546Sopenharmony_ci
53bf215546Sopenharmony_cistruct r600_bytecode_alu {
54bf215546Sopenharmony_ci	struct list_head		list;
55bf215546Sopenharmony_ci	struct r600_bytecode_alu_src		src[3];
56bf215546Sopenharmony_ci	struct r600_bytecode_alu_dst		dst;
57bf215546Sopenharmony_ci	unsigned			op;
58bf215546Sopenharmony_ci	unsigned			last;
59bf215546Sopenharmony_ci	unsigned			is_op3;
60bf215546Sopenharmony_ci	unsigned			is_lds_idx_op;
61bf215546Sopenharmony_ci	unsigned			execute_mask;
62bf215546Sopenharmony_ci	unsigned			update_pred;
63bf215546Sopenharmony_ci	unsigned			pred_sel;
64bf215546Sopenharmony_ci	unsigned			bank_swizzle;
65bf215546Sopenharmony_ci	unsigned			bank_swizzle_force;
66bf215546Sopenharmony_ci	unsigned			omod;
67bf215546Sopenharmony_ci	unsigned                        index_mode;
68bf215546Sopenharmony_ci	unsigned                        lds_idx;
69bf215546Sopenharmony_ci};
70bf215546Sopenharmony_ci
71bf215546Sopenharmony_cistruct r600_bytecode_tex {
72bf215546Sopenharmony_ci	struct list_head		list;
73bf215546Sopenharmony_ci	unsigned			op;
74bf215546Sopenharmony_ci	unsigned			inst_mod;
75bf215546Sopenharmony_ci	unsigned			resource_id;
76bf215546Sopenharmony_ci	unsigned			src_gpr;
77bf215546Sopenharmony_ci	unsigned			src_rel;
78bf215546Sopenharmony_ci	unsigned			dst_gpr;
79bf215546Sopenharmony_ci	unsigned			dst_rel;
80bf215546Sopenharmony_ci	unsigned			dst_sel_x;
81bf215546Sopenharmony_ci	unsigned			dst_sel_y;
82bf215546Sopenharmony_ci	unsigned			dst_sel_z;
83bf215546Sopenharmony_ci	unsigned			dst_sel_w;
84bf215546Sopenharmony_ci	unsigned			lod_bias;
85bf215546Sopenharmony_ci	unsigned			coord_type_x;
86bf215546Sopenharmony_ci	unsigned			coord_type_y;
87bf215546Sopenharmony_ci	unsigned			coord_type_z;
88bf215546Sopenharmony_ci	unsigned			coord_type_w;
89bf215546Sopenharmony_ci	int				offset_x;
90bf215546Sopenharmony_ci	int				offset_y;
91bf215546Sopenharmony_ci	int				offset_z;
92bf215546Sopenharmony_ci	unsigned			sampler_id;
93bf215546Sopenharmony_ci	unsigned			src_sel_x;
94bf215546Sopenharmony_ci	unsigned			src_sel_y;
95bf215546Sopenharmony_ci	unsigned			src_sel_z;
96bf215546Sopenharmony_ci	unsigned			src_sel_w;
97bf215546Sopenharmony_ci	/* indexed samplers/resources only on evergreen/cayman */
98bf215546Sopenharmony_ci	unsigned			sampler_index_mode;
99bf215546Sopenharmony_ci	unsigned			resource_index_mode;
100bf215546Sopenharmony_ci};
101bf215546Sopenharmony_ci
102bf215546Sopenharmony_cistruct r600_bytecode_vtx {
103bf215546Sopenharmony_ci	struct list_head		list;
104bf215546Sopenharmony_ci	unsigned			op;
105bf215546Sopenharmony_ci	unsigned			fetch_type;
106bf215546Sopenharmony_ci	unsigned			buffer_id;
107bf215546Sopenharmony_ci	unsigned			src_gpr;
108bf215546Sopenharmony_ci	unsigned			src_sel_x;
109bf215546Sopenharmony_ci	unsigned			mega_fetch_count;
110bf215546Sopenharmony_ci	unsigned			dst_gpr;
111bf215546Sopenharmony_ci	unsigned			dst_sel_x;
112bf215546Sopenharmony_ci	unsigned			dst_sel_y;
113bf215546Sopenharmony_ci	unsigned			dst_sel_z;
114bf215546Sopenharmony_ci	unsigned			dst_sel_w;
115bf215546Sopenharmony_ci	unsigned			use_const_fields;
116bf215546Sopenharmony_ci	unsigned			data_format;
117bf215546Sopenharmony_ci	unsigned			num_format_all;
118bf215546Sopenharmony_ci	unsigned			format_comp_all;
119bf215546Sopenharmony_ci	unsigned			srf_mode_all;
120bf215546Sopenharmony_ci	unsigned			offset;
121bf215546Sopenharmony_ci	unsigned			endian;
122bf215546Sopenharmony_ci	unsigned			buffer_index_mode;
123bf215546Sopenharmony_ci
124bf215546Sopenharmony_ci	// READ_SCRATCH fields
125bf215546Sopenharmony_ci	unsigned			uncached;
126bf215546Sopenharmony_ci	unsigned			indexed;
127bf215546Sopenharmony_ci	unsigned			src_sel_y;
128bf215546Sopenharmony_ci	unsigned			src_rel;
129bf215546Sopenharmony_ci	unsigned			elem_size;
130bf215546Sopenharmony_ci	unsigned			array_size;
131bf215546Sopenharmony_ci	unsigned			array_base;
132bf215546Sopenharmony_ci	unsigned			burst_count;
133bf215546Sopenharmony_ci	unsigned			dst_rel;
134bf215546Sopenharmony_ci};
135bf215546Sopenharmony_ci
136bf215546Sopenharmony_cistruct r600_bytecode_gds {
137bf215546Sopenharmony_ci	struct list_head		list;
138bf215546Sopenharmony_ci	unsigned			op;
139bf215546Sopenharmony_ci	unsigned			src_gpr;
140bf215546Sopenharmony_ci	unsigned			src_rel;
141bf215546Sopenharmony_ci	unsigned			src_sel_x;
142bf215546Sopenharmony_ci	unsigned			src_sel_y;
143bf215546Sopenharmony_ci	unsigned			src_sel_z;
144bf215546Sopenharmony_ci	unsigned			src_gpr2;
145bf215546Sopenharmony_ci	unsigned			dst_gpr;
146bf215546Sopenharmony_ci	unsigned			dst_rel;
147bf215546Sopenharmony_ci	unsigned			dst_sel_x;
148bf215546Sopenharmony_ci	unsigned			dst_sel_y;
149bf215546Sopenharmony_ci	unsigned			dst_sel_z;
150bf215546Sopenharmony_ci	unsigned			dst_sel_w;
151bf215546Sopenharmony_ci	unsigned			uav_index_mode;
152bf215546Sopenharmony_ci	unsigned                        uav_id;
153bf215546Sopenharmony_ci	unsigned                        alloc_consume;
154bf215546Sopenharmony_ci	unsigned                        bcast_first_req;
155bf215546Sopenharmony_ci};
156bf215546Sopenharmony_ci
157bf215546Sopenharmony_cistruct r600_bytecode_output {
158bf215546Sopenharmony_ci	unsigned			array_base;
159bf215546Sopenharmony_ci	unsigned			array_size;
160bf215546Sopenharmony_ci	unsigned			comp_mask;
161bf215546Sopenharmony_ci	unsigned			type;
162bf215546Sopenharmony_ci
163bf215546Sopenharmony_ci	unsigned			op;
164bf215546Sopenharmony_ci
165bf215546Sopenharmony_ci	unsigned			elem_size;
166bf215546Sopenharmony_ci	unsigned			gpr;
167bf215546Sopenharmony_ci	unsigned			swizzle_x;
168bf215546Sopenharmony_ci	unsigned			swizzle_y;
169bf215546Sopenharmony_ci	unsigned			swizzle_z;
170bf215546Sopenharmony_ci	unsigned			swizzle_w;
171bf215546Sopenharmony_ci	unsigned			burst_count;
172bf215546Sopenharmony_ci	unsigned			index_gpr;
173bf215546Sopenharmony_ci	unsigned			mark; /* used by MEM_SCRATCH */
174bf215546Sopenharmony_ci};
175bf215546Sopenharmony_ci
176bf215546Sopenharmony_cistruct r600_bytecode_rat {
177bf215546Sopenharmony_ci	unsigned			id;
178bf215546Sopenharmony_ci	unsigned			inst;
179bf215546Sopenharmony_ci	unsigned			index_mode;
180bf215546Sopenharmony_ci};
181bf215546Sopenharmony_ci
182bf215546Sopenharmony_cistruct r600_bytecode_kcache {
183bf215546Sopenharmony_ci	unsigned			bank;
184bf215546Sopenharmony_ci	unsigned			mode;
185bf215546Sopenharmony_ci	unsigned			addr;
186bf215546Sopenharmony_ci	unsigned			index_mode;
187bf215546Sopenharmony_ci};
188bf215546Sopenharmony_ci
189bf215546Sopenharmony_cistruct r600_bytecode_cf {
190bf215546Sopenharmony_ci	struct list_head		list;
191bf215546Sopenharmony_ci
192bf215546Sopenharmony_ci	unsigned			op;
193bf215546Sopenharmony_ci	unsigned			addr;
194bf215546Sopenharmony_ci	unsigned			ndw;
195bf215546Sopenharmony_ci	unsigned			id;
196bf215546Sopenharmony_ci	unsigned			cond;
197bf215546Sopenharmony_ci	unsigned			pop_count;
198bf215546Sopenharmony_ci	unsigned			count;
199bf215546Sopenharmony_ci	unsigned			cf_addr; /* control flow addr */
200bf215546Sopenharmony_ci	struct r600_bytecode_kcache		kcache[4];
201bf215546Sopenharmony_ci	unsigned			r6xx_uses_waterfall;
202bf215546Sopenharmony_ci	unsigned			eg_alu_extended;
203bf215546Sopenharmony_ci	unsigned			barrier;
204bf215546Sopenharmony_ci	unsigned			end_of_program;
205bf215546Sopenharmony_ci	unsigned                        mark;
206bf215546Sopenharmony_ci	unsigned                        vpm;
207bf215546Sopenharmony_ci	struct list_head		alu;
208bf215546Sopenharmony_ci	struct list_head		tex;
209bf215546Sopenharmony_ci	struct list_head		vtx;
210bf215546Sopenharmony_ci	struct list_head		gds;
211bf215546Sopenharmony_ci	struct r600_bytecode_output		output;
212bf215546Sopenharmony_ci	struct r600_bytecode_rat		rat;
213bf215546Sopenharmony_ci	struct r600_bytecode_alu		*curr_bs_head;
214bf215546Sopenharmony_ci	struct r600_bytecode_alu		*prev_bs_head;
215bf215546Sopenharmony_ci	struct r600_bytecode_alu		*prev2_bs_head;
216bf215546Sopenharmony_ci	unsigned isa[2];
217bf215546Sopenharmony_ci	unsigned nlds_read;
218bf215546Sopenharmony_ci	unsigned nqueue_read;
219bf215546Sopenharmony_ci};
220bf215546Sopenharmony_ci
221bf215546Sopenharmony_ci#define FC_NONE				0
222bf215546Sopenharmony_ci#define FC_IF				1
223bf215546Sopenharmony_ci#define FC_LOOP				2
224bf215546Sopenharmony_ci#define FC_REP				3
225bf215546Sopenharmony_ci#define FC_PUSH_VPM			4
226bf215546Sopenharmony_ci#define FC_PUSH_WQM			5
227bf215546Sopenharmony_ci
228bf215546Sopenharmony_cistruct r600_cf_stack_entry {
229bf215546Sopenharmony_ci	int				type;
230bf215546Sopenharmony_ci	struct r600_bytecode_cf		*start;
231bf215546Sopenharmony_ci	struct r600_bytecode_cf		**mid; /* used to store the else point */
232bf215546Sopenharmony_ci	int				num_mid;
233bf215546Sopenharmony_ci};
234bf215546Sopenharmony_ci
235bf215546Sopenharmony_ci#define SQ_MAX_CALL_DEPTH 0x00000020
236bf215546Sopenharmony_ci
237bf215546Sopenharmony_ci#define AR_HANDLE_NORMAL 0
238bf215546Sopenharmony_ci#define AR_HANDLE_RV6XX 1 /* except RV670 */
239bf215546Sopenharmony_ci
240bf215546Sopenharmony_cistruct r600_stack_info {
241bf215546Sopenharmony_ci	/* current level of non-WQM PUSH operations
242bf215546Sopenharmony_ci	 * (PUSH, PUSH_ELSE, ALU_PUSH_BEFORE) */
243bf215546Sopenharmony_ci	int push;
244bf215546Sopenharmony_ci	/* current level of WQM PUSH operations
245bf215546Sopenharmony_ci	 * (PUSH, PUSH_ELSE, PUSH_WQM) */
246bf215546Sopenharmony_ci	int push_wqm;
247bf215546Sopenharmony_ci	/* current loop level */
248bf215546Sopenharmony_ci	int loop;
249bf215546Sopenharmony_ci
250bf215546Sopenharmony_ci	/* required depth */
251bf215546Sopenharmony_ci	int max_entries;
252bf215546Sopenharmony_ci	/* subentries per entry */
253bf215546Sopenharmony_ci	int entry_size;
254bf215546Sopenharmony_ci};
255bf215546Sopenharmony_ci
256bf215546Sopenharmony_cistruct r600_bytecode {
257bf215546Sopenharmony_ci	enum amd_gfx_level			gfx_level;
258bf215546Sopenharmony_ci	enum radeon_family		family;
259bf215546Sopenharmony_ci	bool				has_compressed_msaa_texturing;
260bf215546Sopenharmony_ci	int				type;
261bf215546Sopenharmony_ci	struct list_head		cf;
262bf215546Sopenharmony_ci	struct r600_bytecode_cf		*cf_last;
263bf215546Sopenharmony_ci	unsigned			ndw;
264bf215546Sopenharmony_ci	unsigned			ncf;
265bf215546Sopenharmony_ci	unsigned			nalu_groups;
266bf215546Sopenharmony_ci	unsigned			ngpr;
267bf215546Sopenharmony_ci	unsigned			nstack;
268bf215546Sopenharmony_ci	unsigned			nlds_dw;
269bf215546Sopenharmony_ci	unsigned			nresource;
270bf215546Sopenharmony_ci	unsigned			force_add_cf;
271bf215546Sopenharmony_ci	uint32_t			*bytecode;
272bf215546Sopenharmony_ci	uint32_t			fc_sp;
273bf215546Sopenharmony_ci	struct r600_cf_stack_entry	fc_stack[256];
274bf215546Sopenharmony_ci	struct r600_stack_info		stack;
275bf215546Sopenharmony_ci	unsigned	ar_loaded;
276bf215546Sopenharmony_ci	unsigned	ar_reg;
277bf215546Sopenharmony_ci	unsigned	ar_chan;
278bf215546Sopenharmony_ci	unsigned        ar_handling;
279bf215546Sopenharmony_ci	unsigned        r6xx_nop_after_rel_dst;
280bf215546Sopenharmony_ci	bool            index_loaded[2];
281bf215546Sopenharmony_ci	unsigned        index_reg[2]; /* indexing register CF_INDEX_[01] */
282bf215546Sopenharmony_ci	unsigned        index_reg_chan[2]; /* indexing register chanel CF_INDEX_[01] */
283bf215546Sopenharmony_ci	unsigned        debug_id;
284bf215546Sopenharmony_ci	struct r600_isa* isa;
285bf215546Sopenharmony_ci	struct r600_bytecode_output pending_outputs[5];
286bf215546Sopenharmony_ci	int n_pending_outputs;
287bf215546Sopenharmony_ci	boolean			need_wait_ack; /* emit a pending WAIT_ACK prior to control flow */
288bf215546Sopenharmony_ci	boolean			precise;
289bf215546Sopenharmony_ci};
290bf215546Sopenharmony_ci
291bf215546Sopenharmony_ci/* eg_asm.c */
292bf215546Sopenharmony_ciint eg_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode_cf *cf);
293bf215546Sopenharmony_ciint egcm_load_index_reg(struct r600_bytecode *bc, unsigned id, bool inside_alu_clause);
294bf215546Sopenharmony_ciint eg_bytecode_gds_build(struct r600_bytecode *bc, struct r600_bytecode_gds *gds, unsigned id);
295bf215546Sopenharmony_ciint eg_bytecode_alu_build(struct r600_bytecode *bc,
296bf215546Sopenharmony_ci			  struct r600_bytecode_alu *alu, unsigned id);
297bf215546Sopenharmony_ci/* r600_asm.c */
298bf215546Sopenharmony_civoid r600_bytecode_init(struct r600_bytecode *bc,
299bf215546Sopenharmony_ci			enum amd_gfx_level gfx_level,
300bf215546Sopenharmony_ci			enum radeon_family family,
301bf215546Sopenharmony_ci			bool has_compressed_msaa_texturing);
302bf215546Sopenharmony_civoid r600_bytecode_clear(struct r600_bytecode *bc);
303bf215546Sopenharmony_ciint r600_bytecode_add_alu(struct r600_bytecode *bc,
304bf215546Sopenharmony_ci		const struct r600_bytecode_alu *alu);
305bf215546Sopenharmony_ciint r600_bytecode_add_vtx(struct r600_bytecode *bc,
306bf215546Sopenharmony_ci		const struct r600_bytecode_vtx *vtx);
307bf215546Sopenharmony_ciint r600_bytecode_add_vtx_tc(struct r600_bytecode *bc,
308bf215546Sopenharmony_ci			     const struct r600_bytecode_vtx *vtx);
309bf215546Sopenharmony_ciint r600_bytecode_add_tex(struct r600_bytecode *bc,
310bf215546Sopenharmony_ci		const struct r600_bytecode_tex *tex);
311bf215546Sopenharmony_ciint r600_bytecode_add_gds(struct r600_bytecode *bc,
312bf215546Sopenharmony_ci		const struct r600_bytecode_gds *gds);
313bf215546Sopenharmony_ciint r600_bytecode_add_output(struct r600_bytecode *bc,
314bf215546Sopenharmony_ci		const struct r600_bytecode_output *output);
315bf215546Sopenharmony_ciint r600_bytecode_add_pending_output(struct r600_bytecode *bc,
316bf215546Sopenharmony_ci		const struct r600_bytecode_output *output);
317bf215546Sopenharmony_ci
318bf215546Sopenharmony_civoid r600_bytecode_add_ack(struct r600_bytecode *bc);
319bf215546Sopenharmony_ciint r600_bytecode_wait_acks(struct r600_bytecode *bc);
320bf215546Sopenharmony_ciuint32_t r600_bytecode_write_export_ack_type(struct r600_bytecode *bc, bool indirect);
321bf215546Sopenharmony_ci
322bf215546Sopenharmony_ciint r600_bytecode_build(struct r600_bytecode *bc);
323bf215546Sopenharmony_ciint r600_bytecode_add_cf(struct r600_bytecode *bc);
324bf215546Sopenharmony_ciint r600_bytecode_add_cfinst(struct r600_bytecode *bc,
325bf215546Sopenharmony_ci		unsigned op);
326bf215546Sopenharmony_ciint r600_bytecode_add_alu_type(struct r600_bytecode *bc,
327bf215546Sopenharmony_ci		const struct r600_bytecode_alu *alu, unsigned type);
328bf215546Sopenharmony_civoid r600_bytecode_special_constants(uint32_t value, unsigned *sel);
329bf215546Sopenharmony_civoid r600_bytecode_disasm(struct r600_bytecode *bc);
330bf215546Sopenharmony_civoid r600_bytecode_alu_read(struct r600_bytecode *bc,
331bf215546Sopenharmony_ci		struct r600_bytecode_alu *alu, uint32_t word0, uint32_t word1);
332bf215546Sopenharmony_ciint r600_load_ar(struct r600_bytecode *bc, bool for_src);
333bf215546Sopenharmony_ci
334bf215546Sopenharmony_ciint cm_bytecode_add_cf_end(struct r600_bytecode *bc);
335bf215546Sopenharmony_ci
336bf215546Sopenharmony_civoid *r600_create_vertex_fetch_shader(struct pipe_context *ctx,
337bf215546Sopenharmony_ci				      unsigned count,
338bf215546Sopenharmony_ci				      const struct pipe_vertex_element *elements);
339bf215546Sopenharmony_ci
340bf215546Sopenharmony_ci/* r700_asm.c */
341bf215546Sopenharmony_civoid r700_bytecode_cf_vtx_build(uint32_t *bytecode,
342bf215546Sopenharmony_ci		const struct r600_bytecode_cf *cf);
343bf215546Sopenharmony_ciint r700_bytecode_alu_build(struct r600_bytecode *bc,
344bf215546Sopenharmony_ci		struct r600_bytecode_alu *alu, unsigned id);
345bf215546Sopenharmony_civoid r700_bytecode_alu_read(struct r600_bytecode *bc,
346bf215546Sopenharmony_ci		struct r600_bytecode_alu *alu, uint32_t word0, uint32_t word1);
347bf215546Sopenharmony_ciint r700_bytecode_fetch_mem_build(struct r600_bytecode *bc,
348bf215546Sopenharmony_ci		struct r600_bytecode_vtx *mem, unsigned id);
349bf215546Sopenharmony_ci
350bf215546Sopenharmony_civoid r600_bytecode_export_read(struct r600_bytecode *bc,
351bf215546Sopenharmony_ci		struct r600_bytecode_output *output, uint32_t word0, uint32_t word1);
352bf215546Sopenharmony_civoid eg_bytecode_export_read(struct r600_bytecode *bc,
353bf215546Sopenharmony_ci		struct r600_bytecode_output *output, uint32_t word0, uint32_t word1);
354bf215546Sopenharmony_ci
355bf215546Sopenharmony_civoid r600_vertex_data_type(enum pipe_format pformat, unsigned *format,
356bf215546Sopenharmony_ci			   unsigned *num_format, unsigned *format_comp, unsigned *endian);
357bf215546Sopenharmony_ci
358bf215546Sopenharmony_ciint r600_load_ar(struct r600_bytecode *bc, bool for_src);
359bf215546Sopenharmony_ci
360bf215546Sopenharmony_cistatic inline int fp64_switch(int i)
361bf215546Sopenharmony_ci{
362bf215546Sopenharmony_ci	switch (i) {
363bf215546Sopenharmony_ci	case 0:
364bf215546Sopenharmony_ci		return 1;
365bf215546Sopenharmony_ci	case 1:
366bf215546Sopenharmony_ci		return 0;
367bf215546Sopenharmony_ci	case 2:
368bf215546Sopenharmony_ci		return 3;
369bf215546Sopenharmony_ci	case 3:
370bf215546Sopenharmony_ci		return 2;
371bf215546Sopenharmony_ci	}
372bf215546Sopenharmony_ci	return 0;
373bf215546Sopenharmony_ci}
374bf215546Sopenharmony_ci
375bf215546Sopenharmony_ci#ifdef __cplusplus
376bf215546Sopenharmony_ci}
377bf215546Sopenharmony_ci#endif
378bf215546Sopenharmony_ci
379bf215546Sopenharmony_ci#endif
380