This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Improve -Ofast vectorization of std::sin etc. (PR libstdc++/81706)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Marek Polacek <polacek at redhat dot com>, gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Mon, 7 Aug 2017 23:02:27 +0200
- Subject: Re: [PATCH] Improve -Ofast vectorization of std::sin etc. (PR libstdc++/81706)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jakub at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3D3EB8046C
- References: <20170807090825.GK2123@tucnak> <d8d629b2-86f6-9c1f-f627-814f73274fd1@redhat.com> <20170807152742.GM2123@tucnak> <20170807205904.GH15340@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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