panfrost: Use pack for Bifrost test state
[mesa.git] / src / panfrost / bifrost / bi_ra.c
index b6da1df7038c1df2efe2a21817da669e3cefc2b7..1936958c28f33dc76c48b298c41a0e7380686110 100644 (file)
@@ -67,7 +67,7 @@ bi_allocate_registers(bi_context *ctx, bool *success)
         unsigned node_count = bi_max_temp(ctx);
 
         struct lcra_state *l =
-                lcra_alloc_equations(node_count, 1, 8, 16, 1);
+                lcra_alloc_equations(node_count, 1);
 
         l->class_start[BI_REG_CLASS_WORK] = 0;
         l->class_size[BI_REG_CLASS_WORK] = 64 * 4; /* R0 - R63, all 32-bit */
@@ -79,7 +79,7 @@ bi_allocate_registers(bi_context *ctx, bool *success)
                         continue;
 
                 l->class[dest] = BI_REG_CLASS_WORK;
-                lcra_set_alignment(l, dest, 2); /* 2^2 = 4 */
+                lcra_set_alignment(l, dest, 2, 16); /* 2^2 = 4 */
                 lcra_restrict_range(l, dest, 4);
         }
 
@@ -124,8 +124,14 @@ bi_adjust_src_ra(bi_instruction *ins, struct lcra_state *l, unsigned src)
                 /* Use the swizzle as component select */
                 unsigned components = bi_get_component_count(ins, src);
 
+                nir_alu_type T = ins->src_types[src];
+                unsigned size = nir_alu_type_get_type_size(T);
+                /* TODO: 64-bit? */
+                unsigned components_per_word = MAX2(32 / size, 1);
+
                 for (unsigned i = 0; i < components; ++i) {
-                        unsigned off = ins->swizzle[src][i] / components;
+                        unsigned off = ins->swizzle[src][i] / components_per_word;
 
                         /* We can't cross register boundaries in a swizzle */
                         if (i == 0)
@@ -133,7 +139,7 @@ bi_adjust_src_ra(bi_instruction *ins, struct lcra_state *l, unsigned src)
                         else
                                 assert(off == offset);
 
-                        ins->swizzle[src][i] %= components;
+                        ins->swizzle[src][i] %= components_per_word;
                 }
         }
 
@@ -147,6 +153,7 @@ bi_adjust_dest_ra(bi_instruction *ins, struct lcra_state *l)
                 return;
 
         ins->dest = bi_reg_from_index(l, ins->dest, ins->dest_offset);
+        ins->dest_offset = 0;
 }
 
 static void