From ea29ce276c07541dc272bf10599411d140314f2a Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Wed, 25 Feb 2026 14:41:09 -0800 Subject: [PATCH] Make sure VS is set on fault-only-first loads in all cases We weren't setting it in the case that an exception was detected on element 0, which is technically OK since no state changed, but is inconsistent with how we handle regular vector loads. --- riscv/v_ext_macros.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/riscv/v_ext_macros.h b/riscv/v_ext_macros.h index 5f1dd170..e96fc122 100644 --- a/riscv/v_ext_macros.h +++ b/riscv/v_ext_macros.h @@ -1328,8 +1328,10 @@ VI_VX_ULOOP({ \ val = MMU.load( \ baseAddr + (i * nf + fn) * sizeof(elt_width##_t)); \ } catch (trap_t& t) { \ - if (i == 0) \ + if (i == 0) { \ + P.VU.vstart->write(0); /* dirty VS */ \ throw; /* Only take exception on zeroth element */ \ + } \ /* Reduce VL if an exception occurs on a later element */ \ early_stop = true; \ P.VU.vl->write_raw(i); \ @@ -1342,7 +1344,7 @@ VI_VX_ULOOP({ \ break; \ } \ } \ - p->VU.vstart->write(0); + VECTOR_END; #define VI_LD_WHOLE(elt_width) \ require_vector_novtype(true); \