aco: fix cmpswap global atomic definition on GFX6

Missed this one.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 2f0bb39e16 ("aco: ensure that definitions fixed to operands have matching regclasses")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16367>
This commit is contained in:
Rhys Perry 2022-05-06 11:56:30 +01:00 committed by Marge Bot
parent 5a3aee78cb
commit cc410dd4d1
1 changed files with 7 additions and 2 deletions

View File

@ -6740,8 +6740,9 @@ visit_global_atomic(isel_context* ctx, nir_intrinsic_instr* instr)
Builder bld(ctx->program, ctx->block);
bool return_previous = !nir_ssa_def_is_unused(&instr->dest.ssa);
Temp data = as_vgpr(ctx, get_ssa_temp(ctx, instr->src[1].ssa));
bool cmpswap = instr->intrinsic == nir_intrinsic_global_atomic_comp_swap_amd;
if (instr->intrinsic == nir_intrinsic_global_atomic_comp_swap_amd)
if (cmpswap)
data = bld.pseudo(aco_opcode::p_create_vector, bld.def(RegType::vgpr, data.size() * 2),
get_ssa_temp(ctx, instr->src[2].ssa), data);
@ -6900,8 +6901,10 @@ visit_global_atomic(isel_context* ctx, nir_intrinsic_instr* instr)
mubuf->operands[1] = addr.type() == RegType::vgpr ? Operand(addr) : Operand(v1);
mubuf->operands[2] = Operand(offset);
mubuf->operands[3] = Operand(data);
Definition def =
return_previous ? (cmpswap ? bld.def(data.regClass()) : Definition(dst)) : Definition();
if (return_previous)
mubuf->definitions[0] = Definition(dst);
mubuf->definitions[0] = def;
mubuf->glc = return_previous;
mubuf->dlc = false;
mubuf->offset = const_offset;
@ -6910,6 +6913,8 @@ visit_global_atomic(isel_context* ctx, nir_intrinsic_instr* instr)
mubuf->sync = get_memory_sync_info(instr, storage_buffer, semantic_atomicrmw);
ctx->program->needs_exact = true;
ctx->block->instructions.emplace_back(std::move(mubuf));
if (return_previous && cmpswap)
bld.pseudo(aco_opcode::p_extract_vector, Definition(dst), def.getTemp(), Operand::zero());
}
}