intel/vec4: Fix lowering of multiplication by 16-bit constant
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Mon, 16 Dec 2019 22:43:53 +0000 (14:43 -0800)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tue, 17 Dec 2019 18:45:22 +0000 (10:45 -0800)
commit766fdeccf943d090694d4fbeebbe470904481d32
tree328443bac854d16ede90be7456e1a3c466ccabe2
parent2137be22fa2c75eda462456f2b7778684d0631fc
intel/vec4: Fix lowering of multiplication by 16-bit constant

Existing code was ignoring whether the type of the immediate source
was signed or not.  If the source was signed, it would ignore small
negative values but it also would wrongly accept values between
INT16_MAX and UINT16_MAX, causing the atual value to later be
reinterpreted as a negative number (under 16-bits).

Fixes tests/shaders/glsl-mul-const.shader_test in Piglit for older
platforms that don't support MUL with 32x32 types and use vec4.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/compiler/brw_vec4_nir.cpp