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,6 +61,7 @@ void OPPROTO glue(op_psrlw, SUFFIX)(void)
61 d->W(7) >>= shift; 61 d->W(7) >>= shift;
62 #endif 62 #endif
63 } 63 }
  64 + FORCE_RET();
64 } 65 }
65 66
66 void OPPROTO glue(op_psraw, SUFFIX)(void) 67 void OPPROTO glue(op_psraw, SUFFIX)(void)
@@ -114,6 +115,7 @@ void OPPROTO glue(op_psllw, SUFFIX)(void) @@ -114,6 +115,7 @@ void OPPROTO glue(op_psllw, SUFFIX)(void)
114 d->W(7) <<= shift; 115 d->W(7) <<= shift;
115 #endif 116 #endif
116 } 117 }
  118 + FORCE_RET();
117 } 119 }
118 120
119 void OPPROTO glue(op_psrld, SUFFIX)(void) 121 void OPPROTO glue(op_psrld, SUFFIX)(void)
@@ -138,6 +140,7 @@ void OPPROTO glue(op_psrld, SUFFIX)(void) @@ -138,6 +140,7 @@ void OPPROTO glue(op_psrld, SUFFIX)(void)
138 d->L(3) >>= shift; 140 d->L(3) >>= shift;
139 #endif 141 #endif
140 } 142 }
  143 + FORCE_RET();
141 } 144 }
142 145
143 void OPPROTO glue(op_psrad, SUFFIX)(void) 146 void OPPROTO glue(op_psrad, SUFFIX)(void)
@@ -183,6 +186,7 @@ void OPPROTO glue(op_pslld, SUFFIX)(void) @@ -183,6 +186,7 @@ void OPPROTO glue(op_pslld, SUFFIX)(void)
183 d->L(3) <<= shift; 186 d->L(3) <<= shift;
184 #endif 187 #endif
185 } 188 }
  189 + FORCE_RET();
186 } 190 }
187 191
188 void OPPROTO glue(op_psrlq, SUFFIX)(void) 192 void OPPROTO glue(op_psrlq, SUFFIX)(void)
@@ -205,6 +209,7 @@ void OPPROTO glue(op_psrlq, SUFFIX)(void) @@ -205,6 +209,7 @@ void OPPROTO glue(op_psrlq, SUFFIX)(void)
205 d->Q(1) >>= shift; 209 d->Q(1) >>= shift;
206 #endif 210 #endif
207 } 211 }
  212 + FORCE_RET();
208 } 213 }
209 214
210 void OPPROTO glue(op_psllq, SUFFIX)(void) 215 void OPPROTO glue(op_psllq, SUFFIX)(void)
@@ -227,6 +232,7 @@ void OPPROTO glue(op_psllq, SUFFIX)(void) @@ -227,6 +232,7 @@ void OPPROTO glue(op_psllq, SUFFIX)(void)
227 d->Q(1) <<= shift; 232 d->Q(1) <<= shift;
228 #endif 233 #endif
229 } 234 }
  235 + FORCE_RET();
230 } 236 }
231 237
232 #if SHIFT == 1 238 #if SHIFT == 1
@@ -478,6 +484,7 @@ void OPPROTO glue(op_pmaddwd, SUFFIX) (void) @@ -478,6 +484,7 @@ void OPPROTO glue(op_pmaddwd, SUFFIX) (void)
478 d->L(i) = (int16_t)s->W(2*i) * (int16_t)d->W(2*i) + 484 d->L(i) = (int16_t)s->W(2*i) * (int16_t)d->W(2*i) +
479 (int16_t)s->W(2*i+1) * (int16_t)d->W(2*i+1); 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 #if SHIFT == 0 490 #if SHIFT == 0
@@ -530,6 +537,7 @@ void OPPROTO glue(op_maskmov, SUFFIX) (void) @@ -530,6 +537,7 @@ void OPPROTO glue(op_maskmov, SUFFIX) (void)
530 if (s->B(i) & 0x80) 537 if (s->B(i) & 0x80)
531 stb(A0 + i, d->B(i)); 538 stb(A0 + i, d->B(i));
532 } 539 }
  540 + FORCE_RET();
