aco: fix assembly of MUBUF-to-LDS loads
authorRhys Perry <pendingchaos02@gmail.com>
Fri, 17 Jun 2022 15:25:42 +0000 (16:25 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 26 Sep 2022 14:49:56 +0000 (14:49 +0000)
These have an implicit m0 read and don't write VGPRs.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17333>

src/amd/compiler/aco_assembler.cpp

index 91e7e95..0ce5157 100644 (file)
@@ -416,9 +416,9 @@ emit_instruction(asm_context& ctx, std::vector<uint32_t>& out, Instruction* inst
       encoding |= reg(ctx, instr->operands[2]) << 24;
       encoding |= (mubuf.tfe ? 1 : 0) << 23;
       encoding |= (reg(ctx, instr->operands[0]) >> 2) << 16;
-      if (instr->operands.size() > 3)
+      if (instr->operands.size() > 3 && !mubuf.lds)
          encoding |= reg(ctx, instr->operands[3], 8) << 8;
-      else
+      else if (!mubuf.lds)
          encoding |= reg(ctx, instr->definitions[0], 8) << 8;
       encoding |= reg(ctx, instr->operands[1], 8);
       out.push_back(encoding);