Mesa (master): i965/vec4: Perform CSE on MAD instructions with final arguments switched.

Matt Turner mattst88 at kemper.freedesktop.org
Thu Oct 30 04:34:10 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Sun Oct 26 10:31:21 2014 -0700

i965/vec4: Perform CSE on MAD instructions with final arguments switched.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_vec4_cse.cpp |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
index 28c69ca..630d335 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
@@ -104,7 +104,11 @@ is_expression_commutative(enum opcode op)
 static bool
 operands_match(enum opcode op, src_reg *xs, src_reg *ys)
 {
-   if (!is_expression_commutative(op)) {
+   if (op == BRW_OPCODE_MAD) {
+      return xs[0].equals(ys[0]) &&
+             ((xs[1].equals(ys[1]) && xs[2].equals(ys[2])) ||
+              (xs[2].equals(ys[1]) && xs[1].equals(ys[2])));
+   } else if (!is_expression_commutative(op)) {
       return xs[0].equals(ys[0]) && xs[1].equals(ys[1]) && xs[2].equals(ys[2]);
    } else {
       return (xs[0].equals(ys[0]) && xs[1].equals(ys[1])) ||




More information about the mesa-commit mailing list