Commit 4e62a017 by Richard Guenther Committed by Richard Biener

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
parent ebfe4897
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.
2010-01-20 Janis Johnson <janis187@us.ibm.com> 2010-01-20 Janis Johnson <janis187@us.ibm.com>
Jason Merrill <jason@redhat.com> Jason Merrill <jason@redhat.com>
......
...@@ -1129,10 +1129,14 @@ negate_expr_p (tree t) ...@@ -1129,10 +1129,14 @@ negate_expr_p (tree t)
&& TYPE_OVERFLOW_WRAPS (type)); && TYPE_OVERFLOW_WRAPS (type));
case FIXED_CST: case FIXED_CST:
case REAL_CST:
case NEGATE_EXPR: case NEGATE_EXPR:
return true; 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: case COMPLEX_CST:
return negate_expr_p (TREE_REALPART (t)) return negate_expr_p (TREE_REALPART (t))
&& negate_expr_p (TREE_IMAGPART (t)); && negate_expr_p (TREE_IMAGPART (t));
......
2010-01-21 Richard Guenther <rguenther@suse.de>
PR middle-end/19988
* gcc.dg/pr19988.c: New testcase.
2010-01-20 Janis Johnson <janis187@us.ibm.com> 2010-01-20 Janis Johnson <janis187@us.ibm.com>
* g++.dg/compat/decimal/compat-common.h: New file. * g++.dg/compat/decimal/compat-common.h: New file.
......
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-optimized -fdump-tree-original" } */
double foo(double x, double y)
{
return ((x + 0.1234 * y) * (x - 0.1234 * y));
}
/* Keep positive constants during folding. */
/* { dg-final { scan-tree-dump-times " 1.23" 2 "original" } } */
/* CSE one multiplication. */
/* { dg-final { scan-tree-dump-times " \\\* " 2 "optimized" } } */
/* { dg-final { cleanup-tree-dump "original" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
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