Mesa (main): nir/lower_subgroups: fix left shift of -1

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 24 17:28:42 UTC 2021


Module: Mesa
Branch: main
Commit: 34510ce3cca2d7808e1e0480fbfb66bacda69c5a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=34510ce3cca2d7808e1e0480fbfb66bacda69c5a

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Thu Sep 16 17:35:25 2021 +0100

nir/lower_subgroups: fix left shift of -1

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5365
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12901>

---

 src/compiler/nir/nir_lower_subgroups.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c
index 3619fd1fd0f..6f8f34fb8ca 100644
--- a/src/compiler/nir/nir_lower_subgroups.c
+++ b/src/compiler/nir/nir_lower_subgroups.c
@@ -318,7 +318,7 @@ build_ballot_imm_ishl(nir_builder *b, int64_t val, nir_ssa_def *shift,
                       const nir_lower_subgroups_options *options)
 {
    /* This only works if all the high bits are the same as bit 1. */
-   assert(((val << 62) >> 62) == val);
+   assert((val >> 2) == (val & 0x2 ? -1 : 0));
 
    /* First compute the result assuming one ballot component. */
    nir_ssa_def *result =



More information about the mesa-commit mailing list