summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-10-26 10:08:40 -0700
committerMatt Turner <[email protected]>2014-10-29 21:35:46 -0700
commitb65bd9583b9fe0080b5664df2a80d2084499e3c2 (patch)
treeb08a3b18307668a98c48258f594f7056ede2edc2 /src
parentd056863b3c535aeebfe5fcfc9468eb33a06ddb60 (diff)
i965/fs: Perform CSE on MAD instructions with final arguments switched.
Multiplication is commutative. instructions in affected programs: 48314 -> 47954 (-0.75%) Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_cse.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index 801200118d7..5fdbf463984 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -128,7 +128,11 @@ operands_match(fs_inst *a, fs_inst *b)
fs_reg *xs = a->src;
fs_reg *ys = b->src;
- if (!is_expression_commutative(a->opcode)) {
+ if (a->opcode == 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(a->opcode)) {
bool match = true;
for (int i = 0; i < a->sources; i++) {
if (!xs[i].equals(ys[i])) {