aco/optimizer: do can_eliminate_and_exec() optimization later
This will allow to optimize s_not(v_cmp()) safely. Totals from 1024 (0.76% of 134913) affected shaders: (GFX10.3) CodeSize: 5695424 -> 5701860 (+0.11%); split: -0.00%, +0.11% Scratch: 242688 -> 241664 (-0.42%) Instrs: 1040656 -> 1041635 (+0.09%); split: -0.00%, +0.09% Latency: 16842282 -> 16922790 (+0.48%); split: -0.06%, +0.54% InvThroughput: 4772728 -> 4810868 (+0.80%); split: -0.10%, +0.90% VClause: 20013 -> 20000 (-0.06%); split: -0.12%, +0.05% Copies: 115057 -> 114384 (-0.58%); split: -1.22%, +0.63% Branches: 34531 -> 34532 (+0.00%); split: -0.00%, +0.01% PreSGPRs: 46263 -> 46267 (+0.01%) Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18253>
This commit is contained in:
committed by
Marge Bot
parent
14b15b4038
commit
79a8e8b5b2
@@ -1939,9 +1939,6 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
||||
* s_and is unnecessary. */
|
||||
ctx.info[instr->definitions[0].tempId()].set_temp(instr->operands[0].getTemp());
|
||||
break;
|
||||
} else if (can_eliminate_and_exec(ctx, instr->operands[0].getTemp(), instr->pass_flags)) {
|
||||
ctx.info[instr->definitions[0].tempId()].set_temp(instr->operands[0].getTemp());
|
||||
break;
|
||||
}
|
||||
}
|
||||
FALLTHROUGH;
|
||||
@@ -4489,6 +4486,20 @@ select_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
||||
return;
|
||||
}
|
||||
|
||||
/* This optimization is done late in order to be able to apply otherwise
|
||||
* unsafe optimizations such as the inverse comparison optimization.
|
||||
*/
|
||||
if (instr->opcode == aco_opcode::s_and_b32 || instr->opcode == aco_opcode::s_and_b64) {
|
||||
if (instr->operands[0].isTemp() && fixed_to_exec(instr->operands[1]) &&
|
||||
ctx.uses[instr->operands[0].tempId()] == 1 && ctx.uses[instr->definitions[1].tempId()] == 0 &&
|
||||
can_eliminate_and_exec(ctx, instr->operands[0].getTemp(), instr->pass_flags)) {
|
||||
ctx.uses[instr->operands[0].tempId()]--;
|
||||
ctx.info[instr->operands[0].tempId()].instr->definitions[0].setTemp(instr->definitions[0].getTemp());
|
||||
instr.reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Combine DPP copies into VALU. This should be done after creating MAD/FMA. */
|
||||
if (instr->isVALU()) {
|
||||
for (unsigned i = 0; i < instr->operands.size(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user