This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/19988] [4.0 Regression] pessimizes fp multiply-add/subtract combo
- From: "athena at fftw dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Feb 2005 20:37:40 -0000
- Subject: [Bug middle-end/19988] [4.0 Regression] pessimizes fp multiply-add/subtract combo
- References: <20050215225352.19988.stevenj@fftw.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From athena at fftw dot org 2005-02-16 20:37 -------
(In reply to comment #3)
> Ok, this is the patch which caused this code generation regression:
> 2004-02-07 Roger Sayle <roger@eyesopen.com>
>
> * 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.
Note that the straightforward transformation -(A+B) => (-A)-B is illegal
according to the ieee-754 standard. For A=-0 and B=+0, -(A+B) = -(+0) = -0,
whereas (-A)-B = +0 - +0 = +0 + -0 = +0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19988