pan/mdg: Implement vector constant printing for 8-bit
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 14 May 2020 17:30:05 +0000 (13:30 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 21 May 2020 17:49:14 +0000 (17:49 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5151>

src/panfrost/midgard/disassemble.c

index ce70cbc561ddf625567de8e9b17127ca4edc043c..e97cee163a2719ddea400747c870f5931dd5d777 100644 (file)
@@ -357,10 +357,11 @@ print_vector_constants(FILE *fp, unsigned src_binary,
 {
         midgard_vector_alu_src *src = (midgard_vector_alu_src *)&src_binary;
         unsigned bits = bits_for_mode_halved(alu->reg_mode, src->half);
-        unsigned max_comp = MIN2((sizeof(*consts) * 8) / bits, 8);
+        unsigned max_comp = (sizeof(*consts) * 8) / bits;
         unsigned comp_mask, num_comp = 0;
 
         assert(consts);
+        assert(max_comp <= 16);
 
         comp_mask = effective_writemask(alu, condense_writemask(alu->mask, bits));
         num_comp = util_bitcount(comp_mask);
@@ -380,6 +381,20 @@ print_vector_constants(FILE *fp, unsigned src_binary,
                                 c += (!src->rep_low * 4);
                 } else if (bits == 32 && !src->half) {
                         /* Implicitly ok */
+                } else if (bits == 8) {
+                        assert (!src->half);
+                        unsigned index = (i >> 1) & 3;
+                        unsigned base = (src->swizzle >> (index * 2)) & 3;
+                        c = base * 2;
+
+                        if (i < 8)
+                                c += (src->rep_high) * 8;
+                        else
+                                c += (!src->rep_low) * 8;
+
+                        /* We work on twos, actually */
+                        if (i & 1)
+                                c++;
                 } else {
                         printf(" (%d%d%d)", src->rep_low, src->rep_high, src->half);
                 }