target/arm/sme: Unify set_pstate() SM/ZA helpers as set_svcr()

Unify the two helper_set_pstate_{sm,za} in this function.
Do not call helper_* functions from svcr_write.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20230112102436.1913-8-philmd@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>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Richard Henderson 2023-01-12 11:24:36 +01:00 committed by Peter Maydell
parent f431855714
commit 5c922ec5b1
4 changed files with 5 additions and 19 deletions

View File

@ -17,8 +17,7 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
DEF_HELPER_FLAGS_2(set_pstate_sm, TCG_CALL_NO_RWG, void, env, i32)
DEF_HELPER_FLAGS_2(set_pstate_za, TCG_CALL_NO_RWG, void, env, i32)
DEF_HELPER_FLAGS_3(set_svcr, TCG_CALL_NO_RWG, void, env, i32, i32)
DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32)

View File

@ -6765,8 +6765,6 @@ void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask)
static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
uint64_t value)
{
helper_set_pstate_sm(env, FIELD_EX64(value, SVCR, SM));
helper_set_pstate_za(env, FIELD_EX64(value, SVCR, ZA));
aarch64_set_svcr(env, value, -1);
}

View File

@ -29,14 +29,9 @@
#include "vec_internal.h"
#include "sve_ldst_internal.h"
void helper_set_pstate_sm(CPUARMState *env, uint32_t i)
void helper_set_svcr(CPUARMState *env, uint32_t val, uint32_t mask)
{
aarch64_set_svcr(env, 0, R_SVCR_SM_MASK);
}
void helper_set_pstate_za(CPUARMState *env, uint32_t i)
{
aarch64_set_svcr(env, 0, R_SVCR_ZA_MASK);
aarch64_set_svcr(env, val, mask);
}
void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl)

View File

@ -1847,14 +1847,8 @@ static void handle_msr_i(DisasContext *s, uint32_t insn,
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_helper_set_svcr(cpu_env, tcg_constant_i32(new),
tcg_constant_i32(msk));
} else {
s->base.is_jmp = DISAS_NEXT;
}