aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-05-28 13:08:04 -0400
committerMarge Bot <[email protected]>2020-05-29 20:34:55 +0000
commitb9967ab6da8a1c383939752611ad564aee271cb7 (patch)
tree4a41ded987bfdf9304b1cd5c11671fe7be326774 /src
parent627872ef7f8be877cc8c64f0b424827a43ed8ef7 (diff)
pan/bi: Pack branch offset constants
This is not fully generic but for a single constant it will do. Extensions left for future work. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5260>
Diffstat (limited to 'src')
-rw-r--r--src/panfrost/bifrost/bi_pack.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index 9f8bf6b08a4..f35de67abf2 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -1705,7 +1705,18 @@ bi_pack_bundle(bi_clause *clause, bi_bundle bundle, bi_bundle prev, bool first_b
}
/* Packs the next two constants as a dedicated constant quadword at the end of
- * the clause, returning the number packed. */
+ * the clause, returning the number packed. There are two cases to consider:
+ *
+ * Case #1: Branching is not used. For a single constant copy the upper nibble
+ * over, easy.
+ *
+ * Case #2: Branching is used. For a single constant, it suffices to set the
+ * upper nibble to 4 and leave the latter constant 0, which matches what the
+ * blob does.
+ *
+ * Extending to multiple constants is considerably more tricky and left for
+ * future work.
+ */
static unsigned
bi_pack_constants(bi_context *ctx, bi_clause *clause,
@@ -1716,6 +1727,9 @@ bi_pack_constants(bi_context *ctx, bi_clause *clause,
bool done = clause->constant_count <= (index + 2);
bool only = clause->constant_count <= (index + 1);
+ /* Is the constant we're packing for a branch? */
+ bool branches = clause->branch_constant && done;
+
/* TODO: Pos */
assert(index == 0 && clause->bundle_count == 1);
assert(only);
@@ -1729,6 +1743,13 @@ bi_pack_constants(bi_context *ctx, bi_clause *clause,
.imm_2 = ((hi < 8) ? (hi << 60ull) : 0) >> 4,
};
+ if (branches) {
+ /* Branch offsets are less than 60-bits so this should work at
+ * least for now */
+ quad.imm_1 |= (4ull << 60ull) >> 4;
+ assert (hi == 0);
+ }
+
/* XXX: On G71, Connor observed that the difference of the top 4 bits
* of the second constant with the first must be less than 8, otherwise
* we have to swap them. On G52, I'm able to reproduce a similar issue