In sve_vqm1_for_el_sm(), we implicitly assume that the CPU has SVE:
if called with sm == false for non-streaming mode, we try to return a
vector length from svq_vq. This hits the "assert(sm)" at the bettom
of the function in an SME-only CPU where sve_vq.map is zero.
Add code to handle the "SME-only CPU not in streaming mode" case: we
report an effective VL of 128 bits, which is what the architecture
rule R_KXKNK says should be used when SVE instructions are disabled
or trapped but floating point instructions are enabled.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/helper.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index e7aa5ec2f2..e4a6ff17b1 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -4766,7 +4766,7 @@ int sme_exception_el(CPUARMState *env, int el)
}
/*
- * Given that SVE is enabled, return the vector length for EL.
+ * Given that SVE or SME is enabled, return the vector length for EL.
*/
uint32_t sve_vqm1_for_el_sm(CPUARMState *env, int el, bool sm)
{
@@ -4778,6 +4778,12 @@ uint32_t sve_vqm1_for_el_sm(CPUARMState *env, int el, bool sm)
if (sm) {
cr = env->vfp.smcr_el;
map = cpu->sme_vq.map;
+ } else if (map == 0) {
+ /*
+ * SME-only CPU not in streaming mode: effective VL
+ * is 128 bits, per R_KXKNK.
+ */
+ return 0;
}
if (el <= 1 && !el_is_in_host(env, el)) {
--
2.43.0