diff options
author | Matt Turner <[email protected]> | 2015-01-30 13:42:19 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2015-02-11 13:50:19 -0800 |
commit | 69ad5fd4ce33aeab73d9eb546072d77e73e3a730 (patch) | |
tree | e67fb354a443038d85baaa84f3aacd08d956744b /src/glsl | |
parent | c262b2b582798f389601b8198b1dbf3c7ba7a187 (diff) |
glsl: Optimize (f2i(trunc x)) into (f2i x).
total instructions in shared programs: 5950326 -> 5949286 (-0.02%)
instructions in affected programs: 88264 -> 87224 (-1.18%)
helped: 692
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/opt_algebraic.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 588228c9ec2..7bc65daf5c6 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -376,6 +376,15 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } break; + case ir_unop_f2i: + case ir_unop_f2u: + if (op_expr[0] && op_expr[0]->operation == ir_unop_trunc) { + return new(mem_ctx) ir_expression(ir->operation, + ir->type, + op_expr[0]->operands[0]); + } + break; + case ir_unop_logic_not: { enum ir_expression_operation new_op = ir_unop_logic_not; |