pan/midgard: Force address alignment
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 27 Feb 2020 15:07:32 +0000 (10:07 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 27 Feb 2020 21:02:35 +0000 (21:02 +0000)
I thought we already had this but... maybe not..

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

src/panfrost/midgard/midgard_ra.c

index f2fd8384cb4703dbf2238619b10de9d72403f58e..92dbc1fe63c1ed4f3e1cff45b5d29aff0ac8e158 100644 (file)
@@ -492,6 +492,16 @@ allocate_registers(compiler_context *ctx, bool *spilled)
                         }
                 }
 
+                if (ins->type == TAG_LOAD_STORE_4 && OP_HAS_ADDRESS(ins->load_store.op)) {
+                        mir_foreach_src(ins, v) {
+                                unsigned s = ins->src[v];
+                                unsigned size = mir_srcsize(ins, v);
+
+                                if (s < ctx->temp_count)
+                                        min_alignment[s] = (size == midgard_reg_mode_64) ? 3 : 2;
+                        }
+                }
+
                 if (ins->dest >= SSA_FIXED_MINIMUM) continue;
 
                 /* 0 for x, 1 for xy, 2 for xyz, 3 for xyzw */