aco: Fix integer overflows when emitting parallel copies during RA

32-bit shifts were accidentally used before this change despite the intended
output being 64 bits.

This was observed when compiling Dolphin's ubershaders.

Cc: mesa-stable
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6568>
(cherry picked from commit 2182bbf84f)
This commit is contained in:
Tony Wasserka 2020-09-02 18:28:36 +02:00 committed by Eric Engestrom
parent 489e07d86d
commit 3c19a2cfda
2 changed files with 3 additions and 3 deletions

View file

@ -2803,7 +2803,7 @@
"description": "aco: Fix integer overflows when emitting parallel copies during RA",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -1905,11 +1905,11 @@ void register_allocation(Program *program, std::vector<TempSet>& live_out_per_bl
if (!sgpr_operands_alias_defs) {
unsigned reg = parallelcopy[i].first.physReg().reg();
unsigned size = parallelcopy[i].first.getTemp().size();
sgpr_operands[reg / 64u] |= ((1u << size) - 1) << (reg % 64u);
sgpr_operands[reg / 64u] |= u_bit_consecutive64(reg % 64u, size);
reg = parallelcopy[i].second.physReg().reg();
size = parallelcopy[i].second.getTemp().size();
if (sgpr_operands[reg / 64u] & ((1u << size) - 1) << (reg % 64u))
if (sgpr_operands[reg / 64u] & u_bit_consecutive64(reg % 64u, size))
sgpr_operands_alias_defs = true;
}
}