This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH]: Add some more builtins opts for sqrt/cbrt
> From: Richard Henderson <email@example.com>
> On Sat, Mar 27, 2004 at 07:05:32PM -0500, Kaveh R. Ghazi wrote:
> > - tree powfn = mathfn_built_in (type, BUILT_IN_POW);
> > + tree powfn = (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SQRT)
> > + ? implicit_built_in_decls[BUILT_IN_POW] :
> This would suggest that TYPE is wrong in that call then.
No, I don't think so.
I did some further investigating as to why mathfn_built_in didn't do
what I expected. The code in the function says:
const enum machine_mode type_mode = TYPE_MODE (type);
if (type_mode == TYPE_MODE (double_type_node))
else if (type_mode == TYPE_MODE (float_type_node))
else if (type_mode == TYPE_MODE (long_double_type_node))
If I understand it correctly, there's no guarantee that if you ask for
a "long double" pow function that you'll actually get `powl'. The
code prefers the "double" version if the sizes of double and long
double are equal (as I believe they are on aix5 where the error
I'm not sure this is the best design for `mathfn_built_in'. At least,
it wasn't intuitive to me.
Kaveh R. Ghazi firstname.lastname@example.org