summaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard/midgard_ra.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-11-15 15:16:53 -0500
committerAlyssa Rosenzweig <[email protected]>2019-11-17 22:19:31 -0500
commit1798f6bfc33d1d77dae1112591dce18bf7fdbc4a (patch)
treebd350814faf67bbf524efb78c0b956e1059c35fd /src/panfrost/midgard/midgard_ra.c
parent34a860b9e3c544ad82b8287e1b65a93c53bd7f62 (diff)
pan/midgard: Fix masks/alignment for 64-bit loads
These need to be handled with special care. Oh, Midgard, you're *extra* special. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard/midgard_ra.c')
-rw-r--r--src/panfrost/midgard/midgard_ra.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c
index 85ad96ff312..c2c1874aa82 100644
--- a/src/panfrost/midgard/midgard_ra.c
+++ b/src/panfrost/midgard/midgard_ra.c
@@ -452,6 +452,7 @@ allocate_registers(compiler_context *ctx, bool *spilled)
}
unsigned *found_class = calloc(sizeof(unsigned), ctx->temp_count);
+ unsigned *min_alignment = calloc(sizeof(unsigned), ctx->temp_count);
mir_foreach_instr_global(ctx, ins) {
if (ins->dest >= SSA_FIXED_MINIMUM) continue;
@@ -465,17 +466,21 @@ allocate_registers(compiler_context *ctx, bool *spilled)
int dest = ins->dest;
found_class[dest] = MAX2(found_class[dest], class);
- lcra_set_alignment(l, dest, 2); /* (1 << 2) = 4 */
-
/* XXX: Ensure swizzles align the right way with more LCRA constraints? */
if (ins->type == TAG_ALU_4 && ins->alu.reg_mode != midgard_reg_mode_32)
- lcra_set_alignment(l, dest, 3); /* (1 << 3) = 8 */
+ min_alignment[dest] = 3; /* (1 << 3) = 8 */
+
+ if (ins->type == TAG_LOAD_STORE_4 && ins->load_64)
+ min_alignment[dest] = 3;
}
- for (unsigned i = 0; i < ctx->temp_count; ++i)
+ for (unsigned i = 0; i < ctx->temp_count; ++i) {
+ lcra_set_alignment(l, i, min_alignment[i] ? min_alignment[i] : 2);
lcra_restrict_range(l, i, (found_class[i] + 1) * 4);
+ }
free(found_class);
+ free(min_alignment);
/* Next, we'll determine semantic class. We default to zero (work).
* But, if we're used with a special operation, that will force us to a