summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2023-03-15 17:25:36 +0100
committerMarge Bot <emma+marge@anholt.net>2024-04-26 12:55:13 +0000
commit0f62203edf3ec0ab6729bd69cf814b0e4480b0e8 (patch)
tree3ce03ee8277acd55fe15d37ea9921b1d98b667ee
parentef75ea18cd352e4bee17c46069babe5ca3390641 (diff)
ir3/cp: Support swapping mad srcs for shared regs
This was missed when adding shared reg constraints, and helps with eliminating extra moves caused by uniform (but not const) mad sources. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22075>
-rw-r--r--src/freedreno/ir3/ir3_cp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/freedreno/ir3/ir3_cp.c b/src/freedreno/ir3/ir3_cp.c
index 8f3133e18e1..33e9bd1139b 100644
--- a/src/freedreno/ir3/ir3_cp.c
+++ b/src/freedreno/ir3/ir3_cp.c
@@ -280,7 +280,7 @@ try_swap_mad_two_srcs(struct ir3_instruction *instr, unsigned new_flags)
/* If the reason we couldn't fold without swapping is something
* other than const source, then swapping won't help:
*/
- if (!(new_flags & IR3_REG_CONST))
+ if (!(new_flags & (IR3_REG_CONST | IR3_REG_SHARED)))
return false;
instr->cat3.swapped = true;
@@ -339,6 +339,8 @@ reg_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr,
reg->def->instr->use_count++;
return true;
+ } else if (n == 1 && try_swap_mad_two_srcs(instr, new_flags)) {
+ return true;
}
} else if ((is_same_type_mov(src) || is_const_mov(src)) &&
/* cannot collapse const/immed/etc into control flow: */