aco: don't apply dpp if the alu instr uses the operand twice
CP77 has a ton of fma(dpp(a), dpp(a), b). Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22698>
This commit is contained in:
@@ -4819,6 +4819,13 @@ select_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
||||
if (!info.is_dpp() || info.instr->pass_flags != instr->pass_flags)
|
||||
continue;
|
||||
|
||||
/* We won't eliminate the DPP mov if the operand is used twice */
|
||||
bool op_used_twice = false;
|
||||
for (unsigned j = 0; j < instr->operands.size(); j++)
|
||||
op_used_twice |= i != j && instr->operands[i] == instr->operands[j];
|
||||
if (op_used_twice)
|
||||
continue;
|
||||
|
||||
if (i != 0) {
|
||||
if (!can_swap_operands(instr, &instr->opcode, 0, i))
|
||||
continue;
|
||||
|
||||
@@ -505,6 +505,13 @@ try_combine_dpp(pr_opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
||||
if (is_overwritten_since(ctx, mov->operands[0], op_instr_idx))
|
||||
continue;
|
||||
|
||||
/* We won't eliminate the DPP mov if the operand is used twice */
|
||||
bool op_used_twice = false;
|
||||
for (unsigned j = 0; j < instr->operands.size(); j++)
|
||||
op_used_twice |= i != j && instr->operands[i] == instr->operands[j];
|
||||
if (op_used_twice)
|
||||
continue;
|
||||
|
||||
bool dpp8 = mov->isDPP8();
|
||||
bool input_mods = instr_info.can_use_input_modifiers[(int)instr->opcode] &&
|
||||
instr_info.operand_size[(int)instr->opcode] == 32;
|
||||
|
||||
Reference in New Issue
Block a user