1 #include "radeon_program_constants.h"
3 #ifndef RADEON_PROGRAM_UTIL_H
4 #define RADEON_PROGRAM_UTIL_H
6 #include "radeon_opcodes.h"
8 struct radeon_compiler;
10 struct rc_pair_instruction;
11 struct rc_pair_sub_instruction;
12 struct rc_src_register;
14 unsigned int rc_swizzle_to_writemask(unsigned int swz);
16 rc_swizzle get_swz(unsigned int swz, rc_swizzle idx);
18 unsigned int rc_init_swizzle(unsigned int initial_value, unsigned int channels);
20 unsigned int combine_swizzles4(unsigned int src,
21 rc_swizzle swz_x, rc_swizzle swz_y,
22 rc_swizzle swz_z, rc_swizzle swz_w);
24 unsigned int combine_swizzles(unsigned int src, unsigned int swz);
26 rc_swizzle rc_mask_to_swizzle(unsigned int mask);
28 unsigned swizzle_mask(unsigned swizzle, unsigned mask);
30 unsigned int rc_adjust_channels(
31 unsigned int old_swizzle,
32 unsigned int conversion_swizzle);
34 void rc_pair_rewrite_writemask(
35 struct rc_pair_sub_instruction * sub,
36 unsigned int conversion_swizzle);
38 void rc_normal_rewrite_writemask(
39 struct rc_instruction * inst,
40 unsigned int conversion_swizzle);
42 unsigned int rc_rewrite_swizzle(
44 unsigned int new_mask);
46 struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register srcreg);
48 void reset_srcreg(struct rc_src_register* reg);
50 unsigned int rc_src_reads_dst_mask(
51 rc_register_file src_file,
54 rc_register_file dst_file,
56 unsigned int dst_mask);
58 unsigned int rc_source_type_swz(unsigned int swizzle);
60 unsigned int rc_source_type_mask(unsigned int mask);
62 unsigned int rc_inst_can_use_presub(
63 struct rc_instruction * inst,
64 rc_presubtract_op presub_op,
65 unsigned int presub_writemask,
66 const struct rc_src_register * replace_reg,
67 const struct rc_src_register * presub_src0,
68 const struct rc_src_register * presub_src1);
71 struct radeon_compiler * c,
72 rc_register_file file);
74 unsigned int rc_pair_remove_src(
75 struct rc_instruction * inst,
76 unsigned int src_type,
78 unsigned int new_readmask);
80 rc_opcode rc_get_flow_control_inst(struct rc_instruction * inst);
82 struct rc_instruction * rc_match_endloop(struct rc_instruction * endloop);
83 struct rc_instruction * rc_match_bgnloop(struct rc_instruction * bgnloop);
85 unsigned int rc_make_conversion_swizzle(
86 unsigned int old_mask,
87 unsigned int new_mask);
89 #endif /* RADEON_PROGRAM_UTIL_H */