glsl: Optimize 1/exp(x) into exp(-x).
authorMatt Turner <mattst88@gmail.com>
Tue, 10 Feb 2015 20:31:37 +0000 (12:31 -0800)
committerMatt Turner <mattst88@gmail.com>
Wed, 11 Feb 2015 01:48:44 +0000 (17:48 -0800)
commitea0f0eb6c0a8b20bcce50c63170df94892a51142
treebc45fafd47f685fdc1774b671f27a196dbade54f
parenta9065cef4879509c3dc96a5195f785647576f409
glsl: Optimize 1/exp(x) into exp(-x).

Lots of shaders divide by exp2(...) which we turn into a multiplication
by the reciprocal. We can avoid the reciprocal by simply negating exp2's
argument.

total instructions in shared programs: 5947154 -> 5946695 (-0.01%)
instructions in affected programs:     118661 -> 118202 (-0.39%)
helped:                                380

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/opt_algebraic.cpp