From: Michael Beck Date: Sun, 18 May 2008 14:39:10 +0000 (+0000) Subject: Allow safe x/y = x * (1.0/y) for exact 1.0/y even if floating point constant folding... X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=c23262aab77ce426cb0e580f7d18376ff17d9630;p=libfirm Allow safe x/y = x * (1.0/y) for exact 1.0/y even if floating point constant folding is disabled [r19653] --- diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 75b7fe1c4..286b54078 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -2804,8 +2804,17 @@ static ir_node *transform_node_Quot(ir_node *n) { if (is_Const(b)) { tarval *tv = get_Const_tarval(b); + int rem; + /* + * Floating point constant folding might be disabled here to + * prevent rounding. + * However, as we check for exact result, doing it is safe. + * Switch it on. + */ + rem = tarval_enable_fp_ops(1); tv = tarval_quo(get_mode_one(mode), tv); + (void)tarval_enable_fp_ops(rem); /* Do the transformation if the result is either exact or we are not using strict rules. */