From 65506e635bbf53f4854552800996a0f5698e9a73 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Tue, 10 Dec 2024 16:51:53 +0100 Subject: [PATCH] aco/ra: don't write to scc/ttmp with s_fmac Fixes: 4bd229ac50f ("aco/gfx11.5: select SOP2 float instructions") Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 75b06865959..efbd4e7d2b8 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -2091,7 +2091,14 @@ operand_can_use_reg(amd_gfx_level gfx_level, aco_ptr& instr, unsign gfx_level >= GFX10); /* sdata can be vcc */ case Format::MUBUF: case Format::MTBUF: return idx != 2 || gfx_level < GFX12 || reg != scc; - case Format::SOPK: return idx != 0 || reg != scc; + case Format::SOPK: + if (idx == 0 && reg == scc) + return false; + FALLTHROUGH; + case Format::SOP2: + case Format::SOP1: + return get_op_fixed_to_def(instr.get()) != (int)idx || + is_sgpr_writable_without_side_effects(gfx_level, reg); default: // TODO: there are more instructions with restrictions on registers return true;