Commit 80621676af6893b84dec1c5d00e0f5b928253ef9
1 parent
0ca9d380
Math functions helper for CONFIG_SOFTFLOAT=yes
The patch below adds isfinite() and isnormal() functions which can work with float64 type, used when CONFIG_SOFTFLOAT=yes. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4048 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
21 additions
and
0 deletions
target-ppc/op_helper.c
| @@ -492,6 +492,27 @@ static always_inline int isinfinity (float64 d) | @@ -492,6 +492,27 @@ static always_inline int isinfinity (float64 d) | ||
| 492 | (u.ll & 0x000FFFFFFFFFFFFFULL) == 0; | 492 | (u.ll & 0x000FFFFFFFFFFFFFULL) == 0; |
| 493 | } | 493 | } |
| 494 | 494 | ||
| 495 | +#ifdef CONFIG_SOFTFLOAT | ||
| 496 | +static always_inline int isfinite (float64 d) | ||
| 497 | +{ | ||
| 498 | + CPU_DoubleU u; | ||
| 499 | + | ||
| 500 | + u.d = d; | ||
| 501 | + | ||
| 502 | + return (((u.ll >> 52) & 0x7FF) != 0x7FF); | ||
| 503 | +} | ||
| 504 | + | ||
| 505 | +static always_inline int isnormal (float64 d) | ||
| 506 | +{ | ||
| 507 | + CPU_DoubleU u; | ||
| 508 | + | ||
| 509 | + u.d = d; | ||
| 510 | + | ||
| 511 | + uint32_t exp = (u.ll >> 52) & 0x7FF; | ||
| 512 | + return ((0 < exp) && (exp < 0x7FF)); | ||
| 513 | +} | ||
| 514 | +#endif | ||
| 515 | + | ||
| 495 | void do_compute_fprf (int set_fprf) | 516 | void do_compute_fprf (int set_fprf) |
| 496 | { | 517 | { |
| 497 | int isneg; | 518 | int isneg; |