Mesa (master): nir/algebraic: Require operands to iand be 32-bit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 28 21:00:37 UTC 2020


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Apr 27 12:11:17 2020 -0700

nir/algebraic: Require operands to iand be 32-bit

With the mask value 0x80000000, the other operand must be 32-bit.  This
fixes failures in
dEQP-VK.subgroups.ballot_mask.ext_shader_subgroup_ballot.*.gl_subgroupgemaskarb_*
tests from Vulkan 1.2.2 CTS.

Checking one of the tests, it appears that the tests are doing 64-bit
iand with 0x0000000080000000, then comparing the result with zero.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2834
Fixes: 88eb8f190bd ("nir/algebraic: Simplify logic to detect sign of an integer")
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4770>

---

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

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index b2643641a8e..58ff35af0b0 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -517,10 +517,10 @@ optimizations.extend([
    (('iand at 32', a, ('inot', ('ishr', a, 31))), ('imax', a, 0)),
 
    # Simplify logic to detect sign of an integer.
-   (('ieq', ('iand', a, 0x80000000), 0x00000000), ('ige', a, 0)),
-   (('ine', ('iand', a, 0x80000000), 0x80000000), ('ige', a, 0)),
-   (('ine', ('iand', a, 0x80000000), 0x00000000), ('ilt', a, 0)),
-   (('ieq', ('iand', a, 0x80000000), 0x80000000), ('ilt', a, 0)),
+   (('ieq', ('iand', 'a at 32', 0x80000000), 0x00000000), ('ige', a, 0)),
+   (('ine', ('iand', 'a at 32', 0x80000000), 0x80000000), ('ige', a, 0)),
+   (('ine', ('iand', 'a at 32', 0x80000000), 0x00000000), ('ilt', a, 0)),
+   (('ieq', ('iand', 'a at 32', 0x80000000), 0x80000000), ('ilt', a, 0)),
    (('ine', ('ushr', 'a at 32', 31), 0), ('ilt', a, 0)),
    (('ieq', ('ushr', 'a at 32', 31), 0), ('ige', a, 0)),
    (('ieq', ('ushr', 'a at 32', 31), 1), ('ilt', a, 0)),



More information about the mesa-commit mailing list