From: Icecream95 Date: Fri, 10 Dec 2021 10:44:25 +0000 (+1300) Subject: pan/mdg: Use MAX2 to set min_alignment X-Git-Tag: upstream/22.3.5~9214 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b281843974aa86594288ca3c096eedf9965739f5;p=platform%2Fupstream%2Fmesa.git pan/mdg: Use MAX2 to set min_alignment If a value is written in a vector CSEL but then written again by other instructions, it still needs full alignment, so set min_alignment using MAX2 to avoid ever reducing it. Fixes: 1798f6bfc33 ("pan/midgard: Fix masks/alignment for 64-bit loads") Part-of: --- diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c index e02fb74..e392263 100644 --- a/src/panfrost/midgard/midgard_ra.c +++ b/src/panfrost/midgard/midgard_ra.c @@ -504,7 +504,7 @@ allocate_registers(compiler_context *ctx, bool *spilled) unsigned s = ins->src[v]; if (s < ctx->temp_count) - min_alignment[s] = 3; + min_alignment[s] = MAX2(3, min_alignment[s]); } } @@ -514,7 +514,7 @@ allocate_registers(compiler_context *ctx, bool *spilled) unsigned size = nir_alu_type_get_type_size(ins->src_types[v]); if (s < ctx->temp_count) - min_alignment[s] = (size == 64) ? 3 : 2; + min_alignment[s] = MAX2((size == 64) ? 3 : 2, min_alignment[s]); } } @@ -537,10 +537,11 @@ allocate_registers(compiler_context *ctx, bool *spilled) found_class[dest] = MAX2(found_class[dest], bytes); min_alignment[dest] = - (size == 16) ? 1 : /* (1 << 1) = 2-byte */ - (size == 32) ? 2 : /* (1 << 2) = 4-byte */ - (size == 64) ? 3 : /* (1 << 3) = 8-byte */ - 3; /* 8-bit todo */ + MAX2(min_alignment[dest], + (size == 16) ? 1 : /* (1 << 1) = 2-byte */ + (size == 32) ? 2 : /* (1 << 2) = 4-byte */ + (size == 64) ? 3 : /* (1 << 3) = 8-byte */ + 3); /* 8-bit todo */ /* We can't cross xy/zw boundaries. TODO: vec8 can */ if (size == 16 && min_alignment[dest] != 4)