+2007-06-11 Uros Bizjak <ubizjak@gmail.com>
+
+ PR middle-end/32279
+ * fold-const (fold_binary) [RDIV_EXPR]: Optimize a/sqrt(b/c)
+ into a*sqrt(c/b) if flag_unsafe_math_optimizations is set.
+
2007-06-10 Jan Sjodin <jan.sjodin@amd.com>
Sebastian Pop <sebpop@gmail.com>
}
}
+ /* Optimize a/sqrt(b/c) into a*sqrt(c/b). */
+ if (BUILTIN_SQRT_P (fcode1))
+ {
+ tree rootarg = CALL_EXPR_ARG (arg1, 0);
+
+ if (TREE_CODE (rootarg) == RDIV_EXPR)
+ {
+ tree rootfn = TREE_OPERAND (CALL_EXPR_FN (arg1), 0);
+ tree b = TREE_OPERAND (rootarg, 0);
+ tree c = TREE_OPERAND (rootarg, 1);
+
+ tree tmp = fold_build2 (RDIV_EXPR, type, c, b);
+
+ tmp = build_call_expr (rootfn, 1, tmp);
+ return fold_build2 (MULT_EXPR, type, arg0, tmp);
+ }
+ }
+
/* Optimize x/expN(y) into x*expN(-y). */
if (BUILTIN_EXPONENT_P (fcode1))
{
+2007-06-11 Uros Bizjak <ubizjak@gmail.com>
+
+ PR middle-end/32279
+ * gcc.dg/builtins-11.c: Also check folding of a/sqrt(b/c).
+
2007-06-10 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/32235
-/* Copyright (C) 2003 Free Software Foundation.
+/* Copyright (C) 2003,2007 Free Software Foundation.
Check that constant folding of built-in math functions doesn't
break anything and produces the expected results.
if (x/pow(y,z) != x*pow(y,-z))
link_error ();
+
+ if (x/sqrt(y/z) != x*sqrt(z/y))
+ link_error ();
}
int main()