533 } 541 }
534 542
535 void OPPROTO glue(op_movl_mm_T0, SUFFIX) (void) 543 void OPPROTO glue(op_movl_mm_T0, SUFFIX) (void)
@@ -682,7 +690,7 @@ void OPPROTO op_ ## name ## sd (void)\ @@ -682,7 +690,7 @@ void OPPROTO op_ ## name ## sd (void)\
682 #define FPU_DIV(a, b) (a) / (b) 690 #define FPU_DIV(a, b) (a) / (b)
683 #define FPU_MIN(a, b) (a) < (b) ? (a) : (b) 691 #define FPU_MIN(a, b) (a) < (b) ? (a) : (b)
684 #define FPU_MAX(a, b) (a) > (b) ? (a) : (b) 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 SSE_OP_S(add, FPU_ADD) 695 SSE_OP_S(add, FPU_ADD)
688 SSE_OP_S(sub, FPU_SUB) 696 SSE_OP_S(sub, FPU_SUB)
@@ -702,8 +710,8 @@ void OPPROTO op_cvtps2pd(void) @@ -702,8 +710,8 @@ void OPPROTO op_cvtps2pd(void)
702 s = (Reg *)((char *)env + PARAM2); 710 s = (Reg *)((char *)env + PARAM2);
703 s0 = s->XMM_S(0); 711 s0 = s->XMM_S(0);
704 s1 = s->XMM_S(1); 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 void OPPROTO op_cvtpd2ps(void) 717 void OPPROTO op_cvtpd2ps(void)
@@ -711,8 +719,8 @@ void OPPROTO op_cvtpd2ps(void) @@ -711,8 +719,8 @@ void OPPROTO op_cvtpd2ps(void)
711 Reg *d, *s; 719 Reg *d, *s;
712 d = (Reg *)((char *)env + PARAM1); 720 d = (Reg *)((char *)env + PARAM1);
713 s = (Reg *)((char *)env + PARAM2); 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 d->Q(1) = 0; 724 d->Q(1) = 0;
717 } 725 }
718 726
@@ -721,7 +729,7 @@ void OPPROTO op_cvtss2sd(void) @@ -721,7 +729,7 @@ void OPPROTO op_cvtss2sd(void)
721 Reg *d, *s; 729 Reg *d, *s;
722 d = (Reg *)((char *)env + PARAM1); 730 d = (Reg *)((char *)env + PARAM1);
723 s = (Reg *)((char *)env + PARAM2); 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 void OPPROTO op_cvtsd2ss(void) 735 void OPPROTO op_cvtsd2ss(void)
@@ -729,7 +737,7 @@ void OPPROTO op_cvtsd2ss(void) @@ -729,7 +737,7 @@ void OPPROTO op_cvtsd2ss(void)
729 Reg *d, *s; 737 Reg *d, *s;
730 d = (Reg *)((char *)env + PARAM1); 738 d = (Reg *)((char *)env + PARAM1);
731 s = (Reg *)((char *)env + PARAM2); 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 /* integer to float */ 743 /* integer to float */
@@ -737,10 +745,10 @@ void OPPROTO op_cvtdq2ps(void) @@ -737,10 +745,10 @@ void OPPROTO op_cvtdq2ps(void)
737 { 745 {
738 XMMReg *d = (XMMReg *)((char *)env + PARAM1); 746 XMMReg *d = (XMMReg *)((char *)env + PARAM1);
739 XMMReg *s = (XMMReg *)((char *)env + PARAM2); 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 void OPPROTO op_cvtdq2pd(void) 754 void OPPROTO op_cvtdq2pd(void)
@@ -750,49 +758,49 @@ void OPPROTO op_cvtdq2pd(void) @@ -750,49 +758,49 @@ void OPPROTO op_cvtdq2pd(void)
750 int32_t l0, l1; 758 int32_t l0, l1;
751 l0 = (int32_t)s->XMM_L(0); 759 l0 = (int32_t)s->XMM_L(0);
752 l1 = (int32_t)s->XMM_L(1); 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 void OPPROTO op_cvtpi2ps(void) 765 void OPPROTO op_cvtpi2ps(void)
758 { 766 {
759 XMMReg *d = (Reg *)((char *)env + PARAM1); 767 XMMReg *d = (Reg *)((char *)env + PARAM1);
760 MMXReg *s = (MMXReg *)((char *)env + PARAM2); 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 void OPPROTO op_cvtpi2pd(void) 773 void OPPROTO op_cvtpi2pd(void)
766 { 774 {
767 XMMReg *d = (Reg *)((char *)env + PARAM1); 775 XMMReg *d = (Reg *)((char *)env + PARAM1);
768 MMXReg *s = (MMXReg *)((char *)env + PARAM2); 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 void OPPROTO op_cvtsi2ss(void) 781 void OPPROTO op_cvtsi2ss(void)
774 { 782 {
775 XMMReg *d = (Reg *)((char *)env + PARAM1); 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 void OPPROTO op_cvtsi2sd(void) 787 void OPPROTO op_cvtsi2sd(void)
780 { 788 {
781 XMMReg *d = (Reg *)((char *)env + PARAM1); 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 #ifdef TARGET_X86_64 793 #ifdef TARGET_X86_64
786 void OPPROTO op_cvtsq2ss(void) 794 void OPPROTO op_cvtsq2ss(void)
787 { 795 {
788 XMMReg *d = (Reg *)((char *)env + PARAM1); 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 void OPPROTO op_cvtsq2sd(void) 800 void OPPROTO op_cvtsq2sd(void)
793 { 801 {
794 XMMReg *d = (Reg *)((char *)env + PARAM1); 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 #endif 805 #endif
798 806