Commit b991c385198e545c39a7e1a69a476542c92f16f0

Authored by blueswir1
1 parent e55fd934

Fix sign extension problems with smul and umul (Vince Weaver)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5138 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 4 deletions
target-sparc/translate.c
@@ -769,8 +769,8 @@ static inline void gen_op_umul(TCGv dst, TCGv src1, TCGv src2) @@ -769,8 +769,8 @@ static inline void gen_op_umul(TCGv dst, TCGv src1, TCGv src2)
769 r_temp = tcg_temp_new(TCG_TYPE_I64); 769 r_temp = tcg_temp_new(TCG_TYPE_I64);
770 r_temp2 = tcg_temp_new(TCG_TYPE_I64); 770 r_temp2 = tcg_temp_new(TCG_TYPE_I64);
771 771
772 - tcg_gen_extu_tl_i64(r_temp, src2);  
773 - tcg_gen_extu_tl_i64(r_temp2, src1); 772 + tcg_gen_extu_i32_i64(r_temp, src2);
  773 + tcg_gen_extu_i32_i64(r_temp2, src1);
774 tcg_gen_mul_i64(r_temp2, r_temp, r_temp2); 774 tcg_gen_mul_i64(r_temp2, r_temp, r_temp2);
775 775
776 tcg_gen_shri_i64(r_temp, r_temp2, 32); 776 tcg_gen_shri_i64(r_temp, r_temp2, 32);
@@ -793,8 +793,8 @@ static inline void gen_op_smul(TCGv dst, TCGv src1, TCGv src2) @@ -793,8 +793,8 @@ static inline void gen_op_smul(TCGv dst, TCGv src1, TCGv src2)
793 r_temp = tcg_temp_new(TCG_TYPE_I64); 793 r_temp = tcg_temp_new(TCG_TYPE_I64);
794 r_temp2 = tcg_temp_new(TCG_TYPE_I64); 794 r_temp2 = tcg_temp_new(TCG_TYPE_I64);
795 795
796 - tcg_gen_ext_tl_i64(r_temp, src2);  
797 - tcg_gen_ext_tl_i64(r_temp2, src1); 796 + tcg_gen_ext_i32_i64(r_temp, src2);
  797 + tcg_gen_ext_i32_i64(r_temp2, src1);
798 tcg_gen_mul_i64(r_temp2, r_temp, r_temp2); 798 tcg_gen_mul_i64(r_temp2, r_temp, r_temp2);
799 799
800 tcg_gen_shri_i64(r_temp, r_temp2, 32); 800 tcg_gen_shri_i64(r_temp, r_temp2, 32);