pan/mdg: Handle 32-bit offsets from store_shared
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 13 Aug 2020 22:56:40 +0000 (18:56 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 19 Aug 2020 12:08:51 +0000 (12:08 +0000)
Implicitly zero-extended for the 64-bit address.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6321>

src/panfrost/midgard/midgard_address.c

index 5e287dad14f52d75847ca959ac03889ff086563a..2f57c3464a742f0ee41841e81b973028ba854fc2 100644 (file)
@@ -198,10 +198,16 @@ mir_set_offset(compiler_context *ctx, midgard_instruction *ins, nir_src *offset,
                 ins->swizzle[2][i] = 0;
         }
 
+        bool force_zext = (nir_src_bit_size(*offset) < 64);
+
         if (!offset->is_ssa) {
                 ins->load_store.arg_1 |= is_shared ? 0x6E : 0x7E;
                 ins->src[2] = nir_src_index(ctx, offset);
                 ins->src_types[2] = nir_type_uint | nir_src_bit_size(*offset);
+
+                if (force_zext)
+                        ins->load_store.arg_1 |= 0x80;
+
                 return;
         }
 
@@ -221,7 +227,7 @@ mir_set_offset(compiler_context *ctx, midgard_instruction *ins, nir_src *offset,
         } else
                 ins->load_store.arg_2 = 0x1E;
 
-        if (match.zext)
+        if (match.zext || force_zext)
                 ins->load_store.arg_1 |= 0x80;
 
         assert(match.shift <= 7);