Commit 41bb1f06 by Richard Guenther Committed by Richard Biener

fold-const.c (split_tree): Associate floatig-point expressions if flag_associative_math is set.

2008-02-20  Richard Guenther  <rguenther@suse.de>

	* fold-const.c (split_tree): Associate floatig-point expressions
	if flag_associative_math is set.

	* gcc.dg/fold-reassoc-1.c: New testcase.
	* gcc.dg/tree-ssa/recip-3.c: Adjust to not compute d/d.

From-SVN: r132481
parent 2dc0f633
2008-02-20 Richard Guenther <rguenther@suse.de> 2008-02-20 Richard Guenther <rguenther@suse.de>
* fold-const.c (split_tree): Associate floatig-point expressions
if flag_associative_math is set.
2008-02-20 Richard Guenther <rguenther@suse.de>
* tree.h (fold_real_zero_addition_p): Declare. * tree.h (fold_real_zero_addition_p): Declare.
* fold-const.c (fold_real_zero_addition_p): Export. * fold-const.c (fold_real_zero_addition_p): Export.
* tree-ssa-reassoc.c (eliminate_using_constants): Also handle * tree-ssa-reassoc.c (eliminate_using_constants): Also handle
......
...@@ -1491,7 +1491,7 @@ split_tree (tree in, enum tree_code code, tree *conp, tree *litp, ...@@ -1491,7 +1491,7 @@ split_tree (tree in, enum tree_code code, tree *conp, tree *litp,
|| TREE_CODE (in) == FIXED_CST) || TREE_CODE (in) == FIXED_CST)
*litp = in; *litp = in;
else if (TREE_CODE (in) == code else if (TREE_CODE (in) == code
|| (! FLOAT_TYPE_P (TREE_TYPE (in)) || ((! FLOAT_TYPE_P (TREE_TYPE (in)) || flag_associative_math)
&& ! SAT_FIXED_POINT_TYPE_P (TREE_TYPE (in)) && ! SAT_FIXED_POINT_TYPE_P (TREE_TYPE (in))
/* We can associate addition and subtraction together (even /* We can associate addition and subtraction together (even
though the C standard doesn't say so) for integers because though the C standard doesn't say so) for integers because
......
2008-02-20 Richard Guenther <rguenther@suse.de> 2008-02-20 Richard Guenther <rguenther@suse.de>
* gcc.dg/fold-reassoc-1.c: New testcase.
* gcc.dg/tree-ssa/recip-3.c: Adjust to not compute d/d.
2008-02-20 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/reassoc-13.c: New testcase. * gcc.dg/tree-ssa/reassoc-13.c: New testcase.
2008-02-20 Ira Rosen <irar@il.ibm.com> 2008-02-20 Ira Rosen <irar@il.ibm.com>
/* { dg-do compile } */
/* { dg-options "-O -ffast-math -fdump-tree-original" } */
double foo (double x)
{
return (x + 0.5 - x - 0.5);
}
/* { dg-final { scan-tree-dump "return 0.0;" "original" } } */
/* { dg-final { cleanup-tree-dump "original" } } */
...@@ -9,7 +9,7 @@ float h () ...@@ -9,7 +9,7 @@ float h ()
int i; int i;
double E, W, P, d; double E, W, P, d;
W = 1.; W = 1.1;
d = 2.*e; d = 2.*e;
E = 1. - d; E = 1. - d;
......
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