aco: mark mad definition as precise if the mul/add were precise

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20587>
This commit is contained in:
Georg Lehmann
2023-03-01 15:31:23 +01:00
committed by Marge Bot
parent f19fccd9f8
commit ed349951cb
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -4475,6 +4475,8 @@ combine_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
instr = std::move(mad);
}
instr->definitions[0] = add_instr->definitions[0];
instr->definitions[0].setPrecise(add_instr->definitions[0].isPrecise() ||
mul_instr->definitions[0].isPrecise());
/* mark this ssa_def to be re-checked for profitability and literals */
ctx.mad_infos.emplace_back(std::move(add_instr), mul_instr->definitions[0].tempId());
+1 -1
View File
@@ -1583,7 +1583,7 @@ BEGIN_TEST(optimize.mad_mix.fma.precision)
Temp b16 = inputs[4];
/* the optimization is precise for 32-bit on GFX9 */
//~gfx9! v1: %res0 = v_fma_mix_f32 lo(%a16), %b, %c
//~gfx9! v1: (precise)%res0 = v_fma_mix_f32 lo(%a16), %b, %c
//~gfx10! v1: (precise)%res0_tmp = v_fma_mix_f32 lo(%a16), %b, -0
//~gfx10! v1: %res0 = v_add_f32 %res0_tmp, %c
//! p_unit_test 0, %res0