From: Alan Modra Date: Thu, 4 Mar 2004 10:23:23 +0000 (+0000) Subject: real.c (encode_ibm_extended): Don't bother rounding low double. X-Git-Tag: releases/gcc-4.0.0~9636 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ddc6856430bcef3e68563b08cc513f794a5cb57e;p=thirdparty%2Fgcc.git real.c (encode_ibm_extended): Don't bother rounding low double. * real.c (encode_ibm_extended): Don't bother rounding low double. * c-cppbuiltin.c (builtin_define_float_constants): Tweak MAX when fmt->pnan < fmt->p. From-SVN: r78900 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 148e55da340d..071f579e3bdb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-03-04 Alan Modra + + * real.c (encode_ibm_extended): Don't bother rounding low double. + * c-cppbuiltin.c (builtin_define_float_constants): Tweak MAX + when fmt->pnan < fmt->p. + 2004-03-04 Eric Christopher * config/mips/mips.h (FUNCTION_ARG_REGNO_P): Fix to check diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index 4e671d6b055a..8573b8c5a46e 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -193,6 +193,16 @@ builtin_define_float_constants (const char *name_prefix, const char *fp_suffix, if (i < n) *p++ = "08ce"[n - i]; sprintf (p, "p%d", fmt->emax * fmt->log2_b); + if (fmt->pnan < fmt->p) + { + /* This is an IBM extended double format made up of two IEEE + doubles. The value of the long double is the sum of the + values of the two parts. The most significant part is + required to be the value of the long double rounded to the + nearest double. Rounding means we need a slightly smaller + value for LDBL_MAX. */ + buf[4 + fmt->pnan / 4] = "7bde"[fmt->pnan % 4]; + } } sprintf (name, "__%s_MAX__", name_prefix); builtin_define_with_hex_fp_value (name, type, decimal_dig, buf, fp_suffix); diff --git a/gcc/real.c b/gcc/real.c index ed671db0e4d0..d578ace08831 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -3248,7 +3248,9 @@ encode_ibm_extended (const struct real_format *fmt, long *buf, if (u.class == rvc_normal) { do_add (&v, &normr, &u, 1); - round_for_format (base_fmt, &v); + /* The low double won't need rounding, since we round to a 106 bit + mantissa before calling this function, and we've just + subtracted off the top 54 bits. (53+1 because u is rounded.) */ encode_ieee_double (base_fmt, &buf[2], &v); } else