Mesa (main): nir/algebraic: Add some opts for comparisons of comparisons

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 7 18:53:01 UTC 2021


Module: Mesa
Branch: main
Commit: b71bdc3404ede6ec9e4c526a5e540cff20837827
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b71bdc3404ede6ec9e4c526a5e540cff20837827

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Sat Feb 13 01:32:40 2021 -0600

nir/algebraic: Add some opts for comparisons of comparisons

Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13167>

---

 src/compiler/nir/nir_opt_algebraic.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 1862fe98e0f..c690b72a4e0 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -676,6 +676,20 @@ optimizations.extend([
    (('imin', ('imin', ('imin', a, b), c), a), ('imin', ('imin', a, b), c)),
 ])
 
+for N in [8, 16, 32, 64]:
+    b2iN = 'b2i{0}'.format(N)
+    optimizations.extend([
+        (('ieq', (b2iN, 'a at 1'), (b2iN, 'b at 1')), ('ieq', a, b)),
+        (('ine', (b2iN, 'a at 1'), (b2iN, 'b at 1')), ('ine', a, b)),
+    ])
+
+for N in [16, 32, 64]:
+    b2fN = 'b2f{0}'.format(N)
+    optimizations.extend([
+        (('feq', (b2fN, 'a at 1'), (b2fN, 'b at 1')), ('ieq', a, b)),
+        (('fneu', (b2fN, 'a at 1'), (b2fN, 'b at 1')), ('ine', a, b)),
+    ])
+
 # Integer sizes
 for s in [8, 16, 32, 64]:
     optimizations.extend([



More information about the mesa-commit mailing list