aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-01-21 12:15:40 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-01-21 12:15:40 +0000
commit4e62a0175be3a34d66a8b395589897f0d2f53f46 (patch)
tree758eccb5e66ab481705e497e8b218d2fa1fb2f1b /gcc/fold-const.c
parentebfe4897fc27440325d1a23908b5a49c99ddb4ca (diff)
downloadgcc-4e62a0175be3a34d66a8b395589897f0d2f53f46.zip
gcc-4e62a0175be3a34d66a8b395589897f0d2f53f46.tar.gz
gcc-4e62a0175be3a34d66a8b395589897f0d2f53f46.tar.bz2
re PR middle-end/19988 (pessimizes fp multiply-add/subtract combo)
2010-01-21 Richard Guenther <rguenther@suse.de> PR middle-end/19988 * fold-const.c (negate_expr_p): Pretend only negative real constants are easily negatable. * gcc.dg/pr19988.c: New testcase. From-SVN: r156152
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 9d249cc..e7a4b8c 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1129,10 +1129,14 @@ negate_expr_p (tree t)
&& TYPE_OVERFLOW_WRAPS (type));
case FIXED_CST:
- case REAL_CST:
case NEGATE_EXPR:
return true;
+ case REAL_CST:
+ /* We want to canonicalize to positive real constants. Pretend
+ that only negative ones can be easily negated. */
+ return REAL_VALUE_NEGATIVE (TREE_REAL_CST (t));
+
case COMPLEX_CST:
return negate_expr_p (TREE_REALPART (t))
&& negate_expr_p (TREE_IMAGPART (t));