From: Jonathan Marek Date: Wed, 24 Jul 2019 17:33:17 +0000 (-0400) Subject: nir/algebraic: add scmp algebraic optimizations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=97c8314c5fee925cc25daf9ac9ba225f86562805;p=mesa.git 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 Reviewed-by: Matt Turner --- 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'),