From b2abd3bdba6af766967878398f25beb06a541b9e Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 23 Oct 2024 17:50:19 +0100 Subject: [PATCH] nir: fix shfr constant folding with zero src2 No fossil-db changes. Signed-off-by: Rhys Perry Reviewed-by: Georg Lehmann Fixes: 08903bbe89ae ("nir: add mqsad_4x8, shfr and nir_opt_mqsad") Part-of: --- src/compiler/nir/nir_opcodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index 592b0a263d2..c6c0e59df28 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -885,8 +885,8 @@ opcode("uror", 0, tuint, [0, 0], [tuint, tuint32], False, "", """ opcode("shfr", 0, tuint32, [0, 0, 0], [tuint32, tuint32, tuint32], False, "", """ uint32_t rotate_mask = sizeof(src0) * 8 - 1; - dst = (src1 >> (src2 & rotate_mask)) | - (src0 << (-src2 & rotate_mask)); + uint64_t src = src1 | ((uint64_t)src0 << 32); + dst = src >> (src2 & rotate_mask); """) bitwise_description = """