From 364764356ca22b6a20c1f66b442e46f2c77f40e7 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Thu, 29 Aug 2024 22:13:18 +0200 Subject: [PATCH] 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 Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 997fc1551d4..b1e75fd82b4 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -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 */