summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_qir.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2016-03-15 13:55:28 -0700
committerEric Anholt <eric@anholt.net>2016-07-12 17:42:40 -0700
commit05bcd9dd960d5658801ab35d429ba9778f67cad0 (patch)
tree8e26e38f7346c608dfd0b1b34c4af9a568962c45 /src/gallium/drivers/vc4/vc4_qir.c
parent54800bb71c874bc7e9953a2e6d29ea53915f5be7 (diff)
downloadexternal_mesa3d-05bcd9dd960d5658801ab35d429ba9778f67cad0.zip
external_mesa3d-05bcd9dd960d5658801ab35d429ba9778f67cad0.tar.gz
external_mesa3d-05bcd9dd960d5658801ab35d429ba9778f67cad0.tar.bz2
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.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c
index 4c81b56..982e829 100644
--- a/src/gallium/drivers/vc4/vc4_qir.c
+++ b/src/gallium/drivers/vc4/vc4_qir.c
@@ -83,6 +83,8 @@ static const struct qir_op_info qir_op_info[] = {
[QOP_TEX_RESULT] = { "tex_result", 1, 0, true },
[QOP_LOAD_IMM] = { "load_imm", 0, 1 },
+
+ [QOP_BRANCH] = { "branch", 0, 0, true },
};
static const char *
@@ -204,8 +206,12 @@ qir_is_tex(struct qinst *inst)
bool
qir_depends_on_flags(struct qinst *inst)
{
- return (inst->cond != QPU_COND_ALWAYS &&
- inst->cond != QPU_COND_NEVER);
+ if (inst->op == QOP_BRANCH) {
+ return inst->cond != QPU_COND_BRANCH_ALWAYS;
+ } else {
+ return (inst->cond != QPU_COND_ALWAYS &&
+ inst->cond != QPU_COND_NEVER);
+ }
}
bool
@@ -337,20 +343,26 @@ void
qir_dump_inst(struct vc4_compile *c, struct qinst *inst)
{
fprintf(stderr, "%s", qir_get_op_name(inst->op));
- vc4_qpu_disasm_cond(stderr, inst->cond);
+ if (inst->op == QOP_BRANCH)
+ vc4_qpu_disasm_cond_branch(stderr, inst->cond);
+ else
+ vc4_qpu_disasm_cond(stderr, inst->cond);
if (inst->sf)
fprintf(stderr, ".sf");
fprintf(stderr, " ");
- qir_print_reg(c, inst->dst, true);
- if (inst->dst.pack) {
+ if (inst->op != QOP_BRANCH) {
+ qir_print_reg(c, inst->dst, true);
if (inst->dst.pack) {
- if (qir_is_mul(inst))
- vc4_qpu_disasm_pack_mul(stderr, inst->dst.pack);
- else
- vc4_qpu_disasm_pack_a(stderr, inst->dst.pack);
+ if (inst->dst.pack) {
+ if (qir_is_mul(inst))
+ vc4_qpu_disasm_pack_mul(stderr, inst->dst.pack);
+ else
+ vc4_qpu_disasm_pack_a(stderr, inst->dst.pack);
+ }
}
}
+
for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
fprintf(stderr, ", ");
qir_print_reg(c, inst->src[i], false);
@@ -412,6 +424,14 @@ qir_dump(struct vc4_compile *c)
fprintf(stderr, "\n");
ip++;
}
+ if (block->successors[1]) {
+ fprintf(stderr, "-> BLOCK %d, %d\n",
+ block->successors[0]->index,
+ block->successors[1]->index);
+ } else if (block->successors[0]) {
+ fprintf(stderr, "-> BLOCK %d\n",
+ block->successors[0]->index);
+ }
}
}