summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-01-18 10:57:29 -0800
committerEric Anholt <[email protected]>2014-02-07 12:46:48 -0800
commitd72956790fed5f62b8eea5938ed432544530f7bd (patch)
treeade1672aac4cd8b278c7f88b91df6923bf8b2f01 /src
parent6d7c123d6ce46e71ef22e431b76e972b9be1a157 (diff)
glsl: Optimize pow(x, 1) -> x.
total instructions in shared programs: 1627826 -> 1627754 (-0.00%) instructions in affected programs: 6640 -> 6568 (-1.08%) GAINED: 0 LOST: 0 (HoN and savage2) Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/opt_algebraic.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 1e715817f76..953b03c2943 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -520,6 +520,10 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
if (is_vec_one(op_const[0]))
return op_const[0];
+ /* x^1 == x */
+ if (is_vec_one(op_const[1]))
+ return ir->operands[0];
+
/* pow(2,x) == exp2(x) */
if (is_vec_two(op_const[0]))
return expr(ir_unop_exp2, ir->operands[1]);