i965/vec4: Fix null destination register in 3-source instructions
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 23 Mar 2018 18:46:12 +0000 (11:46 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 26 Mar 2018 15:50:44 +0000 (08:50 -0700)
commit91225cb33f0baede872114bd416084b3b52937a1
tree333d1782378b5f1a6726676b8e67dedd53e6f33d
parent2c643fd978c43205b9620820038ba6246ed045e2
i965/vec4: Fix null destination register in 3-source instructions

A recent commit (see below) triggered some cases where conditional
modifier propagation and dead code elimination would cause a MAD
instruction like the following to be generated:

    mad.l.f0  null, ...

Matt pointed out that fs_visitor::fixup_3src_null_dest() fixes cases
like this in the scalar backend.  This commit basically ports that code
to the vec4 backend.

NOTE: I have sent a couple tests to the piglit list that reproduce this
bug *without* the commit mentioned below.  This commit fixes those
tests.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Fixes: ee63933a7 ("nir: Distribute binary operations with constants into bcsel")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105704
src/intel/compiler/brw_vec4.cpp
src/intel/compiler/brw_vec4.h