fold-const.c (negate_expr_p, [...]): Optimize -(A+B) into either (-A)-B or (-B)-A...
authorRoger Sayle <roger@eyesopen.com>
Sat, 7 Feb 2004 15:35:40 +0000 (15:35 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sat, 7 Feb 2004 15:35:40 +0000 (15:35 +0000)
commitdfb36f9be274a9968048ab7137eb52a258aa7106
tree04db5646c3835e0841ea50cc2a2ab2d6036b7d68
parent0ea5865c17469625fcd91d2dcecf5dec6fe4ce10
fold-const.c (negate_expr_p, [...]): Optimize -(A+B) into either (-A)-B or (-B)-A...

* fold-const.c (negate_expr_p, negate_expr): Optimize -(A+B) into
either (-A)-B or (-B)-A, if A or B is easily negated respectively.
(fold) <MINUS_EXPR>: Optimize (A*C) - (B*C) -> (A-B)*C for both
integer types and floating point with unsafe_math_optimizations.
Add similar optimization for (A*C1) - (A*C2) -> A*(C1-C2).
Optimize A - B as A + (-B), if B is easily negated.

From-SVN: r77453
gcc/ChangeLog
gcc/fold-const.c