target-ppc: emulate cmpb instruction
Needed for Power ISA version 2.05 compliance. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
9c2627b09d
commit
fcfda20f2f
@ -36,6 +36,7 @@ DEF_HELPER_3(mulldo, i64, env, i64, i64)
|
||||
DEF_HELPER_FLAGS_1(cntlzw, TCG_CALL_NO_RWG_SE, tl, tl)
|
||||
DEF_HELPER_FLAGS_1(popcntb, TCG_CALL_NO_RWG_SE, tl, tl)
|
||||
DEF_HELPER_FLAGS_1(popcntw, TCG_CALL_NO_RWG_SE, tl, tl)
|
||||
DEF_HELPER_FLAGS_2(cmpb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
|
||||
DEF_HELPER_3(sraw, tl, env, tl, tl)
|
||||
#if defined(TARGET_PPC64)
|
||||
DEF_HELPER_FLAGS_1(cntlzd, TCG_CALL_NO_RWG_SE, tl, tl)
|
||||
|
@ -53,6 +53,21 @@ target_ulong helper_cntlzd(target_ulong t)
|
||||
}
|
||||
#endif
|
||||
|
||||
target_ulong helper_cmpb(target_ulong rs, target_ulong rb)
|
||||
{
|
||||
target_ulong mask = 0xff;
|
||||
target_ulong ra = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(target_ulong); i++) {
|
||||
if ((rs & mask) == (rb & mask)) {
|
||||
ra |= mask;
|
||||
}
|
||||
mask <<= 8;
|
||||
}
|
||||
return ra;
|
||||
}
|
||||
|
||||
/* shift right arithmetic helper */
|
||||
target_ulong helper_sraw(CPUPPCState *env, target_ulong value,
|
||||
target_ulong shift)
|
||||
|
@ -739,6 +739,13 @@ static void gen_isel(DisasContext *ctx)
|
||||
tcg_temp_free_i32(t0);
|
||||
}
|
||||
|
||||
/* cmpb: PowerPC 2.05 specification */
|
||||
static void gen_cmpb(DisasContext *ctx)
|
||||
{
|
||||
gen_helper_cmpb(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)],
|
||||
cpu_gpr[rB(ctx->opcode)]);
|
||||
}
|
||||
|
||||
/*** Integer arithmetic ***/
|
||||
|
||||
static inline void gen_op_arith_compute_ov(DisasContext *ctx, TCGv arg0,
|
||||
@ -8463,6 +8470,7 @@ GEN_HANDLER(cmp, 0x1F, 0x00, 0x00, 0x00400000, PPC_INTEGER),
|
||||
GEN_HANDLER(cmpi, 0x0B, 0xFF, 0xFF, 0x00400000, PPC_INTEGER),
|
||||
GEN_HANDLER(cmpl, 0x1F, 0x00, 0x01, 0x00400000, PPC_INTEGER),
|
||||
GEN_HANDLER(cmpli, 0x0A, 0xFF, 0xFF, 0x00400000, PPC_INTEGER),
|
||||
GEN_HANDLER_E(cmpb, 0x1F, 0x1C, 0x0F, 0x00000001, PPC_NONE, PPC2_ISA205),
|
||||
GEN_HANDLER(isel, 0x1F, 0x0F, 0xFF, 0x00000001, PPC_ISEL),
|
||||
GEN_HANDLER(addi, 0x0E, 0xFF, 0xFF, 0x00000000, PPC_INTEGER),
|
||||
GEN_HANDLER(addic, 0x0C, 0xFF, 0xFF, 0x00000000, PPC_INTEGER),
|
||||
|
Loading…
Reference in New Issue
Block a user