aco: fix global_atomic_swap offset overflow check

Fixes: d7dcd81c77 ("aco/gfx6: allow both constant and gpr offset for global with sgpr address")

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37821>
This commit is contained in:
Georg Lehmann 2025-10-10 18:30:55 +02:00 committed by Marge Bot
parent 451a0bd490
commit c13caa5e5f

View file

@ -2542,10 +2542,13 @@ visit_global_atomic(isel_context* ctx, nir_intrinsic_instr* instr)
const nir_atomic_op nir_op = nir_intrinsic_atomic_op(instr);
const bool cmpswap = nir_op == nir_atomic_op_cmpxchg;
unsigned offset_idx = 2;
if (cmpswap)
if (cmpswap) {
offset_idx = 3;
data = bld.pseudo(aco_opcode::p_create_vector, bld.def(RegType::vgpr, data.size() * 2),
get_ssa_temp(ctx, instr->src[2].ssa), data);
}
Temp dst = get_ssa_temp(ctx, &instr->def);
@ -2554,7 +2557,8 @@ visit_global_atomic(isel_context* ctx, nir_intrinsic_instr* instr)
Temp addr, offset;
uint32_t const_offset;
parse_global(ctx, instr, &addr, &const_offset, &offset);
Format format = lower_global_address(ctx, bld, 0, &addr, &const_offset, &offset, &instr->src[2]);
Format format =
lower_global_address(ctx, bld, 0, &addr, &const_offset, &offset, &instr->src[offset_idx]);
if (format != Format::MUBUF) {
bool global = format == Format::GLOBAL;