summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-09-24 21:57:06 -0700
committerEric Anholt <[email protected]>2014-09-29 11:33:34 -0700
commit76cd9955d96c1b0a13905e255571eb35b3aa2a99 (patch)
treef2a21d620b6661ca69cb80d2aa45f4426b3f3113 /src
parent64122b16ce74a3fb65269bab325c651c26ccd2d0 (diff)
vc4: Optimize out silly SUBs of 0.
Drops instructions on vs-temp-array-mat4-index-col-row-wr.shader_test, which I was looking at because it's failing to register allocate.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/vc4/vc4_opt_algebraic.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_opt_algebraic.c b/src/gallium/drivers/vc4/vc4_opt_algebraic.c
index b5cde0511d0..f88a5c17d2a 100644
--- a/src/gallium/drivers/vc4/vc4_opt_algebraic.c
+++ b/src/gallium/drivers/vc4/vc4_opt_algebraic.c
@@ -117,6 +117,17 @@ qir_opt_algebraic(struct vc4_compile *c)
}
break;
+ case QOP_FSUB:
+ case QOP_SUB:
+ if (is_zero(c, defs, inst->src[1])) {
+ dump_from(c, inst);
+ inst->op = QOP_MOV;
+ inst->src[1] = c->undef;
+ progress = true;
+ dump_to(c, inst);
+ }
+ break;
+
default:
break;
}