aco/ra: fix fill() with certain subdword cases

If div_ceil(start.byte() + num_bytes, 4) != div_ceil(num_bytes, 4), like
v3b at byte=2.

Also, the non-const operator[] was unused and unsafe.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41018>
This commit is contained in:
Rhys Perry 2026-04-09 13:56:16 +01:00 committed by Marge Bot
parent 528aabb056
commit 46047cf5ca

View file

@ -329,8 +329,6 @@ public:
const uint32_t& operator[](PhysReg index) const { return regs[index]; }
uint32_t& operator[](PhysReg index) { return regs[index]; }
unsigned count_zero(PhysRegInterval reg_interval) const
{
unsigned res = 0;
@ -457,8 +455,9 @@ private:
void fill_subdword(PhysReg start, unsigned num_bytes, uint32_t val)
{
fill(start, DIV_ROUND_UP(num_bytes, 4), 0xF0000000);
for (PhysReg i = start; i.reg_b < start.reg_b + num_bytes; i = PhysReg(i + 1)) {
regs[i] = 0xF0000000;
/* emplace or get */
std::array<uint32_t, 4>& sub =
subdword_regs.emplace(i, std::array<uint32_t, 4>{0, 0, 0, 0}).first->second;