aco: propagate literals into sub-dword pseudo instructions on GFX9+
authorRhys Perry <pendingchaos02@gmail.com>
Tue, 13 Oct 2020 12:33:57 +0000 (13:33 +0100)
committerMarge Bot <eric+marge@anholt.net>
Thu, 15 Oct 2020 11:33:42 +0000 (11:33 +0000)
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/7111>

src/amd/compiler/aco_optimizer.cpp

index 463e473..a21fb21 100644 (file)
@@ -836,7 +836,7 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
             is_subdword = std::any_of(instr->definitions.begin(), instr->definitions.end(),
                                       [] (const Definition& def) { return def.regClass().is_subdword();});
             is_subdword = is_subdword || std::any_of(instr->operands.begin(), instr->operands.end(),
-                                                     [] (const Operand& op) { return op.hasRegClass() && op.regClass().is_subdword();});
+                                                     [] (const Operand& op) { return op.bytes() % 4;});
             if (is_subdword && ctx.program->chip_class < GFX9)
                continue;
          }
@@ -864,7 +864,7 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
             }
          }
          unsigned bits = get_operand_size(instr, i);
-         if ((info.is_constant(bits) || (!is_subdword && info.is_literal(bits) && instr->format == Format::PSEUDO)) &&
+         if ((info.is_constant(bits) || (info.is_literal(bits) && instr->format == Format::PSEUDO)) &&
              !instr->operands[i].isFixed() && alu_can_accept_constant(instr->opcode, i)) {
             instr->operands[i] = get_constant_op(ctx, info, bits);
             continue;