summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_qir.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-02-19 12:58:53 -0800
committerEric Anholt <[email protected]>2015-02-19 23:35:17 -0800
commit14dc281c1332518b6144718e1fb3845abbe23ff7 (patch)
tree7726018b2b9106c2d184236027fb56b3dcdd68be /src/gallium/drivers/vc4/vc4_qir.c
parent09c844fcd9c0dc81da4f914e6b88892ea76fe8e9 (diff)
vc4: Enforce one-uniform-per-instruction after optimization.
This lets us more intelligently decide which uniform values should be put into temporaries, by choosing the most reused values to push to temps first. total uniforms in shared programs: 13457 -> 13433 (-0.18%) uniforms in affected programs: 1524 -> 1500 (-1.57%) total instructions in shared programs: 40198 -> 40019 (-0.45%) instructions in affected programs: 6027 -> 5848 (-2.97%) I noticed this opportunity because with the NIR work, some programs were happening to make different uniform copy propagation choices that significantly increased instruction counts.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_qir.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c
index 9e0ee1f0ae5..5c1fdbddfb6 100644
--- a/src/gallium/drivers/vc4/vc4_qir.c
+++ b/src/gallium/drivers/vc4/vc4_qir.c
@@ -174,6 +174,12 @@ qir_is_multi_instruction(struct qinst *inst)
}
bool
+qir_is_tex(struct qinst *inst)
+{
+ return inst->op >= QOP_TEX_S && inst->op <= QOP_TEX_DIRECT;
+}
+
+bool
qir_depends_on_flags(struct qinst *inst)
{
switch (inst->op) {
@@ -420,9 +426,12 @@ qir_get_stage_name(enum qstage stage)
void
qir_SF(struct vc4_compile *c, struct qreg src)
{
- assert(!is_empty_list(&c->instructions));
- struct qinst *last_inst = (struct qinst *)c->instructions.prev;
- if (last_inst->dst.file != src.file ||
+ struct qinst *last_inst = NULL;
+ if (!is_empty_list(&c->instructions))
+ last_inst = (struct qinst *)c->instructions.prev;
+
+ if (!last_inst ||
+ last_inst->dst.file != src.file ||
last_inst->dst.index != src.index ||
qir_is_multi_instruction(last_inst)) {
src = qir_MOV(c, src);