intel/brw: Fix undefined left shift of large UW value in brw_imm_uw

When -fsanitize=shift is used, 'ninja test' would fail in several
Intel assembly tests (mul.asm and and.asm) with:

src/intel/compiler/brw_reg.h:703:22: runtime error: left shift of 65532 by 16 places cannot be represented in type 'int'

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30333>
This commit is contained in:
Ian Romanick
2024-07-22 18:57:46 -07:00
parent abb7c012ff
commit 4f24c2707f

View File

@@ -700,7 +700,7 @@ static inline struct brw_reg
brw_imm_uw(uint16_t uw)
{
struct brw_reg imm = brw_imm_reg(BRW_TYPE_UW);
imm.ud = uw | (uw << 16);
imm.ud = uw | ((uint32_t)uw << 16);
return imm;
}