Mesa (staging/18.2): nir/algebraic: Be more careful converting ushr to extract_u8/16

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 30 12:59:02 UTC 2018


Module: Mesa
Branch: staging/18.2
Commit: ffa251687c978a19c5e5de46bad9b8a94e939607
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ffa251687c978a19c5e5de46bad9b8a94e939607

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Tue Aug 14 15:10:22 2018 -0500

nir/algebraic: Be more careful converting ushr to extract_u8/16

If it's not the right bit-size, it may not actually be the correct
extraction.  For now, we'll only worry about 32-bit versions.

Fixes: 905ff8619824 "nir: Recognize open-coded extract_u16"
Fixes: 76289fbfa84a "nir: Recognize open-coded extract_u8"
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
(cherry picked from commit 116b47fe3c0395e95b67c6bd3506ab7d6a83393e)

---

 src/compiler/nir/nir_opt_algebraic.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 7fc4ff1d40..19526d86d4 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -462,13 +462,13 @@ optimizations = [
                            ('unpack_64_2x32_split_y', a)), a),
 
    # Byte extraction
-   (('ushr', a, 24), ('extract_u8', a, 3), '!options->lower_extract_byte'),
+   (('ushr', 'a at 32', 24), ('extract_u8', a, 3), '!options->lower_extract_byte'),
    (('iand', 0xff, ('ushr', a, 16)), ('extract_u8', a, 2), '!options->lower_extract_byte'),
    (('iand', 0xff, ('ushr', a,  8)), ('extract_u8', a, 1), '!options->lower_extract_byte'),
    (('iand', 0xff, a), ('extract_u8', a, 0), '!options->lower_extract_byte'),
 
     # Word extraction
-   (('ushr', a, 16), ('extract_u16', a, 1), '!options->lower_extract_word'),
+   (('ushr', 'a at 32', 16), ('extract_u16', a, 1), '!options->lower_extract_word'),
    (('iand', 0xffff, a), ('extract_u16', a, 0), '!options->lower_extract_word'),
 
    # Subtracts




More information about the mesa-commit mailing list