diff --git a/.pick_status.json b/.pick_status.json index 3822f60dd82..2ff84c8e483 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -22,7 +22,7 @@ "description": "pan/mdg: Fix 16-bit alignment with spiller", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "129d390bd8cc50f55b748ae6e95bed8c6074a488" }, diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c index d493f4219e3..aee4f283bb8 100644 --- a/src/panfrost/midgard/midgard_ra.c +++ b/src/panfrost/midgard/midgard_ra.c @@ -518,6 +518,18 @@ allocate_registers(compiler_context *ctx, bool *spilled) } } + /* Anything read as 16-bit needs proper alignment to ensure the + * resulting code can be packed. + */ + mir_foreach_src(ins, s) { + unsigned src_size = nir_alu_type_get_type_size(ins->src_types[s]); + if (src_size == 16 && ins->src[s] < SSA_FIXED_MINIMUM) + min_bound[ins->src[s]] = MAX2(min_bound[ins->src[s]], 8); + } + + /* Everything after this concerns only the destination, not the + * sources. + */ if (ins->dest >= SSA_FIXED_MINIMUM) continue; unsigned size = nir_alu_type_get_type_size(ins->dest_type); @@ -547,12 +559,6 @@ allocate_registers(compiler_context *ctx, bool *spilled) if (size == 16 && min_alignment[dest] != 4) min_bound[dest] = 8; - mir_foreach_src(ins, s) { - unsigned src_size = nir_alu_type_get_type_size(ins->src_types[s]); - if (src_size == 16 && ins->src[s] < SSA_FIXED_MINIMUM) - min_bound[ins->src[s]] = MAX2(min_bound[ins->src[s]], 8); - } - /* We don't have a swizzle for the conditional and we don't * want to muck with the conditional itself, so just force * alignment for now */