if (code == PLUS_EXPR && operand_equal_p (var, arg1, 0))
return convert (TREE_TYPE (t), con);
+ /* If ARG0 is a constant, don't change things around;
+ instead keep all the constant computations together. */
+
+ if (TREE_CONSTANT (arg0))
+ return t;
+
/* Otherwise return (CON +- ARG1) - VAR. */
TREE_SET_CODE (t, MINUS_EXPR);
TREE_OPERAND (t, 1) = var;
if (code == MINUS_EXPR && operand_equal_p (var, arg1, 0))
return convert (TREE_TYPE (t), con);
+ /* If ARG0 is a constant, don't change things around;
+ instead keep all the constant computations together. */
+
+ if (TREE_CONSTANT (arg0))
+ return t;
+
/* Otherwise return VAR +- (ARG1 +- CON). */
TREE_OPERAND (t, 1) = tem
= fold (build (code, TREE_TYPE (t), arg1, con));
if (split_tree (arg1, code, &var, &con, &varsign))
{
/* EXPR is ARG0 +- (CON +- VAR). */
- if (varsign == -1)
- TREE_SET_CODE (t,
- (code == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR));
if (TREE_CODE (t) == MINUS_EXPR
&& operand_equal_p (var, arg0, 0))
{
return fold (build1 (NEGATE_EXPR, TREE_TYPE (t),
convert (TREE_TYPE (t), con)));
}
+ if (TREE_CONSTANT (arg1))
+ return t;
+ if (varsign == -1)
+ TREE_SET_CODE (t,
+ (code == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR));
TREE_OPERAND (t, 0)
= fold (build (code, TREE_TYPE (t), arg0, con));
TREE_OPERAND (t, 1) = var;