+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.
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);
}