nir/algebraic: Add downcast-of-pack opts
authorJason Ekstrand <jason@jlekstrand.net>
Sat, 28 Mar 2020 16:24:08 +0000 (11:24 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 31 Mar 2020 00:18:05 +0000 (00:18 +0000)
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4365>

src/compiler/nir/nir_opt_algebraic.py

index dbfd4917503321cfb441d2655127e4b564bd4459..472db765026cab36a0f095933f0b4a5f35ea80a7 100644 (file)
@@ -1400,6 +1400,15 @@ for N, M in itertools.product(type_sizes('uint'), type_sizes('uint')):
       # The N == M case is handled by other optimizations
       pass
 
+# Downcast operations should be able to see through pack
+for t in ['i', 'u']:
+    for N in [8, 16, 32]:
+        x2xN = '{0}2{0}{1}'.format(t, N)
+        optimizations += [
+            ((x2xN, ('pack_64_2x32_split', a, b)), (x2xN, a)),
+            ((x2xN, ('pack_64_2x32_split', a, b)), (x2xN, a)),
+        ]
+
 # Optimize comparisons with up-casts
 for t in ['int', 'uint', 'float']:
     for N, M in itertools.product(type_sizes(t), repeat=2):