aco: Allow literals on VOP3 instructions.
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 12 Sep 2019 18:55:36 +0000 (19:55 +0100)
committerTimur Kristóf <timur.kristof@gmail.com>
Thu, 10 Oct 2019 07:57:53 +0000 (09:57 +0200)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
src/amd/compiler/aco_assembler.cpp
src/amd/compiler/aco_validate.cpp

index 73432a790ef9bf13117b3446d93c9c397e36398a..272be08858911b61892c262e2ca08ccbff137ba6 100644 (file)
@@ -502,7 +502,6 @@ void emit_instruction(asm_context& ctx, std::vector<uint32_t>& out, Instruction*
          for (unsigned i = 0; i < 3; i++)
             encoding |= vop3->neg[i] << (29+i);
          out.push_back(encoding);
-         return;
 
       } else if (instr->isDPP()){
          /* first emit the instruction without the DPP operand */
@@ -525,6 +524,7 @@ void emit_instruction(asm_context& ctx, std::vector<uint32_t>& out, Instruction*
       } else {
          unreachable("unimplemented instruction format");
       }
+      break;
    }
 
    /* append literal dword */
index 9919d0a585dd4db92f5bcd76ba2a4ff233e5db4c..dbfce6314c8c337a752f85e4994c18f0a0ed7791 100644 (file)
@@ -104,7 +104,9 @@ void validate(Program* program, FILE * output)
             unsigned num_literals = 0;
             for (unsigned i = 0; i < instr->operands.size(); i++)
             {
-               if (instr->operands[i].isLiteral()) {
+               if (instr->operands[i].isLiteral() && instr->isVOP3() && program->chip_class >= GFX10) {
+                  num_literals++;
+               } else if (instr->operands[i].isLiteral()) {
                   check(instr->format == Format::SOP1 ||
                         instr->format == Format::SOP2 ||
                         instr->format == Format::SOPC ||