summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-02-24 15:00:44 -0800
committerMatt Turner <[email protected]>2014-02-28 10:36:06 -0800
commitecc6c3d4ab31c6cd848bce02790000c165a02229 (patch)
tree3732755c567d6cb332280fe0f7f29391b67b096c
parent43dee0295e5da42425f1a3b6a3b3108173f4b676 (diff)
glsl: Optimize lrp(0, y, a) into y * a.
Helps two programs in shader-db: instructions in affected programs: 254 -> 234 (-7.87%) Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/glsl/opt_algebraic.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 1b4d319366c..28f95a44c7f 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -568,6 +568,8 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
return ir->operands[1];
} else if (ir->operands[0]->equals(ir->operands[1])) {
return ir->operands[0];
+ } else if (is_vec_zero(op_const[0])) {
+ return mul(ir->operands[1], ir->operands[2]);
}
break;