Mesa (main): pan/midg: Fix 64-bit swizzle printer

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 4 23:24:20 UTC 2022


Module: Mesa
Branch: main
Commit: b58c2621441fec5be6ff29837feaa08a2394deff
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b58c2621441fec5be6ff29837feaa08a2394deff

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Thu Sep  9 10:31:18 2021 +0200

pan/midg: Fix 64-bit swizzle printer

Swizzling happens in 2 steps on Midgard:

1. Vector expansion/shuffling
2. Swizzling at the instruction-size granularity, but defined using
   the source size. Those size are different if the source is expanded.

So, when we print 64 bit swizzles on an expanded source, we first need
to apply an offset if the high part of the 32bit vector was selected,
and then divide the result by 2 to account for vector expansion.

To sum-up, swizzling on midgard is complicated, and I'm not sure I got
it right, but it seems to print what I expect on the few compute
shaders using 64bit arithmetic I debugged.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14885>

---

 src/panfrost/midgard/disassemble.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c
index e51d0d70a47..643bbb86367 100644
--- a/src/panfrost/midgard/disassemble.c
+++ b/src/panfrost/midgard/disassemble.c
@@ -415,7 +415,10 @@ print_vec_selectors_64(FILE *fp, unsigned swizzle,
                 unsigned a = (swizzle >> (i * 2)) & 3;
 
                 if (INPUT_EXPANDS(expand_mode)) {
-                        fprintf(fp, "%c", components[a]);
+                        if (expand_mode == midgard_src_expand_high)
+                                a += 2;
+
+                        fprintf(fp, "%c", components[a / 2]);
                         continue;
                 }
 



More information about the mesa-commit mailing list