Mesa (master): nir/algebraic: Add missing 16-bit extract_[iu]8 patterns

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 28 22:36:20 UTC 2019


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Feb 27 20:15:32 2019 -0800

nir/algebraic: Add missing 16-bit extract_[iu]8 patterns

No shader-db changes on any Intel platform.

v2: Use a loop to generate patterns.  Suggested by Jason.

v3: Fix a copy-and-paste bug in the extract_[ui] of ishl loop that would
replace an extract_i8 with and extract_u8.  This broke ~180 tests.  This
bug was introduced in v2.

Reviewed-by: Matt Turner <mattst88 at gmail.com> [v1]
Reviewed-by: Dylan Baker <dylan at pnwbakers.com> [v2]
Acked-by: Jason Ekstrand <jason at jlekstrand.net> [v2]

---

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

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 42cf7673071..bdf70787937 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -611,8 +611,10 @@ optimizations = [
                            ('unpack_64_2x32_split_y', a)), a),
 
    # Byte extraction
+   (('ushr', 'a at 16',  8), ('extract_u8', a, 1), '!options->lower_extract_byte'),
    (('ushr', 'a at 32', 24), ('extract_u8', a, 3), '!options->lower_extract_byte'),
    (('ushr', 'a at 64', 56), ('extract_u8', a, 7), '!options->lower_extract_byte'),
+   (('ishr', 'a at 16',  8), ('extract_i8', a, 1), '!options->lower_extract_byte'),
    (('ishr', 'a at 32', 24), ('extract_i8', a, 3), '!options->lower_extract_byte'),
    (('ishr', 'a at 64', 56), ('extract_i8', a, 7), '!options->lower_extract_byte'),
    (('iand', 0xff, a), ('extract_u8', a, 0), '!options->lower_extract_byte')
@@ -630,6 +632,7 @@ optimizations.extend([(('extract_u8', ('extract_u16', a, 1), 0), ('extract_u8',
 # After the ('extract_[iu]8', a, 3) patterns, above, trigger, there will be
 # patterns like those below.
 for op in ('extract_u8', 'extract_i8'):
+   optimizations.extend([((op, ('ishl', 'a at 16',      8),     1), (op, a, 0))])
    optimizations.extend([((op, ('ishl', 'a at 32', 24 - 8 * i), 3), (op, a, i)) for i in range(2, -1, -1)])
    optimizations.extend([((op, ('ishl', 'a at 64', 56 - 8 * i), 7), (op, a, i)) for i in range(6, -1, -1)])
 




More information about the mesa-commit mailing list