summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-01-18 10:36:28 -0800
committerEric Anholt <[email protected]>2014-02-07 12:46:47 -0800
commit2c2aa353366c610382273bea10656e6d6960ce3b (patch)
treefbdb2c7a47b6b5c7c441554977b9c0d407d9c129 /src
parent0f6279bab29614e3764a333242680ead78068d91 (diff)
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 <[email protected]> (v1)
Diffstat (limited to 'src')
-rw-r--r--src/glsl/opt_algebraic.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index d1f6435f44f..681973dda0e 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;