[Mesa-dev] [PATCH 5/6] i965/vec4: skip copy-propate for negated logical instructions and 'NOT' src registers

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Tue Jun 3 15:59:25 PDT 2014


The negation source modifier on src registers has changed meaning in Broadwell when
used with logical operations.

On the vec4 backend, make sure copy propagation occurs only for original statements that
does not have negated source registers and destination instruction is not a logical op.
Since 'NOT' is now  a potentially propagate-able instruction, don't propagate it
either when the destination instruction is not a logical op.

Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
 src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index ab50d00..3a76997 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -201,6 +201,15 @@ try_constant_propagation(vec4_instruction *inst, int arg, src_reg *values[4])
    return false;
 }
 
+static bool
+is_logic_op(enum opcode opcode)
+{
+   return (opcode == BRW_OPCODE_AND ||
+           opcode == BRW_OPCODE_OR  ||
+           opcode == BRW_OPCODE_XOR ||
+           opcode == BRW_OPCODE_NOT);
+}
+
 bool
 vec4_visitor::try_copy_propagation(vec4_instruction *inst, int arg,
                                    struct copy_entry *entry)
@@ -239,6 +248,11 @@ vec4_visitor::try_copy_propagation(vec4_instruction *inst, int arg,
        value.file != ATTR)
       return false;
 
+   if (brw->gen >=8 &&
+       ((value.negate && is_logic_op(inst->opcode)) ||
+        (entry->opcode == BRW_OPCODE_NOT && !is_logic_op(inst->opcode))))
+      return false;
+
    if (inst->src[arg].abs) {
       value.negate = false;
       value.abs = true;
-- 
1.9.1



More information about the mesa-dev mailing list