From e47bc3e750a6a475e6ef1d1aabc2e16aa1b38e64 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 27 Sep 2024 16:26:22 +0100 Subject: [PATCH] aco: shrink code size of some p_extract fossil-db (navi21): Totals from 37 (0.05% of 79395) affected shaders: CodeSize: 2048204 -> 2047836 (-0.02%) fossil-db (navi31): Totals from 307 (0.39% of 79395) affected shaders: CodeSize: 3075732 -> 3065236 (-0.34%); split: -0.34%, +0.00% Signed-off-by: Rhys Perry Reviewed-by: Georg Lehmann Part-of: --- src/amd/compiler/aco_lower_to_hw_instr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_lower_to_hw_instr.cpp b/src/amd/compiler/aco_lower_to_hw_instr.cpp index ad62b86ad67..93bc4450118 100644 --- a/src/amd/compiler/aco_lower_to_hw_instr.cpp +++ b/src/amd/compiler/aco_lower_to_hw_instr.cpp @@ -2544,7 +2544,11 @@ lower_to_hw_instr(Program* program) bld.sop2(signext ? aco_opcode::s_bfe_i32 : aco_opcode::s_bfe_u32, dst, instr->definitions[1], op, Operand::c32((bits << 16) | offset)); } - } else if (dst.regClass() == v1 && op.physReg().byte() == 0) { + } else if (dst.regClass() == v1) { + if (op.physReg().byte()) { + offset += op.physReg().byte() * 8; + op = Operand(PhysReg(op.physReg().reg()), v1); + } assert(op.physReg().byte() == 0 && dst.physReg().byte() == 0); if (offset == (32 - bits) && op.regClass() != s1) { bld.vop2(signext ? aco_opcode::v_ashrrev_i32 : aco_opcode::v_lshrrev_b32, dst,