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: 88eb8f190b ("nir/algebraic: Simplify logic to detect sign of an integer")
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4770>
This commit is contained in:
Ian Romanick 2020-04-27 12:11:17 -07:00 committed by Marge Bot
parent 656051d735
commit 7b869710a1
1 changed files with 4 additions and 4 deletions

View File

@ -517,10 +517,10 @@ optimizations.extend([
(('iand@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@32', 0x80000000), 0x00000000), ('ige', a, 0)),
(('ine', ('iand', 'a@32', 0x80000000), 0x80000000), ('ige', a, 0)),
(('ine', ('iand', 'a@32', 0x80000000), 0x00000000), ('ilt', a, 0)),
(('ieq', ('iand', 'a@32', 0x80000000), 0x80000000), ('ilt', a, 0)),
(('ine', ('ushr', 'a@32', 31), 0), ('ilt', a, 0)),
(('ieq', ('ushr', 'a@32', 31), 0), ('ige', a, 0)),
(('ieq', ('ushr', 'a@32', 31), 1), ('ilt', a, 0)),