aco/assembler: Fix v_cmpx pre GFX10.
authorGeorg Lehmann <dadschoorse@gmail.com>
Mon, 15 Aug 2022 10:10:38 +0000 (12:10 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 15 Aug 2022 13:25:38 +0000 (13:25 +0000)
The second destination is implicit exec.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18049>

src/amd/compiler/aco_assembler.cpp

index cf406f9..f15ab45 100644 (file)
@@ -623,7 +623,12 @@ emit_instruction(asm_context& ctx, std::vector<uint32_t>& 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);