[Mesa-dev] [PATCH] i965/fs: Fix handling of abs modifiers in copy propagation.

Kenneth Graunke kenneth at whitecape.org
Tue Sep 4 10:32:57 PDT 2012


We recorded MOVs in the ACP that had abs modifiers (losing the sign of
the original value), and then went ahead and copy propagated that into
an expression that needed the original signed value.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

I think a similar bug exists in register_coalesce()...

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 1870f43..d617d8c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -40,6 +40,10 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry)
       return false;
    }
 
+   /* If we only have the absolute value, we can't recover the original. */
+   if (entry->src.abs && !inst->src[arg].abs)
+      return false;
+
    /* See resolve_ud_negate() and comment in brw_fs_emit.cpp. */
    if (inst->conditional_mod &&
        inst->src[arg].type == BRW_REGISTER_TYPE_UD &&
@@ -57,7 +61,6 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry)
    inst->src[arg].reg_offset = entry->src.reg_offset;
 
    if (!inst->src[arg].abs) {
-      inst->src[arg].abs = entry->src.abs;
       inst->src[arg].negate ^= entry->src.negate;
    }
 
-- 
1.7.11.4



More information about the mesa-dev mailing list