summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_qir.h
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-03-15 13:55:28 -0700
committerEric Anholt <[email protected]>2016-07-12 17:42:40 -0700
commit05bcd9dd960d5658801ab35d429ba9778f67cad0 (patch)
tree8e26e38f7346c608dfd0b1b34c4af9a568962c45 /src/gallium/drivers/vc4/vc4_qir.h
parent54800bb71c874bc7e9953a2e6d29ea53915f5be7 (diff)
vc4: Define a QIR branch instruction
This uses the branch condition code in inst->cond to jump to either successor[0] (condition matches) or successor[0] (condition doesn't match).
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_qir.h')
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h
index 5099b7f1f1c..ad784bb987b 100644
--- a/src/gallium/drivers/vc4/vc4_qir.h
+++ b/src/gallium/drivers/vc4/vc4_qir.h
@@ -156,6 +156,12 @@ enum qop {
QOP_TEX_RESULT,
QOP_LOAD_IMM,
+
+ /* Jumps to block->successor[0] if the qinst->cond (as a
+ * QPU_COND_BRANCH_*) passes, or block->successor[1] if not. Note
+ * that block->successor[1] may be unset if the condition is ALWAYS.
+ */
+ QOP_BRANCH,
};
struct queued_qpu_inst {
@@ -754,6 +760,15 @@ qir_LOAD_IMM(struct vc4_compile *c, uint32_t val)
qir_reg(QFILE_LOAD_IMM, val), c->undef));
}
+static inline struct qinst *
+qir_BRANCH(struct vc4_compile *c, uint8_t cond)
+{
+ struct qinst *inst = qir_inst(QOP_BRANCH, c->undef, c->undef, c->undef);
+ inst->cond = cond;
+ qir_emit_nondef(c, inst);
+ return inst;
+}
+
#define qir_for_each_block(block, c) \
list_for_each_entry(struct qblock, block, &c->blocks, link)