aco: Support GFX10 VOP3 and VOP1 as VOP3 in aco_assembler.
authorTimur Kristóf <timur.kristof@gmail.com>
Thu, 26 Sep 2019 15:51:51 +0000 (17:51 +0200)
committerTimur Kristóf <timur.kristof@gmail.com>
Thu, 10 Oct 2019 07:57:53 +0000 (09:57 +0200)
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
src/amd/compiler/aco_assembler.cpp

index 9070d88e1c6457eb0f4dd5202388a049b08a9004..fcad107f34c103be549b21da8bc63b1de7ad6078 100644 (file)
@@ -442,17 +442,29 @@ void emit_instruction(asm_context& ctx, std::vector<uint32_t>& out, Instruction*
       if ((uint16_t) instr->format & (uint16_t) Format::VOP3A) {
          VOP3A_instruction* vop3 = static_cast<VOP3A_instruction*>(instr);
 
-         if ((uint16_t) instr->format & (uint16_t) Format::VOP2)
+         if ((uint16_t) instr->format & (uint16_t) Format::VOP2) {
             opcode = opcode + 0x100;
-         else if ((uint16_t) instr->format & (uint16_t) Format::VOP1)
-            opcode = opcode + 0x140;
-         else if ((uint16_t) instr->format & (uint16_t) Format::VOPC)
+         } else if ((uint16_t) instr->format & (uint16_t) Format::VOP1) {
+            if (ctx.chip_class <= GFX9) {
+               opcode = opcode + 0x140;
+            } else {
+               /* RDNA ISA doc says this is 0x140, but that doesn't work  */
+               opcode = opcode + 0x180;
+            }
+         } else if ((uint16_t) instr->format & (uint16_t) Format::VOPC) {
             opcode = opcode + 0x0;
-         else if ((uint16_t) instr->format & (uint16_t) Format::VINTRP)
+         } else if ((uint16_t) instr->format & (uint16_t) Format::VINTRP) {
             opcode = opcode + 0x270;
+         }
 
          // TODO: op_sel
-         uint32_t encoding = (0b110100 << 26);
+         uint32_t encoding;
+         if (ctx.chip_class <= GFX9) {
+            encoding = (0b110100 << 26);
+         } else if (ctx.chip_class == GFX10) {
+            encoding = (0b110101 << 26);
+         }
+
          encoding |= opcode << 16;
          encoding |= (vop3->clamp ? 1 : 0) << 15;
          for (unsigned i = 0; i < 3; i++)