This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization comparison: 3.3, 3.4, mainline, tree-ssa
> From: Geert Bosch <bosch@gnat.com>
>
> On Apr 19, 2004, at 02:27, Uros Bizjak wrote:
> > I would like to ask, if these (somehow complex) functions should be
> > implemented as inline functions in a compiler provided optimized
> > header, or as intrinsic functions. For example, asin() and acos()
> > doesn't have hardware implementation, and because of this, I would
> > suggest implementing them as inline functions. The same goes for
> > asinh, acosh, etc... which are even more complex function, and I see
> > no point to implement them in *.md file.
>
> One thing to consider is that non-C languages, such as Fortran, Ada
> and Java, have a need for these functions too. Implementing them as
> header inlines would require each language to redo this in a
> language-dependent way, resulting in duplicated effort and
> more bugs as this stuff is hard to get right.
Agreed...
> It seems that it would make sense to have a more generic inline
> expansion of these well-known functions at the tree level.
> -Geert
...but using trees can be tricky. It's not hard to model e.g. asin at
the tree level using atan2(x, sqrt(1.0 - x * x)); however this is only
a win if we know the entire expression transforms into inline assembly
code. So we don't want to do this transformation on platforms that
don't also have inline intrinsics for atan2 and sqrt.
Therefore, I think it makes sense to do this in the md file where we
know whether we have the other functions expanded.
Perhaps a there's a generic way to do it if we can detect in the
builtin expander that the intrinsics exist.
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu