From ce7ad2639a6a1863015ead0648ad887ab17f28f9 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Tue, 13 Jan 2026 17:16:25 -0800 Subject: [PATCH] nir: Fix C UB in imad24_ir3 evaluation. Same fix as imul24, technically you can't shift into the top bit of the int32, but the util helper does it right. Part-of: --- src/compiler/nir/nir_opcodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index a34289855ce..c5c7bcea40a 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -1361,7 +1361,7 @@ dst = (((int32_t)(((uint32_t)src0 & 0x0000ffff) << 16) * (src1 & 0xffff0000)) >> # # 24b multiply into 32b result (with sign extension) plus 32b int triop("imad24_ir3", tint32, _2src_commutative, - "(((int32_t)src0 << 8) >> 8) * (((int32_t)src1 << 8) >> 8) + src2") + "util_mask_sign_extend(src0, 24) * util_mask_sign_extend(src1, 24) + src2") def triop_shift_ir3(name, shift_op, bit_op): opcode(name, 0, tuint, [0, 0, 0], [tuint, tuint32, tuint], False, "",