From 442df9d8f4644f0984badd6d1ee7a03fd72471a6 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 8 Jul 2021 09:09:25 +0200 Subject: [PATCH] aco: fix shared_atomic_comp_swap if the second source isn't a VGPR Only VGPRs are valid with DS instructions. Cc: 21.1 mesa-stable Signed-off-by: Samuel Pitoiset Reviewed-by: Rhys Perry Part-of: (cherry picked from commit 74a221bcfd8dd8a1badbb44c71c38485d6c05ec2) --- .pick_status.json | 2 +- src/amd/compiler/aco_instruction_selection.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 3583fa2cd12..d5940b1bf3f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1696,7 +1696,7 @@ "description": "aco: fix shared_atomic_comp_swap if the second source isn't a VGPR", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 0b3e617831b..9d03633f90f 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -6882,8 +6882,10 @@ void visit_shared_atomic(isel_context *ctx, nir_intrinsic_instr *instr) ds.reset(create_instruction(op, Format::DS, num_operands, return_previous ? 1 : 0)); ds->operands[0] = Operand(address); ds->operands[1] = Operand(data); - if (num_operands == 4) - ds->operands[2] = Operand(get_ssa_temp(ctx, instr->src[2].ssa)); + if (num_operands == 4) { + Temp data2 = as_vgpr(ctx, get_ssa_temp(ctx, instr->src[2].ssa)); + ds->operands[2] = Operand(data2); + } ds->operands[num_operands - 1] = m; ds->offset0 = offset; if (return_previous)