From bd6ff4f7e1845d380c366d4f643725fe76a101f5 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 28 May 2020 14:38:44 -0400 Subject: [PATCH] pan/bi: Pack unconditional branch Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_pack.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index e852ae7f4a5..85c48ba1f08 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -1620,7 +1620,7 @@ bi_pack_add_imath(bi_instruction *ins, bi_registers *regs) } static unsigned -bi_pack_add_branch(bi_instruction *ins, bi_registers *regs) +bi_pack_add_branch_cond(bi_instruction *ins, bi_registers *regs) { assert(ins->cond == BI_COND_EQ); assert(ins->src[1] == BIR_INDEX_ZERO); @@ -1653,6 +1653,35 @@ bi_pack_add_branch(bi_instruction *ins, bi_registers *regs) RETURN_PACKED(pack); } +static unsigned +bi_pack_add_branch_uncond(bi_instruction *ins, bi_registers *regs) +{ + struct bifrost_branch pack = { + /* It's unclear what these bits actually mean */ + .src0 = BIFROST_SRC_CONST_LO, + .src1 = BIFROST_SRC_PASS_FMA, + + /* Offset, see above */ + .src2 = BIFROST_SRC_CONST_HI, + + /* All ones in fact */ + .cond = (BR_ALWAYS & 0x7), + .size = (BR_ALWAYS >> 3), + .op = BIFROST_ADD_OP_BRANCH + }; + + RETURN_PACKED(pack); +} + +static unsigned +bi_pack_add_branch(bi_instruction *ins, bi_registers *regs) +{ + if (ins->cond == BI_COND_ALWAYS) + return bi_pack_add_branch_uncond(ins, regs); + else + return bi_pack_add_branch_cond(ins, regs); +} + static unsigned bi_pack_add(bi_clause *clause, bi_bundle bundle, bi_registers *regs, gl_shader_stage stage) { -- 2.30.2