i965 new VS: Fix copy propagation of double negatives.
authorPaul Berry <stereotype441@gmail.com>
Thu, 15 Sep 2011 00:06:35 +0000 (17:06 -0700)
committerPaul Berry <stereotype441@gmail.com>
Mon, 19 Sep 2011 17:24:08 +0000 (10:24 -0700)
When copy propagating a value into an instruction that negates its
argument, we need to invert the sense of the value's "negate" flag, so
that -(+x) becomes -x and -(-x) becomes +x.

Previously, we were always setting the value's "negate" flag to true
in this circumstance, so that both -(+x) and -(-x) turned into -x.

Fixes Piglit test vs-double-negative.shader_test.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp

index c46735abfab85a5edbcd7466be40bd446372b3b6..e0b2d2abf2bb26a119de28887027ce17392e614f 100644 (file)
@@ -196,7 +196,7 @@ try_copy_propagation(struct intel_context *intel,
       value.abs = true;
    }
    if (inst->src[arg].negate)
-      value.negate = true;
+      value.negate = !value.negate;
 
    /* FINISHME: We can't copy-propagate things that aren't normal
     * vec8s into gen6 math instructions, because of the weird src