From 34510ce3cca2d7808e1e0480fbfb66bacda69c5a Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 16 Sep 2021 17:35:25 +0100 Subject: [PATCH] nir/lower_subgroups: fix left shift of -1 Signed-off-by: Rhys Perry Reviewed-by: Samuel Pitoiset Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5365 Part-of: --- 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 =