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

Uros Bizjak ubizjak@gmail.com
Mon Jun 11 22:12:00 GMT 2007


Kaveh R. GHAZI wrote:

>>         * 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?
>   

At least for cbrt, it is possible to simply change BUILTIN_SQRT_P into 
BUILTIN_ROOT_P, and the same code will handle cbrt.

Uros.



More information about the Gcc-patches mailing list