From 4bb1a34727f52ecd4a8f00725d740ae2047cb1dc Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 6 Dec 2018 13:02:01 -0600 Subject: [PATCH] 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 --- src/compiler/nir/nir_opt_algebraic.py | 2 ++ 1 file changed, 2 insertions(+) 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), -- 2.30.2