aco: allow an extra SGPR with multiple uses to be applied to VOP3
[mesa.git] / src / amd / compiler / aco_optimizer.cpp
index 8406a9168e0778a115bf891075eca85e6dbb500d..88075fabfb2df3bb60f6c400609b4a87535bbc2a 100644 (file)
@@ -1937,7 +1937,7 @@ void apply_sgprs(opt_ctx &ctx, aco_ptr<Instruction>& instr)
       /* Applying two sgprs require making it VOP3, so don't do it unless it's
        * definitively beneficial.
        * TODO: this is too conservative because later the use count could be reduced to 1 */
-      if (num_sgprs && ctx.uses[sgpr_info_id] > 1)
+      if (num_sgprs && ctx.uses[sgpr_info_id] > 1 && !instr->isVOP3())
          break;
 
       Temp sgpr = ctx.info[sgpr_info_id].temp;
@@ -1963,8 +1963,6 @@ void apply_sgprs(opt_ctx &ctx, aco_ptr<Instruction>& instr)
       sgpr_ids[num_sgprs++] = sgpr.id();
       ctx.uses[sgpr_info_id]--;
       ctx.uses[sgpr.id()]++;
-
-      break; /* for testing purposes, only apply 1 new sgpr */
    }
 }