This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Add some more builtins opts for sqrt/cbrt

 > From: Richard Henderson <>
 > 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.
 > r~

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))
    return implicit_built_in_decls[fcode];
  else if (type_mode == TYPE_MODE (float_type_node))
    return implicit_built_in_decls[fcodef];
  else if (type_mode == TYPE_MODE (long_double_type_node))
    return implicit_built_in_decls[fcodel];
    return 0;

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]