On Mon, Jan 28, 2013 at 04:41:31PM +0100, Marc Glisse wrote:
> On Mon, 28 Jan 2013, Jakub Jelinek wrote:
> 
> >2013-01-28  Jakub Jelinek  <ja...@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.
> 
> is there an implicit -lm in the testsuite?

Yes.

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

The function in question is marked as cold, therefore it should be optimized
for size.  The call to pow is certainly shorter than the sqrt,
multiplication, division etc.

        Jakub

Reply via email to