From 393e577435be0c53b7a41378b6e67268913cbd81 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 15 Aug 2022 12:10:38 +0200 Subject: [PATCH] aco/assembler: Fix v_cmpx pre GFX10. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The second destination is implicit exec. Signed-off-by: Georg Lehmann Reviewed-by: Timur Kristóf Part-of: --- src/amd/compiler/aco_assembler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_assembler.cpp b/src/amd/compiler/aco_assembler.cpp index cf406f92d0c..f15ab451fd0 100644 --- a/src/amd/compiler/aco_assembler.cpp +++ b/src/amd/compiler/aco_assembler.cpp @@ -623,7 +623,12 @@ emit_instruction(asm_context& ctx, std::vector& out, Instruction* inst encoding |= vop3.opsel << 11; for (unsigned i = 0; i < 3; i++) encoding |= vop3.abs[i] << (8 + i); - if (instr->definitions.size() == 2) + /* On GFX9 and older, v_cmpx implicitly writes exec besides writing an SGPR pair. + * On GFX10 and newer, v_cmpx always writes just exec. + */ + if (instr->definitions.size() == 2 && instr->isVOPC()) + assert(ctx.gfx_level <= GFX9 && instr->definitions[1].physReg() == exec); + else if (instr->definitions.size() == 2) encoding |= instr->definitions[1].physReg() << 8; encoding |= (0xFF & instr->definitions[0].physReg()); out.push_back(encoding);