Mesa (master): pan/bi: Fix loads and stores smaller than 32 bits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 3 15:29:41 UTC 2021


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Fri Apr  9 17:06:27 2021 -0400

pan/bi: Fix loads and stores smaller than 32 bits

Spiritual successor to Icecream95's patch of the same name.

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

---

 src/panfrost/bifrost/bi_builder.h.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/panfrost/bifrost/bi_builder.h.py b/src/panfrost/bifrost/bi_builder.h.py
index 2425024afc1..3b7baf1205e 100644
--- a/src/panfrost/bifrost/bi_builder.h.py
+++ b/src/panfrost/bifrost/bi_builder.h.py
@@ -28,6 +28,11 @@ TEMPLATE = """
 #include "compiler.h"
 
 <%
+# For <32-bit loads/stores, the default extend `none` with a natural sized
+# input is not encodeable! To avoid a footgun, swap the default to `zext` which
+# will work as expected
+ZEXT_DEFAULT = set(["LOAD.i8", "LOAD.i16", "LOAD.i24", "STORE.i8", "STORE.i16", "STORE.i24"])
+
 def nirtypes(opcode):
     split = opcode.split('.', 1)
     if len(split) < 2:
@@ -114,6 +119,9 @@ bi_instr * bi_${opcode.replace('.', '_').lower()}${to_suffix(ops[opcode])}(${sig
 % for imm in ops[opcode]["immediates"]:
     I->${imm} = ${imm};
 % endfor
+% if opcode in ZEXT_DEFAULT:
+    I->extend = BI_EXTEND_ZEXT;
+% endif
     bi_builder_insert(&b->cursor, I);
     return I;
 }



More information about the mesa-commit mailing list