diff options
author | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-10 05:47:14 +0000 |
---|---|---|
committer | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-10 05:47:14 +0000 |
commit | 2ce081b770e429fdf14e53cbec975823a44e0564 (patch) | |
tree | d30bf7e4c2a8d092733cec701722dc75f1fb8112 /gcc/real.c | |
parent | 11d99e06a52067db2d0faf32ed7d1f2144bb99d9 (diff) | |
download | gcc-2ce081b770e429fdf14e53cbec975823a44e0564.tar.gz |
* config/rs6000/darwin-ldouble.c: Add big comment explaining
exactly what is expected as a 'long double'.
(_xlqadd): When a value to be returned is representable as a
'double', just return it directly, do not construct it using a union.
Also, correct final fixup.
(_xlqmul): Likewise.
(_xlqdiv): Likewise.
* real.c (encode_ibm_extended): Make consistent with darwin-ldouble.c.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75629 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r-- | gcc/real.c | 60 |
1 files changed, 15 insertions, 45 deletions
diff --git a/gcc/real.c b/gcc/real.c index f7af346db60..ecee90bf40c 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -3235,53 +3235,23 @@ encode_ibm_extended (const struct real_format *fmt, long *buf, base_fmt = fmt->qnan_msb_set ? &ieee_double_format : &mips_double_format; - switch (r->class) - { - case rvc_zero: - /* Both doubles have sign bit set. */ - buf[0] = FLOAT_WORDS_BIG_ENDIAN ? r->sign << 31 : 0; - buf[1] = FLOAT_WORDS_BIG_ENDIAN ? 0 : r->sign << 31; - buf[2] = buf[0]; - buf[3] = buf[1]; - break; - - case rvc_inf: - case rvc_nan: - /* Both doubles set to Inf / NaN. */ - encode_ieee_double (base_fmt, &buf[0], r); - buf[2] = buf[0]; - buf[3] = buf[1]; - return; + /* u = IEEE double precision portion of significand. */ + u = *r; + round_for_format (base_fmt, &u); + encode_ieee_double (base_fmt, &buf[0], &u); - case rvc_normal: - /* u = IEEE double precision portion of significand. */ - u = *r; - clear_significand_below (&u, SIGNIFICAND_BITS - 53); - - normalize (&u); - /* If the upper double is zero, we have a denormal double, so - move it to the first double and leave the second as zero. */ - if (u.class == rvc_zero) - { - v = u; - u = *r; - normalize (&u); - } - else - { - /* v = remainder containing additional 53 bits of significand. */ - do_add (&v, r, &u, 1); - round_for_format (base_fmt, &v); - } - - round_for_format (base_fmt, &u); - - encode_ieee_double (base_fmt, &buf[0], &u); + if (r->class == rvc_normal) + { + do_add (&v, r, &u, 1); + round_for_format (base_fmt, &v); encode_ieee_double (base_fmt, &buf[2], &v); - break; - - default: - abort (); + } + else + { + /* Inf, NaN, 0 are all representable as doubles, so the + least-significant part can be 0.0. */ + buf[2] = 0; + buf[3] = 0; } } |