summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_opt_algebraic.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir/nir_opt_algebraic.py')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 5ba469f5f65..fd260650d8b 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -235,6 +235,15 @@ optimizations = [
# fabs(a) > 0.0
(('~flt', ('fneg', ('fabs', a)), 0.0), ('fne', a, 0.0)),
+ # 0.0 >= fabs(a)
+ # 0.0 == fabs(a) because fabs(a) must be >= 0
+ # 0.0 == a
+ (('fge', 0.0, ('fabs', a)), ('feq', a, 0.0)),
+
+ # -fabs(a) >= 0.0
+ # 0.0 >= fabs(a)
+ (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
+
(('fmax', ('b2f(is_used_once)', a), ('b2f', b)), ('b2f', ('ior', a, b))),
(('fmax', ('fneg(is_used_once)', ('b2f(is_used_once)', a)), ('fneg', ('b2f', b))), ('fneg', ('b2f', ('ior', a, b)))),
(('fmin', ('b2f(is_used_once)', a), ('b2f', b)), ('b2f', ('iand', a, b))),