mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
aco/opt_postRA: allow try_optimize_scc_nocompare for all instructions
If the old SCC source worked, the new one will too. Foz-DB Navi21: Totals from 106 (0.13% of 79789) affected shaders: Instrs: 255233 -> 254825 (-0.16%) CodeSize: 1337308 -> 1335692 (-0.12%) Latency: 1455208 -> 1454524 (-0.05%); split: -0.05%, +0.00% InvThroughput: 385624 -> 385612 (-0.00%); split: -0.00%, +0.00% SALU: 53976 -> 53568 (-0.76%) Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33734>
This commit is contained in:
parent
3386ea09d4
commit
6445ba0f05
1 changed files with 10 additions and 10 deletions
|
|
@ -428,17 +428,17 @@ try_optimize_scc_nocompare(pr_opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
|||
* s_cbranch_scc1 BB3 ; inverted branch
|
||||
*/
|
||||
|
||||
if ((instr->format != Format::PSEUDO_BRANCH || instr->operands.size() != 1 ||
|
||||
instr->operands[0].physReg() != scc) &&
|
||||
instr->opcode != aco_opcode::s_cselect_b32 && instr->opcode != aco_opcode::s_cselect_b64)
|
||||
return;
|
||||
|
||||
/* For cselect, operand 2 is the SCC condition */
|
||||
unsigned scc_op_idx = 0;
|
||||
if (instr->opcode == aco_opcode::s_cselect_b32 || instr->opcode == aco_opcode::s_cselect_b64) {
|
||||
scc_op_idx = 2;
|
||||
int scc_op_idx = -1;
|
||||
for (unsigned i = 0; i < instr->operands.size(); i++) {
|
||||
if (instr->operands[i].isTemp() && instr->operands[i].physReg() == scc) {
|
||||
scc_op_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (scc_op_idx < 0)
|
||||
return;
|
||||
|
||||
Idx wr_idx = last_writer_idx(ctx, instr->operands[scc_op_idx]);
|
||||
if (!wr_idx.found())
|
||||
return;
|
||||
|
|
@ -466,7 +466,7 @@ try_optimize_scc_nocompare(pr_opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
|||
instr->opcode == aco_opcode::s_cselect_b64)
|
||||
std::swap(instr->operands[0], instr->operands[1]);
|
||||
else
|
||||
unreachable("scc_nocompare optimization is only implemented for p_cbranch and s_cselect");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Use the SCC def from the original instruction, not the comparison */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue