Commit 0523c6b7c5605e93b1c9960a3a91d08535e9a77e

Authored by bellard
1 parent 39c61f49

FORCE_RET() fixes - fpu fixes


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1236 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 29 additions and 21 deletions
target-i386/ops_sse.h
... ... @@ -61,6 +61,7 @@ void OPPROTO glue(op_psrlw, SUFFIX)(void)
61 61 d->W(7) >>= shift;
62 62 #endif
63 63 }
  64 + FORCE_RET();
64 65 }
65 66  
66 67 void OPPROTO glue(op_psraw, SUFFIX)(void)
... ... @@ -114,6 +115,7 @@ void OPPROTO glue(op_psllw, SUFFIX)(void)
114 115 d->W(7) <<= shift;
115 116 #endif
116 117 }
  118 + FORCE_RET();
117 119 }
118 120  
119 121 void OPPROTO glue(op_psrld, SUFFIX)(void)
... ... @@ -138,6 +140,7 @@ void OPPROTO glue(op_psrld, SUFFIX)(void)
138 140 d->L(3) >>= shift;
139 141 #endif
140 142 }
  143 + FORCE_RET();
141 144 }
142 145  
143 146 void OPPROTO glue(op_psrad, SUFFIX)(void)
... ... @@ -183,6 +186,7 @@ void OPPROTO glue(op_pslld, SUFFIX)(void)
183 186 d->L(3) <<= shift;
184 187 #endif
185 188 }
  189 + FORCE_RET();
186 190 }
187 191  
188 192 void OPPROTO glue(op_psrlq, SUFFIX)(void)
... ... @@ -205,6 +209,7 @@ void OPPROTO glue(op_psrlq, SUFFIX)(void)
205 209 d->Q(1) >>= shift;
206 210 #endif
207 211 }
  212 + FORCE_RET();
208 213 }
209 214  
210 215 void OPPROTO glue(op_psllq, SUFFIX)(void)
... ... @@ -227,6 +232,7 @@ void OPPROTO glue(op_psllq, SUFFIX)(void)
227 232 d->Q(1) <<= shift;
228 233 #endif
229 234 }
  235 + FORCE_RET();
230 236 }
231 237  
232 238 #if SHIFT == 1
... ... @@ -478,6 +484,7 @@ void OPPROTO glue(op_pmaddwd, SUFFIX) (void)
478 484 d->L(i) = (int16_t)s->W(2*i) * (int16_t)d->W(2*i) +
479 485 (int16_t)s->W(2*i+1) * (int16_t)d->W(2*i+1);
480 486 }
  487 + FORCE_RET();
481 488 }
482 489  
483 490 #if SHIFT == 0
... ... @@ -530,6 +537,7 @@ void OPPROTO glue(op_maskmov, SUFFIX) (void)
530 537 if (s->B(i) & 0x80)
531 538 stb(A0 + i, d->B(i));
532 539 }
  540 + FORCE_RET();
533 541 }
534 542  
535 543 void OPPROTO glue(op_movl_mm_T0, SUFFIX) (void)
... ... @@ -682,7 +690,7 @@ void OPPROTO op_ ## name ## sd (void)\
682 690 #define FPU_DIV(a, b) (a) / (b)
683 691 #define FPU_MIN(a, b) (a) < (b) ? (a) : (b)
684 692 #define FPU_MAX(a, b) (a) > (b) ? (a) : (b)
685   -#define FPU_SQRT(a, b) sqrt(b)
  693 +#define FPU_SQRT(a, b) helper_sqrt(b)
686 694  
687 695 SSE_OP_S(add, FPU_ADD)
688 696 SSE_OP_S(sub, FPU_SUB)
... ... @@ -702,8 +710,8 @@ void OPPROTO op_cvtps2pd(void)
702 710 s = (Reg *)((char *)env + PARAM2);
703 711 s0 = s->XMM_S(0);
704 712 s1 = s->XMM_S(1);
705   - d->XMM_D(0) = s0;
706   - d->XMM_D(1) = s1;
  713 + d->XMM_D(0) = float32_to_float64(s0);
  714 + d->XMM_D(1) = float32_to_float64(s1);
707 715 }
708 716  
709 717 void OPPROTO op_cvtpd2ps(void)
... ... @@ -711,8 +719,8 @@ void OPPROTO op_cvtpd2ps(void)
711 719 Reg *d, *s;
712 720 d = (Reg *)((char *)env + PARAM1);
713 721 s = (Reg *)((char *)env + PARAM2);
714   - d->XMM_S(0) = s->XMM_D(0);
715   - d->XMM_S(1) = s->XMM_D(1);
  722 + d->XMM_S(0) = float64_to_float32(s->XMM_D(0));
  723 + d->XMM_S(1) = float64_to_float32(s->XMM_D(1));
