summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-03-15 14:21:30 -0700
committerEric Anholt <eric@anholt.net>2013-04-01 16:17:24 -0700
commit1d6ead38042cc0d1e667d8ff55937c1e32d108b1 (patch)
treedbaf84a7a95ea9b70d735073a918194ab48abcfc
parent50fd9c454495d15239b059236e17d29b57297dd4 (diff)
i965/fs: Allow constant propagation into MACH.
This happens quite a bit with varying-index uniform loads. We could also do better by avoiding the MACH entirely, but there's no reason not to at least take this step. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index ec72ede87b9..96c9b4efc4b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -262,6 +262,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
progress = true;
break;
+ case BRW_OPCODE_MACH:
case BRW_OPCODE_MUL:
case BRW_OPCODE_ADD:
if (i == 1) {
@@ -269,10 +270,11 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
progress = true;
} else if (i == 0 && inst->src[1].file != IMM) {
/* Fit this constant in by commuting the operands.
- * Exception: we can't do this for 32-bit integer MUL
+ * Exception: we can't do this for 32-bit integer MUL/MACH
* because it's asymmetric.
*/
- if (inst->opcode == BRW_OPCODE_MUL &&
+ if ((inst->opcode == BRW_OPCODE_MUL ||
+ inst->opcode == BRW_OPCODE_MACH) &&
(inst->src[1].type == BRW_REGISTER_TYPE_D ||
inst->src[1].type == BRW_REGISTER_TYPE_UD))
break;