target/arm: Merge aarch64_sve_zcr_get_valid_len into caller

This function is used only once, and will need modification
for Streaming SVE mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220607203306.657998-11-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Richard Henderson 2022-06-08 19:38:57 +01:00 committed by Peter Maydell
parent 87252bdecd
commit 9b5f422559
2 changed files with 11 additions and 30 deletions

View File

@ -6212,39 +6212,31 @@ int sve_exception_el(CPUARMState *env, int el)
return 0;
}
uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len)
{
uint32_t end_len;
start_len = MIN(start_len, ARM_MAX_VQ - 1);
end_len = start_len;
if (!test_bit(start_len, cpu->sve_vq_map)) {
end_len = find_last_bit(cpu->sve_vq_map, start_len);
assert(end_len < start_len);
}
return end_len;
}
/*
* Given that SVE is enabled, return the vector length for EL.
*/
uint32_t sve_zcr_len_for_el(CPUARMState *env, int el)
{
ARMCPU *cpu = env_archcpu(env);
uint32_t zcr_len = cpu->sve_max_vq - 1;
uint32_t len = cpu->sve_max_vq - 1;
uint32_t end_len;
if (el <= 1 && !el_is_in_host(env, el)) {
zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[1]);
len = MIN(len, 0xf & (uint32_t)env->vfp.zcr_el[1]);
}
if (el <= 2 && arm_feature(env, ARM_FEATURE_EL2)) {
zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[2]);
len = MIN(len, 0xf & (uint32_t)env->vfp.zcr_el[2]);
}
if (arm_feature(env, ARM_FEATURE_EL3)) {
zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]);
len = MIN(len, 0xf & (uint32_t)env->vfp.zcr_el[3]);
}
return aarch64_sve_zcr_get_valid_len(cpu, zcr_len);
end_len = len;
if (!test_bit(len, cpu->sve_vq_map)) {
end_len = find_last_bit(cpu->sve_vq_map, len);
assert(end_len < len);
}
return end_len;
}
static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri,

View File

@ -189,17 +189,6 @@ void arm_translate_init(void);
void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb);
#endif /* CONFIG_TCG */
/**
* aarch64_sve_zcr_get_valid_len:
* @cpu: cpu context
* @start_len: maximum len to consider
*
* Return the maximum supported sve vector length <= @start_len.
* Note that both @start_len and the return value are in units
* of ZCR_ELx.LEN, so the vector bit length is (x + 1) * 128.
*/
uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len);
enum arm_fprounding {
FPROUNDING_TIEEVEN,
FPROUNDING_POSINF,