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

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

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

revision 1.43 by bellard, Thu Mar 3 01:14:55 2005 UTC revision 1.44 by bellard, Sun Mar 13 16:59:53 2005 UTC
# Line 2541  void helper_fbld_ST0_A0(void) Line 2541  void helper_fbld_ST0_A0(void)
2541    
2542  void helper_fbst_ST0_A0(void)  void helper_fbst_ST0_A0(void)
2543  {  {
     CPU86_LDouble tmp;  
2544      int v;      int v;
2545      target_ulong mem_ref, mem_end;      target_ulong mem_ref, mem_end;
2546      int64_t val;      int64_t val;
2547    
2548      tmp = rint(ST0);      val = floatx_to_int64(ST0, &env->fp_status);
     val = (int64_t)tmp;  
2549      mem_ref = A0;      mem_ref = A0;
2550      mem_end = mem_ref + 9;      mem_end = mem_ref + 9;
2551      if (val < 0) {      if (val < 0) {
# Line 2740  void helper_fsincos(void) Line 2738  void helper_fsincos(void)
2738    
2739  void helper_frndint(void)  void helper_frndint(void)
2740  {  {
2741      CPU86_LDouble a;      ST0 = floatx_round_to_int(ST0, &env->fp_status);
   
     a = ST0;  
 #ifdef __arm__  
     switch(env->fpuc & RC_MASK) {  
     default:  
     case RC_NEAR:  
         asm("rndd %0, %1" : "=f" (a) : "f"(a));  
         break;  
     case RC_DOWN:  
         asm("rnddm %0, %1" : "=f" (a) : "f"(a));  
         break;  
     case RC_UP:  
         asm("rnddp %0, %1" : "=f" (a) : "f"(a));  
         break;  
     case RC_CHOP:  
         asm("rnddz %0, %1" : "=f" (a) : "f"(a));  
         break;  
     }  
 #else  
     a = rint(a);  
 #endif  
     ST0 = a;  
2742  }  }
2743    
2744  void helper_fscale(void)  void helper_fscale(void)
# Line 3263  float approx_rcp(float a) Line 3239  float approx_rcp(float a)
3239      return 1.0 / a;      return 1.0 / a;
3240  }  }
3241    
3242  /* XXX: find a better solution */  void update_fp_status(void)
 double helper_sqrt(double a)  
3243  {  {
3244      return sqrt(a);      int rnd_type;
 }  
   
 /* XXX: move that to another file */  
 #if defined(__powerpc__)  
 /* better to call an helper on ppc */  
 float int32_to_float32(int32_t a)  
 {  
     return (float)a;  
 }  
3245    
3246  double int32_to_float64(int32_t a)      /* set rounding mode */
3247  {      switch(env->fpuc & RC_MASK) {
3248      return (double)a;      default:
3249  }      case RC_NEAR:
3250            rnd_type = float_round_nearest_even;
3251            break;
3252        case RC_DOWN:
3253            rnd_type = float_round_down;
3254            break;
3255        case RC_UP:
3256            rnd_type = float_round_up;
3257            break;
3258        case RC_CHOP:
3259            rnd_type = float_round_to_zero;
3260            break;
3261        }
3262        set_float_rounding_mode(rnd_type, &env->fp_status);
3263    #ifdef FLOATX80
3264        switch((env->fpuc >> 8) & 3) {
3265        case 0:
3266            rnd_type = 32;
3267            break;
3268        case 2:
3269            rnd_type = 64;
3270            break;
3271        case 3:
3272        default:
3273            rnd_type = 80;
3274            break;
3275        }
3276        set_floatx80_rounding_precision(rnd_type, &env->fp_status);
3277  #endif  #endif
3278    }
3279    
3280  #if !defined(CONFIG_USER_ONLY)  #if !defined(CONFIG_USER_ONLY)
3281    

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44

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