aco: create vgpr constant copies using v_bfrev_b32
Looks like this worked once but broke at some point. fossil-db (Vega): Totals from 577 (0.42% of 137413) affected shaders: CodeSize: 3822052 -> 3818720 (-0.09%) Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5390>
This commit is contained in:
@@ -984,16 +984,19 @@ void copy_constant(lower_context *ctx, Builder& bld, Definition dst, Operand op)
|
||||
{
|
||||
assert(op.bytes() == dst.bytes());
|
||||
|
||||
if (dst.regClass() == s1 && op.isLiteral()) {
|
||||
if (dst.bytes() == 4 && op.isLiteral()) {
|
||||
uint32_t imm = op.constantValue();
|
||||
if (imm >= 0xffff8000 || imm <= 0x7fff) {
|
||||
if (dst.regClass() == s1 && (imm >= 0xffff8000 || imm <= 0x7fff)) {
|
||||
bld.sopk(aco_opcode::s_movk_i32, dst, imm & 0xFFFFu);
|
||||
return;
|
||||
} else if (util_bitreverse(imm) <= 64 || util_bitreverse(imm) >= 0xFFFFFFF0) {
|
||||
uint32_t rev = util_bitreverse(imm);
|
||||
bld.sop1(aco_opcode::s_brev_b32, dst, Operand(rev));
|
||||
if (dst.regClass() == s1)
|
||||
bld.sop1(aco_opcode::s_brev_b32, dst, Operand(rev));
|
||||
else
|
||||
bld.vop1(aco_opcode::v_bfrev_b32, dst, Operand(rev));
|
||||
return;
|
||||
} else if (imm != 0) {
|
||||
} else if (dst.regClass() == s1 && imm != 0) {
|
||||
unsigned start = (ffs(imm) - 1) & 0x1f;
|
||||
unsigned size = util_bitcount(imm) & 0x1f;
|
||||
if ((((1u << size) - 1u) << start) == imm) {
|
||||
|
||||
Reference in New Issue
Block a user