diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 6bc4065694c..4ac8821464d 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -3445,14 +3445,14 @@ combine_vop3p(opt_ctx& ctx, aco_ptr& instr) continue; } - Operand op[3] = {op_instr->operands[0], op_instr->operands[1], instr->operands[1 - i]}; - if (ctx.uses[instr->operands[i].tempId()] >= uses || !check_vop3_operands(ctx, 3, op)) - continue; - /* no clamp allowed between mul and add */ if (op_instr->valu().clamp) continue; + Operand op[3] = {op_instr->operands[0], op_instr->operands[1], instr->operands[1 - i]}; + if (ctx.uses[instr->operands[i].tempId()] >= uses || !check_vop3_operands(ctx, 3, op)) + continue; + mul_instr = op_instr; add_op_idx = 1 - i; uses = ctx.uses[instr->operands[i].tempId()];