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>
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;
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;