[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/7] target/arm/sme: Reorg SME access handling in handle_msr_i
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 1/7] target/arm/sme: Reorg SME access handling in handle_msr_i() |
Date: |
Thu, 12 Jan 2023 11:24:30 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org>
[PMD: Split patch in multiple tiny steps]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/translate-a64.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 2ee171f249..35cc851246 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -1841,18 +1841,20 @@ static void handle_msr_i(DisasContext *s, uint32_t insn,
goto do_unallocated;
}
if (sme_access_check(s)) {
- bool i = crm & 1;
- bool changed = false;
+ int old = s->pstate_sm | (s->pstate_za << 1);
+ int new = (crm & 1) * 3;
+ int msk = (crm >> 1) & 3;
- if ((crm & 2) && i != s->pstate_sm) {
- gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i));
- changed = true;
- }
- if ((crm & 4) && i != s->pstate_za) {
- gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i));
- changed = true;
- }
- if (changed) {
+ if ((old ^ new) & msk) {
+ /* At least one bit changes. */
+ bool i = crm & 1;
+
+ if ((crm & 2) && i != s->pstate_sm) {
+ gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i));
+ }
+ if ((crm & 4) && i != s->pstate_za) {
+ gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i));
+ }
gen_rebuild_hflags(s);
} else {
s->base.is_jmp = DISAS_NEXT;
--
2.38.1
- [PATCH v2 0/7] target/arm: Introduce aarch64_set_svcr, Philippe Mathieu-Daudé, 2023/01/12
- [PATCH v2 1/7] target/arm/sme: Reorg SME access handling in handle_msr_i(),
Philippe Mathieu-Daudé <=
- [PATCH v2 2/7] target/arm/sme: Rebuild hflags in set_pstate() helpers, Philippe Mathieu-Daudé, 2023/01/12
- [PATCH v2 3/7] target/arm/sme: Introduce aarch64_set_svcr(), Philippe Mathieu-Daudé, 2023/01/12
- [PATCH v2 4/7] target/arm/sme: Reset SVE state in aarch64_set_svcr(), Philippe Mathieu-Daudé, 2023/01/12
- [PATCH v2 5/7] target/arm/sme: Reset ZA state in aarch64_set_svcr(), Philippe Mathieu-Daudé, 2023/01/12
- [PATCH v2 6/7] target/arm/sme: Rebuild hflags in aarch64_set_svcr(), Philippe Mathieu-Daudé, 2023/01/12
- [PATCH v2 7/7] target/arm/sme: Unify set_pstate() SM/ZA helpers as set_svcr(), Philippe Mathieu-Daudé, 2023/01/12
- Re: [PATCH v2 0/7] target/arm: Introduce aarch64_set_svcr, Fabiano Rosas, 2023/01/12
- Re: [PATCH v2 0/7] target/arm: Introduce aarch64_set_svcr, Peter Maydell, 2023/01/17