i965/fs: Patch the instruction generating discards; don't use CMP.Z.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 26 Feb 2015 00:08:14 +0000 (16:08 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 27 Feb 2015 19:36:24 +0000 (11:36 -0800)
commitea696be5ac097af621f10858d925a343a838be7a
tree5fe6df5a13c0a89529f8e5e09ba602ebf3dab9d4
parent4ebacf8aa67b1bfba7820f25536be98c7452dcb1
i965/fs: Patch the instruction generating discards; don't use CMP.Z.

CMP.Z doesn't work on Gen4-5 because the boolean isn't guaranteed to be
0 or 0xFFFFFFFF - only the low bit is defined.

We can call emit_bool_to_cond_code to generate the condition in f0.0;
the last instruction will generate the flag value.  We can patch it to
use f0.1, and negate the condition.

Fixes discard tests on Gen4-5.

Haswell shader-db stats:
total instructions in shared programs: 5770279 -> 5769112 (-0.02%)
instructions in affected programs:     64342 -> 63175 (-1.81%)
helped:                                1069

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp