This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, middle-end]: Optimize a/sqrt(b/c) into a*sqrt(c/b).


On 6/11/07, Kaveh R. GHAZI <ghazi@caip.rutgers.edu> wrote:
On Mon, 11 Jun 2007, Uros Bizjak wrote:

> Hello!
>
> This patch optimizes a/sqrt(b/c) into a*sqrt(c/b), converting one
> division into the multiplication. This patch also converts cases like
> sqrt(a)/sqrt(1.0/b) into sqrt (b*a).
>
> Patch was bootstrapped on x86_64-pc-linux-gnu, regression test for all
> default languages is in progress. OK for mainline if it passes?
>
> 2007-06-11  Uros Bizjak  <ubizjak@gmail.com>
>
>         * fold-const (fold_binary) [RDIV_EXPR]: Optimize a/sqrt(b/c)
>         into a*sqrt(c/b) if flag_unsafe_math_optimizations is set.

Is it possible to do the same with cbrt, pow (possibly others?) along the
lines of negate_exp/negate_expr_p/negate_mathfn_p?

We could certainly introduce a new predicate like reciprocal_mathfn_p that tells we can compute the reciprocal of the function by computing the function of the reciprocal argument. And a corresponding reciprocal_expr_p/reciprocal_expr set of functions.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]