This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Improve -Ofast vectorization of std::sin etc. (PR libstdc++/81706)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, Marek Polacek <polacek at redhat dot com>, Jonathan Wakely <jwakely at redhat dot com>, gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Mon, 7 Aug 2017 17:27:42 +0200
- Subject: Re: [PATCH] Improve -Ofast vectorization of std::sin etc. (PR libstdc++/81706)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx10.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 B7F126147E
- References: <20170807090825.GK2123@tucnak> <d8d629b2-86f6-9c1f-f627-814f73274fd1@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Aug 07, 2017 at 10:54:18AM -0400, Jason Merrill wrote:
> On 08/07/2017 05:08 AM, Jakub Jelinek wrote:
> > + tree s = lookup_attribute ("omp declare simd",
> > + DECL_ATTRIBUTES (newdecl));
> > + if (s)
> > + {
> > + tree b
> > + = builtin_decl_explicit (DECL_FUNCTION_CODE (newdecl));
> > + if (b)
> > + {
> > + tree s2 = lookup_attribute ("omp declare simd",
> > + DECL_ATTRIBUTES (b));
> > + while (s)
> > + {
> > + tree s3;
> > + for (s3 = s2; s3;
> > + s3 = lookup_attribute ("omp declare simd",
> > + TREE_CHAIN (s3)))
> > + if (attribute_value_equal (s, s3))
> > + break;
> > + if (!s3)
> > + {
> > + s3 = copy_node (s);
> > + TREE_CHAIN (s3) = DECL_ATTRIBUTES (b);
> > + DECL_ATTRIBUTES (b) = s3;
> > + }
> > + s = lookup_attribute ("omp declare simd",
> > + TREE_CHAIN (s));
> > + }
> > + }
> > + }
>
> This should really be a separate function. Perhaps "merge_one_attribute"?
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).
Jakub