[PATCH] Fix up pow folding (PR tree-optimization/56125)

Marc Glisse marc.glisse@inria.fr
Mon Jan 28 15:41:00 GMT 2013


On Mon, 28 Jan 2013, Jakub Jelinek wrote:

> 2013-01-28  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR tree-optimization/56125
> 	* tree-ssa-math-opts.c (gimple_expand_builtin_pow): Don't optimize
> 	pow(x,c) into sqrt(x) * powi(x, n/2) or
> 	1.0 / (sqrt(x) * powi(x, abs(n/2))) if c is an integer or when
> 	optimizing for size.
> 	Don't optimize pow(x,c) into powi(x, n/3) * powi(cbrt(x), n%3) or
> 	1.0 / (powi(x, abs(n)/3) * powi(cbrt(x), abs(n)%3)) if 2c is an
> 	integer.
>
> 	* gcc.dg/pr56125.c: New test.

Hello,

is there an implicit -lm in the testsuite?

The testcase now generates a library call to pow, like gcc-4.6. This is 
correct, but I am surprised this is considered better than leaving the 
original x/(n*n) unchanged... Should that be a different PR?

-- 
Marc Glisse



More information about the Gcc-patches mailing list