aco/optimizer: propagate salu fabs

Foz-DB Navi48:
Totals from 5156 (5.28% of 97637) affected shaders:
Instrs: 12713219 -> 12694317 (-0.15%); split: -0.15%, +0.00%
CodeSize: 67099236 -> 67037588 (-0.09%); split: -0.13%, +0.04%
VGPRs: 352620 -> 352608 (-0.00%)
SpillSGPRs: 22032 -> 22031 (-0.00%)
Latency: 68288972 -> 68271858 (-0.03%); split: -0.03%, +0.00%
InvThroughput: 13639078 -> 13633997 (-0.04%); split: -0.04%, +0.00%
VClause: 235194 -> 235186 (-0.00%); split: -0.01%, +0.00%
SClause: 249057 -> 249012 (-0.02%); split: -0.03%, +0.01%
Copies: 963813 -> 960529 (-0.34%); split: -0.36%, +0.02%
Branches: 321041 -> 321039 (-0.00%)
PreSGPRs: 303392 -> 303295 (-0.03%); split: -0.03%, +0.00%
VALU: 7134563 -> 7134533 (-0.00%); split: -0.00%, +0.00%
SALU: 1913802 -> 1899948 (-0.72%); split: -0.72%, +0.00%
VOPD: 19914 -> 19885 (-0.15%); split: +0.01%, -0.15%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38723>
This commit is contained in:
Georg Lehmann
2025-11-29 10:41:17 +01:00
committed by Marge Bot
parent 04037c7af3
commit bb58ba2075
+24
View File
@@ -2838,6 +2838,30 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
}
break;
case aco_opcode::s_and_b32:
for (unsigned i = 0; i < 2; i++) {
if (!instr->operands[!i].isTemp())
continue;
Temp tmp = instr->operands[!i].getTemp();
const Operand& op = instr->operands[i];
uint32_t constant;
if (op.isConstant())
constant = op.constantValue();
else if (op.isTemp() && ctx.info[op.tempId()].is_constant())
constant = ctx.info[op.tempId()].val;
else
continue;
if (constant == 0x7fffffff) {
if (ctx.info[tmp.id()].is_canonicalized(32))
ctx.info[instr->definitions[0].tempId()].set_canonicalized(32);
ctx.info[instr->definitions[0].tempId()].set_abs(tmp, 32);
} else if (constant == 0x7fff) {
if (ctx.info[tmp.id()].is_canonicalized(16))
ctx.info[instr->definitions[0].tempId()].set_canonicalized(16);
ctx.info[instr->definitions[0].tempId()].set_abs(tmp, 16);
}
}
FALLTHROUGH;
case aco_opcode::s_and_b64:
if (fixed_to_exec(instr->operands[1]) && instr->operands[0].isTemp()) {
if (ctx.info[instr->operands[0].tempId()].is_uniform_bool()) {