Mesa (main): pan/bi: Handle trivial i2i32

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Feb 19 03:33:22 UTC 2022


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Sat Jan 15 14:06:06 2022 -0500

pan/bi: Handle trivial i2i32

lower_bool_to_bitsize can generate i2i32 from a 32-bit source, which is
trivial but needs to be handled explicitly to avoid going down the 8-bit
conversion path.

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

---

 src/panfrost/bifrost/bifrost_compile.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 5661800bf12..c2ee1668c09 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -2167,6 +2167,8 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
                 break;
 
         case nir_op_i2f32:
+                assert(src_sz == 32 || src_sz == 16 || src_sz == 8);
+
                 if (src_sz == 32)
                         bi_s32_to_f32_to(b, dst, s0, BI_ROUND_RTZ);
                 else if (src_sz == 16)
@@ -2176,17 +2178,26 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
                 break;
 
         case nir_op_i2i32:
-                if (src_sz == 16)
+                assert(src_sz == 32 || src_sz == 16 || src_sz == 8);
+
+                if (src_sz == 32)
+                        bi_mov_i32_to(b, dst, s0);
+                else if (src_sz == 16)
                         bi_s16_to_s32_to(b, dst, s0);
-                else
+                else if (src_sz == 8)
                         bi_s8_to_s32_to(b, dst, s0);
                 break;
 
         case nir_op_u2u32:
-                if (src_sz == 16)
+                assert(src_sz == 32 || src_sz == 16 || src_sz == 8);
+
+                if (src_sz == 32)
+                        bi_mov_i32_to(b, dst, s0);
+                else if (src_sz == 16)
                         bi_u16_to_u32_to(b, dst, s0);
-                else
+                else if (src_sz == 8)
                         bi_u8_to_u32_to(b, dst, s0);
+
                 break;
 
         case nir_op_i2i16:



More information about the mesa-commit mailing list