public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jason Merrill <jason@redhat.com>,
	"Joseph S. Myers" <joseph@codesourcery.com>,
	Marek Polacek <polacek@redhat.com>,
	gcc-patches@gcc.gnu.org,	libstdc++@gcc.gnu.org
Subject: Re: [PATCH] Improve -Ofast vectorization of std::sin etc. (PR libstdc++/81706)
Date: Mon, 07 Aug 2017 20:59:00 -0000	[thread overview]
Message-ID: <20170807205904.GH15340@redhat.com> (raw)
In-Reply-To: <20170807152742.GM2123@tucnak>

On 07/08/17 17:27 +0200, Jakub Jelinek wrote:
>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).

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.


  reply	other threads:[~2017-08-07 20:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07  9:08 Jakub Jelinek
2017-08-07 14:54 ` Jason Merrill
2017-08-07 15:28   ` Jakub Jelinek
2017-08-07 20:59     ` Jonathan Wakely [this message]
2017-08-07 21:02       ` Jakub Jelinek
2017-08-07 21:58         ` Jonathan Wakely
2017-09-01 11:13     ` Jakub Jelinek
2017-09-09 13:43       ` Jason Merrill
2017-09-12  7:49         ` Jakub Jelinek
2017-09-29 12:32           ` Jakub Jelinek
2017-09-29 20:17             ` Joseph Myers
2017-10-24 15:06             ` Jason Merrill
2017-10-24 15:34               ` Jakub Jelinek
2017-10-24 17:56                 ` Jason Merrill
2017-10-24 19:36                   ` Jakub Jelinek
2017-10-24 20:26                     ` Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170807205904.GH15340@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=polacek@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).