summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-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 b1e266259fa..f6800b419ba 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -24,6 +24,7 @@
# Jason Ekstrand ([email protected])
import nir_algebraic
+import itertools
# Convenience variables
a = 'a'
@@ -545,6 +546,14 @@ optimizations = [
'options->lower_unpack_snorm_4x8'),
]
+invert = {'feq': 'fne', 'fne': 'feq', 'fge': 'flt', 'flt': 'fge' }
+
+for left, right in list(itertools.combinations(invert.keys(), 2)) + zip(invert.keys(), invert.keys()):
+ optimizations.append((('inot', ('ior(is_used_once)', (left, a, b), (right, c, d))),
+ ('iand', (invert[left], a, b), (invert[right], c, d))))
+ optimizations.append((('inot', ('iand(is_used_once)', (left, a, b), (right, c, d))),
+ ('ior', (invert[left], a, b), (invert[right], c, d))))
+
def fexp2i(exp, bits):
# We assume that exp is already in the right range.
if bits == 32: