diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2007-06-12 09:19:36 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2007-06-12 09:19:36 +0200 |
commit | 9883e373fc9bbdf33e1913f184f3768835b88f88 (patch) | |
tree | d7c8c6158be8c32577d9db56a22df3abbd3fc85f /gcc | |
parent | f84c7ed94694125c633be09bedb477cfac3a7f46 (diff) | |
download | gcc-9883e373fc9bbdf33e1913f184f3768835b88f88.zip gcc-9883e373fc9bbdf33e1913f184f3768835b88f88.tar.gz gcc-9883e373fc9bbdf33e1913f184f3768835b88f88.tar.bz2 |
fold-const (fold_binary): Also optimize a/cbrt(b/c) into a*cbrt(c/b) if flag_unsafe_math_optimizations is set.
* fold-const (fold_binary) [RDIV_EXPR]: Also optimize a/cbrt(b/c)
into a*cbrt(c/b) if flag_unsafe_math_optimizations is set.
testuite/ChangeLog:
* gcc.dg/builtins-11.c: Also check folding of a/cbrt(b/c).
From-SVN: r125641
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fold-const.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-11.c | 4 |
4 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a381a86..a36f359 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-06-12 Uros Bizjak <ubizjak@gmail.com> + + * fold-const (fold_binary) [RDIV_EXPR]: Also optimize a/cbrt(b/c) + into a*cbrt(c/b) if flag_unsafe_math_optimizations is set. + 2007-06-11 Diego Novillo <dnovillo@google.com> * Makefile.in (reload1.o-warn): Remove. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index d2dd8cb..06b7c74 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10555,8 +10555,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) } } - /* Optimize a/sqrt(b/c) into a*sqrt(c/b). */ - if (BUILTIN_SQRT_P (fcode1)) + /* Optimize a/root(b/c) into a*root(c/b). */ + if (BUILTIN_ROOT_P (fcode1)) { tree rootarg = CALL_EXPR_ARG (arg1, 0); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1e40136..73d6b96 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-06-12 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/builtins-11.c: Also check folding of a/cbrt(b/c). + 2007-06-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/29786 diff --git a/gcc/testsuite/gcc.dg/builtins-11.c b/gcc/testsuite/gcc.dg/builtins-11.c index ba46892..ba0d2db 100644 --- a/gcc/testsuite/gcc.dg/builtins-11.c +++ b/gcc/testsuite/gcc.dg/builtins-11.c @@ -12,6 +12,7 @@ extern void link_error(void); extern double exp(double); extern double sqrt(double); +extern double cbrt(double); extern double pow(double,double); void test(double x, double y, double z) @@ -39,6 +40,9 @@ void test(double x, double y, double z) if (x/sqrt(y/z) != x*sqrt(z/y)) link_error (); + + if (x/cbrt(y/z) != x*cbrt(z/y)) + link_error (); } int main() |