This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Accessing signgam from the middle-end for builtin lgamma
On Fri, 27 Apr 2007, Tom Tromey wrote:
> Not to be too negative (I am curious about this), but does this sort of
> optimization really carry its own weight? Is this a common thing in
> numeric code or something like that?
> Tom
I don't know that optimizing lgamma by itself makes a big difference.
However we're down to the last few C99 math functions and if I can get all
of them I think it's worthwhile to be complete. For the record, the
remaining ones are lgamma/gamma and drem/remainder/remquo. (Bessel
functions have been submitted but not approved yet. Complex math however
still needs some TLC.) If you can find something I've overlooked, please
let me know.
Taken as a whole, I do believe optimizing constant args helps numeric
code. E.g. it's noted here that PI is often written as 4*atan(1) and that
this idiom appears in several SPEC benchmarks.
http://gcc.gnu.org/ml/gcc-patches/2003-05/msg02310.html
And of course there are many ways through macros, inlining, templates, and
various optimizations that a constant could be propagated into a math
function call. When that happens, it is both a size and a speed win to
fold it. And in the above PI case, folding atan also allows GCC to fold
the mult.
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu