diff --git a/target-sparc/translate.c b/target-sparc/translate.c index 9d5230fa53c1a84f4da7e4c62511bfda86ce6097..44290637bce341b8d290c9fa33de581f28cd9ae7 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -2920,20 +2920,17 @@ static void disas_sparc_insn(DisasContext * dc) if (insn & (1 << 12)) { tcg_gen_shli_i64(cpu_dst, cpu_src1, rs2 & 0x3f); } else { - tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL); - tcg_gen_shli_i64(cpu_dst, cpu_dst, rs2 & 0x1f); + tcg_gen_shli_i64(cpu_dst, cpu_src1, rs2 & 0x1f); } } else { /* register */ rs2 = GET_FIELD(insn, 27, 31); gen_movl_reg_TN(rs2, cpu_src2); if (insn & (1 << 12)) { tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f); - tcg_gen_shl_i64(cpu_dst, cpu_src1, cpu_tmp0); } else { tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL); - tcg_gen_shl_i64(cpu_dst, cpu_dst, cpu_tmp0); } + tcg_gen_shl_i64(cpu_dst, cpu_src1, cpu_tmp0); } gen_movl_TN_reg(rd, cpu_dst); } else if (xop == 0x26) { /* srl, V9 srlx */ @@ -2979,6 +2976,7 @@ static void disas_sparc_insn(DisasContext * dc) } else { tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f); tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL); + tcg_gen_ext_i32_i64(cpu_dst, cpu_dst); tcg_gen_sar_i64(cpu_dst, cpu_dst, cpu_tmp0); } }