pan/bi: Assign constant port for branch offsets
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 28 May 2020 17:27:31 +0000 (13:27 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 29 May 2020 20:34:55 +0000 (20:34 +0000)
By convention.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5260>

src/panfrost/bifrost/bi_pack.c

index f35de67abf235eb378b502bdb2b9bf4dcbe65e8e..b5cbc5fa948defb8e60ffe07fc6e9123b224491d 100644 (file)
@@ -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;