aco: disable a*1.0 optimization if the instruction is precise

fossil-db (GFX10):
Totals from 10370 (7.44% of 139391) affected shaders:
SGPRs: 564072 -> 564016 (-0.01%); split: -0.01%, +0.00%
VGPRs: 248312 -> 248532 (+0.09%); split: -0.02%, +0.11%
CodeSize: 12866732 -> 13208904 (+2.66%); split: -0.00%, +2.66%
MaxWaves: 190198 -> 190170 (-0.01%)
Instrs: 2460818 -> 2545351 (+3.44%)

fossil-db (GFX10.3):
Totals from 10370 (7.44% of 139391) affected shaders:
SGPRs: 563904 -> 564272 (+0.07%); split: -0.16%, +0.22%
VGPRs: 289344 -> 295016 (+1.96%); split: -0.88%, +2.84%
CodeSize: 13519204 -> 14197020 (+5.01%); split: -0.00%, +5.01%
MaxWaves: 155946 -> 154566 (-0.88%)
Instrs: 2719177 -> 2806919 (+3.23%); split: -0.00%, +3.23%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5523>
This commit is contained in:
Rhys Perry 2020-06-17 14:56:55 +01:00
parent 8da467f4fe
commit 0c3d8e8e2e

View file

@ -1313,7 +1313,8 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
} else if (instr->operands[!i].constantValue() == (fp16 ? 0x3800 : 0x3f000000)) { /* 0.5 */
ctx.info[instr->operands[i].tempId()].set_omod5(instr.get());
} else if (instr->operands[!i].constantValue() == (fp16 ? 0x3c00 : 0x3f800000) &&
!(fp16 ? block.fp_mode.must_flush_denorms16_64 : block.fp_mode.must_flush_denorms32)) { /* 1.0 */
!(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 {
continue;