From 4f24c2707f23bde75956ce3498801f8e52521eb2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 22 Jul 2024 18:57:46 -0700 Subject: [PATCH] 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 Reviewed-by: Matt Turner Part-of: --- src/intel/compiler/brw_reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h index 6fbdc2a5c41..d8489ac39b3 100644 --- a/src/intel/compiler/brw_reg.h +++ b/src/intel/compiler/brw_reg.h @@ -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; }