summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJonathan Marek <jonathan@marek.ca>2019-07-24 13:33:17 -0400
committerJonathan Marek <jonathan@marek.ca>2019-07-24 17:36:21 -0400
commit97c8314c5fee925cc25daf9ac9ba225f86562805 (patch)
tree6bddd9ceb1ffc6555980f8b3e01fcedf6c629c41 /src/compiler
parent9be902097c72466f60d3178cc6ecaa578fb45d86 (diff)
nir/algebraic: add scmp algebraic optimizations
When 'x' is the result of a scmp op: x != 0.0 or x == 1.0: passthrough x == 0.0 or x != 1.0: invert Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index e4f4a652c19..351f467b246 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -568,6 +568,22 @@ optimizations = [
(('sge', a, b), ('b2f', ('fge', a, b)), 'options->lower_scmp'),
(('seq', a, b), ('b2f', ('feq', a, b)), 'options->lower_scmp'),
(('sne', a, b), ('b2f', ('fne', a, b)), 'options->lower_scmp'),
+ (('seq', ('seq', a, b), 1.0), ('seq', a, b)),
+ (('seq', ('sne', a, b), 1.0), ('sne', a, b)),
+ (('seq', ('slt', a, b), 1.0), ('slt', a, b)),
+ (('seq', ('sge', a, b), 1.0), ('sge', a, b)),
+ (('sne', ('seq', a, b), 0.0), ('seq', a, b)),
+ (('sne', ('sne', a, b), 0.0), ('sne', a, b)),
+ (('sne', ('slt', a, b), 0.0), ('slt', a, b)),
+ (('sne', ('sge', a, b), 0.0), ('sge', a, b)),
+ (('seq', ('seq', a, b), 0.0), ('sne', a, b)),
+ (('seq', ('sne', a, b), 0.0), ('seq', a, b)),
+ (('seq', ('slt', a, b), 0.0), ('sge', a, b)),
+ (('seq', ('sge', a, b), 0.0), ('slt', a, b)),
+ (('sne', ('seq', a, b), 1.0), ('sne', a, b)),
+ (('sne', ('sne', a, b), 1.0), ('seq', a, b)),
+ (('sne', ('slt', a, b), 1.0), ('sge', a, b)),
+ (('sne', ('sge', a, b), 1.0), ('slt', a, b)),
(('fall_equal2', a, b), ('fmin', ('seq', 'a.x', 'b.x'), ('seq', 'a.y', 'b.y')), 'options->lower_vector_cmp'),
(('fall_equal3', a, b), ('seq', ('fany_nequal3', a, b), 0.0), 'options->lower_vector_cmp'),
(('fall_equal4', a, b), ('seq', ('fany_nequal4', a, b), 0.0), 'options->lower_vector_cmp'),