aco: fix assembly of FLAT/GLOBAL atomics
[mesa.git] / src / amd / compiler / aco_assembler.cpp
index 4b70b2c0ac75105a8a02aec2f77879ec1fb88209..c9b5ca1068447a351264e9aee50de56891731a85 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);