Commit 12644a9a by Toon Moene Committed by Toon Moene

fold-const.c (extract_muldiv): Check whether c divides op1 exactly if operation…

fold-const.c (extract_muldiv): Check whether c divides op1 exactly if operation is not multiplication.

2000-07-08  Toon Moene  <toon@moene.indiv.nluug.nl>

	* fold-const.c (extract_muldiv) case PLUS_EXPR, MINUS_EXPR:
	Check whether c divides op1 exactly if operation is not
	multiplication.

From-SVN: r34928
parent 0ac76ad9
2000-07-08 Toon Moene <toon@moene.indiv.nluug.nl>
* fold-const.c (extract_muldiv) case PLUS_EXPR, MINUS_EXPR:
Check whether c divides op1 exactly if operation is not
multiplication.
2000-07-08 Richard Henderson <rth@cygnus.com> 2000-07-08 Richard Henderson <rth@cygnus.com>
* final.c (final): Do not abort when reg-stack introduces * final.c (final): Do not abort when reg-stack introduces
......
...@@ -4501,10 +4501,17 @@ extract_muldiv (t, c, code, wide_type) ...@@ -4501,10 +4501,17 @@ extract_muldiv (t, c, code, wide_type)
break; break;
} }
/* Now do the operation and verify it doesn't overflow. */ /* If it's a multiply or a division/modulus operation of a multiple
op1 = const_binop (code, convert (ctype, op1), convert (ctype, c), 0); of our constant, do the operation and verify it doesn't overflow. */
if (op1 == 0 || TREE_OVERFLOW (op1)) if (code == MULT_EXPR
break; || integer_zerop (const_binop (TRUNC_MOD_EXPR, op1, c, 0)))
{
op1 = const_binop (code, convert (ctype, op1), convert (ctype, c), 0);
if (op1 == 0 || TREE_OVERFLOW (op1))
break;
}
else
break;
/* If we have an unsigned type is not a sizetype, we cannot widen /* If we have an unsigned type is not a sizetype, we cannot widen
the operation since it will change the result if the original the operation since it will change the result if the original
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment