Update the environment carry variable in the helper. Signed-off-by: Nikunj A Dadhania <nik...@linux.vnet.ibm.com> --- target/ppc/int_helper.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index b376860..d7af671 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -37,6 +37,11 @@ static inline void helper_update_ov_legacy(CPUPPCState *env, int ov) } } +static inline void helper_update_ca(CPUPPCState *env, int ca) +{ + env->ca = ca; +} + target_ulong helper_divweu(CPUPPCState *env, target_ulong ra, target_ulong rb, uint32_t oe) { @@ -213,24 +218,26 @@ target_ulong helper_sraw(CPUPPCState *env, target_ulong value, target_ulong shift) { int32_t ret; + int ca; if (likely(!(shift & 0x20))) { if (likely((uint32_t)shift != 0)) { shift &= 0x1f; ret = (int32_t)value >> shift; if (likely(ret >= 0 || (value & ((1 << shift) - 1)) == 0)) { - env->ca = 0; + ca = 0; } else { - env->ca = 1; + ca = 1; } } else { ret = (int32_t)value; - env->ca = 0; + ca = 0; } } else { ret = (int32_t)value >> 31; - env->ca = (ret != 0); + ca = (ret != 0); } + helper_update_ca(env, ca); return (target_long)ret; } @@ -239,24 +246,26 @@ target_ulong helper_srad(CPUPPCState *env, target_ulong value, target_ulong shift) { int64_t ret; + int ca; if (likely(!(shift & 0x40))) { if (likely((uint64_t)shift != 0)) { shift &= 0x3f; ret = (int64_t)value >> shift; if (likely(ret >= 0 || (value & ((1ULL << shift) - 1)) == 0)) { - env->ca = 0; + ca = 0; } else { - env->ca = 1; + ca = 1; } } else { ret = (int64_t)value; - env->ca = 0; + ca = 0; } } else { ret = (int64_t)value >> 63; - env->ca = (ret != 0); + ca = (ret != 0); } + helper_update_ca(env, ca); return ret; } #endif -- 2.7.4