OSDN Git Service

i965/vec4: Propagate swizzles correctly during copy propagation.
authorFrancisco Jerez <currojerez@riseup.net>
Sat, 27 Feb 2016 01:42:27 +0000 (17:42 -0800)
committerFrancisco Jerez <currojerez@riseup.net>
Sun, 6 Mar 2016 20:22:40 +0000 (12:22 -0800)
commit3dd0441f6cbcceb42effea2219d835082c2e2725
treef1cfe0ec3e0b0b1d5650db1fed7eb2878b475ee7
parentc70b7c80e3e1dea150ece96e02ef3d364284812d
i965/vec4: Propagate swizzles correctly during copy propagation.

This simplifies the code that iterates over the per-component values
found in the matching copy_entry struct and checks whether the
register regions that were copied to each component are similar enough
to be treated as a single (reswizzled) value which can be propagated
into the current instruction.

Aside from being scattered between opt_copy_propagation(),
try_copy_propagate(), and try_constant_propagate(), what I found
terribly confusing about the preexisting logic was that
opt_copy_propagation() tried to reorder the array of values according
to the swizzle of the instruction source, which meant one would have
had to invert the reordering applied at the top level in order to find
out which component to take from each value (we were just taking the
i-th component from the i-th value, which is not correct in general).
The saturate mask was also being swizzled incorrectly.

This consolidates the logic for matching multiple components of a
copy_entry into a single function which returns the result as a
regular src_reg on success, as if the copy had been performed with a
single MOV instruction copying all components of the src_reg into the
destination.

Fixes several ARB_vertex_program MOV test-cases from:
 https://cgit.freedesktop.org/~kwg/piglit/log/?h=arb_program

Acked-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp