This will cause the assert to pass when it shouldn't in some cases
with a 32-bit bitsize, and seems like a hack since it's subverting the
point of the assert, which is guarantee that we won't lose any
information by truncating the source. It would be better to fix the
caller that's hitting the assert, and maybe change the argument to be
a int64_t too.
On Mon, Nov 19, 2018 at 10:38 AM Samuel Pitoiset
<samuel.pitoi...@gmail.com> wrote:
>
> Fixes dEQP-VK.spirv_assembly.type.scalar.i16.*
>
> Fixes: 1f29f4db1e ("nir/builder: Assert that intN_t immediates fit")
> Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
> ---
>  src/compiler/nir/nir_builder.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
> index e37aba23dc..1f29209157 100644
> --- a/src/compiler/nir/nir_builder.h
> +++ b/src/compiler/nir/nir_builder.h
> @@ -332,7 +332,8 @@ nir_imm_intN_t(nir_builder *build, uint64_t x, unsigned 
> bit_size)
>
>     assert(bit_size == 64 ||
>            (int64_t)x >> bit_size == 0 ||
> -          (int64_t)x >> bit_size == -1);
> +          (int64_t)x >> bit_size == -1 ||
> +          (int64_t)x >> bit_size == 65535);
>
>     memset(&v, 0, sizeof(v));
>     assert(bit_size <= 64);
> --
> 2.19.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to