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
This commit is contained in:
Richard Henderson 2005-09-19 10:01:40 -07:00 committed by Richard Henderson
parent 3c7d0735f5
commit d289e37a26
3 changed files with 27 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2005-09-19 Richard Henderson <rth@redhat.com>
PR 23941
* real.c (exact_real_truncate): Return false if the format cannot
represent the number as a normal.
2005-09-19 Dorit Nuzman <dorit@il.ibm.com>
* tree-ssa-operands.c (swap_tree_operands): Export.

View File

@ -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);
}

View File

@ -0,0 +1,9 @@
extern void abort (void);
double d = __FLT_MIN__ / 2.0;
int main()
{
double x = __FLT_MIN__ / 2.0;
if (x != d)
abort ();
return 0;
}