From cd9a08d4f2360c227eb17f5b1f166ac46ca08ebe Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 28 May 2020 13:27:31 -0400 Subject: [PATCH] pan/bi: Assign constant port for branch offsets By convention. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_pack.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index f35de67abf2..b5cbc5fa948 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -123,6 +123,24 @@ bi_assign_uniform_constant_single( return true; } + if (ins->type == BI_BRANCH && clause->branch_constant) { + /* By convention branch constant is last */ + unsigned idx = clause->constant_count - 1; + + /* We can only jump to clauses which are qword aligned so the + * bottom 4-bits of the offset are necessarily 0 */ + unsigned lo = 0; + + /* Build the constant */ + unsigned C = bi_constant_field(idx) | lo; + + if (assigned && regs->uniform_constant != C) + unreachable("Mismatched uniform/const field: branch"); + + regs->uniform_constant = C; + return true; + } + bi_foreach_src(ins, s) { if (s == 0 && (ins->type == BI_LOAD_VAR_ADDRESS || ins->type == BI_LOAD_ATTR)) continue; if (s == 1 && (ins->type == BI_BRANCH)) continue; -- 2.30.2