summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-01-10 06:08:48 +0000
committerDave Airlie <[email protected]>2018-01-18 03:38:17 +0000
commit44a27cdceca0b835d964ca16db68721816ae868f (patch)
tree26ba42a775cc7ff7636745448da406bbdb942078
parent3bb2b2cc451651247307ceb6f08ab06909437984 (diff)
r600/sb: add lds related peepholes.
if no destination: a) convert _RET instructions to non _RET variants if no dst b) set src0 to undefined if it's a READ, this should get DCE then. Acked-By: Roland Scheidegger <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r--src/gallium/drivers/r600/sb/sb_peephole.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/sb/sb_peephole.cpp b/src/gallium/drivers/r600/sb/sb_peephole.cpp
index 49a6965b1f3..4390a8f525c 100644
--- a/src/gallium/drivers/r600/sb/sb_peephole.cpp
+++ b/src/gallium/drivers/r600/sb/sb_peephole.cpp
@@ -68,7 +68,14 @@ void peephole::run_on(container_node* c) {
if (n->is_alu_inst()) {
alu_node *a = static_cast<alu_node*>(n);
- if (a->bc.op_ptr->flags &
+ if (a->bc.op_ptr->flags & AF_LDS) {
+ if (!a->dst[0]) {
+ if (a->bc.op >= LDS_OP2_LDS_ADD_RET && a->bc.op <= LDS_OP3_LDS_MSKOR_RET)
+ a->bc.set_op(a->bc.op - LDS_OP2_LDS_ADD_RET + LDS_OP2_LDS_ADD);
+ if (a->bc.op == LDS_OP1_LDS_READ_RET)
+ a->src[0] = sh.get_undef_value();
+ }
+ } else if (a->bc.op_ptr->flags &
(AF_PRED | AF_SET | AF_CMOV | AF_KILL)) {
optimize_cc_op(a);
} else if (a->bc.op == ALU_OP1_FLT_TO_INT) {