summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-12-06 13:02:01 -0600
committerJason Ekstrand <[email protected]>2018-12-16 21:03:02 +0000
commit4bb1a34727f52ecd4a8f00725d740ae2047cb1dc (patch)
tree9d18de5762d84dc7eed5b5c2bdc4b96ced0d2bb1 /src
parent3595a0abf43be3ce27d88f5939b257a74e90035b (diff)
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 <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Tested-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py2
1 files changed, 2 insertions, 0 deletions
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),