pan/mdg: Ensure we don't DCE into impossible masks
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 21 May 2020 21:51:06 +0000 (17:51 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 22 May 2020 18:05:14 +0000 (18:05 +0000)
We round up for ld/st.

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

src/panfrost/midgard/midgard_opt_dce.c

index be9307e712a746c1be7c05d2db4c15ecbb997076..93d3d45b2412423794af2a5e6beb4aa5d2bed1a5 100644 (file)
@@ -73,9 +73,14 @@ midgard_opt_dead_code_eliminate_block(compiler_context *ctx, midgard_block *bloc
         mir_foreach_instr_in_block_rev(block, ins) {
                 if (can_cull_mask(ctx, ins)) {
                         unsigned type_size = nir_alu_type_get_type_size(ins->dest_type);
+                        unsigned round_size = type_size;
                         unsigned oldmask = ins->mask;
 
-                        unsigned rounded = mir_round_bytemask_up(live[ins->dest], type_size);
+                        /* Make sure we're packable */
+                        if (type_size == 16 && ins->type == TAG_LOAD_STORE_4)
+                                round_size = 32;
+
+                        unsigned rounded = mir_round_bytemask_up(live[ins->dest], round_size);
                         unsigned cmask = mir_from_bytemask(rounded, type_size);
 
                         ins->mask &= cmask;