diff --git a/qemu/fpu/softfloat.c b/qemu/fpu/softfloat.c index 2792012b..c9b1785b 100644 --- a/qemu/fpu/softfloat.c +++ b/qemu/fpu/softfloat.c @@ -1220,7 +1220,7 @@ float64 int32_to_float64(int32_t a STATUS_PARAM) if ( a == 0 ) return float64_zero; zSign = ( a < 0 ); - absA = (zSign & (a != 0x80000000)) ? - a : a; + absA = (zSign && (a != 0x80000000)) ? - a : a; shiftCount = countLeadingZeros32( absA ) + 21; zSig = absA; return packFloat64( zSign, 0x432 - shiftCount, zSig<> shift) & mask; + return (src >> (shift & 0x3f)) & mask; } void helper_extrq_r(CPUX86State *env, XMMReg *d, XMMReg *s) diff --git a/qemu/target-mips/translate.c b/qemu/target-mips/translate.c index 8f54ca55..93812760 100644 --- a/qemu/target-mips/translate.c +++ b/qemu/target-mips/translate.c @@ -8505,7 +8505,7 @@ static void gen_movci (DisasContext *ctx, int rd, int rs, int cc, int tf) l1 = gen_new_label(tcg_ctx); t0 = tcg_temp_new_i32(tcg_ctx); - tcg_gen_andi_i32(tcg_ctx, t0, tcg_ctx->fpu_fcr31, 1U << get_fp_bit(cc)); + tcg_gen_andi_i32(tcg_ctx, t0, tcg_ctx->fpu_fcr31, 1U << (get_fp_bit(cc) & 0x1f)); tcg_gen_brcondi_i32(tcg_ctx, cond, t0, 0, l1); tcg_temp_free_i32(tcg_ctx, t0); if (rs == 0) { @@ -8528,7 +8528,7 @@ static inline void gen_movcf_s (DisasContext *ctx, int fs, int fd, int cc, int t else cond = TCG_COND_NE; - tcg_gen_andi_i32(tcg_ctx, t0, tcg_ctx->fpu_fcr31, 1U << get_fp_bit(cc)); + tcg_gen_andi_i32(tcg_ctx, t0, tcg_ctx->fpu_fcr31, 1U << (get_fp_bit(cc) & 0x1f)); tcg_gen_brcondi_i32(tcg_ctx, cond, t0, 0, l1); gen_load_fpr32(ctx, t0, fs); gen_store_fpr32(ctx, t0, fd); @@ -8549,7 +8549,7 @@ static inline void gen_movcf_d (DisasContext *ctx, int fs, int fd, int cc, int t else cond = TCG_COND_NE; - tcg_gen_andi_i32(tcg_ctx, t0, tcg_ctx->fpu_fcr31, 1U << get_fp_bit(cc)); + tcg_gen_andi_i32(tcg_ctx, t0, tcg_ctx->fpu_fcr31, 1U << (get_fp_bit(cc) & 0x1f)); tcg_gen_brcondi_i32(tcg_ctx, cond, t0, 0, l1); tcg_temp_free_i32(tcg_ctx, t0); fp0 = tcg_temp_new_i64(tcg_ctx); @@ -8573,13 +8573,13 @@ static inline void gen_movcf_ps(DisasContext *ctx, int fs, int fd, else cond = TCG_COND_NE; - tcg_gen_andi_i32(tcg_ctx, t0, tcg_ctx->fpu_fcr31, 1U << get_fp_bit(cc)); + tcg_gen_andi_i32(tcg_ctx, t0, tcg_ctx->fpu_fcr31, 1U << (get_fp_bit(cc) & 0x1f)); tcg_gen_brcondi_i32(tcg_ctx, cond, t0, 0, l1); gen_load_fpr32(ctx, t0, fs); gen_store_fpr32(ctx, t0, fd); gen_set_label(tcg_ctx, l1); - tcg_gen_andi_i32(tcg_ctx, t0, tcg_ctx->fpu_fcr31, 1U << get_fp_bit(cc+1)); + tcg_gen_andi_i32(tcg_ctx, t0, tcg_ctx->fpu_fcr31, 1U << (get_fp_bit(cc+1) & 0x1f)); tcg_gen_brcondi_i32(tcg_ctx, cond, t0, 0, l2); gen_load_fpr32h(ctx, t0, fs); gen_store_fpr32h(ctx, t0, fd); diff --git a/qemu/target-sparc/helper.c b/qemu/target-sparc/helper.c index 8f60d0ae..e4ae5d40 100644 --- a/qemu/target-sparc/helper.c +++ b/qemu/target-sparc/helper.c @@ -116,7 +116,7 @@ static target_ulong helper_sdiv_common(CPUSPARCState *env, target_ulong a, int64_t x0; int32_t x1; - x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32); + x0 = (a & 0xffffffff) | ((uint64_t) (env->y) << 32); x1 = (b & 0xffffffff); if (x1 == 0) {