pan/bi: Use bi_emit_split_i32 for trimming vecs
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 21 Jul 2022 19:43:29 +0000 (15:43 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 16:03:23 +0000 (16:03 +0000)
This ensures the shape of the split is correct (no nulls in the destination).
This should not affect the register allocation, though it does "cost" extra
variable names.

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

src/panfrost/bifrost/bifrost_compile.c

index cedd639..b448c8f 100644 (file)
@@ -1044,17 +1044,17 @@ bi_emit_store_vary(bi_builder *b, nir_intrinsic_instr *instr)
         if (nr < nir_intrinsic_src_components(instr, 0)) {
                 assert(T_size == 32 && "todo: 16-bit trim");
 
-                bi_instr *split = bi_split_i32_to(b, bi_null(), data);
-                split->nr_dests = nir_intrinsic_src_components(instr, 0);
+                bi_index chans[4] = { bi_null(), bi_null(), bi_null(), bi_null() };
+                unsigned src_comps = nir_intrinsic_src_components(instr, 0);
+
+                bi_emit_split_i32(b, chans, data, src_comps);
 
                 bi_index tmp = bi_temp(b->shader);
                 bi_instr *collect = bi_collect_i32_to(b, tmp);
                 collect->nr_srcs = nr;
 
-                for (unsigned w = 0; w < nr; ++w) {
-                        split->dest[w] = bi_temp(b->shader);
-                        collect->src[w] = split->dest[w];
-                }
+                for (unsigned w = 0; w < nr; ++w)
+                        collect->src[w] = chans[w];
 
                 data = tmp;
         }