diff options
author | Jason Ekstrand <[email protected]> | 2015-04-03 12:15:48 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-04-17 11:01:33 -0700 |
commit | bb99a58e7710acd19463646c38cdddbd926e89c4 (patch) | |
tree | 7e64e4a366368e050da8204cfef43d8cf019d00f | |
parent | 95e68adcd9f2589ae6d998328c72b84ffc49edc7 (diff) |
i965/fs: Use the source type when looking for UD negations in copy prop
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.
Signed-off-by: Jason Ekstrand <[email protected]>
Reviewed-by: Anuj Phogat <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp index 764741d369e..e8d092cbc00 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -307,7 +307,7 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry) * instead. See also resolve_ud_negate() and comment in * fs_generator::generate_code. */ - if (inst->src[arg].type == BRW_REGISTER_TYPE_UD && + if (entry->src.type == BRW_REGISTER_TYPE_UD && entry->src.negate) return false; |