From 0a43be6d4fe16fda005324dc076c62dfaf9a3d3d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 3 Feb 2025 17:08:36 -0500 Subject: [PATCH] agx: fix botched address fuses identified in dEQP-VK.robustness.robustness2.push.notemplate.rgba32f.unroll.nonvolatile.sampled_image.no_fmt_qual.img.samples_1.2d.comp. owwie. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_nir_lower_address.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/asahi/compiler/agx_nir_lower_address.c b/src/asahi/compiler/agx_nir_lower_address.c index cdd9e306a6b..c0e3469979f 100644 --- a/src/asahi/compiler/agx_nir_lower_address.c +++ b/src/asahi/compiler/agx_nir_lower_address.c @@ -82,8 +82,10 @@ pass(struct nir_builder *b, nir_intrinsic_instr *intr, void *data) uint32_t shift = MIN2(__builtin_ctz(raw_scalar), max_shift); int64_t k = raw_scalar >> shift; - /* See if the reduced scalar is from a sign extension. */ - if (k > INT32_MAX || k < INT32_MIN) + /* See if the reduced scalar is from a sign extension. We must have + * at least the format shift to avoid underflowing. + */ + if (k > INT32_MAX || k < INT32_MIN || shift < format_shift) break; /* Match the constant */