mirror of
https://github.com/qemu/qemu.git
synced 2026-02-04 02:24:51 +00:00
target/ppc: Introduce ppc_code_endian_dc() helper
Introduce the ppc_code_endian_dc() helper which returns the
MemOp endianness for the CODE path.
Use it in need_byteswap(), removing one TARGET_BIG_ENDIAN.
Note, the target MemOp endianness can be evaluated as (see
commit 5c43a750b6 "accel/tcg: Implement translator_ld*_end"):
MO_TE ^ (do_swap * MO_BSWAP)
For PPC we use the DisasContext::le_mode field to swap the
default (big-endian) order, so to get the PPC MemOp endianness
we can directly use:
MO_BE ^ (ctx->le_mode * MO_BSWAP)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Message-ID: <20260202210106.93257-7-philmd@linaro.org>
This commit is contained in:
@@ -214,14 +214,21 @@ static inline bool is_ppe(const DisasContext *ctx)
|
||||
return !!(ctx->flags & POWERPC_FLAG_PPE42);
|
||||
}
|
||||
|
||||
/**
|
||||
* ppc_code_endian_dc:
|
||||
* @dc: the disassembly context
|
||||
*
|
||||
* Return the MemOp endianness of the CODE path.
|
||||
*/
|
||||
static inline MemOp ppc_code_endian_dc(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_dc(ctx) != MO_TE;
|
||||
}
|
||||
|
||||
/* True when active word size < size of target_long. */
|
||||
|
||||
Reference in New Issue
Block a user