diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-04-27 20:12:55 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-29 15:35:54 +0000 |
commit | 459cf59c6114d3dc58a4db7187126b5b17ae6c87 (patch) | |
tree | 8d7fbc8b25cea99bbff87cbee98c2025a8e1b543 | |
parent | 62768590d5414a40e6b22a22a7a50e66893d0451 (diff) |
pan/mdg: Specialize swizzle to type
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4793>
-rw-r--r-- | src/panfrost/midgard/midgard_print.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/panfrost/midgard/midgard_print.c b/src/panfrost/midgard/midgard_print.c index 58d6cf67278..fb0e701d599 100644 --- a/src/panfrost/midgard/midgard_print.c +++ b/src/panfrost/midgard/midgard_print.c @@ -71,12 +71,18 @@ mir_print_mask(unsigned mask) } static void -mir_print_swizzle(unsigned *swizzle) +mir_print_swizzle(unsigned *swizzle, nir_alu_type T) { + unsigned sz = nir_alu_type_get_type_size(T); + unsigned comps = 128 / sz; + printf("."); - for (unsigned i = 0; i < 16; ++i) - putchar(components[swizzle[i]]); + for (unsigned i = 0; i < comps; ++i) { + unsigned C = swizzle[i]; + assert(C < comps); + putchar(components[C]); + } } static const char * @@ -352,7 +358,7 @@ mir_print_instruction(midgard_instruction *ins) if (ins->src[0] != ~0) { pan_print_alu_type(ins->src_types[0], stdout); - mir_print_swizzle(ins->swizzle[0]); + mir_print_swizzle(ins->swizzle[0], ins->src_types[0]); } } printf(", "); @@ -366,7 +372,7 @@ mir_print_instruction(midgard_instruction *ins) if (ins->src[1] != ~0) { pan_print_alu_type(ins->src_types[1], stdout); - mir_print_swizzle(ins->swizzle[1]); + mir_print_swizzle(ins->swizzle[1], ins->src_types[1]); } } @@ -376,7 +382,7 @@ mir_print_instruction(midgard_instruction *ins) if (ins->src[c] != ~0) { pan_print_alu_type(ins->src_types[c], stdout); - mir_print_swizzle(ins->swizzle[c]); + mir_print_swizzle(ins->swizzle[c], ins->src_types[c]); } } |