Mesa (master): glsl: Apply the transformation (a a) - a in opt_algebraic.
Module: Mesa Branch: master Commit: 58a98d32e451762934ca8c38135357f36e29654f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=58a98d32e451762934ca8c38135357f36e29654f Author: Eric Anholt e...@anholt.net Date: Thu Oct 31 09:32:42 2013 -0700 glsl: Apply the transformation (a a) - a in opt_algebraic. Reviewed-by: Jordan Justen jordan.l.jus...@intel.com --- src/glsl/opt_algebraic.cpp |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 3da27e5..ea3c386 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -357,7 +357,6 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) break; case ir_binop_logic_and: - /* FINISHME: Also simplify (a a) to (a). */ if (is_vec_one(op_const[0])) { return ir-operands[1]; } else if (is_vec_one(op_const[1])) { @@ -371,6 +370,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) */ return logic_not(logic_or(op_expr[0]-operands[0], op_expr[1]-operands[0])); + } else if (ir-operands[0]-equals(ir-operands[1])) { + /* (a a) == a */ + return ir-operands[0]; } break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Apply the transformation (a ^^ a) - false in opt_algebraic.
Module: Mesa Branch: master Commit: 477f8cd08bb8467d28fdfd6c25fe358957e3da58 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=477f8cd08bb8467d28fdfd6c25fe358957e3da58 Author: Eric Anholt e...@anholt.net Date: Thu Nov 7 12:10:25 2013 -0800 glsl: Apply the transformation (a ^^ a) - false in opt_algebraic. Reviewed-by: Jordan Justen jordan.l.jus...@intel.com --- src/glsl/opt_algebraic.cpp |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index ea3c386..448f27e 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -377,7 +377,6 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) break; case ir_binop_logic_xor: - /* FINISHME: Also simplify (a ^^ a) to (false). */ if (is_vec_zero(op_const[0])) { return ir-operands[1]; } else if (is_vec_zero(op_const[1])) { @@ -386,6 +385,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) return logic_not(ir-operands[1]); } else if (is_vec_one(op_const[1])) { return logic_not(ir-operands[0]); + } else if (ir-operands[0]-equals(ir-operands[1])) { + /* (a ^^ a) == false */ +return ir_constant::zero(mem_ctx, ir-type); } break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Apply the transformation (a || a) - a in opt_algebraic.
Module: Mesa Branch: master Commit: ee2704826264eba22d095c3e1e03a8532b7bd1e6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee2704826264eba22d095c3e1e03a8532b7bd1e6 Author: Eric Anholt e...@anholt.net Date: Thu Oct 31 00:10:32 2013 -0700 glsl: Apply the transformation (a || a) - a in opt_algebraic. total instructions in shared programs: 1732385 - 1732373 (-0.00%) instructions in affected programs: 416 - 404 (-2.88%) GAINED:0 LOST: 0 (That's 4 already-short fragment shaders in dota2) Reviewed-by: Jordan Justen jordan.l.jus...@intel.com --- src/glsl/opt_algebraic.cpp |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index a07e153..3da27e5 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -388,7 +388,6 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) break; case ir_binop_logic_or: - /* FINISHME: Also simplify (a || a) to (a). */ if (is_vec_zero(op_const[0])) { return ir-operands[1]; } else if (is_vec_zero(op_const[1])) { @@ -407,6 +406,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) */ return logic_not(logic_and(op_expr[0]-operands[0], op_expr[1]-operands[0])); + } else if (ir-operands[0]-equals(ir-operands[1])) { + /* (a || a) == a */ + return ir-operands[0]; } break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit