Introduce the ppc_code_endian() helper which returns the
MemOp endianness for the CODE path.
Use it in need_byteswap(), removing one TARGET_BIG_ENDIAN.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/ppc/translate.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 17e6d07c8c2..4a9199a4473 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -214,14 +214,15 @@ static inline bool is_ppe(const DisasContext *ctx)
return !!(ctx->flags & POWERPC_FLAG_PPE42);
}
+static inline MemOp ppc_code_endian(const DisasContext *ctx)
+{
+ return MO_BE ^ (ctx->le_mode * MO_BSWAP);
+}
+
/* Return true iff byteswap is needed in a scalar memop */
static inline bool need_byteswap(const DisasContext *ctx)
{
-#if TARGET_BIG_ENDIAN
- return ctx->le_mode;
-#else
- return !ctx->le_mode;
-#endif
+ return ppc_code_endian(ctx) != MO_TE;
}
/* True when active word size < size of target_long. */
--
2.52.0