mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 22:00:13 +01:00
aco: use s_pack_ll_b32_b16 for constant copies
Totals from 2 (0.00% of 134913) affected shaders: CodeSize: 28636 -> 28628 (-0.03%) Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20970>
This commit is contained in:
parent
9ee9b0859b
commit
2b264455b5
1 changed files with 10 additions and 2 deletions
|
|
@ -1145,13 +1145,21 @@ copy_constant(lower_context* ctx, Builder& bld, Definition dst, Operand op)
|
|||
else
|
||||
bld.vop1(aco_opcode::v_bfrev_b32, dst, Operand::c32(rev));
|
||||
return;
|
||||
} else if (dst.regClass() == s1 && imm != 0) {
|
||||
} else if (dst.regClass() == s1) {
|
||||
unsigned start = (ffs(imm) - 1) & 0x1f;
|
||||
unsigned size = util_bitcount(imm) & 0x1f;
|
||||
if ((((1u << size) - 1u) << start) == imm) {
|
||||
if (BITFIELD_RANGE(start, size) == imm) {
|
||||
bld.sop2(aco_opcode::s_bfm_b32, dst, Operand::c32(size), Operand::c32(start));
|
||||
return;
|
||||
}
|
||||
if (ctx->program->gfx_level >= GFX9) {
|
||||
Operand op_lo = Operand::c32(int32_t(int16_t(imm)));
|
||||
Operand op_hi = Operand::c32(int32_t(int16_t(imm >> 16)));
|
||||
if (!op_lo.isLiteral() && !op_hi.isLiteral()) {
|
||||
bld.sop2(aco_opcode::s_pack_ll_b32_b16, dst, op_lo, op_hi);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue