Mesa (main): pan/bi: Include modifier info in opcode table

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 15 20:41:30 UTC 2021


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Fri Mar  5 23:10:39 2021 +0000

pan/bi: Include modifier info in opcode table

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

---

 src/panfrost/bifrost/bi_opcodes.c.py | 12 +++++++++++-
 src/panfrost/bifrost/bi_opcodes.h.py |  7 +++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/bifrost/bi_opcodes.c.py b/src/panfrost/bifrost/bi_opcodes.c.py
index 7ef88da8f0a..d0cda112dcd 100644
--- a/src/panfrost/bifrost/bi_opcodes.c.py
+++ b/src/panfrost/bifrost/bi_opcodes.c.py
@@ -21,7 +21,10 @@
 # IN THE SOFTWARE.
 
 TEMPLATE = """#include "bi_opcodes.h"
-
+<%
+def hasmod(mods, name):
+        return 1 if name in mods else 0
+%>
 struct bi_op_props bi_opcode_props[BI_NUM_OPCODES] = {
 % for opcode in sorted(mnemonics):
     <%
@@ -35,10 +38,17 @@ struct bi_op_props bi_opcode_props[BI_NUM_OPCODES] = {
         branch = int(opcode.startswith('BRANCH'))
         has_fma = int("*" + opcode in instructions)
         has_add = int("+" + opcode in instructions)
+        mods = ops[opcode]['modifiers']
+        clamp = hasmod(mods, 'clamp')
+        not_result = hasmod(mods, 'not_result')
+        abs = hasmod(mods, 'abs0') | (hasmod(mods, 'abs1') << 1) | (hasmod(mods, 'abs2') << 2)
+        neg = hasmod(mods, 'neg0') | (hasmod(mods, 'neg1') << 1) | (hasmod(mods, 'neg2') << 2)
+        m_not = hasmod(mods, 'not1')
     %>
     [BI_OPCODE_${opcode.replace('.', '_').upper()}] = {
         "${opcode}", BIFROST_MESSAGE_${message}, BI_SR_COUNT_${sr_count},
         ${sr_read}, ${sr_write}, ${last}, ${branch}, ${table}, ${has_fma}, ${has_add},
+        ${clamp}, ${not_result}, ${abs}, ${neg}, ${m_not},
     },
 % endfor
 };"""
diff --git a/src/panfrost/bifrost/bi_opcodes.h.py b/src/panfrost/bifrost/bi_opcodes.h.py
index b807513e196..9459eda894c 100644
--- a/src/panfrost/bifrost/bi_opcodes.h.py
+++ b/src/panfrost/bifrost/bi_opcodes.h.py
@@ -77,6 +77,13 @@ struct bi_op_props {
         bool table : 1;
         bool fma : 1;
         bool add : 1;
+
+        /* Supported propagable modifiers */
+        bool clamp : 1;
+        bool not_result : 1;
+        unsigned abs : 3;
+        unsigned neg : 3;
+        bool not : 1;
 };
 
 /* Generated in bi_opcodes.c.py */



More information about the mesa-commit mailing list