mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
aco/ra: Use std::all_of to simplify a loop
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7799>
This commit is contained in:
parent
f7e6b61379
commit
d9e1375e27
1 changed files with 6 additions and 7 deletions
|
|
@ -828,15 +828,14 @@ std::pair<PhysReg, bool> get_reg_simple(ra_ctx& ctx,
|
|||
continue;
|
||||
|
||||
for (unsigned i = 0; i < 4; i+= info.stride) {
|
||||
if (entry.second[i] != 0)
|
||||
continue;
|
||||
/* check if there's a block of free bytes large enough to hold the register */
|
||||
bool reg_found = std::all_of(&entry.second[i], &entry.second[std::min(4u, i + rc.bytes())],
|
||||
[](unsigned v) { return v == 0; });
|
||||
|
||||
bool reg_found = true;
|
||||
for (unsigned j = 1; reg_found && i + j < 4 && j < rc.bytes(); j++)
|
||||
reg_found &= entry.second[i + j] == 0;
|
||||
/* check if also the neighboring reg is free if needed */
|
||||
if (reg_found && i + rc.bytes() > 4)
|
||||
reg_found = (reg_file[entry.first + 1] == 0);
|
||||
|
||||
/* check neighboring reg if needed */
|
||||
reg_found &= ((int)i <= 4 - (int)rc.bytes() || reg_file[entry.first + 1] == 0);
|
||||
if (reg_found) {
|
||||
PhysReg res{entry.first};
|
||||
res.reg_b += i;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue