Mesa (master): pan/bi: Track scalarness of 16-bit ALU

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 5 02:45:05 UTC 2021


Module: Mesa
Branch: master
Commit: 578f5d00000d864e2c19cf451a438444dd763505
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=578f5d00000d864e2c19cf451a438444dd763505

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Tue Apr 13 20:21:03 2021 -0400

pan/bi: Track scalarness of 16-bit ALU

Needed for optimal swizzle lowering.

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

---

 src/panfrost/bifrost/bifrost_compile.c | 4 ++++
 src/panfrost/bifrost/compiler.h        | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index dee0dd16572..399cbf534fe 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -1532,6 +1532,10 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
         unsigned comps = nir_dest_num_components(instr->dest.dest);
         unsigned src_sz = srcs > 0 ? nir_src_bit_size(instr->src[0].src) : 0;
 
+        /* Indicate scalarness */
+        if ((sz == 1 || sz == 16) && comps == 1)
+                dst.swizzle = BI_SWIZZLE_H00;
+
         if (!instr->dest.dest.is_ssa) {
                 for (unsigned i = 0; i < comps; ++i)
                         assert(instr->dest.write_mask);
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 6627d26070c..1c1ee1ab2b0 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -83,6 +83,9 @@ typedef struct {
         bool abs : 1;
         bool neg : 1;
 
+        /* For a source, the swizzle. For a destination, acts a bit like a
+         * write mask. Identity for the full 32-bit, H00 for only caring about
+         * the lower half, other values unused. */
         enum bi_swizzle swizzle : 4;
         uint32_t offset : 2;
         bool reg : 1;



More information about the mesa-commit mailing list