intel/fs: Fix lowering of dword multiplication by 16-bit constant
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Mon, 16 Dec 2019 21:37:41 +0000 (13:37 -0800)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tue, 17 Dec 2019 18:45:22 +0000 (10:45 -0800)
commit2137be22fa2c75eda462456f2b7778684d0631fc
treeaa8a77384b4c84e307a1b82059bd369985b107e1
parent66013cb1be2bd60d88d78ebe1624a5556a0460f7
intel/fs: Fix lowering of dword 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 platforms
that don't support MUL with 32x32 types, including ICL and TGL.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2186
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/compiler/brw_fs.cpp