diff options
author | Richard Henderson <rth@redhat.com> | 2005-09-19 10:01:40 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-09-19 10:01:40 -0700 |
commit | d289e37a267820946191990603ad70cb29a7ffc9 (patch) | |
tree | 939f5124bb5cc88af26701e1be41242556942d1d /gcc/real.c | |
parent | 3c7d0735f564a48ea13b5246c5675cabaf53d0c6 (diff) | |
download | gcc-d289e37a267820946191990603ad70cb29a7ffc9.zip gcc-d289e37a267820946191990603ad70cb29a7ffc9.tar.gz gcc-d289e37a267820946191990603ad70cb29a7ffc9.tar.bz2 |
re PR rtl-optimization/23941 (compress_float_constant creates denormals)
PR 23941
* real.c (exact_real_truncate): Return false if the format cannot
represent the number as a normal.
From-SVN: r104424
Diffstat (limited to 'gcc/real.c')
-rw-r--r-- | gcc/real.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -2399,7 +2399,19 @@ real_value_truncate (enum machine_mode mode, REAL_VALUE_TYPE a) bool exact_real_truncate (enum machine_mode mode, const REAL_VALUE_TYPE *a) { + const struct real_format *fmt; REAL_VALUE_TYPE t; + int emin2m1; + + fmt = REAL_MODE_FORMAT (mode); + gcc_assert (fmt); + + /* Don't allow conversion to denormals. */ + emin2m1 = (fmt->emin - 1) * fmt->log2_b; + if (REAL_EXP (a) <= emin2m1) + return false; + + /* After conversion to the new mode, the value must be identical. */ real_convert (&t, mode, a); return real_identical (&t, a); } |