We need to account for the full vector lengths. Especially important once we
start restricting the reg file.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
{
assert(count >= 1);
- for (unsigned reg = 0; reg < max; reg += align) {
+ for (unsigned reg = 0; reg + count <= max; reg += align) {
if (!BITSET_TEST_RANGE(used_regs, reg, reg + count - 1))
return reg;
}
* for a register for the source such that the collect base is aligned.
*/
if (collect_align > align) {
- for (unsigned reg = offset; reg < rctx->bound; reg += collect_align) {
+ for (unsigned reg = offset; reg + collect_align <= rctx->bound;
+ reg += collect_align) {
if (!BITSET_TEST_RANGE(rctx->used_regs, reg, reg + count - 1))
return reg;
}