target/arm: Introduce mo_endian() helper
Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260414005348.4767-6-philmd@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Philippe Mathieu-Daudé committed
Apr 14, 2026 at 02:53 UTC
fb815fe39817354f68b7c77b05dc4c85b30ffeb6
2 files changed
+8
-1
target/arm/internals.h
+6
@@ -28,6 +28,7 @@
28
#include "exec/hwaddr.h"
29
#include "exec/vaddr.h"
30
#include "exec/breakpoint.h"
31
+#include "exec/memop.h"
32
#include "accel/tcg/tb-cpu-state.h"
33
#include "hw/core/registerfields.h"
34
#include "tcg/tcg-gvec-desc.h"
@@ -46,6 +47,11 @@
47
#define BANK_HYP 6
48
#define BANK_MON 7
49
50
+static inline MemOp mo_endian(CPUARMState *env)
51
+{
52
+ return EX_TBFLAG_ANY(env->hflags, BE_DATA) ? MO_BE : MO_LE;
53
+}
54
+
55
static inline int arm_env_mmu_index(CPUARMState *env)
56
{
57
return EX_TBFLAG_ANY(env->hflags, MMUIDX);
target/arm/tcg/mve_helper.c
+2
-1
@@ -299,7 +299,8 @@ DO_VSTR(vstrh_w, MO_UW, 2, stw, 4, int32_t)
299
unsigned e; \
300
uint32_t addr; \
301
int mmu_idx = arm_to_core_mmu_idx(arm_mmu_idx(env)); \
302
- MemOpIdx oi = make_memop_idx(MO_TE | MO_UL | MO_ALIGN, mmu_idx);\
302
+ MemOpIdx oi = make_memop_idx(mo_endian(env) | MO_UL | MO_ALIGN, \
303
+ mmu_idx); \
304
for (e = 0; e < 16 / 4; e++, mask >>= 4, eci_mask >>= 4) { \
305
if (!(eci_mask & 1)) { \
306
continue; \