diff options
author | Eric Anholt <[email protected]> | 2014-08-24 16:51:32 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-09-04 11:39:51 -0700 |
commit | 874dfa8b2ecccf3c9a73453d7ccc6638363a59bd (patch) | |
tree | be821f68c78f6785282b2d620b84c122effd57a7 /src/gallium/drivers/vc4/vc4_opt_algebraic.c | |
parent | 3972a6f057e20ec9e8358f4487c3b4d51c499628 (diff) |
vc4: Expose compares at a lower level in QIR.
Before, we had some special opcodes like CMP and SNE that emitted multiple
instructions. Now, we reduce those operations significantly, giving
optimization more to look at for reducing redundant operations.
The downside is that QOP_SF is pretty special -- we're going to have to
track it separately when we're doing instruction scheduling, and we want
to peephole it into the instruction generating the destination write in
most cases (and not allocate the destination reg, probably. Unless it's
used for some other purpose, as well).
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_opt_algebraic.c')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_opt_algebraic.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/drivers/vc4/vc4_opt_algebraic.c b/src/gallium/drivers/vc4/vc4_opt_algebraic.c index 2bf474ccef9..f8ed6218adc 100644 --- a/src/gallium/drivers/vc4/vc4_opt_algebraic.c +++ b/src/gallium/drivers/vc4/vc4_opt_algebraic.c @@ -45,9 +45,12 @@ qir_opt_algebraic(struct qcompile *c) struct qinst *inst = (struct qinst *)node; switch (inst->op) { - case QOP_CMP: - /* Turn "dst = (a < 0) ? b : b)" into "dst = b" */ - if (qir_reg_equals(inst->src[1], inst->src[2])) { + case QOP_SEL_X_Y_ZS: + case QOP_SEL_X_Y_ZC: + case QOP_SEL_X_Y_NS: + case QOP_SEL_X_Y_NC: + /* Turn "dst = (sf == x) ? a : a)" into "dst = a" */ + if (qir_reg_equals(inst->src[0], inst->src[1])) { if (debug) { fprintf(stderr, "optimizing: "); qir_dump_inst(inst); |