Skip to content

Commit cc7abc3

Browse files
rth7680pm215
authored andcommitted
target/arm: Simplify pstate_sm check in sve_access_check
In StreamingMode, fp_access_checked is handled already. We cannot fall through to fp_access_check lest we fall foul of the double-check assertion. Cc: [email protected] Fixes: 285b1d5 ("target/arm: Handle SME in sve_access_check") Signed-off-by: Richard Henderson <[email protected]> Message-id: [email protected] Reviewed-by: Peter Maydell <[email protected]> [PMM: move declaration of 'ret' to top of block] Signed-off-by: Peter Maydell <[email protected]>
1 parent 298a049 commit cc7abc3

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

target/arm/tcg/translate-a64.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,23 +1456,23 @@ static int fp_access_check_vector_hsd(DisasContext *s, bool is_q, MemOp esz)
14561456
bool sve_access_check(DisasContext *s)
14571457
{
14581458
if (s->pstate_sm || !dc_isar_feature(aa64_sve, s)) {
1459+
bool ret;
1460+
14591461
assert(dc_isar_feature(aa64_sme, s));
1460-
if (!sme_sm_enabled_check(s)) {
1461-
goto fail_exit;
1462-
}
1463-
} else if (s->sve_excp_el) {
1462+
ret = sme_sm_enabled_check(s);
1463+
s->sve_access_checked = (ret ? 1 : -1);
1464+
return ret;
1465+
}
1466+
if (s->sve_excp_el) {
1467+
/* Assert that we only raise one exception per instruction. */
1468+
assert(!s->sve_access_checked);
14641469
gen_exception_insn_el(s, 0, EXCP_UDEF,
14651470
syn_sve_access_trap(), s->sve_excp_el);
1466-
goto fail_exit;
1471+
s->sve_access_checked = -1;
1472+
return false;
14671473
}
14681474
s->sve_access_checked = 1;
14691475
return fp_access_check(s);
1470-
1471-
fail_exit:
1472-
/* Assert that we only raise one exception per instruction. */
1473-
assert(!s->sve_access_checked);
1474-
s->sve_access_checked = -1;
1475-
return false;
14761476
}
14771477

14781478
/*

0 commit comments

Comments
 (0)