This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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] Improve -Ofast vectorization of std::sin etc. (PR libstdc++/81706)


On Mon, Aug 07, 2017 at 09:59:04PM +0100, Jonathan Wakely wrote:
> > If it is outlined without the first 7 lines, i.e. just the body of if (b),
> > then it could be duplicate_one_attribute (tree *, tree, const char *);
> > called like if (b) duplicate_one_attribute (&DECL_ATTRIBUTES (b), s, "omp declare simd");
> > If it is duplicated as whole, it should be called
> > duplicate_one_attr_to_builtin or something similar.
> > In any case, it could be in tree.c or attribs.c.
> > 
> > The primary question is if we want this behavior, or if we should go the
> > libstdc++ patch routine (and for Jonathan the question is if he knows
> > why __builtin_XXXf has been used there rather than the ::XXXf).
> 
> I don't know for certain, but I suspect it's because sinf, cosf, powf
> etc. were new in C99, so a strict libc might not declare them in C++98
> mode.
> 
> By using __builtin_sinf we don't need a declaration of sinf, we only
> require the definition to exist in libc or libm. If the function is
> present, but not declared for C++98, then it works.

Ah, so if we go the libstdc++ patch route, we'd need to check in configure
for the prototypes in C++98 mode and guard the stuff with #ifdef
_GLIBCXX_HAVE_COSF or similar, right?  Or do this only for C++11 and above.

	Jakub


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