X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Freal.c;h=b4d617f94d6ed12bfd2f63c231815b6701a820ad;hp=867fdc70b037e29992dc6decc6d5795e1103e20c;hb=b5a0636d0b999957265e206ca9e6da21490ebb8d;hpb=f53594a1b77953ce80d290289dff74748e5f585a diff --git a/gcc/real.c b/gcc/real.c index 867fdc70b03..b4d617f94d6 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -1,6 +1,6 @@ /* real.c - software floating point emulation. Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 2000, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by Stephen L. Moshier (moshier@world.std.com). Re-written by Richard Henderson @@ -1163,6 +1163,14 @@ real_isnan (const REAL_VALUE_TYPE *r) return (r->cl == rvc_nan); } +/* Determine whether a floating-point value X is finite. */ + +bool +real_isfinite (const REAL_VALUE_TYPE *r) +{ + return (r->cl != rvc_nan) && (r->cl != rvc_inf); +} + /* Determine whether a floating-point value X is negative. */ bool @@ -2774,7 +2782,7 @@ const struct real_format mips_single_format = true }; -const struct real_format coldfire_single_format = +const struct real_format motorola_single_format = { encode_ieee_single, decode_ieee_single, @@ -3019,7 +3027,7 @@ const struct real_format mips_double_format = true }; -const struct real_format coldfire_double_format = +const struct real_format motorola_double_format = { encode_ieee_double, decode_ieee_double, @@ -3082,7 +3090,15 @@ encode_ieee_extended (const struct real_format *fmt, long *buf, if (fmt->has_nans) { image_hi |= 32767; - if (HOST_BITS_PER_LONG == 32) + if (r->canonical) + { + if (fmt->canonical_nan_lsbs_set) + { + sig_hi = (1 << 30) - 1; + sig_lo = 0xffffffff; + } + } + else if (HOST_BITS_PER_LONG == 32) { sig_hi = r->sig[SIGSZ-1]; sig_lo = r->sig[SIGSZ-2]; @@ -3364,7 +3380,7 @@ const struct real_format ieee_extended_motorola_format = true, true, true, - false + true }; const struct real_format ieee_extended_intel_96_format = @@ -4563,7 +4579,7 @@ real_sqrt (REAL_VALUE_TYPE *r, enum machine_mode mode, } /* Infinity and NaN return themselves. */ - if (real_isinf (x) || real_isnan (x)) + if (!real_isfinite (x)) { *r = *x; return false;