Mesa (master): i965/fs: Ignore type in cmod prop if scan_inst is CMP.
Matt Turner
mattst88 at kemper.freedesktop.org
Thu Mar 19 04:03:48 UTC 2015
Module: Mesa
Branch: master
Commit: bb22aa08e4b08c9688c5d5c6558ac01663d0163a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb22aa08e4b08c9688c5d5c6558ac01663d0163a
Author: Matt Turner <mattst88 at gmail.com>
Date: Tue Mar 17 19:17:15 2015 -0700
i965/fs: Ignore type in cmod prop if scan_inst is CMP.
total instructions in shared programs: 6263270 -> 6203091 (-0.96%)
instructions in affected programs: 2606529 -> 2546350 (-2.31%)
helped: 14301
GAINED: 5
LOST: 3
Revewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
---
.../drivers/dri/i965/brw_fs_cmod_propagation.cpp | 25 ++++++++++----------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
index 1935f06..798fef3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
@@ -94,21 +94,22 @@ opt_cmod_propagation_local(bblock_t *block)
scan_inst->dst.reg_offset != inst->src[0].reg_offset)
break;
- /* This must be done before the dst.type check because the result
- * type of the AND will always be D, but the result of the CMP
- * could be anything. The assumption is that the AND is just
- * figuring out what the result of the previous comparison was
- * instead of doing a new comparison with a different type.
- */
- if (inst->opcode == BRW_OPCODE_AND) {
- if (scan_inst->opcode == BRW_OPCODE_CMP) {
- inst->remove(block);
- progress = true;
- }
-
+ /* CMP's result is the same regardless of dest type. */
+ if (inst->conditional_mod == BRW_CONDITIONAL_NZ &&
+ scan_inst->opcode == BRW_OPCODE_CMP &&
+ (inst->dst.type == BRW_REGISTER_TYPE_D ||
+ inst->dst.type == BRW_REGISTER_TYPE_UD)) {
+ inst->remove(block);
+ progress = true;
break;
}
+ /* If the AND wasn't handled by the previous case, it isn't safe
+ * to remove it.
+ */
+ if (inst->opcode == BRW_OPCODE_AND)
+ break;
+
/* Comparisons operate differently for ints and floats */
if (scan_inst->dst.type != inst->dst.type)
break;
More information about the mesa-commit
mailing list