From 231a4774024d6397839b9ee26afde59b328d8636 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Tue, 13 Jan 2026 17:27:30 -0800 Subject: [PATCH] nir/opcodes: Define udiv_aligned_4 to return poison for not-aligned-4. Part-of: --- src/compiler/nir/nir_opcodes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index cdce76462b4..5a9e2e6a49f 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -958,8 +958,11 @@ opcode("ushr", 0, tuint, [0, 0], [tuint, tuint32], False, "", "src0 >> (src1 & (sizeof(src0) * 8 - 1))", description = "Unsigned right-shift." + shift_note) -opcode("udiv_aligned_4", 0, tuint, [0], [tuint], False, "", - "src0 >> 2", description = "Divide a multiple of 4 by 4") +opcode("udiv_aligned_4", 0, tuint, [0], [tuint], False, "", """ +dst = src0 >> 2; +if (src0 & 3) + poison = true; +""", description = "Divide a multiple of 4 by 4") opcode("urol", 0, tuint, [0, 0], [tuint, tuint32], False, "", """ uint32_t rotate_mask = sizeof(src0) * 8 - 1;