i965/fs: Use the source type when looking for UD negations in copy prop

Graphics / Mesa 3D Graphics Library / Mesa - Jason Ekstrand [intel.com] - 17 April 2015 13:01 UTC

There can be problems with floats and conditional modifiers when copy-propagating a negated UD source. The problem arises when a source modifier is applied to a UD value. In this case, a 33-bit representation is internally used. If you do the following:

1: mov foo:UD 7U 2: mov bar:UD -foo:UD 3: mov out:F bar:UD

the out register will have the value (float)(unt32_t)-7 which is some very large floating-point number. However, if we allow copy-propagation of the second mov, we get

1: mov foo:UD 7U 3: mov out:f -bar:UD

and, since the negation is computed in 33-bits, we get a value of -7.0f which is clearly not the same. This is a similar problem if the instruction has a conditional modifier where the 33-bit value is used in the comparison and not the 32-bit version.

Previously, we checked the source to be copied for the negate and then checked the source being propagated to for the type. This isn't quite what we want because we are really just looking for negated UD sources. A check later in the file ensures that both ends of the propagate have the right type so it works. However, if we relax the restriction that both ends of the propagation have the same type, it ends up causing us to bail early in cases we don't want.

bb99a58 i965/fs: Use the source type when looking for UD negations in copy prop
.../drivers/dri/i965/brw_fs_copy_propagation.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Upstream: cgit.freedesktop.org


  • Share