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

Author: Dmitry Baryshkov <[email protected]>
Date:   Sun Oct 22 09:47:41 2023 +0000

ir3: fix shift amount for 8-bit shifts

Follow the 16-bit approach and convert shift amount to 8b for 8b shift
instructions.

Signed-off-by: Dmitry Baryshkov <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26817>

---

 src/freedreno/ir3/ir3_compiler_nir.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/freedreno/ir3/ir3_compiler_nir.c 
b/src/freedreno/ir3/ir3_compiler_nir.c
index d1f36c7f493..0da15340814 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -294,10 +294,12 @@ static struct ir3_instruction *
 resize_shift_amount(struct ir3_context *ctx, struct ir3_instruction *src,
                     unsigned bs)
 {
-   if (bs != 16)
+   if (bs == 16)
+      return ir3_COV(ctx->block, src, TYPE_U32, TYPE_U16);
+   else if (bs == 8)
+      return ir3_COV(ctx->block, src, TYPE_U32, TYPE_U8);
+   else
       return src;
-
-   return ir3_COV(ctx->block, src, TYPE_U32, TYPE_U16);
 }
 
 static void

Reply via email to