summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-10-26 10:31:21 -0700
committerMatt Turner <[email protected]>2014-10-29 21:35:46 -0700
commit601a134180f4b0c5b02f6866dddc3ab220feb831 (patch)
tree7e4628cd41744ada5e219b34463de7150f5176e4 /src/mesa
parentb65bd9583b9fe0080b5664df2a80d2084499e3c2 (diff)
i965/vec4: Perform CSE on MAD instructions with final arguments switched.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_cse.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
index 28c69ca69d1..630d3357a3f 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])) ||