Commit 9b686843a0d88d78553aeea4cd1b976a58db1863

Authored by ths
1 parent 84774e8e

Fix truncate/extend reversal in MIPS DIV{, U} handling, by Richard Sandiford.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4620 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 8 additions and 8 deletions
target-mips/translate.c
... ... @@ -1906,12 +1906,12 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc,
1906 1906 TCGv r_tmp2 = new_tmp();
1907 1907 TCGv r_tmp3 = new_tmp();
1908 1908  
1909   - tcg_gen_ext_i32_tl(r_tmp1, cpu_T[0]);
1910   - tcg_gen_ext_i32_tl(r_tmp2, cpu_T[1]);
  1909 + tcg_gen_trunc_tl_i32(r_tmp1, cpu_T[0]);
  1910 + tcg_gen_trunc_tl_i32(r_tmp2, cpu_T[1]);
1911 1911 tcg_gen_div_i32(r_tmp3, r_tmp1, r_tmp2);
1912 1912 tcg_gen_rem_i32(r_tmp1, r_tmp1, r_tmp2);
1913   - tcg_gen_trunc_tl_i32(cpu_T[0], r_tmp3);
1914   - tcg_gen_trunc_tl_i32(cpu_T[1], r_tmp1);
  1913 + tcg_gen_ext_i32_tl(cpu_T[0], r_tmp3);
  1914 + tcg_gen_ext_i32_tl(cpu_T[1], r_tmp1);
1915 1915 gen_store_LO(cpu_T[0], 0);
1916 1916 gen_store_HI(cpu_T[1], 0);
1917 1917 dead_tmp(r_tmp1);
... ... @@ -1932,12 +1932,12 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc,
1932 1932 TCGv r_tmp2 = new_tmp();
1933 1933 TCGv r_tmp3 = new_tmp();
1934 1934  
1935   - tcg_gen_ext_i32_tl(r_tmp1, cpu_T[0]);
1936   - tcg_gen_ext_i32_tl(r_tmp2, cpu_T[1]);
  1935 + tcg_gen_trunc_tl_i32(r_tmp1, cpu_T[0]);
  1936 + tcg_gen_trunc_tl_i32(r_tmp2, cpu_T[1]);
1937 1937 tcg_gen_divu_i32(r_tmp3, r_tmp1, r_tmp2);
1938 1938 tcg_gen_remu_i32(r_tmp1, r_tmp1, r_tmp2);
1939   - tcg_gen_trunc_tl_i32(cpu_T[0], r_tmp3);
1940   - tcg_gen_trunc_tl_i32(cpu_T[1], r_tmp1);
  1939 + tcg_gen_ext_i32_tl(cpu_T[0], r_tmp3);
  1940 + tcg_gen_ext_i32_tl(cpu_T[1], r_tmp1);
1941 1941 gen_store_LO(cpu_T[0], 0);
1942 1942 gen_store_HI(cpu_T[1], 0);
1943 1943 dead_tmp(r_tmp1);
... ...