i965/vec4: Call opt_algebraic after opt_cse.
authorMatt Turner <mattst88@gmail.com>
Sat, 27 Sep 2014 17:34:07 +0000 (10:34 -0700)
committerMatt Turner <mattst88@gmail.com>
Wed, 1 Oct 2014 00:09:34 +0000 (17:09 -0700)
commit189ac077644c4ef2c6c15080b6d094410c74abdc
tree0d66fb36ec6fae28f93b164851009cf1220daebd
parentd13bcdb3a9f9b43010fe8cbb4efbfe7eec0b705b
i965/vec4: Call opt_algebraic after opt_cse.

The next patch adds an algebraic optimization for the pattern

   sqrt a, b
   rcp  c, a

and turns it into

   sqrt a, b
   rsq  c, b

but many vertex shaders do

   a = sqrt(b);
   var1 /= a;
   var2 /= a;

which generates

   sqrt a, b
   rcp  c, a
   rcp  d, a

If we apply the algebraic optimization before CSE, we'll end up with

   sqrt a, b
   rsq  c, b
   rcp  d, a

Applying CSE combines the RCP instructions, preventing this from
happening.

No shader-db changes.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_vec4.cpp