[Mesa-dev] [PATCH] i965/fs: Convert MOV null with conditional mod into CMP.

Matt Turner mattst88 at gmail.com
Tue Feb 10 11:45:12 PST 2015


The cmod propagation pass handles CMP and MOV.NZ. If we propagated a
conditional modifier other than NZ onto a MOV, it would be stuck there.
Convert these instructions into a CMP to let the cmod be propagated
further.

instructions in affected programs:     1482 -> 1454 (-1.89%)
helped:                                6
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 200a494..61e286a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2312,6 +2312,16 @@ fs_visitor::opt_algebraic()
    foreach_block_and_inst(block, fs_inst, inst, cfg) {
       switch (inst->opcode) {
       case BRW_OPCODE_MOV:
+         if (inst->dst.is_null() && inst->conditional_mod) {
+            inst->opcode = BRW_OPCODE_CMP;
+            inst->saturate = false;
+            inst->src[1] = fs_reg(0.0f);
+            inst->src[1].type = inst->src[0].type;
+            inst->dst.type = inst->src[0].type;
+            progress = true;
+            break;
+         }
+
          if (inst->src[0].file != IMM)
             break;
 
-- 
2.0.5



More information about the mesa-dev mailing list