i965: Implement b2f and b2i using negation.
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 10 Jul 2015 16:18:39 +0000 (19:18 +0300)
committerFrancisco Jerez <currojerez@riseup.net>
Thu, 16 Jul 2015 15:29:32 +0000 (18:29 +0300)
commit3ee2daf23dc91b8dfc017b5c89c10ab1376ba4df
tree543f89614463538b7e3f5348d8b00a887332ef67
parent8fba933ca2dd3c3487281135a9063b6ca9bed359
i965: Implement b2f and b2i using negation.

Booleans are represented as 0/-1 on modern hardware which means we can
just negate them to convert them into a numeric type.  Negation has
the benefit that it can be implemented using a source modifier which
can easily be propagated into some other instruction.  shader-db
results on HSW:

total instructions in shared programs: 6349082 -> 6346693 (-0.04%)
instructions in affected programs:     40948 -> 38559 (-5.83%)
helped:                                123
HURT:                                  1
GAINED:                                1
LOST:                                  0

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp