aco: fix assembly of FLAT/GLOBAL atomics
authorRhys Perry <pendingchaos02@gmail.com>
Wed, 27 Nov 2019 17:06:10 +0000 (17:06 +0000)
committerRhys Perry <pendingchaos02@gmail.com>
Fri, 29 Nov 2019 17:46:01 +0000 (17:46 +0000)
They can take both a definition and data operand

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
src/amd/compiler/aco_assembler.cpp

index 4b70b2c..c9b5ca1 100644 (file)
@@ -425,7 +425,7 @@ void emit_instruction(asm_context& ctx, std::vector<uint32_t>& out, Instruction*
       encoding = (0xFF & instr->operands[0].physReg());
       if (!instr->definitions.empty())
          encoding |= (0xFF & instr->definitions[0].physReg()) << 24;
-      else
+      if (instr->operands.size() >= 3)
          encoding |= (0xFF & instr->operands[2].physReg()) << 8;
       if (!instr->operands[1].isUndefined()) {
          assert(ctx.chip_class >= GFX10 || instr->operands[1].physReg() != 0x7F);