Module: Mesa
Branch: master
Commit: a66660d2b75197814f5e36b9994b1e9eadff0a2e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a66660d2b75197814f5e36b9994b1e9eadff0a2e

Author: Abdiel Janulgue <[email protected]>
Date:   Thu Jun  5 11:05:28 2014 -0700

i965/fs: Refactor check for potential copy propagated instructions.

Reviewed-by: Matt Turner <[email protected]>
Signed-off-by: Abdiel Janulgue <[email protected]>

---

 .../drivers/dri/i965/brw_fs_copy_propagation.cpp   |   27 ++++++++++++--------
 1 file changed, 17 insertions(+), 10 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 a1aff21..d3d59aa 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -478,6 +478,22 @@ fs_visitor::try_constant_propagate(fs_inst *inst, 
acp_entry *entry)
 
    return progress;
 }
+
+static bool
+can_propagate_from(fs_inst *inst)
+{
+   return (inst->opcode == BRW_OPCODE_MOV &&
+           inst->dst.file == GRF &&
+           ((inst->src[0].file == GRF &&
+             (inst->src[0].reg != inst->dst.reg ||
+              inst->src[0].reg_offset != inst->dst.reg_offset)) ||
+            inst->src[0].file == UNIFORM ||
+            inst->src[0].file == IMM) &&
+           inst->src[0].type == inst->dst.type &&
+           !inst->saturate &&
+           !inst->is_partial_write());
+}
+
 /* Walks a basic block and does copy propagation on it using the acp
  * list.
  */
@@ -532,16 +548,7 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, 
bblock_t *block,
       /* If this instruction's source could potentially be folded into the
        * operand of another instruction, add it to the ACP.
        */
-      if (inst->opcode == BRW_OPCODE_MOV &&
-         inst->dst.file == GRF &&
-         ((inst->src[0].file == GRF &&
-           (inst->src[0].reg != inst->dst.reg ||
-            inst->src[0].reg_offset != inst->dst.reg_offset)) ||
-           inst->src[0].file == UNIFORM ||
-           inst->src[0].file == IMM) &&
-         inst->src[0].type == inst->dst.type &&
-         !inst->saturate &&
-         !inst->is_partial_write()) {
+      if (can_propagate_from(inst)) {
         acp_entry *entry = ralloc(copy_prop_ctx, acp_entry);
         entry->dst = inst->dst;
         entry->src = inst->src[0];

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to