/[qemu]/qemu/target-i386/op.c
ViewVC logotype

Diff of /qemu/target-i386/op.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.34 by bellard, Sun Mar 13 09:52:09 2005 UTC revision 1.35 by bellard, Sun Mar 13 16:59:53 2005 UTC
# Line 1598  CCTable cc_table[CC_OP_NB] = { Line 1598  CCTable cc_table[CC_OP_NB] = {
1598     functions comes from the LGPL'ed x86 emulator found in the Willows     functions comes from the LGPL'ed x86 emulator found in the Willows
1599     TWIN windows emulator. */     TWIN windows emulator. */
1600    
 #if defined(__powerpc__)  
 extern CPU86_LDouble copysign(CPU86_LDouble, CPU86_LDouble);  
   
 /* correct (but slow) PowerPC rint() (glibc version is incorrect) */  
 double qemu_rint(double x)  
 {  
     double y = 4503599627370496.0;  
     if (fabs(x) >= y)  
         return x;  
     if (x < 0)  
         y = -y;  
     y = (x + y) - y;  
     if (y == 0.0)  
         y = copysign(y, x);  
     return y;  
 }  
   
 #define rint qemu_rint  
 #endif  
   
1601  /* fp load FT0 */  /* fp load FT0 */
1602    
1603  void OPPROTO op_flds_FT0_A0(void)  void OPPROTO op_flds_FT0_A0(void)
# Line 1866  void OPPROTO op_fist_ST0_A0(void) Line 1846  void OPPROTO op_fist_ST0_A0(void)
1846      int val;      int val;
1847    
1848      d = ST0;      d = ST0;
1849      val = lrint(d);      val = floatx_to_int32(d, &env->fp_status);
1850      if (val != (int16_t)val)      if (val != (int16_t)val)
1851          val = -32768;          val = -32768;
1852      stw(A0, val);      stw(A0, val);
# Line 1883  void OPPROTO op_fistl_ST0_A0(void) Line 1863  void OPPROTO op_fistl_ST0_A0(void)
1863      int val;      int val;
1864    
1865      d = ST0;      d = ST0;
1866      val = lrint(d);      val = floatx_to_int32(d, &env->fp_status);
1867      stl(A0, val);      stl(A0, val);
1868      FORCE_RET();      FORCE_RET();
1869  }  }
# Line 1898  void OPPROTO op_fistll_ST0_A0(void) Line 1878  void OPPROTO op_fistll_ST0_A0(void)
1878      int64_t val;      int64_t val;
1879    
1880      d = ST0;      d = ST0;
1881      val = llrint(d);      val = floatx_to_int64(d, &env->fp_status);
1882      stq(A0, val);      stq(A0, val);
1883      FORCE_RET();      FORCE_RET();
1884  }  }
# Line 2101  void OPPROTO op_fdivr_STN_ST0(void) Line 2081  void OPPROTO op_fdivr_STN_ST0(void)
2081  /* misc FPU operations */  /* misc FPU operations */
2082  void OPPROTO op_fchs_ST0(void)  void OPPROTO op_fchs_ST0(void)
2083  {  {
2084      ST0 = -ST0;      ST0 = floatx_chs(ST0);
2085  }  }
2086    
2087  void OPPROTO op_fabs_ST0(void)  void OPPROTO op_fabs_ST0(void)
2088  {  {
2089      ST0 = fabs(ST0);      ST0 = floatx_abs(ST0);
2090  }  }
2091    
2092  void OPPROTO op_fxam_ST0(void)  void OPPROTO op_fxam_ST0(void)
# Line 2251  void OPPROTO op_fnstcw_A0(void) Line 2231  void OPPROTO op_fnstcw_A0(void)
2231    
2232  void OPPROTO op_fldcw_A0(void)  void OPPROTO op_fldcw_A0(void)
2233  {  {
     int rnd_type;  
2234      env->fpuc = lduw(A0);      env->fpuc = lduw(A0);
2235      /* set rounding mode */      update_fp_status();
     switch(env->fpuc & RC_MASK) {  
     default:  
     case RC_NEAR:  
         rnd_type = FE_TONEAREST;  
         break;  
     case RC_DOWN:  
         rnd_type = FE_DOWNWARD;  
         break;  
     case RC_UP:  
         rnd_type = FE_UPWARD;  
         break;  
     case RC_CHOP:  
         rnd_type = FE_TOWARDZERO;  
         break;  
     }  
     fesetround(rnd_type);  
2236  }  }
2237    
2238  void OPPROTO op_fclex(void)  void OPPROTO op_fclex(void)

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26