Fix Sparc64 shifts

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4990 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
blueswir1 2008-08-06 18:13:54 +00:00
parent ae6b5e5afd
commit 01b1fa6d16

View File

@ -2920,20 +2920,17 @@ static void disas_sparc_insn(DisasContext * dc)
if (insn & (1 << 12)) { if (insn & (1 << 12)) {
tcg_gen_shli_i64(cpu_dst, cpu_src1, rs2 & 0x3f); tcg_gen_shli_i64(cpu_dst, cpu_src1, rs2 & 0x3f);
} else { } else {
tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL); tcg_gen_shli_i64(cpu_dst, cpu_src1, rs2 & 0x1f);
tcg_gen_shli_i64(cpu_dst, cpu_dst, rs2 & 0x1f);
} }
} else { /* register */ } else { /* register */
rs2 = GET_FIELD(insn, 27, 31); rs2 = GET_FIELD(insn, 27, 31);
gen_movl_reg_TN(rs2, cpu_src2); gen_movl_reg_TN(rs2, cpu_src2);
if (insn & (1 << 12)) { if (insn & (1 << 12)) {
tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f); tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f);
tcg_gen_shl_i64(cpu_dst, cpu_src1, cpu_tmp0);
} else { } else {
tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f); 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); gen_movl_TN_reg(rd, cpu_dst);
} else if (xop == 0x26) { /* srl, V9 srlx */ } else if (xop == 0x26) { /* srl, V9 srlx */
@ -2979,6 +2976,7 @@ static void disas_sparc_insn(DisasContext * dc)
} else { } else {
tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f); tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f);
tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL); 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); tcg_gen_sar_i64(cpu_dst, cpu_dst, cpu_tmp0);
} }
} }