Mesa (master): glsl: Optimize ~~x into x.
Eric Anholt
anholt at kemper.freedesktop.org
Fri Feb 7 20:49:52 UTC 2014
Module: Mesa
Branch: master
Commit: 2c2aa353366c610382273bea10656e6d6960ce3b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c2aa353366c610382273bea10656e6d6960ce3b
Author: Eric Anholt <eric at anholt.net>
Date: Sat Jan 18 10:36:28 2014 -0800
glsl: Optimize ~~x into x.
v2: Fix pasteo of an extra abs being inserted (caught by many). Rewrite
to drop the silly switch statement.
Reviewed-by: Matt Turner <mattst88 at gmail.com> (v1)
---
src/glsl/opt_algebraic.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index d1f6435..681973d 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -218,6 +218,11 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
this->mem_ctx = ralloc_parent(ir);
switch (ir->operation) {
+ case ir_unop_bit_not:
+ if (op_expr[0] && op_expr[0]->operation == ir_unop_bit_not)
+ return op_expr[0]->operands[0];
+ break;
+
case ir_unop_abs:
if (op_expr[0] == NULL)
break;
More information about the mesa-commit
mailing list