public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Kirill Yukhin <kirill.yukhin@gmail.com>
Cc: Joseph Myers <joseph@codesourcery.com>, Jeff Law <law@redhat.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
Date: Tue, 27 Oct 2015 14:17:00 -0000	[thread overview]
Message-ID: <20151027141505.GG478@tucnak.redhat.com> (raw)
In-Reply-To: <20151027140655.GC46998@msticlxl57.ims.intel.com>

On Tue, Oct 27, 2015 at 05:06:58PM +0300, Kirill Yukhin wrote:
> Boostrapped. Regtesting is in progress. Is it ok for trunk if pass?
> 
> gcc/
>         * cp/parser.h (cp_parser): Add simd_attr_present.
>         * cp/parser.c (cp_parser_late_return_type_opt): Handle simd_attr_present,
> 	require comman in __vector__ attribute.
>         (cp_parser_gnu_attribute_list): Ditto.
>         * c/c-parser.c (c_parser): Add simd_attr_present flag.
>         (c_parser_declaration_or_fndef): Call c_parser_declaration_or_fndef
>         if simd_attr_present is set.

gcc/cp/ and gcc/c/ have their own ChangeLog files, therefore cp/ or c/
prefixes should also never appear in the ChangeLog entries.

>         (c_finish_omp_declare_simd): Handle simd_attr_present.
>         * doc/extend.texi (simd): Document new attribute.
>         * omp-low.c (pass_omp_simd_clone::gate): If target allows - call
>         without additional conditions.
> gcc/testsuite/
>         * c-c++-common/attr-simd.c: New test.
>         * c-c++-common/attr-simd-2.c: Ditto.
>         * c-c++-common/attr-simd-3.c: Ditto.
> -      error ("%<#pragma omp declare simd%> cannot be used in the same "
> +      error ("%<#pragma omp declare simd%> or __simd__ attribute cannot be used in the same "

I'd write %<simd%> instead of __simd__.  __simd__ is just one of the
possible spellings of the attribute...

>  	     "function marked as a Cilk Plus SIMD-enabled function");
>        vec_free (parser->cilk_simd_fn_tokens);
>        return;
> @@ -15423,7 +15441,7 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
>    unsigned int tokens_avail = parser->tokens_avail;
>    gcc_assert (parser->tokens == &parser->tokens_buf[0]);
>    bool is_cilkplus_cilk_simd_fn = false;
> -  
> + 
>    if (flag_cilkplus && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))

If you are changing this, please remove all trailing whitespace from the
empty line.

> +  if (parser->simd_attr_present
> +      && is_cilkplus_cilk_simd_fn)

This could fit on one line
  if (parser->simd_attr_present && is_cilkplus_cilk_simd_fn)
just fine.

> +      error ("SIMD-enabled function attributes"
> +	     "are allowed when attribute __simd__ is specified");

See earlier.
>  
> +  /* Attach `omp declare simd’ attribute if __simd__ is specified AND no OpenMP clauses
> +     present in decl.  */
> +  if (parser->simd_attr_present
> +      && parser->tokens_avail == 0)

See earlier.

> @@ -19363,6 +19365,18 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_declarator *declarator,
>        = cp_parser_late_parsing_omp_declare_simd (parser,
>  						 declarator->std_attributes);
>  
> +  if (parser->simd_attr_present
> +      && !declare_simd_p)

Ditto.
> +    {
> +      if (cilk_simd_fn_vector_p)
> +	error ("__simd__ attribute cannot be used in the same function"
> +	       " marked as a Cilk Plus SIMD-enabled function");

Ditto.

> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> index ad7c017..232dc5c 100644
> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -17412,10 +17412,7 @@ public:
>  bool
>  pass_omp_simd_clone::gate (function *)
>  {
> -  return ((flag_openmp || flag_openmp_simd
> -	   || flag_cilkplus
> -	   || (in_lto_p && !flag_wpa))
> -	  && (targetm.simd_clone.compute_vecsize_and_simdlen != NULL));
> +  return targetm.simd_clone.compute_vecsize_and_simdlen != NULL;
>  }
>  
>  } // anon namespace

I wonder what the compile time effect this will have.
have (alternative is of course 

> diff --git a/gcc/testsuite/c-c++-common/attr-simd-2.c b/gcc/testsuite/c-c++-common/attr-simd-2.c
> new file mode 100644
> index 0000000..e9afc11
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/attr-simd-2.c
> @@ -0,0 +1,11 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fdump-tree-optimized -fopenmp-simd" } */
> +
> +#pragma omp declare simd
> +__attribute__((__simd__))
> +static int simd_attr (void)
> +{
> +  return 0;
> +}
> +
> +/* { dg-final { scan-tree-dump "omp declare simd" "optimized" } } */

You should also test other spellings of the attribute...

	Jakub

  reply	other threads:[~2015-10-27 14:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20151005130733.GB62312@msticlxl57.ims.intel.com>
     [not found] ` <alpine.DEB.2.10.1510051320120.16355@digraph.polyomino.org.uk>
     [not found]   ` <561551B0.70507@redhat.com>
2015-10-14 12:36     ` Kirill Yukhin
2015-10-14 13:40       ` Joseph Myers
2015-10-15 14:34         ` Kirill Yukhin
2015-10-15 14:39           ` Jakub Jelinek
2015-10-15 14:48             ` Kirill Yukhin
2015-10-22 12:25               ` Kirill Yukhin
2015-10-22 12:50                 ` Joseph Myers
2015-10-23 14:16                   ` Kirill Yukhin
2015-10-23 14:23                     ` Joseph Myers
2015-10-27 14:09                       ` Kirill Yukhin
2015-10-27 14:17                         ` Jakub Jelinek [this message]
2015-10-28  9:40                           ` Kirill Yukhin
2015-10-29  8:56                             ` Jakub Jelinek
2015-11-10  8:44                               ` Kirill Yukhin
2015-11-10  8:58                                 ` Jakub Jelinek
2015-11-13 11:55                                   ` Kirill Yukhin
2015-11-13 12:16                                     ` Jakub Jelinek
2015-12-02 12:47                                       ` Kirill Yukhin
2015-12-02 17:40                                         ` Jeff Law
2015-12-02 17:42                                           ` Jakub Jelinek
2015-11-18  9:39                                     ` Andreas Schwab
2015-11-18  9:46                                     ` Andreas Schwab
2015-11-18 14:11                                       ` Kirill Yukhin
2015-11-18 17:01                                         ` Jeff Law
2015-11-20 12:15                                         ` Kyrill Tkachov
2015-11-20 13:33                                           ` Kirill Yukhin
2015-11-20 19:48                                           ` Jeff Law
2015-11-17 16:10 David Edelsohn

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=20151027141505.GG478@tucnak.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=kirill.yukhin@gmail.com \
    --cc=law@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).