nir: Recognize a pattern of bool frobbing from TGSI KILL_IF.
authorEric Anholt <eric@anholt.net>
Mon, 30 Mar 2015 06:04:21 +0000 (23:04 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 1 Apr 2015 17:57:01 +0000 (10:57 -0700)
commit15b03b7964fc2c3c52e9f384815b76957f557878
tree1d00b9d4b20bc34ebe6d155c14e823f6a00eea23
parent6e8d4a2f8043a3a7a28175326e63770aa9511ee7
nir: Recognize a pattern of bool frobbing from TGSI KILL_IF.

TGSI's conditional discards take float arg and negate it, so GLSL to TGSI
generates a b2f and negates that value.  Only, in NIR we want a proper
bool once again, so we compare with 0.  This is a lot of pointless extra
instructions.

total instructions in shared programs: 39735 -> 39702 (-0.08%)
instructions in affected programs:     1342 -> 1309 (-2.46%)

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir_opt_algebraic.py