i965/vec4: Emit smarter code for b2f of a comparison
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 11 Jun 2014 01:07:50 +0000 (18:07 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 11 Jun 2014 19:00:24 +0000 (12:00 -0700)
commit63117ac32948310c87e30f67b475a07f98884633
treedfe848db31688c62059d8b9a82e0273ff64ef1c5
parentbe0452b0499798dcc2a09c600810be88112d0896
i965/vec4: Emit smarter code for b2f of a comparison

Previously we would emit the comparison, emit an AND to mask off extra
bits from the comparison result, then convert the result to float.  Now,
do the comparison, then use a cleverly constructed SEL to pick either
0.0f or 1.0f.

No piglit regressions on Ivybridge.

total instructions in shared programs: 1642311 -> 1639449 (-0.17%)
instructions in affected programs:     136533 -> 133671 (-2.10%)
GAINED:                                0
LOST:                                  0

Programs that are affected appear to save between 1 and 5 instuctions
(just by skimming the output from shader-db report.py.

v2: s/b2i/b2f/ in commit subject (noticed by Chris Forbes).  Remove
extraneous fix_3src_operand (suggested by Matt).  The latter change
required swapping the order of the operands and using predicate_inverse.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_vec4.h
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp