aco: use s_pack_lh for bitfield_select(0xffff)

Foz-DB Navi31
Totals from 13 (0.02% of 79206) affected shaders:
Instrs: 44871 -> 44838 (-0.07%)
CodeSize: 223804 -> 223608 (-0.09%)
Latency: 220186 -> 220191 (+0.00%); split: -0.01%, +0.02%
InvThroughput: 54169 -> 54186 (+0.03%); split: -0.00%, +0.03%
SALU: 5048 -> 5023 (-0.50%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31509>
This commit is contained in:
Georg Lehmann 2024-10-03 16:53:31 +02:00 committed by Marge Bot
parent a6f82cf16d
commit 07032102e9

View file

@ -3726,6 +3726,17 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr)
aco_ptr<Instruction> sop2;
nir_const_value* const_bitmask = nir_src_as_const_value(instr->src[0].src);
nir_const_value* const_insert = nir_src_as_const_value(instr->src[1].src);
if (const_bitmask && ctx->program->gfx_level >= GFX9 &&
(const_bitmask->u32 == 0xffff || const_bitmask->u32 == 0xffff0000)) {
if (const_bitmask->u32 == 0xffff) {
bld.sop2(aco_opcode::s_pack_lh_b32_b16, Definition(dst), insert, base);
} else {
bld.sop2(aco_opcode::s_pack_lh_b32_b16, Definition(dst), base, insert);
}
break;
}
Operand lhs;
if (const_insert && const_bitmask) {
lhs = Operand::c32(const_insert->u32 & const_bitmask->u32);