aco/optimizer: create ff0/bcnt0

Foz-DB Navi21:
Totals from 1 (0.00% of 82387) affected shaders:
Instrs: 350 -> 347 (-0.86%)
CodeSize: 1800 -> 1788 (-0.67%)
Latency: 2427 -> 2421 (-0.25%)
SALU: 80 -> 77 (-3.75%)

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38530>
This commit is contained in:
Georg Lehmann
2025-03-08 11:35:19 +01:00
committed by Marge Bot
parent 0f7a1ce23e
commit c538f47f03
+12
View File
@@ -4531,6 +4531,18 @@ combine_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
add_opt(s_not_b32, s_xnor_b32, 0x3, "01");
} else if (info.opcode == aco_opcode::s_xor_b64) {
add_opt(s_not_b64, s_xnor_b64, 0x3, "01");
} else if ((info.opcode == aco_opcode::s_sub_u32 || info.opcode == aco_opcode::s_sub_i32) &&
!ctx.uses[info.defs[1].tempId()]) {
add_opt(s_bcnt1_i32_b32, s_bcnt0_i32_b32, 0x2, "10", remove_const_cb<32>);
add_opt(s_bcnt1_i32_b64, s_bcnt0_i32_b64, 0x2, "10", remove_const_cb<64>);
} else if (info.opcode == aco_opcode::s_bcnt1_i32_b32) {
add_opt(s_not_b32, s_bcnt0_i32_b32, 0x1, "0");
} else if (info.opcode == aco_opcode::s_bcnt1_i32_b64) {
add_opt(s_not_b64, s_bcnt0_i32_b64, 0x1, "0");
} else if (info.opcode == aco_opcode::s_ff1_i32_b32 && ctx.program->gfx_level < GFX11) {
add_opt(s_not_b32, s_ff0_i32_b32, 0x1, "0");
} else if (info.opcode == aco_opcode::s_ff1_i32_b64 && ctx.program->gfx_level < GFX11) {
add_opt(s_not_b64, s_ff0_i32_b64, 0x1, "0");
}
if (match_and_apply_patterns(ctx, info, patterns)) {