diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-47.c | 2 |
4 files changed, 14 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a28c1e2..1c78a67 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-10-10 Richard Guenther <rguenther@suse.de> + + PR middle-end/50195 + * fold-const.c (fold_binary_loc): Canonicalize x*x to pow (x, 2) + only when optimizing. + 2011-10-10 Nick Clifton <nickc@redhat.com> PR middle-end/49801 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 7568c6f..5b0fea7 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10693,9 +10693,9 @@ fold_binary_loc (location_t loc, } } - /* Optimize x*x as pow(x,2.0), which is expanded as x*x. */ + /* Canonicalize x*x as pow(x,2.0), which is expanded as x*x. */ if (!in_gimple_form - && optimize_function_for_speed_p (cfun) + && optimize && operand_equal_p (arg0, arg1, 0)) { tree powfn = mathfn_built_in (type, BUILT_IN_POW); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d0700e9..7d978b8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-10-10 Richard Guenther <rguenther@suse.de> + + PR middle-end/50195 + * gcc.dg/builtins-47.c: Optimize. + 2011-10-10 Aldy Hernandez <aldyh@redhat.com> * lib/gcc-simulate-thread.exp: New. diff --git a/gcc/testsuite/gcc.dg/builtins-47.c b/gcc/testsuite/gcc.dg/builtins-47.c index b25ee1b..9513483 100644 --- a/gcc/testsuite/gcc.dg/builtins-47.c +++ b/gcc/testsuite/gcc.dg/builtins-47.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-ffast-math -fdump-tree-gimple" } */ +/* { dg-options "-O -ffast-math -fdump-tree-gimple" } */ extern double sqrt (double); extern double pow (double, double); |