From 54a09545ec639e9204e6ee823e52872897e793df Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 17 Jun 2020 14:57:57 +0100 Subject: [PATCH] aco: optimize a*0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fossil-db (GFX10): Totals from 1943 (1.39% of 139391) affected shaders: SGPRs: 99952 -> 99544 (-0.41%); split: -0.44%, +0.03% VGPRs: 60880 -> 60272 (-1.00%); split: -1.02%, +0.02% CodeSize: 5138488 -> 5107500 (-0.60%); split: -0.61%, +0.01% MaxWaves: 32193 -> 32380 (+0.58%) Instrs: 983178 -> 975684 (-0.76%); split: -0.77%, +0.01% fossil-db (GFX10.3): Totals from 1943 (1.39% of 139391) affected shaders: SGPRs: 99832 -> 99648 (-0.18%); split: -0.25%, +0.06% VGPRs: 64708 -> 63944 (-1.18%); split: -1.27%, +0.09% CodeSize: 5196732 -> 5157632 (-0.75%); split: -0.76%, +0.00% MaxWaves: 27478 -> 27486 (+0.03%); split: +0.06%, -0.03% Instrs: 1007222 -> 998737 (-0.84%); split: -0.84%, +0.00% Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_optimizer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index b4a63e7e580..b324f484075 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -1316,6 +1316,9 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr& instr) !(fp16 ? block.fp_mode.must_flush_denorms16_64 : block.fp_mode.must_flush_denorms32) && !instr->definitions[0].isPrecise()) { /* 1.0 */ ctx.info[instr->definitions[0].tempId()].set_temp(instr->operands[i].getTemp()); + } else if (instr->operands[!i].constantValue() == 0u && + !(fp16 ? block.fp_mode.preserve_signed_zero_inf_nan16_64 : block.fp_mode.preserve_signed_zero_inf_nan32)) { /* 0.0 */ + ctx.info[instr->definitions[0].tempId()].set_constant(ctx.program->chip_class, 0u); } else { continue; }