aboutsummaryrefslogtreecommitdiff
path: root/target/arm/mve_helper.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-08-13 17:11:49 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-08-25 10:48:49 +0100
commite0d40070e1b3b6cf16ad2a51e85fb92261363d2a (patch)
tree7e8ab68e9e90624cfe46cd8884dfba5bcf3f34a4 /target/arm/mve_helper.c
parent3f4f1880c245453b75d4c09049845b19de9964bf (diff)
downloadqemu-e0d40070e1b3b6cf16ad2a51e85fb92261363d2a.zip
qemu-e0d40070e1b3b6cf16ad2a51e85fb92261363d2a.tar.gz
qemu-e0d40070e1b3b6cf16ad2a51e85fb92261363d2a.tar.bz2
target/arm: Factor out mve_eci_mask()
In some situations we need a mask telling us which parts of the vector correspond to beats that are not being executed because of ECI, separately from the combined "which bytes are predicated away" mask. Factor this mask calculation out of mve_element_mask() into its own function. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/arm/mve_helper.c')
-rw-r--r--target/arm/mve_helper.c58
1 files changed, 34 insertions, 24 deletions
diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c
index bc67b86..ffff280 100644
--- a/target/arm/mve_helper.c
+++ b/target/arm/mve_helper.c
@@ -26,6 +26,35 @@
#include "exec/exec-all.h"
#include "tcg/tcg.h"
+static uint16_t mve_eci_mask(CPUARMState *env)
+{
+ /*
+ * Return the mask of which elements in the MVE vector correspond
+ * to beats being executed. The mask has 1 bits for executed lanes
+ * and 0 bits where ECI says this beat was already executed.
+ */
+ int eci;
+
+ if ((env->condexec_bits & 0xf) != 0) {
+ return 0xffff;
+ }
+
+ eci = env->condexec_bits >> 4;
+ switch (eci) {
+ case ECI_NONE:
+ return 0xffff;
+ case ECI_A0:
+ return 0xfff0;
+ case ECI_A0A1:
+ return 0xff00;
+ case ECI_A0A1A2:
+ case ECI_A0A1A2B0:
+ return 0xf000;
+ default:
+ g_assert_not_reached();
+ }
+}
+
static uint16_t mve_element_mask(CPUARMState *env)
{
/*
@@ -68,30 +97,11 @@ static uint16_t mve_element_mask(CPUARMState *env)
mask &= ltpmask;
}
- if ((env->condexec_bits & 0xf) == 0) {
- /*
- * ECI bits indicate which beats are already executed;
- * we handle this by effectively predicating them out.
- */
- int eci = env->condexec_bits >> 4;
- switch (eci) {
- case ECI_NONE:
- break;
- case ECI_A0:
- mask &= 0xfff0;
- break;
- case ECI_A0A1:
- mask &= 0xff00;
- break;
- case ECI_A0A1A2:
- case ECI_A0A1A2B0:
- mask &= 0xf000;
- break;
- default:
- g_assert_not_reached();
- }
- }
-
+ /*
+ * ECI bits indicate which beats are already executed;
+ * we handle this by effectively predicating them out.
+ */
+ mask &= mve_eci_mask(env);
return mask;
}