Commit 05b936038f18763bbea7fa46f68b33c4a04637f2

Authored by aurel32
1 parent eb44b959

target-ppc: use a correct value to represent 1.0

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6046 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 12 additions and 9 deletions
target-ppc/op_helper.c
@@ -1517,7 +1517,8 @@ uint64_t helper_fsqrt (uint64_t arg) @@ -1517,7 +1517,8 @@ uint64_t helper_fsqrt (uint64_t arg)
1517 /* fre - fre. */ 1517 /* fre - fre. */
1518 uint64_t helper_fre (uint64_t arg) 1518 uint64_t helper_fre (uint64_t arg)
1519 { 1519 {
1520 - CPU_DoubleU farg; 1520 + CPU_DoubleU fone, farg;
  1521 + fone.ll = 0x3FF0000000000000ULL;
1521 farg.ll = arg; 1522 farg.ll = arg;
1522 1523
1523 if (unlikely(float64_is_signaling_nan(farg.d))) { 1524 if (unlikely(float64_is_signaling_nan(farg.d))) {
@@ -1525,9 +1526,9 @@ uint64_t helper_fre (uint64_t arg) @@ -1525,9 +1526,9 @@ uint64_t helper_fre (uint64_t arg)
1525 farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); 1526 farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
1526 } else if (unlikely(iszero(farg.d))) { 1527 } else if (unlikely(iszero(farg.d))) {
1527 /* Zero reciprocal */ 1528 /* Zero reciprocal */
1528 - farg.ll = float_zero_divide_excp(1.0, farg.d); 1529 + farg.ll = float_zero_divide_excp(fone.d, farg.d);
1529 } else if (likely(isnormal(farg.d))) { 1530 } else if (likely(isnormal(farg.d))) {
1530 - farg.d = float64_div(1.0, farg.d, &env->fp_status); 1531 + farg.d = float64_div(fone.d, farg.d, &env->fp_status);
1531 } else { 1532 } else {
1532 if (farg.ll == 0x8000000000000000ULL) { 1533 if (farg.ll == 0x8000000000000000ULL) {
1533 farg.ll = 0xFFF0000000000000ULL; 1534 farg.ll = 0xFFF0000000000000ULL;
@@ -1547,7 +1548,8 @@ uint64_t helper_fre (uint64_t arg) @@ -1547,7 +1548,8 @@ uint64_t helper_fre (uint64_t arg)
1547 /* fres - fres. */ 1548 /* fres - fres. */
1548 uint64_t helper_fres (uint64_t arg) 1549 uint64_t helper_fres (uint64_t arg)
1549 { 1550 {
1550 - CPU_DoubleU farg; 1551 + CPU_DoubleU fone, farg;
  1552 + fone.ll = 0x3FF0000000000000ULL;
1551 farg.ll = arg; 1553 farg.ll = arg;
1552 1554
1553 if (unlikely(float64_is_signaling_nan(farg.d))) { 1555 if (unlikely(float64_is_signaling_nan(farg.d))) {
@@ -1555,13 +1557,13 @@ uint64_t helper_fres (uint64_t arg) @@ -1555,13 +1557,13 @@ uint64_t helper_fres (uint64_t arg)
1555 farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); 1557 farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
1556 } else if (unlikely(iszero(farg.d))) { 1558 } else if (unlikely(iszero(farg.d))) {
1557 /* Zero reciprocal */ 1559 /* Zero reciprocal */
1558 - farg.ll = float_zero_divide_excp(1.0, farg.d); 1560 + farg.ll = float_zero_divide_excp(fone.d, farg.d);
1559 } else if (likely(isnormal(farg.d))) { 1561 } else if (likely(isnormal(farg.d))) {
1560 #if USE_PRECISE_EMULATION 1562 #if USE_PRECISE_EMULATION
1561 - farg.d = float64_div(1.0, farg.d, &env->fp_status); 1563 + farg.d = float64_div(fone.d, farg.d, &env->fp_status);
1562 farg.d = float64_to_float32(farg.d, &env->fp_status); 1564 farg.d = float64_to_float32(farg.d, &env->fp_status);
1563 #else 1565 #else
1564 - farg.d = float32_div(1.0, farg.d, &env->fp_status); 1566 + farg.d = float32_div(fone.d, farg.d, &env->fp_status);
1565 #endif 1567 #endif
1566 } else { 1568 } else {
1567 if (farg.ll == 0x8000000000000000ULL) { 1569 if (farg.ll == 0x8000000000000000ULL) {
@@ -1582,7 +1584,8 @@ uint64_t helper_fres (uint64_t arg) @@ -1582,7 +1584,8 @@ uint64_t helper_fres (uint64_t arg)
1582 /* frsqrte - frsqrte. */ 1584 /* frsqrte - frsqrte. */
1583 uint64_t helper_frsqrte (uint64_t arg) 1585 uint64_t helper_frsqrte (uint64_t arg)
1584 { 1586 {
1585 - CPU_DoubleU farg; 1587 + CPU_DoubleU fone, farg;
  1588 + fone.ll = 0x3FF0000000000000ULL;
1586 farg.ll = arg; 1589 farg.ll = arg;
1587 1590
1588 if (unlikely(float64_is_signaling_nan(farg.d))) { 1591 if (unlikely(float64_is_signaling_nan(farg.d))) {
@@ -1593,7 +1596,7 @@ uint64_t helper_frsqrte (uint64_t arg) @@ -1593,7 +1596,7 @@ uint64_t helper_frsqrte (uint64_t arg)
1593 farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSQRT); 1596 farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSQRT);
1594 } else if (likely(isnormal(farg.d))) { 1597 } else if (likely(isnormal(farg.d))) {
1595 farg.d = float64_sqrt(farg.d, &env->fp_status); 1598 farg.d = float64_sqrt(farg.d, &env->fp_status);
1596 - farg.d = float32_div(1.0, farg.d, &env->fp_status); 1599 + farg.d = float32_div(fone.d, farg.d, &env->fp_status);
1597 } else { 1600 } else {
1598 if (farg.ll == 0x8000000000000000ULL) { 1601 if (farg.ll == 0x8000000000000000ULL) {
1599 farg.ll = 0xFFF0000000000000ULL; 1602 farg.ll = 0xFFF0000000000000ULL;