Revision 1f1af9fd

b/target-i386/cpu.h
408 408
#endif
409 409
}
410 410

  
411
/* used for debug or cpu save/restore */
412
void cpu_get_fp80(uint64_t *pmant, uint16_t *pexp, CPU86_LDouble f);
413
CPU86_LDouble cpu_set_fp80(uint64_t mant, uint16_t upper);
414

  
411 415
/* the following helpers are only usable in user mode simulation as
412 416
   they can trigger unexpected exceptions */
413 417
void cpu_x86_load_seg(CPUX86State *s, int seg_reg, int selector);
b/target-i386/helper.c
2005 2005

  
2006 2006
/* BCD ops */
2007 2007

  
2008
#define MUL10(iv) ( iv + iv + (iv << 3) )
2009

  
2010 2008
void helper_fbld_ST0_A0(void)
2011 2009
{
2012 2010
    CPU86_LDouble tmp;
......
2431 2429
    }
2432 2430
}
2433 2431

  
2432
/* XXX: merge with helper_fstt ? */
2433

  
2434
#ifndef USE_X86LDOUBLE
2435

  
2436
void cpu_get_fp80(uint64_t *pmant, uint16_t *pexp, CPU86_LDouble f)
2437
{
2438
    CPU86_LDoubleU temp;
2439
    int e;
2440

  
2441
    temp.d = f;
2442
    /* mantissa */
2443
    *pmant = (MANTD(temp) << 11) | (1LL << 63);
2444
    /* exponent + sign */
2445
    e = EXPD(temp) - EXPBIAS + 16383;
2446
    e |= SIGND(temp) >> 16;
2447
    *pexp = e;
2448
}
2449

  
2450
CPU86_LDouble cpu_set_fp80(uint64_t mant, uint16_t upper)
2451
{
2452
    CPU86_LDoubleU temp;
2453
    int e;
2454
    uint64_t ll;
2455

  
2456
    /* XXX: handle overflow ? */
2457
    e = (upper & 0x7fff) - 16383 + EXPBIAS; /* exponent */
2458
    e |= (upper >> 4) & 0x800; /* sign */
2459
    ll = (mant >> 11) & ((1LL << 52) - 1);
2460
#ifdef __arm__
2461
    temp.l.upper = (e << 20) | (ll >> 32);
2462
    temp.l.lower = ll;
2463
#else
2464
    temp.ll = ll | ((uint64_t)e << 52);
2465
#endif
2466
    return temp.d;
2467
}
2468

  
2469
#else
2470

  
2471
void cpu_get_fp80(uint64_t *pmant, uint16_t *pexp, CPU86_LDouble f)
2472
{
2473
    CPU86_LDoubleU temp;
2474

  
2475
    temp.d = f;
2476
    *pmant = temp.l.lower;
2477
    *pexp = temp.l.upper;
2478
}
2479

  
2480
CPU86_LDouble cpu_set_fp80(uint64_t mant, uint16_t upper)
2481
{
2482
    CPU86_LDoubleU temp;
2483

  
2484
    temp.l.upper = upper;
2485
    temp.l.lower = mant;
2486
    return temp.d;
2487
}
2488
#endif
2489

  
2434 2490
#if !defined(CONFIG_USER_ONLY) 
2435 2491

  
2436 2492
#define MMUSUFFIX _mmu

Also available in: Unified diff