i965/vs: Use the MAD instruction when possible.
authorEric Anholt <eric@anholt.net>
Thu, 6 Jun 2013 17:14:41 +0000 (10:14 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 10 Jun 2013 21:04:24 +0000 (14:04 -0700)
commit263a7e4cd992738814575b04d2de24ca0a0ad08a
tree6c5e756aa0c4af3f830faff693e57aecf3ea4876
parent1ff10f92e77625bd17f5825b8f5aee4d355587fc
i965/vs: Use the MAD instruction when possible.

This is different from how we do it in the FS - we are using MAD even when
some of the args are constants, because with the relatively unrestrained
ability to schedule a MOV to prepare a temporary with that data, we can
get lower latency for the sequence of instructions.

No significant performance difference on GLB2.7 trex (n=33/34), though it
doesn't have that many MADs.  I noticed MAD opportunities while reading
the code for the DOTA2 bug.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_vec4.h
src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp