Mesa (main): pan/bi: Move typesize to common code

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


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Jun 10 20:07:50 2021 -0400

pan/bi: Move typesize to common code

Useful for the 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_builder.h.py | 15 +--------------
 src/panfrost/bifrost/bifrost_isa.py  | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/panfrost/bifrost/bi_builder.h.py b/src/panfrost/bifrost/bi_builder.h.py
index 3b7baf1205e..b3ccafd26e8 100644
--- a/src/panfrost/bifrost/bi_builder.h.py
+++ b/src/panfrost/bifrost/bi_builder.h.py
@@ -58,19 +58,6 @@ def nirtypes(opcode):
     else:
         return None
 
-def typesize(opcode):
-    if opcode[-3:] == '128':
-        return 128
-    if opcode[-2:] == '48':
-        return 48
-    elif opcode[-1] == '8':
-        return 8
-    else:
-        try:
-            return int(opcode[-2:])
-        except:
-            return None
-
 def condition(opcode, typecheck, sizecheck):
     cond = ''
     if typecheck == True:
@@ -211,4 +198,4 @@ def arguments(op, temp_dest = True):
         modifier_signature(op) +
         op["immediates"])
 
-print(Template(COPYRIGHT + TEMPLATE).render(ops = ir_instructions, modifiers = modifier_lists, signature = signature, arguments = arguments, src_count = src_count, SKIP = SKIP))
+print(Template(COPYRIGHT + TEMPLATE).render(ops = ir_instructions, modifiers = modifier_lists, signature = signature, arguments = arguments, src_count = src_count, typesize = typesize, SKIP = SKIP))
diff --git a/src/panfrost/bifrost/bifrost_isa.py b/src/panfrost/bifrost/bifrost_isa.py
index 31bb5620ce9..63dd785d513 100644
--- a/src/panfrost/bifrost/bifrost_isa.py
+++ b/src/panfrost/bifrost/bifrost_isa.py
@@ -334,3 +334,17 @@ def order_modifiers(ir_instructions):
 def src_count(op):
     staging = 1 if (op["staging"] in ["r", "rw"]) else 0
     return op["srcs"] + staging
+
+# Parses out the size part of an opocde name
+def typesize(opcode):
+    if opcode[-3:] == '128':
+        return 128
+    if opcode[-2:] == '48':
+        return 48
+    elif opcode[-1] == '8':
+        return 8
+    else:
+        try:
+            return int(opcode[-2:])
+        except:
+            return 32



More information about the mesa-commit mailing list