Mesa (main): pan/va: Record which instructions are signed

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 6 18:22:58 UTC 2022


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Jun  2 19:06:07 2022 -0400

pan/va: Record which instructions are signed

We need to distinguish signed integer instructions from unsigned integer
instructions, to distinguish sign-extension and zero-extension of sources.

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

---

 src/panfrost/bifrost/valhall/valhall.c.py | 1 +
 src/panfrost/bifrost/valhall/valhall.h    | 1 +
 src/panfrost/bifrost/valhall/valhall.py   | 1 +
 3 files changed, 3 insertions(+)

diff --git a/src/panfrost/bifrost/valhall/valhall.c.py b/src/panfrost/bifrost/valhall/valhall.c.py
index d47fdfbfc0f..db0c0fb2083 100644
--- a/src/panfrost/bifrost/valhall/valhall.c.py
+++ b/src/panfrost/bifrost/valhall/valhall.c.py
@@ -147,6 +147,7 @@ valhall_opcodes[BI_NUM_OPCODES] = {
         },
         .type_size = ${typesize(op.name)},
         .has_dest = ${ibool(len(op.dests) > 0)},
+        .is_signed = ${ibool(op.is_signed)},
         .unit = VA_UNIT_${op.unit},
         .nr_srcs = ${len(op.srcs)},
         .nr_staging_srcs = ${sum([sr.read for sr in op.staging])},
diff --git a/src/panfrost/bifrost/valhall/valhall.h b/src/panfrost/bifrost/valhall/valhall.h
index 36bc606a6ab..2780c09a09e 100644
--- a/src/panfrost/bifrost/valhall/valhall.h
+++ b/src/panfrost/bifrost/valhall/valhall.h
@@ -90,6 +90,7 @@ struct va_opcode_info {
    unsigned nr_staging_srcs : 2;
    unsigned nr_staging_dests : 2;
    bool has_dest : 1;
+   bool is_signed : 1;
    bool clamp : 1;
    bool round_mode : 1;
    bool condition : 1;
diff --git a/src/panfrost/bifrost/valhall/valhall.py b/src/panfrost/bifrost/valhall/valhall.py
index dd4c27493c8..5e3497fc5b1 100644
--- a/src/panfrost/bifrost/valhall/valhall.py
+++ b/src/panfrost/bifrost/valhall/valhall.py
@@ -191,6 +191,7 @@ class Instruction:
         self.modifiers = modifiers
         self.staging = staging
         self.unit = unit
+        self.is_signed = len(name.split(".")) > 1 and ('s' in name.split(".")[1])
 
         # Message-passing instruction <===> not ALU instruction
         self.message = unit not in ["FMA", "CVT", "SFU"]



More information about the mesa-commit mailing list