diff options
-rw-r--r-- | src/compiler/nir/nir_opt_algebraic.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 575024c04bf..4b5fc5ecc9a 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -2041,6 +2041,9 @@ distribute_src_mods = [ (('fdot_replicated4', ('fneg', a), ('fneg', b)), ('fdot_replicated4', a, b)), (('fneg', ('fneg', a)), a), + (('fneg', ('fmul(is_used_once)', a, b)), ('fmul', ('fneg', a), b)), + (('fabs', ('fmul(is_used_once)', a, b)), ('fmul', ('fabs', a), ('fabs', b))), + (('fneg', ('ffma(is_used_once)', a, b, c)), ('ffma', ('fneg', a), b, ('fneg', c))), (('fneg', ('flrp(is_used_once)', a, b, c)), ('flrp', ('fneg', a), ('fneg', b), c)), (('fneg', ('fadd(is_used_once)', a, b)), ('fadd', ('fneg', a), ('fneg', b))), @@ -2050,21 +2053,18 @@ distribute_src_mods = [ (('fneg', ('fmin(is_used_once)', a, b)), ('fmax', ('fneg', a), ('fneg', b))), (('fneg', ('fmax(is_used_once)', a, b)), ('fmin', ('fneg', a), ('fneg', b))), + (('fneg', ('fdot_replicated2(is_used_once)', a, b)), ('fdot_replicated2', ('fneg', a), b)), + (('fneg', ('fdot_replicated3(is_used_once)', a, b)), ('fdot_replicated3', ('fneg', a), b)), + (('fneg', ('fdot_replicated4(is_used_once)', a, b)), ('fdot_replicated4', ('fneg', a), b)), + # fdph works mostly like fdot, but to get the correct result, the negation # must be applied to the second source. (('fneg', ('fdph_replicated(is_used_once)', a, b)), ('fdph_replicated', a, ('fneg', b))), - (('fabs', ('fdph_replicated(is_used_once)', a, b)), ('fdph_replicated', ('fabs', a), ('fabs', b))), (('fneg', ('fsign(is_used_once)', a)), ('fsign', ('fneg', a))), (('fabs', ('fsign(is_used_once)', a)), ('fsign', ('fabs', a))), ] -for op in ['fmul', 'fdot_replicated2', 'fdot_replicated3', 'fdot_replicated4']: - distribute_src_mods.extend([ - (('fneg', (op + '(is_used_once)', a, b)), (op, ('fneg', a), b)), - (('fabs', (op + '(is_used_once)', a, b)), (op, ('fabs', a), ('fabs', b))), - ]) - print(nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render()) print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_before_ffma", before_ffma_optimizations).render()) |