2 * Copyright 2013 Vadim Girlin <vadimgirlin@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 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the 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 NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
32 inline float float_clamp(float v
) {
33 return v
< 0.0f
? 0.0f
: (v
> 1.0f
? 1.0f
: v
);
36 value
* get_select_value_for_em(shader
&sh
, value
*em
);
38 void convert_predset_to_set(shader
&sh
, alu_node
*a
);
39 unsigned invert_setcc_condition(unsigned cc
, bool &swap_args
);
40 unsigned get_setcc_opcode(unsigned cc
, unsigned cmp_type
, bool int_dst
);
41 unsigned get_predsetcc_opcode(unsigned cc
, unsigned cmp_type
);
50 expr_handler(shader
&sh
);
52 bool equal(value
*l
, value
*r
);
53 bool defs_equal(value
*l
, value
*r
);
54 bool args_equal(const vvec
&l
, const vvec
&r
);
55 bool ops_equal(const alu_node
*l
, const alu_node
*r
);
56 bool ivars_equal(value
*l
, value
*r
);
58 value
* get_const(const literal
&l
);
60 bool try_fold(value
*v
);
61 bool try_fold(node
*n
);
64 bool fold(container_node
&n
);
65 bool fold(alu_node
&n
);
66 bool fold(fetch_node
&n
);
67 bool fold(cf_node
&n
);
69 bool fold_setcc(alu_node
&n
);
71 bool fold_alu_op1(alu_node
&n
);
72 bool fold_alu_op2(alu_node
&n
);
73 bool fold_alu_op3(alu_node
&n
);
75 void apply_alu_src_mod(const bc_alu
&bc
, unsigned src
, literal
&v
);
76 void apply_alu_dst_mod(const bc_alu
&bc
, literal
&v
);
78 void assign_source(value
*dst
, value
*src
);
81 } // namespace r600_sb
83 #endif /* SB_EXPR_H_ */