Commit 7127fe84e70487a8ffd9840391ce735a49541f8f

Authored by blueswir1
1 parent af896aaa

Fix mulscc


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4103 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 7 deletions
target-sparc/translate.c
... ... @@ -751,21 +751,22 @@ static inline void gen_op_tsub_T1_T0_ccTV(void)
751 751  
752 752 static inline void gen_op_mulscc_T1_T0(void)
753 753 {
754   - TCGv r_temp;
  754 + TCGv r_temp, r_temp2;
755 755 int l1, l2;
756 756  
757 757 l1 = gen_new_label();
758 758 l2 = gen_new_label();
759 759 r_temp = tcg_temp_new(TCG_TYPE_TL);
  760 + r_temp2 = tcg_temp_new(TCG_TYPE_I32);
760 761  
761 762 /* old op:
762 763 if (!(env->y & 1))
763 764 T1 = 0;
764 765 */
765   - tcg_gen_ld_i32(cpu_tmp32, cpu_env, offsetof(CPUSPARCState, y));
766   - tcg_gen_extu_i32_tl(r_temp, cpu_tmp32);
767   - tcg_gen_andi_tl(r_temp, r_temp, 0x1);
768   - tcg_gen_brcond_tl(TCG_COND_EQ, r_temp, tcg_const_tl(0), l1);
  766 + tcg_gen_ld32u_tl(r_temp, cpu_env, offsetof(CPUSPARCState, y));
  767 + tcg_gen_trunc_tl_i32(r_temp2, r_temp);
  768 + tcg_gen_andi_i32(r_temp2, r_temp2, 0x1);
  769 + tcg_gen_brcond_i32(TCG_COND_EQ, r_temp2, tcg_const_i32(0), l1);
769 770 tcg_gen_mov_tl(cpu_cc_src2, cpu_T[1]);
770 771 tcg_gen_br(l2);
771 772 gen_set_label(l1);
... ... @@ -774,10 +775,12 @@ static inline void gen_op_mulscc_T1_T0(void)
774 775  
775 776 // b2 = T0 & 1;
776 777 // env->y = (b2 << 31) | (env->y >> 1);
777   - tcg_gen_shli_tl(r_temp, cpu_T[0], 31);
  778 + tcg_gen_trunc_tl_i32(r_temp2, cpu_T[0]);
  779 + tcg_gen_andi_i32(r_temp2, r_temp2, 0x1);
  780 + tcg_gen_shli_i32(r_temp2, r_temp2, 31);
778 781 tcg_gen_ld_i32(cpu_tmp32, cpu_env, offsetof(CPUSPARCState, y));
779 782 tcg_gen_shri_i32(cpu_tmp32, cpu_tmp32, 1);
780   - tcg_gen_or_i32(cpu_tmp32, cpu_tmp32, r_temp);
  783 + tcg_gen_or_i32(cpu_tmp32, cpu_tmp32, r_temp2);
781 784 tcg_gen_st_i32(cpu_tmp32, cpu_env, offsetof(CPUSPARCState, y));
782 785  
783 786 // b1 = N ^ V;
... ...