Mesa (master): i965/fs: Only consider real sources when comparing instructions.

Matt Turner mattst88 at kemper.freedesktop.org
Tue Jun 17 17:07:19 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Tue Mar 25 15:28:17 2014 -0700

i965/fs: Only consider real sources when comparing instructions.

---

 src/mesa/drivers/dri/i965/brw_fs_cse.cpp |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index 3414d50..920bfee 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -105,10 +105,20 @@ is_expression_commutative(enum opcode op)
 }
 
 static bool
-operands_match(enum opcode op, fs_reg *xs, fs_reg *ys)
+operands_match(fs_inst *a, fs_inst *b)
 {
-   if (!is_expression_commutative(op)) {
-      return xs[0].equals(ys[0]) && xs[1].equals(ys[1]) && xs[2].equals(ys[2]);
+   fs_reg *xs = a->src;
+   fs_reg *ys = b->src;
+
+   if (!is_expression_commutative(a->opcode)) {
+      bool match = true;
+      for (int i = 0; i < a->sources; i++) {
+         if (!xs[i].equals(ys[i])) {
+            match = false;
+            break;
+         }
+      }
+      return match;
    } else {
       return (xs[0].equals(ys[0]) && xs[1].equals(ys[1])) ||
              (xs[1].equals(ys[0]) && xs[0].equals(ys[1]));
@@ -124,7 +134,8 @@ instructions_match(fs_inst *a, fs_inst *b)
           a->predicate_inverse == b->predicate_inverse &&
           a->conditional_mod == b->conditional_mod &&
           a->dst.type == b->dst.type &&
-          operands_match(a->opcode, a->src, b->src);
+          a->sources == b->sources &&
+          operands_match(a, b);
 }
 
 bool




More information about the mesa-commit mailing list