aco/ra: use parallelcopy to copy literal instead of s_mov

This can result in smaller code size.

Foz-DB Vega10:
Totals from 4745 (7.53% of 63053) affected shaders:
CodeSize: 33014176 -> 33007088 (-0.02%); split: -0.02%, +0.00%
Copies: 690055 -> 704738 (+2.13%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30932>
This commit is contained in:
Georg Lehmann
2024-08-29 22:13:18 +02:00
committed by Marge Bot
parent 607cf5a8e9
commit 364764356c
+6 -5
View File
@@ -3255,16 +3255,17 @@ register_allocation(Program* program, ra_test_policy policy)
PhysReg reg = get_reg(ctx, tmp_file, tmp, parallelcopy, instr);
update_renames(ctx, register_file, parallelcopy, instr, rename_not_killed_ops);
Instruction* mov = create_instruction(aco_opcode::s_mov_b32, Format::SOP1, 1, 1);
mov->operands[0] = instr->operands[0];
mov->definitions[0] = Definition(tmp);
mov->definitions[0].setFixed(reg);
Instruction* copy =
create_instruction(aco_opcode::p_parallelcopy, Format::PSEUDO, 1, 1);
copy->operands[0] = Operand::c32(instr->operands[0].constantValue());
copy->definitions[0] = Definition(tmp);
copy->definitions[0].setFixed(reg);
instr->operands[0] = Operand(tmp);
instr->operands[0].setFixed(reg);
instr->operands[0].setFirstKill(true);
instructions.emplace_back(mov);
instructions.emplace_back(copy);
}
/* change the instruction to VOP3 to enable an arbitrary register pair as dst */