From: Jason Ekstrand Date: Thu, 6 Dec 2018 19:02:01 +0000 (-0600) Subject: nir/algebraic: Optimize x2b(xneg(a)) -> a X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4bb1a34727f52ecd4a8f00725d740ae2047cb1dc;p=mesa.git nir/algebraic: Optimize x2b(xneg(a)) -> a Shader-db results on Kaby Lake: total instructions in shared programs: 15072525 -> 15072525 (0.00%) instructions in affected programs: 0 -> 0 helped: 0 HURT: 0 This helps prevent regressions in later commits. Reviewed-by: Eric Anholt Reviewed-by: Bas Nieuwenhuizen Tested-by: Bas Nieuwenhuizen --- diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 28e8a96d4d5..ea24094a927 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -85,6 +85,8 @@ optimizations = [ (('fabs', ('u2f', a)), ('u2f', a)), (('iabs', ('iabs', a)), ('iabs', a)), (('iabs', ('ineg', a)), ('iabs', a)), + (('f2b', ('fneg', a)), ('f2b', a)), + (('i2b', ('ineg', a)), ('i2b', a)), (('~fadd', a, 0.0), a), (('iadd', a, 0), a), (('usadd_4x8', a, 0), a),