agx: Try to align sources of pack_64_2x32_split

Helps with coalescing the pack.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19971>
This commit is contained in:
Alyssa Rosenzweig 2022-11-19 16:43:19 -05:00 committed by Marge Bot
parent 442e29890d
commit 94124925ca
1 changed files with 14 additions and 0 deletions

View File

@ -226,6 +226,20 @@ pick_regs(struct ra_ctx *rctx, agx_instr *I, unsigned d)
if (!BITSET_TEST_RANGE(rctx->used_regs, our_reg, our_reg + align - 1))
return our_reg;
}
/* Try to respect the alignment requirement of the collect destination,
* which may be greater than the sources (e.g. pack_64_2x32_split). Look
* for a register for the source such that the collect base is aligned.
*/
unsigned collect_align = agx_size_align_16(collect->dest[0].size);
if (collect_align > align) {
unsigned offset = our_source * align;
for (unsigned reg = offset; reg < rctx->bound; reg += collect_align) {
if (!BITSET_TEST_RANGE(rctx->used_regs, reg, reg + count - 1))
return reg;
}
}
}
/* Default to any contiguous sequence of registers */