716 724 d->Q(1) = 0;
717 725 }
718 726  
... ... @@ -721,7 +729,7 @@ void OPPROTO op_cvtss2sd(void)
721 729 Reg *d, *s;
722 730 d = (Reg *)((char *)env + PARAM1);
723 731 s = (Reg *)((char *)env + PARAM2);
724   - d->XMM_D(0) = s->XMM_S(0);
  732 + d->XMM_D(0) = float32_to_float64(s->XMM_S(0));
725 733 }
726 734  
727 735 void OPPROTO op_cvtsd2ss(void)
... ... @@ -729,7 +737,7 @@ void OPPROTO op_cvtsd2ss(void)
729 737 Reg *d, *s;
730 738 d = (Reg *)((char *)env + PARAM1);
731 739 s = (Reg *)((char *)env + PARAM2);
732   - d->XMM_S(0) = s->XMM_D(0);
  740 + d->XMM_S(0) = float64_to_float32(s->XMM_D(0));
733 741 }
734 742  
735 743 /* integer to float */
... ... @@ -737,10 +745,10 @@ void OPPROTO op_cvtdq2ps(void)
737 745 {
738 746 XMMReg *d = (XMMReg *)((char *)env + PARAM1);
739 747 XMMReg *s = (XMMReg *)((char *)env + PARAM2);
740   - d->XMM_S(0) = (int32_t)s->XMM_L(0);
741   - d->XMM_S(1) = (int32_t)s->XMM_L(1);
742   - d->XMM_S(2) = (int32_t)s->XMM_L(2);
743   - d->XMM_S(3) = (int32_t)s->XMM_L(3);
  748 + d->XMM_S(0) = int32_to_float32(s->XMM_L(0));
  749 + d->XMM_S(1) = int32_to_float32(s->XMM_L(1));
  750 + d->XMM_S(2) = int32_to_float32(s->XMM_L(2));
  751 + d->XMM_S(3) = int32_to_float32(s->XMM_L(3));
744 752 }
745 753  
746 754 void OPPROTO op_cvtdq2pd(void)
... ... @@ -750,49 +758,49 @@ void OPPROTO op_cvtdq2pd(void)
750 758 int32_t l0, l1;
751 759 l0 = (int32_t)s->XMM_L(0);
752 760 l1 = (int32_t)s->XMM_L(1);
753   - d->XMM_D(0) = l0;
754   - d->XMM_D(1) = l1;
  761 + d->XMM_D(0) = int32_to_float64(l0);
  762 + d->XMM_D(1) = int32_to_float64(l1);
755 763 }
756 764  
757 765 void OPPROTO op_cvtpi2ps(void)
758 766 {
759 767 XMMReg *d = (Reg *)((char *)env + PARAM1);
760 768 MMXReg *s = (MMXReg *)((char *)env + PARAM2);
761   - d->XMM_S(0) = (int32_t)s->MMX_L(0);
762   - d->XMM_S(1) = (int32_t)s->MMX_L(1);
  769 + d->XMM_S(0) = int32_to_float32(s->MMX_L(0));
  770 + d->XMM_S(1) = int32_to_float32(s->MMX_L(1));
763 771 }
764 772  
765 773 void OPPROTO op_cvtpi2pd(void)
766 774 {
767 775 XMMReg *d = (Reg *)((char *)env + PARAM1);
768 776 MMXReg *s = (MMXReg *)((char *)env + PARAM2);
769   - d->XMM_D(0) = (int32_t)s->MMX_L(0);
770   - d->XMM_D(1) = (int32_t)s->MMX_L(1);
  777 + d->XMM_D(0) = int32_to_float64(s->MMX_L(0));
  778 + d->XMM_D(1) = int32_to_float64(s->MMX_L(1));
771 779 }
772 780  
773 781 void OPPROTO op_cvtsi2ss(void)
774 782 {
775 783 XMMReg *d = (Reg *)((char *)env + PARAM1);
776   - d->XMM_S(0) = (int32_t)T0;
  784 + d->XMM_S(0) = int32_to_float32(T0);
777 785 }
778 786  
779 787 void OPPROTO op_cvtsi2sd(void)
780 788 {
781 789 XMMReg *d = (Reg *)((char *)env + PARAM1);
782   - d->XMM_D(0) = (int32_t)T0;
  790 + d->XMM_D(0) = int32_to_float64(T0);
783 791 }
784 792  
785 793 #ifdef TARGET_X86_64
786 794 void OPPROTO op_cvtsq2ss(void)
787 795 {
788 796 XMMReg *d = (Reg *)((char *)env + PARAM1);
789   - d->XMM_S(0) = (int64_t)T0;
  797 + d->XMM_S(0) = int64_to_float32(T0);
790 798 }
791 799  
792 800 void OPPROTO op_cvtsq2sd(void)
793 801 {
794 802 XMMReg *d = (Reg *)((char *)env + PARAM1);
795   - d->XMM_D(0) = (int64_t)T0;
  803 + d->XMM_D(0) = int64_to_float64(T0);
796 804 }
797 805 #endif
798 806  
... ...