[Mesa-dev] [PATCH 4/5] nir/algebraic: Optimize 64bit pack/unpack

Jason Ekstrand jason at jlekstrand.net
Wed Feb 15 07:29:50 UTC 2017


This reduces the instruction count in some fp64 and int64 piglit tests
---
 src/compiler/nir/nir_opt_algebraic.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 8a6dd07..d3eaa1f 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -306,6 +306,12 @@ optimizations = [
    (('fabs', ('b2f', a)), ('b2f', a)),
    (('iabs', ('b2i', a)), ('b2i', a)),
 
+   # Packing and then unpacking does nothing
+   (('unpack_64_2x32_split_x', ('pack_64_2x32_split', a, b)), a),
+   (('unpack_64_2x32_split_y', ('pack_64_2x32_split', a, b)), b),
+   (('pack_64_2x32_split', ('unpack_64_2x32_split_x', a),
+                           ('unpack_64_2x32_split_y', a)), a),
+
    # Byte extraction
    (('ushr', a, 24), ('extract_u8', a, 3), '!options->lower_extract_byte'),
    (('iand', 0xff, ('ushr', a, 16)), ('extract_u8', a, 2), '!options->lower_extract_byte'),
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list