public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
       [not found]   ` <561551B0.70507@redhat.com>
@ 2015-10-14 12:36     ` Kirill Yukhin
  2015-10-14 13:40       ` Joseph Myers
  0 siblings, 1 reply; 28+ messages in thread
From: Kirill Yukhin @ 2015-10-14 12:36 UTC (permalink / raw)
  To: Jeff Law; +Cc: Joseph Myers, Jakub Jelinek, GCC Patches

Hello,
On 07 Oct 11:09, Jeff Law wrote:
> On 10/05/2015 07:24 AM, Joseph Myers wrote:
> >On Mon, 5 Oct 2015, Kirill Yukhin wrote:
> >
> >>To enable vectorization of loops w/ calls to math functions it is reasonable
> >>to enable parsing of attribute vector for functions unconditionally and
> >>change GlibC's header file not to use `omp declare simd', but use
> >>__attribute__((vector)) instead.
> >
> >I assume you mean __vector__, for namespace reasons.  Obviously you need
> >appropriate GCC version conditionals in the headers to use the attribute
> >only when supported.  In addition, (a) this attribute doesn't seem to be
> >documented in extend.texi, and you'll need to include documentation in
> >your GCC patch that makes this a generic extension rather than just part
> >of Cilkplus, and (b) you'll need to agree with the x86_64 ABI mailing list
> >an extension of the ABI document (as attached to
> ><https://sourceware.org/glibc/wiki/libmvec>) to cover this attribute, and
> >update the document there.
> I'm not sure why this attribute isn't documented, but clearly that should be
> fixed.
> 
> From the GCC side, I don't see a compelling reason to keep this attribute
> conditional on Cilk+ support.   One could very easily want to use the math
> library's vector entry points independent of OpenMP or Cilk+.
> 
> I thought the ABI for this stuff was consistent across the implementations
> (that was certainly the goal).  So aside from an example of how to use the
> attribute to get calls into the vector math library, I'm not sure what's
> needed.  Essentially the attribute is just another way to ensure we exploit
> the vector library when possible.
> 
> It also seems to me that showing that example on the libmvec page would be
> advisable.

Patch in the bottom introduces new attribute called `simd'.
I've decided to introduce a new one since Cilk's `vector' attribute
generates only one version of SIMD-enabled function [1] (which one -
implementation specific).

This new attribute shouldn't be used along w/ Cilk's `vector'.
If it is used w/ `pragma omp declare simd' - it is ignored.

Bootstrapped. New tests pass.

gcc/
	* 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.
	(c_finish_omp_declare_simd): Handle simd_attr_present.
	* 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.

Is it ok for trunk?

Here is a description for new attribute:
simd
	Enables creation of one or more versions that can process multiple arguments using
	SIMD instructions from a single invocation from a SIMD loop. It is ultimately an alias
	to `omp declare simd’ pragma, available w/o additional compiler switches.
	It is prohibited to use the attribute along with Cilk Plus’s `vector’ attribute.
	If the attribute is specified and `pragma omp declare simd’ presents on a decl, then
	the attribute is ignored.

[1] - https://www.cilkplus.org/sites/default/files/open_specifications/Intel_Cilk_plus_lang_spec_1.2.htm#elem.attr

--
Thanks, K

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 2d24c21..b83c9d8 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -224,6 +224,9 @@ struct GTY(()) c_parser {
   /* Buffer to hold all the tokens from parsing the vector attribute for the
      SIMD-enabled functions (formerly known as elemental functions).  */
   vec <c_token, va_gc> *cilk_simd_fn_tokens;
+
+  /* Designates if "simd" attribute is specified in decl.  */
+  BOOL_BITFIELD simd_attr_present : 1;
 };
 
 
@@ -1700,7 +1703,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
       if (declarator == NULL)
 	{
 	  if (omp_declare_simd_clauses.exists ()
-	      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+	      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+	      || parser->simd_attr_present)
 	    c_finish_omp_declare_simd (parser, NULL_TREE, NULL_TREE,
 				       omp_declare_simd_clauses);
 	  c_parser_skip_to_end_of_block_or_statement (parser);
@@ -1796,7 +1800,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
-		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		      || parser->simd_attr_present)
 		    c_finish_omp_declare_simd (parser, d, NULL_TREE,
 					       omp_declare_simd_clauses);
 		}
@@ -1809,7 +1814,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
-		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		      || parser->simd_attr_present)
 		    c_finish_omp_declare_simd (parser, d, NULL_TREE,
 					       omp_declare_simd_clauses);
 		  start_init (d, asm_name, global_bindings_p ());
@@ -1838,7 +1844,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 				   chainon (postfix_attrs,
 					    all_prefix_attrs));
 	      if (omp_declare_simd_clauses.exists ()
-		  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		  || parser->simd_attr_present)
 		{
 		  tree parms = NULL_TREE;
 		  if (d && TREE_CODE (d) == FUNCTION_DECL)
@@ -1967,7 +1974,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 				       true, false, NULL, vNULL);
       store_parm_decls ();
       if (omp_declare_simd_clauses.exists ()
-	  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+	  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+	  || parser->simd_attr_present)
 	c_finish_omp_declare_simd (parser, current_function_decl, NULL_TREE,
 				   omp_declare_simd_clauses);
       DECL_STRUCT_FUNCTION (current_function_decl)->function_start_locus
@@ -3998,6 +4006,12 @@ c_parser_attributes (c_parser *parser)
 	      c_parser_cilk_simd_fn_vector_attrs (parser, *v_token);
 	      continue;
 	    }
+	  if (is_attribute_p ("simd", attr_name))
+	    {
+	      parser->simd_attr_present = 1;
+	      c_parser_consume_token (parser);
+	      continue;
+	    }
 	  c_parser_consume_token (parser);
 	  if (c_parser_next_token_is_not (parser, CPP_OPEN_PAREN))
 	    {
@@ -14210,9 +14224,10 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
 			   vec<c_token> clauses)
 {
   if (flag_cilkplus
-      && clauses.exists () && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+      && (clauses.exists () || parser->simd_attr_present)
+      && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
     {
-      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 "
 	     "function marked as a Cilk Plus SIMD-enabled function");
       vec_free (parser->cilk_simd_fn_tokens);
       return;
@@ -14257,41 +14272,63 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
       parser->tokens = clauses.address ();
       parser->tokens_avail = clauses.length ();
     }
-  
-  /* c_parser_omp_declare_simd pushed 2 extra CPP_EOF tokens at the end.  */
-  while (parser->tokens_avail > 3)
+
+  if (parser->simd_attr_present
+      && is_cilkplus_cilk_simd_fn)
     {
-      c_token *token = c_parser_peek_token (parser);
-      if (!is_cilkplus_cilk_simd_fn) 
-	gcc_assert (token->type == CPP_NAME 
-		    && strcmp (IDENTIFIER_POINTER (token->value), "simd") == 0);
-      else
-	gcc_assert (token->type == CPP_NAME
-		    && is_cilkplus_vector_p (token->value));
-      c_parser_consume_token (parser);
-      parser->in_pragma = true;
+      error ("SIMD-enabled function attributes"
+	     "are allowed when attribute __simd__ is specified");
+      clauses[0].type = CPP_EOF;
+      return;
+    }
 
+  /* 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)
+    {
       tree c = NULL_TREE;
-      if (is_cilkplus_cilk_simd_fn) 
-	c = c_parser_omp_all_clauses (parser, CILK_SIMD_FN_CLAUSE_MASK,
-				      "SIMD-enabled functions attribute");
-      else 
-	c = c_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
-				      "#pragma omp declare simd");
-      c = c_omp_declare_simd_clauses_to_numbers (parms, c);
-      if (c != NULL_TREE)
-	c = tree_cons (NULL_TREE, c, NULL_TREE);
-      if (is_cilkplus_cilk_simd_fn) 
-	{ 
-	  tree k = build_tree_list (get_identifier ("cilk simd function"), 
-				    NULL_TREE);
-	  TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
-	  DECL_ATTRIBUTES (fndecl) = k;
-	} 
       c = build_tree_list (get_identifier ("omp declare simd"), c);
       TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
       DECL_ATTRIBUTES (fndecl) = c;
     }
+  else
+    {
+      /* c_parser_omp_declare_simd pushed 2 extra CPP_EOF tokens at the end.  */
+      while (parser->tokens_avail > 3)
+	{
+	  c_token *token = c_parser_peek_token (parser);
+	  if (!is_cilkplus_cilk_simd_fn)
+	    gcc_assert (token->type == CPP_NAME
+			&& strcmp (IDENTIFIER_POINTER (token->value), "simd") == 0);
+	  else
+	    gcc_assert (token->type == CPP_NAME
+			&& is_cilkplus_vector_p (token->value));
+	  c_parser_consume_token (parser);
+	  parser->in_pragma = true;
+
+	  tree c = NULL_TREE;
+	  if (is_cilkplus_cilk_simd_fn)
+	    c = c_parser_omp_all_clauses (parser, CILK_SIMD_FN_CLAUSE_MASK,
+					  "SIMD-enabled functions attribute");
+	  else
+	    c = c_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
+					  "#pragma omp declare simd");
+	  c = c_omp_declare_simd_clauses_to_numbers (parms, c);
+	  if (c != NULL_TREE)
+	    c = tree_cons (NULL_TREE, c, NULL_TREE);
+	  if (is_cilkplus_cilk_simd_fn)
+	    {
+	      tree k = build_tree_list (get_identifier ("cilk simd function"),
+					NULL_TREE);
+	      TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
+	      DECL_ATTRIBUTES (fndecl) = k;
+	    }
+	  c = build_tree_list (get_identifier ("omp declare simd"), c);
+	  TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
+	  DECL_ATTRIBUTES (fndecl) = c;
+	}
+    }
 
   parser->tokens = &parser->tokens_buf[0];
   parser->tokens_avail = tokens_avail;
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index cdcf9d6..87537cd 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -13919,10 +13919,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
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..263fa9a
--- /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 "simdclone" "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
new file mode 100644
index 0000000..2bbdf04
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
+
+void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
new file mode 100644
index 0000000..5dad89c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+
+__attribute__((__simd__))
+static int simd_attr (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "simdclone" "optimized" } } */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-14 12:36     ` [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC Kirill Yukhin
@ 2015-10-14 13:40       ` Joseph Myers
  2015-10-15 14:34         ` Kirill Yukhin
  0 siblings, 1 reply; 28+ messages in thread
From: Joseph Myers @ 2015-10-14 13:40 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Jeff Law, Jakub Jelinek, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]

On Wed, 14 Oct 2015, Kirill Yukhin wrote:

> Is it ok for trunk?

This patch has no documentation.  Documentation for new attributes must be 
added to extend.texi.

> Enables creation of one or more versions that can process multiple 
> arguments using SIMD instructions from a single invocation from a SIMD 
> loop. It is ultimately an alias to `omp declare simd’ pragma, available 
> w/o additional compiler switches. It is prohibited to use the attribute 
> along with Cilk Plus’s `vector’ attribute. If the attribute is specified 
> and `pragma omp declare simd’ presents on a decl, then the attribute is 
> ignored.

This is missing the key information that it's not just about *creation* of 
the versions, it's about (in the case of an external declaration) 
*assuming* such versions were created in another translation unit.  And 
you should have a link to the external ABI documents specifying for each 
architecture for which this involves such an assumption exactly what 
versions may be assumed to be present - this is what's required to be able 
to use the attribute in headers for a library and know that future GCC 
versions won't reinterpret the attribute as implying some versions for 
future ISA extensions are also present.

I wonder whether the syntax for this attribute should allow optional 
arguments to describe what versions are present, but maybe that can be 
deferred until e.g. you want a way in future for a library to specify it 
has an AVX1024 version of a function as well as the baseline ABI set of 
versions.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-14 13:40       ` Joseph Myers
@ 2015-10-15 14:34         ` Kirill Yukhin
  2015-10-15 14:39           ` Jakub Jelinek
  0 siblings, 1 reply; 28+ messages in thread
From: Kirill Yukhin @ 2015-10-15 14:34 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Jeff Law, Jakub Jelinek, GCC Patches

Hello,
On 14 Oct 13:40, Joseph Myers wrote:
> On Wed, 14 Oct 2015, Kirill Yukhin wrote:
> 
> > Is it ok for trunk?
> 
> This patch has no documentation.  Documentation for new attributes must be 
> added to extend.texi.
Fixed. Extra entry to gcc/Changelog:
	* doc/extend.texi (simd): Document new attribute.

> > Enables creation of one or more versions that can process multiple 
> > arguments using SIMD instructions from a single invocation from a SIMD 
> > loop. It is ultimately an alias to `omp declare simd’ pragma, available 
> > w/o additional compiler switches. It is prohibited to use the attribute 
> > along with Cilk Plus’s `vector’ attribute. If the attribute is specified 
> > and `pragma omp declare simd’ presents on a decl, then the attribute is 
> > ignored.
> 
> This is missing the key information that it's not just about *creation* of 
> the versions, it's about (in the case of an external declaration) 
> *assuming* such versions were created in another translation unit.  And 
> you should have a link to the external ABI documents specifying for each 
> architecture for which this involves such an assumption exactly what 
> versions may be assumed to be present - this is what's required to be able 
> to use the attribute in headers for a library and know that future GCC 
> versions won't reinterpret the attribute as implying some versions for 
> future ISA extensions are also present.
I've put reference to x86_64 Vector ABI in the attribute documentation.


> I wonder whether the syntax for this attribute should allow optional 
> arguments to describe what versions are present, but maybe that can be 
> deferred until e.g. you want a way in future for a library to specify it 
> has an AVX1024 version of a function as well as the baseline ABI set of 
> versions.
We'll add it later when needed.

> Joseph S. Myers
> joseph@codesourcery.com

--
Thanks, K

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 2d24c21..b83c9d8 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -224,6 +224,9 @@ struct GTY(()) c_parser {
   /* Buffer to hold all the tokens from parsing the vector attribute for the
      SIMD-enabled functions (formerly known as elemental functions).  */
   vec <c_token, va_gc> *cilk_simd_fn_tokens;
+
+  /* Designates if "simd" attribute is specified in decl.  */
+  BOOL_BITFIELD simd_attr_present : 1;
 };
 
 
@@ -1700,7 +1703,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
       if (declarator == NULL)
 	{
 	  if (omp_declare_simd_clauses.exists ()
-	      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+	      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+	      || parser->simd_attr_present)
 	    c_finish_omp_declare_simd (parser, NULL_TREE, NULL_TREE,
 				       omp_declare_simd_clauses);
 	  c_parser_skip_to_end_of_block_or_statement (parser);
@@ -1796,7 +1800,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
-		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		      || parser->simd_attr_present)
 		    c_finish_omp_declare_simd (parser, d, NULL_TREE,
 					       omp_declare_simd_clauses);
 		}
@@ -1809,7 +1814,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
-		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		      || parser->simd_attr_present)
 		    c_finish_omp_declare_simd (parser, d, NULL_TREE,
 					       omp_declare_simd_clauses);
 		  start_init (d, asm_name, global_bindings_p ());
@@ -1838,7 +1844,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 				   chainon (postfix_attrs,
 					    all_prefix_attrs));
 	      if (omp_declare_simd_clauses.exists ()
-		  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		  || parser->simd_attr_present)
 		{
 		  tree parms = NULL_TREE;
 		  if (d && TREE_CODE (d) == FUNCTION_DECL)
@@ -1967,7 +1974,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 				       true, false, NULL, vNULL);
       store_parm_decls ();
       if (omp_declare_simd_clauses.exists ()
-	  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+	  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+	  || parser->simd_attr_present)
 	c_finish_omp_declare_simd (parser, current_function_decl, NULL_TREE,
 				   omp_declare_simd_clauses);
       DECL_STRUCT_FUNCTION (current_function_decl)->function_start_locus
@@ -3998,6 +4006,12 @@ c_parser_attributes (c_parser *parser)
 	      c_parser_cilk_simd_fn_vector_attrs (parser, *v_token);
 	      continue;
 	    }
+	  if (is_attribute_p ("simd", attr_name))
+	    {
+	      parser->simd_attr_present = 1;
+	      c_parser_consume_token (parser);
+	      continue;
+	    }
 	  c_parser_consume_token (parser);
 	  if (c_parser_next_token_is_not (parser, CPP_OPEN_PAREN))
 	    {
@@ -14210,9 +14224,10 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
 			   vec<c_token> clauses)
 {
   if (flag_cilkplus
-      && clauses.exists () && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+      && (clauses.exists () || parser->simd_attr_present)
+      && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
     {
-      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 "
 	     "function marked as a Cilk Plus SIMD-enabled function");
       vec_free (parser->cilk_simd_fn_tokens);
       return;
@@ -14245,7 +14260,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))
     {
       parser->tokens = parser->cilk_simd_fn_tokens->address ();
@@ -14257,41 +14272,63 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
       parser->tokens = clauses.address ();
       parser->tokens_avail = clauses.length ();
     }
-  
-  /* c_parser_omp_declare_simd pushed 2 extra CPP_EOF tokens at the end.  */
-  while (parser->tokens_avail > 3)
+
+  if (parser->simd_attr_present
+      && is_cilkplus_cilk_simd_fn)
     {
-      c_token *token = c_parser_peek_token (parser);
-      if (!is_cilkplus_cilk_simd_fn) 
-	gcc_assert (token->type == CPP_NAME 
-		    && strcmp (IDENTIFIER_POINTER (token->value), "simd") == 0);
-      else
-	gcc_assert (token->type == CPP_NAME
-		    && is_cilkplus_vector_p (token->value));
-      c_parser_consume_token (parser);
-      parser->in_pragma = true;
+      error ("SIMD-enabled function attributes"
+	     "are allowed when attribute __simd__ is specified");
+      clauses[0].type = CPP_EOF;
+      return;
+    }
 
+  /* 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)
+    {
       tree c = NULL_TREE;
-      if (is_cilkplus_cilk_simd_fn) 
-	c = c_parser_omp_all_clauses (parser, CILK_SIMD_FN_CLAUSE_MASK,
-				      "SIMD-enabled functions attribute");
-      else 
-	c = c_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
-				      "#pragma omp declare simd");
-      c = c_omp_declare_simd_clauses_to_numbers (parms, c);
-      if (c != NULL_TREE)
-	c = tree_cons (NULL_TREE, c, NULL_TREE);
-      if (is_cilkplus_cilk_simd_fn) 
-	{ 
-	  tree k = build_tree_list (get_identifier ("cilk simd function"), 
-				    NULL_TREE);
-	  TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
-	  DECL_ATTRIBUTES (fndecl) = k;
-	} 
       c = build_tree_list (get_identifier ("omp declare simd"), c);
       TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
       DECL_ATTRIBUTES (fndecl) = c;
     }
+  else
+    {
+      /* c_parser_omp_declare_simd pushed 2 extra CPP_EOF tokens at the end.  */
+      while (parser->tokens_avail > 3)
+	{
+	  c_token *token = c_parser_peek_token (parser);
+	  if (!is_cilkplus_cilk_simd_fn)
+	    gcc_assert (token->type == CPP_NAME
+			&& strcmp (IDENTIFIER_POINTER (token->value), "simd") == 0);
+	  else
+	    gcc_assert (token->type == CPP_NAME
+			&& is_cilkplus_vector_p (token->value));
+	  c_parser_consume_token (parser);
+	  parser->in_pragma = true;
+
+	  tree c = NULL_TREE;
+	  if (is_cilkplus_cilk_simd_fn)
+	    c = c_parser_omp_all_clauses (parser, CILK_SIMD_FN_CLAUSE_MASK,
+					  "SIMD-enabled functions attribute");
+	  else
+	    c = c_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
+					  "#pragma omp declare simd");
+	  c = c_omp_declare_simd_clauses_to_numbers (parms, c);
+	  if (c != NULL_TREE)
+	    c = tree_cons (NULL_TREE, c, NULL_TREE);
+	  if (is_cilkplus_cilk_simd_fn)
+	    {
+	      tree k = build_tree_list (get_identifier ("cilk simd function"),
+					NULL_TREE);
+	      TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
+	      DECL_ATTRIBUTES (fndecl) = k;
+	    }
+	  c = build_tree_list (get_identifier ("omp declare simd"), c);
+	  TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
+	  DECL_ATTRIBUTES (fndecl) = c;
+	}
+    }
 
   parser->tokens = &parser->tokens_buf[0];
   parser->tokens_avail = tokens_avail;
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 79440d3..6296a80 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3066,6 +3066,20 @@ This function attribute make a stack protection of the function if
 flags @option{fstack-protector} or @option{fstack-protector-strong}
 or @option{fstack-protector-explicit} are set.
 
+@item simd
+@cindex @code{simd} function attribute.
+This attribute enables creation of one or more function versions that
+can process multiple arguments using SIMD instructions from a
+single invocation.  Specifying this attribute allows compiler to
+assume that such a versions are available at link time (provided
+in the same or another translation unit).  Generated versions are
+target dependent and described in corresponding Vector ABI document.  For
+x86_64 target this document can be found
+@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
+It is prohibited to use the attribute along with Cilk Plus's @code{vector}
+attribute. If the attribute is specified and @code{#pragma omp declare simd}
+presented on a declaration, then the attribute is ignored.
+
 @item target (@var{options})
 @cindex @code{target} function attribute
 Multiple target back ends implement the @code{target} attribute
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index cdcf9d6..87537cd 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -13919,10 +13919,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
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..263fa9a
--- /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 "simdclone" "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
new file mode 100644
index 0000000..2bbdf04
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
+
+void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
new file mode 100644
index 0000000..5dad89c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+
+__attribute__((__simd__))
+static int simd_attr (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "simdclone" "optimized" } } */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-15 14:34         ` Kirill Yukhin
@ 2015-10-15 14:39           ` Jakub Jelinek
  2015-10-15 14:48             ` Kirill Yukhin
  0 siblings, 1 reply; 28+ messages in thread
From: Jakub Jelinek @ 2015-10-15 14:39 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Joseph Myers, Jeff Law, GCC Patches

On Thu, Oct 15, 2015 at 05:33:32PM +0300, Kirill Yukhin wrote:
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -3066,6 +3066,20 @@ This function attribute make a stack protection of the function if
>  flags @option{fstack-protector} or @option{fstack-protector-strong}
>  or @option{fstack-protector-explicit} are set.
>  
> +@item simd
> +@cindex @code{simd} function attribute.
> +This attribute enables creation of one or more function versions that
> +can process multiple arguments using SIMD instructions from a
> +single invocation.  Specifying this attribute allows compiler to
> +assume that such a versions are available at link time (provided
> +in the same or another translation unit).  Generated versions are
> +target dependent and described in corresponding Vector ABI document.  For
> +x86_64 target this document can be found
> +@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
> +It is prohibited to use the attribute along with Cilk Plus's @code{vector}
> +attribute. If the attribute is specified and @code{#pragma omp declare simd}
> +presented on a declaration, then the attribute is ignored.

Is that what is implemented?  I mean, isn't the argument ignored only
if #pragma omp declare simd is present and -fopenmp or -fopenmp-simd
passed on the command line, because otherwise the pragma is ignored?

	Jakub

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-15 14:39           ` Jakub Jelinek
@ 2015-10-15 14:48             ` Kirill Yukhin
  2015-10-22 12:25               ` Kirill Yukhin
  0 siblings, 1 reply; 28+ messages in thread
From: Kirill Yukhin @ 2015-10-15 14:48 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Joseph Myers, Jeff Law, GCC Patches

Hi Jakub,
On 15 Oct 16:39, Jakub Jelinek wrote:
> On Thu, Oct 15, 2015 at 05:33:32PM +0300, Kirill Yukhin wrote:
> > --- a/gcc/doc/extend.texi
> > +++ b/gcc/doc/extend.texi
> > @@ -3066,6 +3066,20 @@ This function attribute make a stack protection of the function if
> >  flags @option{fstack-protector} or @option{fstack-protector-strong}
> >  or @option{fstack-protector-explicit} are set.
> >  
> > +@item simd
> > +@cindex @code{simd} function attribute.
> > +This attribute enables creation of one or more function versions that
> > +can process multiple arguments using SIMD instructions from a
> > +single invocation.  Specifying this attribute allows compiler to
> > +assume that such a versions are available at link time (provided
> > +in the same or another translation unit).  Generated versions are
> > +target dependent and described in corresponding Vector ABI document.  For
> > +x86_64 target this document can be found
> > +@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
> > +It is prohibited to use the attribute along with Cilk Plus's @code{vector}
> > +attribute. If the attribute is specified and @code{#pragma omp declare simd}
> > +presented on a declaration, then the attribute is ignored.
> 
> Is that what is implemented?  I mean, isn't the argument ignored only
> if #pragma omp declare simd is present and -fopenmp or -fopenmp-simd
> passed on the command line, because otherwise the pragma is ignored?
You're right. The attribute is ignored if `pragma omp declare simd' is
got in charge. Which happens only if -fopenmp or -fopenmp-simd is
are passed. 
Updated hunk for doc/extend.texi is in the bottom.

> 
> 	Jakub

--
Thanks, K

$ git show
commit ffda5e84f2b79a28f4104b1eda2df0f907821ec0
Author: Kirill Yukhin <kirill.yukhin@intel.com>
Date:   Thu Oct 15 17:10:53 2015 +0300

    [vector-attr] Add documentation.

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 79440d3..d9463d8 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3066,6 +3066,21 @@ This function attribute make a stack protection of the function if
 flags @option{fstack-protector} or @option{fstack-protector-strong}
 or @option{fstack-protector-explicit} are set.

+@item simd
+@cindex @code{simd} function attribute.
+This attribute enables creation of one or more function versions that
+can process multiple arguments using SIMD instructions from a
+single invocation.  Specifying this attribute allows compiler to
+assume that such a versions are available at link time (provided
+in the same or another translation unit).  Generated versions are
+target dependent and described in corresponding Vector ABI document.  For
+x86_64 target this document can be found
+@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
+It is prohibited to use the attribute along with Cilk Plus's @code{vector}
+attribute. If the attribute is specified and @code{#pragma omp declare simd}
+presented on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}
+switch is specified, then the attribute is ignored.
+
 @item target (@var{options})
 @cindex @code{target} function attribute
 Multiple target back ends implement the @code{target} attribute

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-15 14:48             ` Kirill Yukhin
@ 2015-10-22 12:25               ` Kirill Yukhin
  2015-10-22 12:50                 ` Joseph Myers
  0 siblings, 1 reply; 28+ messages in thread
From: Kirill Yukhin @ 2015-10-22 12:25 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Joseph Myers, Jeff Law, GCC Patches

Hello,
On 15 Oct 17:47, Kirill Yukhin wrote:
> Hi Jakub,
> On 15 Oct 16:39, Jakub Jelinek wrote:
> > On Thu, Oct 15, 2015 at 05:33:32PM +0300, Kirill Yukhin wrote:
> > > --- a/gcc/doc/extend.texi
> > > +++ b/gcc/doc/extend.texi
> > > @@ -3066,6 +3066,20 @@ This function attribute make a stack protection of the function if
> > >  flags @option{fstack-protector} or @option{fstack-protector-strong}
> > >  or @option{fstack-protector-explicit} are set.
> > >  
> > > +@item simd
> > > +@cindex @code{simd} function attribute.
> > > +This attribute enables creation of one or more function versions that
> > > +can process multiple arguments using SIMD instructions from a
> > > +single invocation.  Specifying this attribute allows compiler to
> > > +assume that such a versions are available at link time (provided
> > > +in the same or another translation unit).  Generated versions are
> > > +target dependent and described in corresponding Vector ABI document.  For
> > > +x86_64 target this document can be found
> > > +@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
> > > +It is prohibited to use the attribute along with Cilk Plus's @code{vector}
> > > +attribute. If the attribute is specified and @code{#pragma omp declare simd}
> > > +presented on a declaration, then the attribute is ignored.
> > 
> > Is that what is implemented?  I mean, isn't the argument ignored only
> > if #pragma omp declare simd is present and -fopenmp or -fopenmp-simd
> > passed on the command line, because otherwise the pragma is ignored?
> You're right. The attribute is ignored if `pragma omp declare simd' is
> got in charge. Which happens only if -fopenmp or -fopenmp-simd is
> are passed. 
> Updated hunk for doc/extend.texi is in the bottom.
Ping?

--
Thanks, K

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-22 12:25               ` Kirill Yukhin
@ 2015-10-22 12:50                 ` Joseph Myers
  2015-10-23 14:16                   ` Kirill Yukhin
  0 siblings, 1 reply; 28+ messages in thread
From: Joseph Myers @ 2015-10-22 12:50 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Jakub Jelinek, Jeff Law, GCC Patches

On Thu, 22 Oct 2015, Kirill Yukhin wrote:

> Ping?

You need to update this patch to take account of Marek's fix for bug 67964 
(it was because I was suspicious of the "continue;" in this patch 
accepting invalid syntax that I found that bug), retest and resubmit.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-22 12:50                 ` Joseph Myers
@ 2015-10-23 14:16                   ` Kirill Yukhin
  2015-10-23 14:23                     ` Joseph Myers
  0 siblings, 1 reply; 28+ messages in thread
From: Kirill Yukhin @ 2015-10-23 14:16 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Jakub Jelinek, Jeff Law, GCC Patches

Hello Joseph,
On 22 Oct 12:48, Joseph Myers wrote:
> On Thu, 22 Oct 2015, Kirill Yukhin wrote:
> 
> > Ping?
> 
> You need to update this patch to take account of Marek's fix for bug 67964 
> (it was because I was suspicious of the "continue;" in this patch 
> accepting invalid syntax that I found that bug), retest and resubmit.
I've rebased the patch on top of current trunk.
Additionally I've discovered that despite of the tests being in c-c++-common,
attribute was added to C only. I've added it to C++ as well.

Updated ChangeLog:
gcc/
	* cp/parser.h (cp_parser): Add simd_attr_present.
	* cp/parser.c (cp_parser_late_return_type_opt): Handle simd_attr_present.
	(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.
	(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.

Bootstrapped. Regtests showed 2 flakys (IMHO) + all new tests PASS:
$ 26110-vector-attr-2-ref/src/gcc/contrib/compare_tests *ref *exp
# Comparing directories
## Dir1=26110-vector-attr-2-ref: 4 sum files
## Dir2=26121-vector-attr-2-exp: 4 sum files

# Comparing 4 common sum files
## /bin/sh 26110-vector-attr-2-ref/src/gcc/contrib/compare_tests  /tmp/gxx-sum1.11112 /tmp/gxx-sum2.11112
Tests that now fail, but worked before:

gcc.dg/cpp/_Pragma3.c (test for excess errors)
gcc.dg/pragma-diag-5.c missing (test for warnings, line 2)
unix/-m32: gcc.dg/cpp/_Pragma3.c (test for excess errors)
unix/-m32: gcc.dg/pragma-diag-5.c missing (test for warnings, line 2)

Is it ok for trunk?

--
Thanks, K

> -- 
> Joseph S. Myers
> joseph@codesourcery.com

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index c8c6a2d..ae6122a 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -224,6 +224,9 @@ struct GTY(()) c_parser {
   /* Buffer to hold all the tokens from parsing the vector attribute for the
      SIMD-enabled functions (formerly known as elemental functions).  */
   vec <c_token, va_gc> *cilk_simd_fn_tokens;
+
+  /* Designates if "simd" attribute is specified in decl.  */
+  BOOL_BITFIELD simd_attr_present : 1;
 };
 
 
@@ -1701,7 +1704,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
       if (declarator == NULL)
 	{
 	  if (omp_declare_simd_clauses.exists ()
-	      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+	      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+	      || parser->simd_attr_present)
 	    c_finish_omp_declare_simd (parser, NULL_TREE, NULL_TREE,
 				       omp_declare_simd_clauses);
 	  c_parser_skip_to_end_of_block_or_statement (parser);
@@ -1797,7 +1801,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
-		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		      || parser->simd_attr_present)
 		    c_finish_omp_declare_simd (parser, d, NULL_TREE,
 					       omp_declare_simd_clauses);
 		}
@@ -1810,7 +1815,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
-		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		      || parser->simd_attr_present)
 		    c_finish_omp_declare_simd (parser, d, NULL_TREE,
 					       omp_declare_simd_clauses);
 		  start_init (d, asm_name, global_bindings_p ());
@@ -1839,7 +1845,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 				   chainon (postfix_attrs,
 					    all_prefix_attrs));
 	      if (omp_declare_simd_clauses.exists ()
-		  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		  || parser->simd_attr_present)
 		{
 		  tree parms = NULL_TREE;
 		  if (d && TREE_CODE (d) == FUNCTION_DECL)
@@ -1968,7 +1975,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 				       true, false, NULL, vNULL);
       store_parm_decls ();
       if (omp_declare_simd_clauses.exists ()
-	  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+	  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+	  || parser->simd_attr_present)
 	c_finish_omp_declare_simd (parser, current_function_decl, NULL_TREE,
 				   omp_declare_simd_clauses);
       DECL_STRUCT_FUNCTION (current_function_decl)->function_start_locus
@@ -3993,6 +4001,12 @@ c_parser_attributes (c_parser *parser)
 		break;
 	      continue;
 	    }
+	  if (is_attribute_p ("simd", attr_name))
+	    {
+	      parser->simd_attr_present = 1;
+	      c_parser_consume_token (parser);
+	      continue;
+	    }
 	  c_parser_consume_token (parser);
 	  if (c_parser_next_token_is_not (parser, CPP_OPEN_PAREN))
 	    {
@@ -15388,9 +15402,10 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
 			   vec<c_token> clauses)
 {
   if (flag_cilkplus
-      && clauses.exists () && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+      && (clauses.exists () || parser->simd_attr_present)
+      && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
     {
-      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 "
 	     "function marked as a Cilk Plus SIMD-enabled function");
       vec_free (parser->cilk_simd_fn_tokens);
       return;
@@ -15423,7 +15438,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))
     {
       parser->tokens = parser->cilk_simd_fn_tokens->address ();
@@ -15435,41 +15450,63 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
       parser->tokens = clauses.address ();
       parser->tokens_avail = clauses.length ();
     }
-  
-  /* c_parser_omp_declare_simd pushed 2 extra CPP_EOF tokens at the end.  */
-  while (parser->tokens_avail > 3)
+
+  if (parser->simd_attr_present
+      && is_cilkplus_cilk_simd_fn)
     {
-      c_token *token = c_parser_peek_token (parser);
-      if (!is_cilkplus_cilk_simd_fn) 
-	gcc_assert (token->type == CPP_NAME 
-		    && strcmp (IDENTIFIER_POINTER (token->value), "simd") == 0);
-      else
-	gcc_assert (token->type == CPP_NAME
-		    && is_cilkplus_vector_p (token->value));
-      c_parser_consume_token (parser);
-      parser->in_pragma = true;
+      error ("SIMD-enabled function attributes"
+	     "are allowed when attribute __simd__ is specified");
+      clauses[0].type = CPP_EOF;
+      return;
+    }
 
+  /* 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)
+    {
       tree c = NULL_TREE;
-      if (is_cilkplus_cilk_simd_fn) 
-	c = c_parser_omp_all_clauses (parser, CILK_SIMD_FN_CLAUSE_MASK,
-				      "SIMD-enabled functions attribute");
-      else 
-	c = c_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
-				      "#pragma omp declare simd");
-      c = c_omp_declare_simd_clauses_to_numbers (parms, c);
-      if (c != NULL_TREE)
-	c = tree_cons (NULL_TREE, c, NULL_TREE);
-      if (is_cilkplus_cilk_simd_fn) 
-	{ 
-	  tree k = build_tree_list (get_identifier ("cilk simd function"), 
-				    NULL_TREE);
-	  TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
-	  DECL_ATTRIBUTES (fndecl) = k;
-	} 
       c = build_tree_list (get_identifier ("omp declare simd"), c);
       TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
       DECL_ATTRIBUTES (fndecl) = c;
     }
+  else
+    {
+      /* c_parser_omp_declare_simd pushed 2 extra CPP_EOF tokens at the end.  */
+      while (parser->tokens_avail > 3)
+	{
+	  c_token *token = c_parser_peek_token (parser);
+	  if (!is_cilkplus_cilk_simd_fn)
+	    gcc_assert (token->type == CPP_NAME
+			&& strcmp (IDENTIFIER_POINTER (token->value), "simd") == 0);
+	  else
+	    gcc_assert (token->type == CPP_NAME
+			&& is_cilkplus_vector_p (token->value));
+	  c_parser_consume_token (parser);
+	  parser->in_pragma = true;
+
+	  tree c = NULL_TREE;
+	  if (is_cilkplus_cilk_simd_fn)
+	    c = c_parser_omp_all_clauses (parser, CILK_SIMD_FN_CLAUSE_MASK,
+					  "SIMD-enabled functions attribute");
+	  else
+	    c = c_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
+					  "#pragma omp declare simd");
+	  c = c_omp_declare_simd_clauses_to_numbers (parms, c);
+	  if (c != NULL_TREE)
+	    c = tree_cons (NULL_TREE, c, NULL_TREE);
+	  if (is_cilkplus_cilk_simd_fn)
+	    {
+	      tree k = build_tree_list (get_identifier ("cilk simd function"),
+					NULL_TREE);
+	      TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
+	      DECL_ATTRIBUTES (fndecl) = k;
+	    }
+	  c = build_tree_list (get_identifier ("omp declare simd"), c);
+	  TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
+	  DECL_ATTRIBUTES (fndecl) = c;
+	}
+    }
 
   parser->tokens = &parser->tokens_buf[0];
   parser->tokens_avail = tokens_avail;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7555bf3..8970cf5 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -19331,7 +19331,9 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_declarator *declarator,
   /* A late-specified return type is indicated by an initial '->'. */
   if (token->type != CPP_DEREF
       && token->keyword != RID_REQUIRES
-      && !(declare_simd_p || cilk_simd_fn_vector_p))
+      && !(declare_simd_p
+	   || cilk_simd_fn_vector_p
+	   || parser->simd_attr_present))
     return NULL_TREE;
 
   tree save_ccp = current_class_ptr;
@@ -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)
+    {
+      if (cilk_simd_fn_vector_p)
+	error ("__simd__ attribute cannot be used in the same function"
+	       " marked as a Cilk Plus SIMD-enabled function");
+
+      tree c = build_tree_list (get_identifier ("omp declare simd"), NULL_TREE);
+      TREE_CHAIN (c) = declarator->std_attributes;
+      declarator->std_attributes = c;
+    }
+
   if (quals >= 0)
     {
       current_class_ptr = save_ccp;
@@ -23321,6 +23335,11 @@ cp_parser_gnu_attribute_list (cp_parser* parser)
 	    {
 	      cp_parser_cilk_simd_fn_vector_attrs (parser, id_token);
 	      continue;
+	    } else
+	  if (is_attribute_p ("simd", identifier))
+	    {
+	      parser->simd_attr_present = 1;
+	      continue;
 	    }
 
 	  if (arguments != error_mark_node)
diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h
index 760467c..f4e33e3 100644
--- a/gcc/cp/parser.h
+++ b/gcc/cp/parser.h
@@ -371,6 +371,8 @@ struct GTY(()) cp_parser {
      necessary.  */
   cp_omp_declare_simd_data * GTY((skip)) cilk_simd_fn_info;
 
+  bool simd_attr_present;
+
   /* Nonzero if parsing a parameter list where 'auto' should trigger an implicit
      template parameter.  */
   bool auto_is_implicit_function_template_parm_p;
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index fdb1547..32994a2 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3066,6 +3066,21 @@ This function attribute make a stack protection of the function if
 flags @option{fstack-protector} or @option{fstack-protector-strong}
 or @option{fstack-protector-explicit} are set.
 
+@item simd
+@cindex @code{simd} function attribute.
+This attribute enables creation of one or more function versions that
+can process multiple arguments using SIMD instructions from a
+single invocation.  Specifying this attribute allows compiler to
+assume that such a versions are available at link time (provided
+in the same or another translation unit).  Generated versions are
+target dependent and described in corresponding Vector ABI document.  For
+x86_64 target this document can be found
+@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
+It is prohibited to use the attribute along with Cilk Plus's @code{vector}
+attribute. If the attribute is specified and @code{#pragma omp declare simd}
+presented on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}
+switch is specified, then the attribute is ignored.
+
 @item target (@var{options})
 @cindex @code{target} function attribute
 Multiple target back ends implement the @code{target} attribute
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
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" } } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
new file mode 100644
index 0000000..2bbdf04
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
+
+void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
new file mode 100644
index 0000000..dabdd81
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+
+__attribute__((__simd__))
+static int simd_attr (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "omp declare simd" "optimized" } } */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-23 14:16                   ` Kirill Yukhin
@ 2015-10-23 14:23                     ` Joseph Myers
  2015-10-27 14:09                       ` Kirill Yukhin
  0 siblings, 1 reply; 28+ messages in thread
From: Joseph Myers @ 2015-10-23 14:23 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Jakub Jelinek, Jeff Law, GCC Patches

On Fri, 23 Oct 2015, Kirill Yukhin wrote:

> > You need to update this patch to take account of Marek's fix for bug 67964 
> > (it was because I was suspicious of the "continue;" in this patch 
> > accepting invalid syntax that I found that bug), retest and resubmit.
> I've rebased the patch on top of current trunk.

This isn't taking proper account of Marek's fix.

> @@ -3993,6 +4001,12 @@ c_parser_attributes (c_parser *parser)
>  		break;
>  	      continue;
>  	    }
> +	  if (is_attribute_p ("simd", attr_name))
> +	    {
> +	      parser->simd_attr_present = 1;
> +	      c_parser_consume_token (parser);
> +	      continue;
> +	    }

Any such continue needs first to break if the next token isn't a comma; 
otherwise you accept bad syntax with no comma between successive 
attributes.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-23 14:23                     ` Joseph Myers
@ 2015-10-27 14:09                       ` Kirill Yukhin
  2015-10-27 14:17                         ` Jakub Jelinek
  0 siblings, 1 reply; 28+ messages in thread
From: Kirill Yukhin @ 2015-10-27 14:09 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Jakub Jelinek, Jeff Law, GCC Patches

Hello Joseph,
On 23 Oct 14:16, Joseph Myers wrote:
> On Fri, 23 Oct 2015, Kirill Yukhin wrote:
> 
> > > You need to update this patch to take account of Marek's fix for bug 67964 
> > > (it was because I was suspicious of the "continue;" in this patch 
> > > accepting invalid syntax that I found that bug), retest and resubmit.
> > I've rebased the patch on top of current trunk.
> 
> This isn't taking proper account of Marek's fix.
> 
> > @@ -3993,6 +4001,12 @@ c_parser_attributes (c_parser *parser)
> >  		break;
> >  	      continue;
> >  	    }
> > +	  if (is_attribute_p ("simd", attr_name))
> > +	    {
> > +	      parser->simd_attr_present = 1;
> > +	      c_parser_consume_token (parser);
> > +	      continue;
> > +	    }
> 
> Any such continue needs first to break if the next token isn't a comma; 
> otherwise you accept bad syntax with no comma between successive 
> attributes.
I've understood your point.
Fixed both C/C++. I've additionally fixed Cilk case in C++ by analogy w/
Marek's fix.

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.
        (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.

--
Thanks, K

index c8c6a2d..b026f72 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -224,6 +224,9 @@ struct GTY(()) c_parser {
   /* Buffer to hold all the tokens from parsing the vector attribute for the
      SIMD-enabled functions (formerly known as elemental functions).  */
   vec <c_token, va_gc> *cilk_simd_fn_tokens;
+
+  /* Designates if "simd" attribute is specified in decl.  */
+  BOOL_BITFIELD simd_attr_present : 1;
 };
 
 
@@ -1701,7 +1704,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
       if (declarator == NULL)
 	{
 	  if (omp_declare_simd_clauses.exists ()
-	      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+	      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+	      || parser->simd_attr_present)
 	    c_finish_omp_declare_simd (parser, NULL_TREE, NULL_TREE,
 				       omp_declare_simd_clauses);
 	  c_parser_skip_to_end_of_block_or_statement (parser);
@@ -1797,7 +1801,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
-		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		      || parser->simd_attr_present)
 		    c_finish_omp_declare_simd (parser, d, NULL_TREE,
 					       omp_declare_simd_clauses);
 		}
@@ -1810,7 +1815,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
-		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		      || parser->simd_attr_present)
 		    c_finish_omp_declare_simd (parser, d, NULL_TREE,
 					       omp_declare_simd_clauses);
 		  start_init (d, asm_name, global_bindings_p ());
@@ -1839,7 +1845,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 				   chainon (postfix_attrs,
 					    all_prefix_attrs));
 	      if (omp_declare_simd_clauses.exists ()
-		  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		  || parser->simd_attr_present)
 		{
 		  tree parms = NULL_TREE;
 		  if (d && TREE_CODE (d) == FUNCTION_DECL)
@@ -1968,7 +1975,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 				       true, false, NULL, vNULL);
       store_parm_decls ();
       if (omp_declare_simd_clauses.exists ()
-	  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+	  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+	  || parser->simd_attr_present)
 	c_finish_omp_declare_simd (parser, current_function_decl, NULL_TREE,
 				   omp_declare_simd_clauses);
       DECL_STRUCT_FUNCTION (current_function_decl)->function_start_locus
@@ -3993,6 +4001,15 @@ c_parser_attributes (c_parser *parser)
 		break;
 	      continue;
 	    }
+	  if (is_attribute_p ("simd", attr_name))
+	    {
+	      parser->simd_attr_present = 1;
+	      c_parser_consume_token (parser);
+	      /* If the next token isn't a comma, we're done.  */
+	      if (!c_parser_next_token_is (parser, CPP_COMMA))
+		break;
+	      continue;
+	    }
 	  c_parser_consume_token (parser);
 	  if (c_parser_next_token_is_not (parser, CPP_OPEN_PAREN))
 	    {
@@ -15388,9 +15405,10 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
 			   vec<c_token> clauses)
 {
   if (flag_cilkplus
-      && clauses.exists () && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+      && (clauses.exists () || parser->simd_attr_present)
+      && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
     {
-      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 "
 	     "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))
     {
       parser->tokens = parser->cilk_simd_fn_tokens->address ();
@@ -15435,41 +15453,63 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
       parser->tokens = clauses.address ();
       parser->tokens_avail = clauses.length ();
     }
-  
-  /* c_parser_omp_declare_simd pushed 2 extra CPP_EOF tokens at the end.  */
-  while (parser->tokens_avail > 3)
+
+  if (parser->simd_attr_present
+      && is_cilkplus_cilk_simd_fn)
     {
-      c_token *token = c_parser_peek_token (parser);
-      if (!is_cilkplus_cilk_simd_fn) 
-	gcc_assert (token->type == CPP_NAME 
-		    && strcmp (IDENTIFIER_POINTER (token->value), "simd") == 0);
-      else
-	gcc_assert (token->type == CPP_NAME
-		    && is_cilkplus_vector_p (token->value));
-      c_parser_consume_token (parser);
-      parser->in_pragma = true;
+      error ("SIMD-enabled function attributes"
+	     "are allowed when attribute __simd__ is specified");
+      clauses[0].type = CPP_EOF;
+      return;
+    }
 
+  /* 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)
+    {
       tree c = NULL_TREE;
-      if (is_cilkplus_cilk_simd_fn) 
-	c = c_parser_omp_all_clauses (parser, CILK_SIMD_FN_CLAUSE_MASK,
-				      "SIMD-enabled functions attribute");
-      else 
-	c = c_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
-				      "#pragma omp declare simd");
-      c = c_omp_declare_simd_clauses_to_numbers (parms, c);
-      if (c != NULL_TREE)
-	c = tree_cons (NULL_TREE, c, NULL_TREE);
-      if (is_cilkplus_cilk_simd_fn) 
-	{ 
-	  tree k = build_tree_list (get_identifier ("cilk simd function"), 
-				    NULL_TREE);
-	  TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
-	  DECL_ATTRIBUTES (fndecl) = k;
-	} 
       c = build_tree_list (get_identifier ("omp declare simd"), c);
       TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
       DECL_ATTRIBUTES (fndecl) = c;
     }
+  else
+    {
+      /* c_parser_omp_declare_simd pushed 2 extra CPP_EOF tokens at the end.  */
+      while (parser->tokens_avail > 3)
+	{
+	  c_token *token = c_parser_peek_token (parser);
+	  if (!is_cilkplus_cilk_simd_fn)
+	    gcc_assert (token->type == CPP_NAME
+			&& strcmp (IDENTIFIER_POINTER (token->value), "simd") == 0);
+	  else
+	    gcc_assert (token->type == CPP_NAME
+			&& is_cilkplus_vector_p (token->value));
+	  c_parser_consume_token (parser);
+	  parser->in_pragma = true;
+
+	  tree c = NULL_TREE;
+	  if (is_cilkplus_cilk_simd_fn)
+	    c = c_parser_omp_all_clauses (parser, CILK_SIMD_FN_CLAUSE_MASK,
+					  "SIMD-enabled functions attribute");
+	  else
+	    c = c_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
+					  "#pragma omp declare simd");
+	  c = c_omp_declare_simd_clauses_to_numbers (parms, c);
+	  if (c != NULL_TREE)
+	    c = tree_cons (NULL_TREE, c, NULL_TREE);
+	  if (is_cilkplus_cilk_simd_fn)
+	    {
+	      tree k = build_tree_list (get_identifier ("cilk simd function"),
+					NULL_TREE);
+	      TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
+	      DECL_ATTRIBUTES (fndecl) = k;
+	    }
+	  c = build_tree_list (get_identifier ("omp declare simd"), c);
+	  TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
+	  DECL_ATTRIBUTES (fndecl) = c;
+	}
+    }
 
   parser->tokens = &parser->tokens_buf[0];
   parser->tokens_avail = tokens_avail;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7555bf3..69ffb61 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -19331,7 +19331,9 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_declarator *declarator,
   /* A late-specified return type is indicated by an initial '->'. */
   if (token->type != CPP_DEREF
       && token->keyword != RID_REQUIRES
-      && !(declare_simd_p || cilk_simd_fn_vector_p))
+      && !(declare_simd_p
+	   || cilk_simd_fn_vector_p
+	   || parser->simd_attr_present))
     return NULL_TREE;
 
   tree save_ccp = current_class_ptr;
@@ -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)
+    {
+      if (cilk_simd_fn_vector_p)
+	error ("__simd__ attribute cannot be used in the same function"
+	       " marked as a Cilk Plus SIMD-enabled function");
+
+      tree c = build_tree_list (get_identifier ("omp declare simd"), NULL_TREE);
+      TREE_CHAIN (c) = declarator->std_attributes;
+      declarator->std_attributes = c;
+    }
+
   if (quals >= 0)
     {
       current_class_ptr = save_ccp;
@@ -23320,6 +23334,21 @@ cp_parser_gnu_attribute_list (cp_parser* parser)
 	  else if (is_cilkplus_vector_p (identifier))
 	    {
 	      cp_parser_cilk_simd_fn_vector_attrs (parser, id_token);
+	      /* Now, look for more attributes.  If the next token isn't a
+		 `,', we're done.  */
+	      if (token->type != CPP_COMMA)
+		break;
+
+	      continue;
+	    } else
+	  if (is_attribute_p ("simd", identifier))
+	    {
+	      parser->simd_attr_present = 1;
+	      /* Now, look for more attributes.  If the next token isn't a
+		 `,', we're done.  */
+	      if (token->type != CPP_COMMA)
+		break;
+
 	      continue;
 	    }
 
diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h
index 760467c..f4e33e3 100644
--- a/gcc/cp/parser.h
+++ b/gcc/cp/parser.h
@@ -371,6 +371,8 @@ struct GTY(()) cp_parser {
      necessary.  */
   cp_omp_declare_simd_data * GTY((skip)) cilk_simd_fn_info;
 
+  bool simd_attr_present;
+
   /* Nonzero if parsing a parameter list where 'auto' should trigger an implicit
      template parameter.  */
   bool auto_is_implicit_function_template_parm_p;
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index fdb1547..32994a2 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3066,6 +3066,21 @@ This function attribute make a stack protection of the function if
 flags @option{fstack-protector} or @option{fstack-protector-strong}
 or @option{fstack-protector-explicit} are set.
 
+@item simd
+@cindex @code{simd} function attribute.
+This attribute enables creation of one or more function versions that
+can process multiple arguments using SIMD instructions from a
+single invocation.  Specifying this attribute allows compiler to
+assume that such a versions are available at link time (provided
+in the same or another translation unit).  Generated versions are
+target dependent and described in corresponding Vector ABI document.  For
+x86_64 target this document can be found
+@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
+It is prohibited to use the attribute along with Cilk Plus's @code{vector}
+attribute. If the attribute is specified and @code{#pragma omp declare simd}
+presented on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}
+switch is specified, then the attribute is ignored.
+
 @item target (@var{options})
 @cindex @code{target} function attribute
 Multiple target back ends implement the @code{target} attribute
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
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" } } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
new file mode 100644
index 0000000..2bbdf04
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
+
+void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
new file mode 100644
index 0000000..dabdd81
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+
+__attribute__((__simd__))
+static int simd_attr (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "omp declare simd" "optimized" } } */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-27 14:09                       ` Kirill Yukhin
@ 2015-10-27 14:17                         ` Jakub Jelinek
  2015-10-28  9:40                           ` Kirill Yukhin
  0 siblings, 1 reply; 28+ messages in thread
From: Jakub Jelinek @ 2015-10-27 14:17 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Joseph Myers, Jeff Law, GCC Patches

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

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-27 14:17                         ` Jakub Jelinek
@ 2015-10-28  9:40                           ` Kirill Yukhin
  2015-10-29  8:56                             ` Jakub Jelinek
  0 siblings, 1 reply; 28+ messages in thread
From: Kirill Yukhin @ 2015-10-28  9:40 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Joseph Myers, Jeff Law, GCC Patches

Hello Jakub,

Your inputs fixed.

On 27 Oct 15:15, Jakub Jelinek wrote:
> > 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 
Concerning this. It should affect compile time since all work is
done if attribute is actually present.
It also already `ON' while LTO.

Bootstrapped. Regtested. Is it ok for trunk?


gcc/
        * omp-low.c (pass_omp_simd_clone::gate): If target allows - call
        without additional conditions.
        * doc/extend.texi (simd): Document new attribute.
gcc/cp/
        * parser.h (cp_parser): Add simd_attr_present.
        * parser.c (cp_parser_late_return_type_opt): Handle simd_attr_present,
        require comman in __vector__ attribute.
        (cp_parser_gnu_attribute_list): Ditto.
gcc/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.
        (c_finish_omp_declare_simd): Handle simd_attr_present.
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.


diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index c8c6a2d..d596b77 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -224,6 +224,9 @@ struct GTY(()) c_parser {
   /* Buffer to hold all the tokens from parsing the vector attribute for the
      SIMD-enabled functions (formerly known as elemental functions).  */
   vec <c_token, va_gc> *cilk_simd_fn_tokens;
+
+  /* Designates if "simd" attribute is specified in decl.  */
+  BOOL_BITFIELD simd_attr_present : 1;
 };
 
 
@@ -1701,7 +1704,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
       if (declarator == NULL)
 	{
 	  if (omp_declare_simd_clauses.exists ()
-	      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+	      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+	      || parser->simd_attr_present)
 	    c_finish_omp_declare_simd (parser, NULL_TREE, NULL_TREE,
 				       omp_declare_simd_clauses);
 	  c_parser_skip_to_end_of_block_or_statement (parser);
@@ -1797,7 +1801,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
-		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		      || parser->simd_attr_present)
 		    c_finish_omp_declare_simd (parser, d, NULL_TREE,
 					       omp_declare_simd_clauses);
 		}
@@ -1810,7 +1815,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
-		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		      || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		      || parser->simd_attr_present)
 		    c_finish_omp_declare_simd (parser, d, NULL_TREE,
 					       omp_declare_simd_clauses);
 		  start_init (d, asm_name, global_bindings_p ());
@@ -1839,7 +1845,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 				   chainon (postfix_attrs,
 					    all_prefix_attrs));
 	      if (omp_declare_simd_clauses.exists ()
-		  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+		  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+		  || parser->simd_attr_present)
 		{
 		  tree parms = NULL_TREE;
 		  if (d && TREE_CODE (d) == FUNCTION_DECL)
@@ -1968,7 +1975,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
 				       true, false, NULL, vNULL);
       store_parm_decls ();
       if (omp_declare_simd_clauses.exists ()
-	  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+	  || !vec_safe_is_empty (parser->cilk_simd_fn_tokens)
+	  || parser->simd_attr_present)
 	c_finish_omp_declare_simd (parser, current_function_decl, NULL_TREE,
 				   omp_declare_simd_clauses);
       DECL_STRUCT_FUNCTION (current_function_decl)->function_start_locus
@@ -3993,6 +4001,15 @@ c_parser_attributes (c_parser *parser)
 		break;
 	      continue;
 	    }
+	  if (is_attribute_p ("simd", attr_name))
+	    {
+	      parser->simd_attr_present = 1;
+	      c_parser_consume_token (parser);
+	      /* If the next token isn't a comma, we're done.  */
+	      if (!c_parser_next_token_is (parser, CPP_COMMA))
+		break;
+	      continue;
+	    }
 	  c_parser_consume_token (parser);
 	  if (c_parser_next_token_is_not (parser, CPP_OPEN_PAREN))
 	    {
@@ -15388,10 +15405,11 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
 			   vec<c_token> clauses)
 {
   if (flag_cilkplus
-      && clauses.exists () && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+      && (clauses.exists () || parser->simd_attr_present)
+      && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
     {
-      error ("%<#pragma omp declare simd%> cannot be used in the same "
-	     "function marked as a Cilk Plus SIMD-enabled function");
+      error ("%<#pragma omp declare simd%> or %<__simd__%> attribute cannot be "
+	     "used in the same 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))
     {
       parser->tokens = parser->cilk_simd_fn_tokens->address ();
@@ -15435,41 +15453,61 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
       parser->tokens = clauses.address ();
       parser->tokens_avail = clauses.length ();
     }
-  
-  /* c_parser_omp_declare_simd pushed 2 extra CPP_EOF tokens at the end.  */
-  while (parser->tokens_avail > 3)
+
+  if (parser->simd_attr_present && is_cilkplus_cilk_simd_fn)
     {
-      c_token *token = c_parser_peek_token (parser);
-      if (!is_cilkplus_cilk_simd_fn) 
-	gcc_assert (token->type == CPP_NAME 
-		    && strcmp (IDENTIFIER_POINTER (token->value), "simd") == 0);
-      else
-	gcc_assert (token->type == CPP_NAME
-		    && is_cilkplus_vector_p (token->value));
-      c_parser_consume_token (parser);
-      parser->in_pragma = true;
+      error ("SIMD-enabled function attributes"
+	     "are allowed when attribute %<__simd__%> is specified");
+      clauses[0].type = CPP_EOF;
+      return;
+    }
 
+  /* 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)
+    {
       tree c = NULL_TREE;
-      if (is_cilkplus_cilk_simd_fn) 
-	c = c_parser_omp_all_clauses (parser, CILK_SIMD_FN_CLAUSE_MASK,
-				      "SIMD-enabled functions attribute");
-      else 
-	c = c_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
-				      "#pragma omp declare simd");
-      c = c_omp_declare_simd_clauses_to_numbers (parms, c);
-      if (c != NULL_TREE)
-	c = tree_cons (NULL_TREE, c, NULL_TREE);
-      if (is_cilkplus_cilk_simd_fn) 
-	{ 
-	  tree k = build_tree_list (get_identifier ("cilk simd function"), 
-				    NULL_TREE);
-	  TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
-	  DECL_ATTRIBUTES (fndecl) = k;
-	} 
       c = build_tree_list (get_identifier ("omp declare simd"), c);
       TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
       DECL_ATTRIBUTES (fndecl) = c;
     }
+  else
+    {
+      /* c_parser_omp_declare_simd pushed 2 extra CPP_EOF tokens at the end.  */
+      while (parser->tokens_avail > 3)
+	{
+	  c_token *token = c_parser_peek_token (parser);
+	  if (!is_cilkplus_cilk_simd_fn)
+	    gcc_assert (token->type == CPP_NAME
+			&& strcmp (IDENTIFIER_POINTER (token->value), "simd") == 0);
+	  else
+	    gcc_assert (token->type == CPP_NAME
+			&& is_cilkplus_vector_p (token->value));
+	  c_parser_consume_token (parser);
+	  parser->in_pragma = true;
+
+	  tree c = NULL_TREE;
+	  if (is_cilkplus_cilk_simd_fn)
+	    c = c_parser_omp_all_clauses (parser, CILK_SIMD_FN_CLAUSE_MASK,
+					  "SIMD-enabled functions attribute");
+	  else
+	    c = c_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
+					  "#pragma omp declare simd");
+	  c = c_omp_declare_simd_clauses_to_numbers (parms, c);
+	  if (c != NULL_TREE)
+	    c = tree_cons (NULL_TREE, c, NULL_TREE);
+	  if (is_cilkplus_cilk_simd_fn)
+	    {
+	      tree k = build_tree_list (get_identifier ("cilk simd function"),
+					NULL_TREE);
+	      TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
+	      DECL_ATTRIBUTES (fndecl) = k;
+	    }
+	  c = build_tree_list (get_identifier ("omp declare simd"), c);
+	  TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
+	  DECL_ATTRIBUTES (fndecl) = c;
+	}
+    }
 
   parser->tokens = &parser->tokens_buf[0];
   parser->tokens_avail = tokens_avail;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7555bf3..a53d193 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -19331,7 +19331,9 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_declarator *declarator,
   /* A late-specified return type is indicated by an initial '->'. */
   if (token->type != CPP_DEREF
       && token->keyword != RID_REQUIRES
-      && !(declare_simd_p || cilk_simd_fn_vector_p))
+      && !(declare_simd_p
+	   || cilk_simd_fn_vector_p
+	   || parser->simd_attr_present))
     return NULL_TREE;
 
   tree save_ccp = current_class_ptr;
@@ -19363,6 +19365,17 @@ 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)
+    {
+      if (cilk_simd_fn_vector_p)
+	error ("%<__simd__%> attribute cannot be used in the same function"
+	       " marked as a Cilk Plus SIMD-enabled function");
+
+      tree c = build_tree_list (get_identifier ("omp declare simd"), NULL_TREE);
+      TREE_CHAIN (c) = declarator->std_attributes;
+      declarator->std_attributes = c;
+    }
+
   if (quals >= 0)
     {
       current_class_ptr = save_ccp;
@@ -23320,6 +23333,21 @@ cp_parser_gnu_attribute_list (cp_parser* parser)
 	  else if (is_cilkplus_vector_p (identifier))
 	    {
 	      cp_parser_cilk_simd_fn_vector_attrs (parser, id_token);
+	      /* Now, look for more attributes.  If the next token isn't a
+		 `,', we're done.  */
+	      if (token->type != CPP_COMMA)
+		break;
+
+	      continue;
+	    } else
+	  if (is_attribute_p ("simd", identifier))
+	    {
+	      parser->simd_attr_present = 1;
+	      /* Now, look for more attributes.  If the next token isn't a
+		 `,', we're done.  */
+	      if (token->type != CPP_COMMA)
+		break;
+
 	      continue;
 	    }
 
diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h
index 760467c..f4e33e3 100644
--- a/gcc/cp/parser.h
+++ b/gcc/cp/parser.h
@@ -371,6 +371,8 @@ struct GTY(()) cp_parser {
      necessary.  */
   cp_omp_declare_simd_data * GTY((skip)) cilk_simd_fn_info;
 
+  bool simd_attr_present;
+
   /* Nonzero if parsing a parameter list where 'auto' should trigger an implicit
      template parameter.  */
   bool auto_is_implicit_function_template_parm_p;
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index fdb1547..32994a2 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3066,6 +3066,21 @@ This function attribute make a stack protection of the function if
 flags @option{fstack-protector} or @option{fstack-protector-strong}
 or @option{fstack-protector-explicit} are set.
 
+@item simd
+@cindex @code{simd} function attribute.
+This attribute enables creation of one or more function versions that
+can process multiple arguments using SIMD instructions from a
+single invocation.  Specifying this attribute allows compiler to
+assume that such a versions are available at link time (provided
+in the same or another translation unit).  Generated versions are
+target dependent and described in corresponding Vector ABI document.  For
+x86_64 target this document can be found
+@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
+It is prohibited to use the attribute along with Cilk Plus's @code{vector}
+attribute. If the attribute is specified and @code{#pragma omp declare simd}
+presented on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}
+switch is specified, then the attribute is ignored.
+
 @item target (@var{options})
 @cindex @code{target} function attribute
 Multiple target back ends implement the @code{target} attribute
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
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" } } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
new file mode 100644
index 0000000..2bbdf04
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
+
+void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
new file mode 100644
index 0000000..6fd757a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+
+__attribute__((__simd__))
+static int simd_attr (void)
+{
+  return 0;
+}
+
+__attribute__((simd))
+static int simd_attr2 (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
+/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" } } */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-28  9:40                           ` Kirill Yukhin
@ 2015-10-29  8:56                             ` Jakub Jelinek
  2015-11-10  8:44                               ` Kirill Yukhin
  0 siblings, 1 reply; 28+ messages in thread
From: Jakub Jelinek @ 2015-10-29  8:56 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Joseph Myers, Jeff Law, GCC Patches

On Wed, Oct 28, 2015 at 12:16:04PM +0300, Kirill Yukhin wrote:
> Bootstrapped. Regtested. Is it ok for trunk?
> 
> 
> gcc/
>         * omp-low.c (pass_omp_simd_clone::gate): If target allows - call
>         without additional conditions.
>         * doc/extend.texi (simd): Document new attribute.
> gcc/cp/
>         * parser.h (cp_parser): Add simd_attr_present.
>         * parser.c (cp_parser_late_return_type_opt): Handle simd_attr_present,
>         require comman in __vector__ attribute.
>         (cp_parser_gnu_attribute_list): Ditto.
> gcc/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.
>         (c_finish_omp_declare_simd): Handle simd_attr_present.

Actually, do you plan to eventually add some clauses/operands to the simd
attribute, or is the plan to just say that simd attribute is
#pragma omp declare simd
with no clauses as if -fopenmp-simd has been enabled?
If you don't plan to add any clauses, I wonder whether you really need to
add any parser changes at all, whether this couldn't be all handled in
c-family/c-common.c - handle_simd_attribute, adding simd to the attribute
table in there as a function decl attribute, and simply when processing it
add
        tree c = build_tree_list (get_identifier ("omp declare simd"), NULL_TREE);
        TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
        DECL_ATTRIBUTES (fndecl) = c;
(after checking whether the attribute isn't already present and erroring out
if there is "cilk simd function" attribute).
The reason for the (admittedly ugly) parser changes for #pragma omp declare simd is
that the clauses on the directive refer to parameters that will be declared
later, so we need to save the tokens of the pragma and then after parsing
the parameter declarations actually parse the clauses.  But, in the simd
attribute case, there are no clauses, there is nothing to parse later.

Sorry for not raising this earlier.

	Jakub

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-10-29  8:56                             ` Jakub Jelinek
@ 2015-11-10  8:44                               ` Kirill Yukhin
  2015-11-10  8:58                                 ` Jakub Jelinek
  0 siblings, 1 reply; 28+ messages in thread
From: Kirill Yukhin @ 2015-11-10  8:44 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Joseph Myers, Jeff Law, GCC Patches

Hi Jakub,
On 29 Oct 09:54, Jakub Jelinek wrote:
> On Wed, Oct 28, 2015 at 12:16:04PM +0300, Kirill Yukhin wrote:
> > Bootstrapped. Regtested. Is it ok for trunk?
> > 
> > 
> > gcc/
> >         * omp-low.c (pass_omp_simd_clone::gate): If target allows - call
> >         without additional conditions.
> >         * doc/extend.texi (simd): Document new attribute.
> > gcc/cp/
> >         * parser.h (cp_parser): Add simd_attr_present.
> >         * parser.c (cp_parser_late_return_type_opt): Handle simd_attr_present,
> >         require comman in __vector__ attribute.
> >         (cp_parser_gnu_attribute_list): Ditto.
> > gcc/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.
> >         (c_finish_omp_declare_simd): Handle simd_attr_present.
> 
> Actually, do you plan to eventually add some clauses/operands to the simd
> attribute, or is the plan to just say that simd attribute is
> #pragma omp declare simd
> with no clauses as if -fopenmp-simd has been enabled?
I think so/
> If you don't plan to add any clauses, I wonder whether you really need to
> add any parser changes at all, whether this couldn't be all handled in
> c-family/c-common.c - handle_simd_attribute, adding simd to the attribute
> table in there as a function decl attribute, and simply when processing it
> add
>         tree c = build_tree_list (get_identifier ("omp declare simd"), NULL_TREE);
>         TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
>         DECL_ATTRIBUTES (fndecl) = c;
> (after checking whether the attribute isn't already present and erroring out
> if there is "cilk simd function" attribute).
> The reason for the (admittedly ugly) parser changes for #pragma omp declare simd is
> that the clauses on the directive refer to parameters that will be declared
> later, so we need to save the tokens of the pragma and then after parsing
> the parameter declarations actually parse the clauses.  But, in the simd
> attribute case, there are no clauses, there is nothing to parse later.
I've refactored the patch.
New tests pass except one, which fails due to PR68158.
Bootstrapped and reg-tested.

Is it ok for trunk?

gcc/
        * omp-low.c (pass_omp_simd_clone::gate): If target allows - call
        without additional conditions.
	* doc/extend.texi (@item simd): New.
gcc/c-family/
	* c-common.c (handle_simd_attribute): New.
	(struct attribute_spec): Add entry for "simd".
	(handle_simd_attribute): New
gcc/c/
	* c-parser.c (c_finish_omp_declare_simd): Look for
	"simd" attribute as well. Update error message.
gcc/cp/
	* parser.c (cp_parser_late_parsing_cilk_simd_fn_info): Look for
	"simd" attribute as well. Update error message.
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.

> 	Jakub

--
Thanks, K

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 1c75921..08ab220 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -392,6 +392,7 @@ static tree handle_warn_unused_attribute (tree *, tree, tree, int, bool *);
 static tree handle_returns_nonnull_attribute (tree *, tree, tree, int, bool *);
 static tree handle_omp_declare_simd_attribute (tree *, tree, tree, int,
 					       bool *);
+static tree handle_simd_attribute (tree *, tree, tree, int, bool *);
 static tree handle_omp_declare_target_attribute (tree *, tree, tree, int,
 						 bool *);
 static tree handle_designated_init_attribute (tree *, tree, tree, int, bool *);
@@ -818,6 +819,8 @@ const struct attribute_spec c_common_attribute_table[] =
 			      handle_omp_declare_simd_attribute, false },
   { "cilk simd function",     0, -1, true,  false, false,
 			      handle_omp_declare_simd_attribute, false },
+  { "simd",		      0, -1, true,  false, false,
+			      handle_simd_attribute, false },
   { "omp declare target",     0, 0, true, false, false,
 			      handle_omp_declare_target_attribute, false },
   { "alloc_align",	      1, 1, false, true, true,
@@ -8955,6 +8958,37 @@ handle_omp_declare_simd_attribute (tree *, tree, tree, int, bool *)
   return NULL_TREE;
 }
 
+/* Handle an "simd" attribute.  */
+
+static tree
+handle_simd_attribute (tree *node, tree name, tree ARG_UNUSED (args),
+		       int ARG_UNUSED (flags), bool *no_add_attrs)
+{
+  if (TREE_CODE (*node) == FUNCTION_DECL)
+    {
+      if (lookup_attribute ("cilk simd function", DECL_ATTRIBUTES (*node)) != NULL)
+	{
+	  error_at (DECL_SOURCE_LOCATION (*node),
+		    "%<__simd__%> attribute cannot be "
+		    "used in the same function marked as a Cilk Plus SIMD-enabled function");
+	  *no_add_attrs = true;
+	}
+      else
+	{
+	  DECL_ATTRIBUTES (*node)
+	    = tree_cons (get_identifier ("omp declare simd"),
+			 NULL_TREE, DECL_ATTRIBUTES (*node));	  
+	}
+    }
+  else
+    {
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
+      *no_add_attrs = true;
+    }
+
+  return NULL_TREE;
+}
+
 /* Handle an "omp declare target" attribute; arguments as in
    struct attribute_spec.handler.  */
 
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index c8c6a2d..3dce493 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -15388,9 +15388,11 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
 			   vec<c_token> clauses)
 {
   if (flag_cilkplus
-      && clauses.exists () && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+      && (clauses.exists ()
+	  || lookup_attribute ("simd", DECL_ATTRIBUTES (fndecl)))
+      && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
     {
-      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 "
 	     "function marked as a Cilk Plus SIMD-enabled function");
       vec_free (parser->cilk_simd_fn_tokens);
       return;
@@ -15429,6 +15431,16 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
       parser->tokens = parser->cilk_simd_fn_tokens->address ();
       parser->tokens_avail = vec_safe_length (parser->cilk_simd_fn_tokens);
       is_cilkplus_cilk_simd_fn = true;
+
+      if (lookup_attribute ("simd", DECL_ATTRIBUTES (fndecl)) != NULL)
+	{
+	  error_at (DECL_SOURCE_LOCATION (fndecl),
+		    "%<__simd__%> attribute cannot be "
+		    "used in the same function marked as a Cilk Plus SIMD-enabled function");
+	  vec_free (parser->cilk_simd_fn_tokens);
+	  return;
+	}
+
     }
   else
     {
@@ -15460,12 +15472,12 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
       if (c != NULL_TREE)
 	c = tree_cons (NULL_TREE, c, NULL_TREE);
       if (is_cilkplus_cilk_simd_fn) 
-	{ 
+	{
 	  tree k = build_tree_list (get_identifier ("cilk simd function"), 
 				    NULL_TREE);
 	  TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl);
 	  DECL_ATTRIBUTES (fndecl) = k;
-	} 
+	}
       c = build_tree_list (get_identifier ("omp declare simd"), c);
       TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
       DECL_ATTRIBUTES (fndecl) = c;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7555bf3..f3831b9 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -34534,10 +34534,11 @@ cp_parser_late_parsing_cilk_simd_fn_info (cp_parser *parser, tree attrs)
   cp_omp_declare_simd_data *info = parser->cilk_simd_fn_info;
   int ii = 0;
 
-  if (parser->omp_declare_simd != NULL)
+  if (parser->omp_declare_simd != NULL
+      || lookup_attribute ("simd", attrs))
     {
-      error ("%<#pragma omp declare simd%> cannot be used in the same function"
-	     " marked as a Cilk Plus SIMD-enabled function");
+      error ("%<#pragma omp declare simd%> of %<simd%> attribute cannot be used "
+	     "in the same function marked as a Cilk Plus SIMD-enabled function");
       XDELETE (parser->cilk_simd_fn_info);
       parser->cilk_simd_fn_info = NULL;
       return attrs;
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index fdb1547..32994a2 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3066,6 +3066,21 @@ This function attribute make a stack protection of the function if
 flags @option{fstack-protector} or @option{fstack-protector-strong}
 or @option{fstack-protector-explicit} are set.
 
+@item simd
+@cindex @code{simd} function attribute.
+This attribute enables creation of one or more function versions that
+can process multiple arguments using SIMD instructions from a
+single invocation.  Specifying this attribute allows compiler to
+assume that such a versions are available at link time (provided
+in the same or another translation unit).  Generated versions are
+target dependent and described in corresponding Vector ABI document.  For
+x86_64 target this document can be found
+@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
+It is prohibited to use the attribute along with Cilk Plus's @code{vector}
+attribute. If the attribute is specified and @code{#pragma omp declare simd}
+presented on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}
+switch is specified, then the attribute is ignored.
+
 @item target (@var{options})
 @cindex @code{target} function attribute
 Multiple target back ends implement the @code{target} attribute
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
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" } } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
new file mode 100644
index 0000000..2bbdf04
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
+
+void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
new file mode 100644
index 0000000..6fd757a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+
+__attribute__((__simd__))
+static int simd_attr (void)
+{
+  return 0;
+}
+
+__attribute__((simd))
+static int simd_attr2 (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
+/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" } } */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-11-10  8:44                               ` Kirill Yukhin
@ 2015-11-10  8:58                                 ` Jakub Jelinek
  2015-11-13 11:55                                   ` Kirill Yukhin
  0 siblings, 1 reply; 28+ messages in thread
From: Jakub Jelinek @ 2015-11-10  8:58 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Joseph Myers, Jeff Law, GCC Patches

On Tue, Nov 10, 2015 at 11:44:18AM +0300, Kirill Yukhin wrote:
> gcc/
>         * omp-low.c (pass_omp_simd_clone::gate): If target allows - call
>         without additional conditions.

Please make sure CHangeLog entries are tab indented.  I would just use
a comma instead of " -" above.

>         * c-c++-common/attr-simd.c: New test.
>         * c-c++-common/attr-simd-2.c: Ditto.
>         * c-c++-common/attr-simd-3.c: Ditto.

New test is IMHO short enough that it is better to spell it
in each case.
>  					       bool *);
> +static tree handle_simd_attribute (tree *, tree, tree, int, bool *);
>  static tree handle_omp_declare_target_attribute (tree *, tree, tree, int,
>  						 bool *);
>  static tree handle_designated_init_attribute (tree *, tree, tree, int, bool *);
> @@ -818,6 +819,8 @@ const struct attribute_spec c_common_attribute_table[] =
>  			      handle_omp_declare_simd_attribute, false },
>    { "cilk simd function",     0, -1, true,  false, false,
>  			      handle_omp_declare_simd_attribute, false },
> +  { "simd",		      0, -1, true,  false, false,
> +			      handle_simd_attribute, false },

Why the -1 in there?  I thought the simd attribute has exactly zero
arguments, so 0, 0.

> +static tree
> +handle_simd_attribute (tree *node, tree name, tree ARG_UNUSED (args),
> +		       int ARG_UNUSED (flags), bool *no_add_attrs)

As per recent discussion, please leave ARG_UNUSED (args) etc. out, just
use unnamed arguments.
> +{
> +  if (TREE_CODE (*node) == FUNCTION_DECL)
> +    {
> +      if (lookup_attribute ("cilk simd function", DECL_ATTRIBUTES (*node)) != NULL)

Too long line.
> +	{
> +	  error_at (DECL_SOURCE_LOCATION (*node),
> +		    "%<__simd__%> attribute cannot be "
> +		    "used in the same function marked as a Cilk Plus SIMD-enabled function");

Too long line.  You should just move "use in the same " one line above.

> +	  *no_add_attrs = true;
> +	}
> +      else
> +	{
> +	  DECL_ATTRIBUTES (*node)
> +	    = tree_cons (get_identifier ("omp declare simd"),
> +			 NULL_TREE, DECL_ATTRIBUTES (*node));	  
> +	}

Please avoid {}s around single statement in the body.
>      {
> -      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 "
>  	     "function marked as a Cilk Plus SIMD-enabled function");

Too long line.

> +      if (lookup_attribute ("simd", DECL_ATTRIBUTES (fndecl)) != NULL)
> +	{
> +	  error_at (DECL_SOURCE_LOCATION (fndecl),
> +		    "%<__simd__%> attribute cannot be "
> +		    "used in the same function marked as a Cilk Plus SIMD-enabled function");

Too long line, see above.

>        c = build_tree_list (get_identifier ("omp declare simd"), c);
>        TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
>        DECL_ATTRIBUTES (fndecl) = c;
> diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
> index 7555bf3..f3831b9 100644
> --- a/gcc/cp/parser.c
> +++ b/gcc/cp/parser.c
> @@ -34534,10 +34534,11 @@ cp_parser_late_parsing_cilk_simd_fn_info (cp_parser *parser, tree attrs)
>    cp_omp_declare_simd_data *info = parser->cilk_simd_fn_info;
>    int ii = 0;
>  
> -  if (parser->omp_declare_simd != NULL)
> +  if (parser->omp_declare_simd != NULL
> +      || lookup_attribute ("simd", attrs))
>      {
> -      error ("%<#pragma omp declare simd%> cannot be used in the same function"
> -	     " marked as a Cilk Plus SIMD-enabled function");
> +      error ("%<#pragma omp declare simd%> of %<simd%> attribute cannot be used "
> +	     "in the same function marked as a Cilk Plus SIMD-enabled function");

Too long lines.

>        XDELETE (parser->cilk_simd_fn_info);
>        parser->cilk_simd_fn_info = NULL;
>        return attrs;
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index fdb1547..32994a2 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -3066,6 +3066,21 @@ This function attribute make a stack protection of the function if
>  flags @option{fstack-protector} or @option{fstack-protector-strong}
>  or @option{fstack-protector-explicit} are set.
>  
> +@item simd
> +@cindex @code{simd} function attribute.
> +This attribute enables creation of one or more function versions that
> +can process multiple arguments using SIMD instructions from a
> +single invocation.  Specifying this attribute allows compiler to
> +assume that such a versions are available at link time (provided
> +in the same or another translation unit).  Generated versions are
> +target dependent and described in corresponding Vector ABI document.  For
> +x86_64 target this document can be found
> +@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.

Are you going to update VectorABI.txt based on the latest changes in
the Intel ABI document?  I mean especially using L, R or U for linear
%val(), %ref() or %uval() (if references), not using s for linear with
uniform parameter stride, but instead using ls, Ls, Rs or Us for those?

> +It is prohibited to use the attribute along with Cilk Plus's @code{vector}
> +attribute. If the attribute is specified and @code{#pragma omp declare simd}
> +presented on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}
> +switch is specified, then the attribute is ignored.
> +
>  @item target (@var{options})
>  @cindex @code{target} function attribute
>  Multiple target back ends implement the @code{target} attribute
> 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
> 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" } } */
> diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
> new file mode 100644
> index 0000000..2bbdf04
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
> @@ -0,0 +1,5 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fcilkplus" } */
> +/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
> +
> +void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
> diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
> new file mode 100644
> index 0000000..6fd757a
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/attr-simd.c
> @@ -0,0 +1,17 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fdump-tree-optimized" } */
> +
> +__attribute__((__simd__))
> +static int simd_attr (void)
> +{
> +  return 0;
> +}
> +
> +__attribute__((simd))
> +static int simd_attr2 (void)
> +{
> +  return 0;
> +}
> +
> +/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
> +/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" } } */

You should add a few scan-assembler lines for x86_64/i?86 (see some
declare-simd*.{c,C} tests) to test mangling.  Of course not when the
function is static...

Otherwise LGTM.

	Jakub

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-11-10  8:58                                 ` Jakub Jelinek
@ 2015-11-13 11:55                                   ` Kirill Yukhin
  2015-11-13 12:16                                     ` Jakub Jelinek
                                                       ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Kirill Yukhin @ 2015-11-13 11:55 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Joseph Myers, Jeff Law, GCC Patches

Hello Jakub,
I've fixed all long lines, thanks!
I've also fixed max_len for "simd" attribute.

Tests are fixed w/ scan for SIMD-mangled routines, routines
made `extern'.

ChangeLog entry was updated.
gcc/
        * omp-low.c (pass_omp_simd_clone::gate): If target allows - call
        without additional conditions.
	* doc/extend.texi (@item simd): New.
gcc/c-family/
	* c-common.c (handle_simd_attribute): New.
	(struct attribute_spec): Add entry for "simd".
	(handle_simd_attribute): New
gcc/c/
	* c-parser.c (c_finish_omp_declare_simd): Look for
	"simd" attribute as well. Update error message.
gcc/cp/
	* parser.c (cp_parser_late_parsing_cilk_simd_fn_info): Look for
	"simd" attribute as well. Update error message.
gcc/testsuite/
        * c-c++-common/attr-simd.c: New test.
        * c-c++-common/attr-simd-2.c: New test.
        * c-c++-common/attr-simd-3.c: New test.

Bootstrapped and regtested.

If no more objections - I'll check it into main trunk next ww.

> Are you going to update VectorABI.txt based on the latest changes in
> the Intel ABI document?  I mean especially using L, R or U for linear
> %val(), %ref() or %uval() (if references), not using s for linear with
> uniform parameter stride, but instead using ls, Ls, Rs or Us for those?

Yes, we'll update it.

--
Thanks, K

On 10 Nov 09:58, Jakub Jelinek wrote:
> On Tue, Nov 10, 2015 at 11:44:18AM +0300, Kirill Yukhin wrote:
> >  					       bool *);
> > +static tree handle_simd_attribute (tree *, tree, tree, int, bool *);
> >  static tree handle_omp_declare_target_attribute (tree *, tree, tree, int,
> >  						 bool *);
> >  static tree handle_designated_init_attribute (tree *, tree, tree, int, bool *);
> > @@ -818,6 +819,8 @@ const struct attribute_spec c_common_attribute_table[] =
> >  			      handle_omp_declare_simd_attribute, false },
> >    { "cilk simd function",     0, -1, true,  false, false,
> >  			      handle_omp_declare_simd_attribute, false },
> > +  { "simd",		      0, -1, true,  false, false,
> > +			      handle_simd_attribute, false },
> 
> Why the -1 in there?  I thought the simd attribute has exactly zero
> arguments, so 0, 0.
> 
> > +static tree
> > +handle_simd_attribute (tree *node, tree name, tree ARG_UNUSED (args),
> > +		       int ARG_UNUSED (flags), bool *no_add_attrs)
> 
> As per recent discussion, please leave ARG_UNUSED (args) etc. out, just
> use unnamed arguments.
> > +{
> > +  if (TREE_CODE (*node) == FUNCTION_DECL)
> > +    {
> > +      if (lookup_attribute ("cilk simd function", DECL_ATTRIBUTES (*node)) != NULL)
> 
> Too long line.
> > +	{
> > +	  error_at (DECL_SOURCE_LOCATION (*node),
> > +		    "%<__simd__%> attribute cannot be "
> > +		    "used in the same function marked as a Cilk Plus SIMD-enabled function");
> 
> Too long line.  You should just move "use in the same " one line above.
> 
> > +	  *no_add_attrs = true;
> > +	}
> > +      else
> > +	{
> > +	  DECL_ATTRIBUTES (*node)
> > +	    = tree_cons (get_identifier ("omp declare simd"),
> > +			 NULL_TREE, DECL_ATTRIBUTES (*node));	  
> > +	}
> 
> Please avoid {}s around single statement in the body.
> >      {
> > -      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 "
> >  	     "function marked as a Cilk Plus SIMD-enabled function");
> 
> Too long line.
> 
> > +      if (lookup_attribute ("simd", DECL_ATTRIBUTES (fndecl)) != NULL)
> > +	{
> > +	  error_at (DECL_SOURCE_LOCATION (fndecl),
> > +		    "%<__simd__%> attribute cannot be "
> > +		    "used in the same function marked as a Cilk Plus SIMD-enabled function");
> 
> Too long line, see above.
> 
> >        c = build_tree_list (get_identifier ("omp declare simd"), c);
> >        TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
> >        DECL_ATTRIBUTES (fndecl) = c;
> > diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
> > index 7555bf3..f3831b9 100644
> > --- a/gcc/cp/parser.c
> > +++ b/gcc/cp/parser.c
> > @@ -34534,10 +34534,11 @@ cp_parser_late_parsing_cilk_simd_fn_info (cp_parser *parser, tree attrs)
> >    cp_omp_declare_simd_data *info = parser->cilk_simd_fn_info;
> >    int ii = 0;
> >  
> > -  if (parser->omp_declare_simd != NULL)
> > +  if (parser->omp_declare_simd != NULL
> > +      || lookup_attribute ("simd", attrs))
> >      {
> > -      error ("%<#pragma omp declare simd%> cannot be used in the same function"
> > -	     " marked as a Cilk Plus SIMD-enabled function");
> > +      error ("%<#pragma omp declare simd%> of %<simd%> attribute cannot be used "
> > +	     "in the same function marked as a Cilk Plus SIMD-enabled function");
> 
> Too long lines.
> 
> >        XDELETE (parser->cilk_simd_fn_info);
> >        parser->cilk_simd_fn_info = NULL;
> >        return attrs;
> > diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> > index fdb1547..32994a2 100644
> > --- a/gcc/doc/extend.texi
> > +++ b/gcc/doc/extend.texi
> > @@ -3066,6 +3066,21 @@ This function attribute make a stack protection of the function if
> >  flags @option{fstack-protector} or @option{fstack-protector-strong}
> >  or @option{fstack-protector-explicit} are set.
> >  
> > +@item simd
> > +@cindex @code{simd} function attribute.
> > +This attribute enables creation of one or more function versions that
> > +can process multiple arguments using SIMD instructions from a
> > +single invocation.  Specifying this attribute allows compiler to
> > +assume that such a versions are available at link time (provided
> > +in the same or another translation unit).  Generated versions are
> > +target dependent and described in corresponding Vector ABI document.  For
> > +x86_64 target this document can be found
> > +@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
> 
> Are you going to update VectorABI.txt based on the latest changes in
> the Intel ABI document?  I mean especially using L, R or U for linear
> %val(), %ref() or %uval() (if references), not using s for linear with
> uniform parameter stride, but instead using ls, Ls, Rs or Us for those?
> 
> > diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
> > new file mode 100644
> > index 0000000..6fd757a
> > --- /dev/null
> > +++ b/gcc/testsuite/c-c++-common/attr-simd.c
> > @@ -0,0 +1,17 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-fdump-tree-optimized" } */
> > +
> > +__attribute__((__simd__))
> > +static int simd_attr (void)
> > +{
> > +  return 0;
> > +}
> > +
> > +__attribute__((simd))
> > +static int simd_attr2 (void)
> > +{
> > +  return 0;
> > +}
> > +
> > +/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
> > +/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" } } */
> 
> You should add a few scan-assembler lines for x86_64/i?86 (see some
> declare-simd*.{c,C} tests) to test mangling.  Of course not when the
> function is static...
> 
> Otherwise LGTM.
> 
> 	Jakub


diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 6e2ce0a..ed9db8af 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -387,6 +387,7 @@ static tree handle_warn_unused_attribute (tree *, tree, tree, int, bool *);
 static tree handle_returns_nonnull_attribute (tree *, tree, tree, int, bool *);
 static tree handle_omp_declare_simd_attribute (tree *, tree, tree, int,
 					       bool *);
+static tree handle_simd_attribute (tree *, tree, tree, int, bool *);
 static tree handle_omp_declare_target_attribute (tree *, tree, tree, int,
 						 bool *);
 static tree handle_designated_init_attribute (tree *, tree, tree, int, bool *);
@@ -817,6 +818,8 @@ const struct attribute_spec c_common_attribute_table[] =
 			      handle_omp_declare_simd_attribute, false },
   { "cilk simd function",     0, -1, true,  false, false,
 			      handle_omp_declare_simd_attribute, false },
+  { "simd",		      0, 0, true,  false, false,
+			      handle_simd_attribute, false },
   { "omp declare target",     0, 0, true, false, false,
 			      handle_omp_declare_target_attribute, false },
   { "alloc_align",	      1, 1, false, true, true,
@@ -9013,6 +9016,35 @@ handle_omp_declare_simd_attribute (tree *, tree, tree, int, bool *)
   return NULL_TREE;
 }
 
+/* Handle an "simd" attribute.  */
+
+static tree
+handle_simd_attribute (tree *node, tree name, tree, int , bool *no_add_attrs)
+{
+  if (TREE_CODE (*node) == FUNCTION_DECL)
+    {
+      if (lookup_attribute ("cilk simd function",
+			    DECL_ATTRIBUTES (*node)) != NULL)
+	{
+	  error_at (DECL_SOURCE_LOCATION (*node),
+		    "%<__simd__%> attribute cannot be used in the same "
+		    "function marked as a Cilk Plus SIMD-enabled function");
+	  *no_add_attrs = true;
+	}
+      else
+	DECL_ATTRIBUTES (*node)
+	  = tree_cons (get_identifier ("omp declare simd"),
+		       NULL_TREE, DECL_ATTRIBUTES (*node));
+    }
+  else
+    {
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
+      *no_add_attrs = true;
+    }
+
+  return NULL_TREE;
+}
+
 /* Handle an "omp declare target" attribute; arguments as in
    struct attribute_spec.handler.  */
 
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index c01d651..b33be9d 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -16055,10 +16055,13 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
 			   vec<c_token> clauses)
 {
   if (flag_cilkplus
-      && clauses.exists () && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
+      && (clauses.exists ()
+	  || lookup_attribute ("simd", DECL_ATTRIBUTES (fndecl)))
+      && !vec_safe_is_empty (parser->cilk_simd_fn_tokens))
     {
-      error ("%<#pragma omp declare simd%> cannot be used in the same "
-	     "function marked as a Cilk Plus SIMD-enabled function");
+      error ("%<#pragma omp declare simd%> or %<simd%> attribute cannot be "
+	     "used in the same function marked as a Cilk Plus SIMD-enabled "
+	     "function");
       vec_free (parser->cilk_simd_fn_tokens);
       return;
     }
@@ -16096,6 +16099,16 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
       parser->tokens = parser->cilk_simd_fn_tokens->address ();
       parser->tokens_avail = vec_safe_length (parser->cilk_simd_fn_tokens);
       is_cilkplus_cilk_simd_fn = true;
+
+      if (lookup_attribute ("simd", DECL_ATTRIBUTES (fndecl)) != NULL)
+	{
+	  error_at (DECL_SOURCE_LOCATION (fndecl),
+		    "%<__simd__%> attribute cannot be used in the same "
+		    "function marked as a Cilk Plus SIMD-enabled function");
+	  vec_free (parser->cilk_simd_fn_tokens);
+	  return;
+	}
+
     }
   else
     {
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 0c918ecf..2386c60 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -35042,10 +35042,12 @@ cp_parser_late_parsing_cilk_simd_fn_info (cp_parser *parser, tree attrs)
   cp_omp_declare_simd_data *info = parser->cilk_simd_fn_info;
   int ii = 0;
 
-  if (parser->omp_declare_simd != NULL)
+  if (parser->omp_declare_simd != NULL
+      || lookup_attribute ("simd", attrs))
     {
-      error ("%<#pragma omp declare simd%> cannot be used in the same function"
-	     " marked as a Cilk Plus SIMD-enabled function");
+      error ("%<#pragma omp declare simd%> of %<simd%> attribute cannot be "
+	     "used in the same function marked as a Cilk Plus SIMD-enabled "
+	     " function");
       XDELETE (parser->cilk_simd_fn_info);
       parser->cilk_simd_fn_info = NULL;
       return attrs;
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index aab6bad..e973047 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3143,6 +3143,21 @@ one compiled with @option{-msse4.1} and another with @option{-mavx}.
 At the function call it will create resolver @code{ifunc}, that will
 dynamically call a clone suitable for current architecture.
 
+@item simd
+@cindex @code{simd} function attribute.
+This attribute enables creation of one or more function versions that
+can process multiple arguments using SIMD instructions from a
+single invocation.  Specifying this attribute allows compiler to
+assume that such a versions are available at link time (provided
+in the same or another translation unit).  Generated versions are
+target dependent and described in corresponding Vector ABI document.  For
+x86_64 target this document can be found
+@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
+It is prohibited to use the attribute along with Cilk Plus's @code{vector}
+attribute. If the attribute is specified and @code{#pragma omp declare simd}
+presented on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}
+switch is specified, then the attribute is ignored.
+
 @item target (@var{options})
 @cindex @code{target} function attribute
 Multiple target back ends implement the @code{target} attribute
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index f7584de..15e8737 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -18405,10 +18405,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
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..bc91ccf
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized -fopenmp-simd" } */
+
+#pragma omp declare simd
+__attribute__((__simd__))
+extern
+int simd_attr (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "omp declare simd" "optimized" } } */
+/* { dg-final { scan-assembler-times "_ZGVbN4_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVbM4_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
new file mode 100644
index 0000000..2bbdf04
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
+
+void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
new file mode 100644
index 0000000..b4eda34
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+
+__attribute__((__simd__))
+extern
+int simd_attr (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
+/* { dg-final { scan-assembler-times "_ZGVbN4_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVbM4_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVcN4_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVcM4_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVdN8_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVdM8_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+
+__attribute__((simd))
+extern
+int simd_attr2 (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" } } */
+/* { dg-final { scan-assembler-times "_ZGVbN4_(?:_Z10)?simd_attr2(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVbM4_(?:_Z10)?simd_attr2(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVcN4_(?:_Z10)?simd_attr2(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVcM4_(?:_Z10)?simd_attr2(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVdN8_(?:_Z10)?simd_attr2(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVdM8_(?:_Z10)?simd_attr2(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-11-13 11:55                                   ` Kirill Yukhin
@ 2015-11-13 12:16                                     ` Jakub Jelinek
  2015-12-02 12:47                                       ` Kirill Yukhin
  2015-11-18  9:39                                     ` Andreas Schwab
  2015-11-18  9:46                                     ` Andreas Schwab
  2 siblings, 1 reply; 28+ messages in thread
From: Jakub Jelinek @ 2015-11-13 12:16 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Joseph Myers, Jeff Law, GCC Patches

On Fri, Nov 13, 2015 at 02:54:33PM +0300, Kirill Yukhin wrote:
> @@ -9013,6 +9016,35 @@ handle_omp_declare_simd_attribute (tree *, tree, tree, int, bool *)
>    return NULL_TREE;
>  }
>  
> +/* Handle an "simd" attribute.  */

/* Handle a "simd" attribute.  */
instead?

> +static tree
> +handle_simd_attribute (tree *node, tree name, tree, int , bool *no_add_attrs)

No space after int.

> +@item simd
> +@cindex @code{simd} function attribute.
> +This attribute enables creation of one or more function versions that
> +can process multiple arguments using SIMD instructions from a
> +single invocation.  Specifying this attribute allows compiler to
> +assume that such a versions are available at link time (provided

Not a native english speaker, but I'd leave the "a " out.

> +in the same or another translation unit).  Generated versions are
> +target dependent and described in corresponding Vector ABI document.  For
> +x86_64 target this document can be found
> +@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
> +It is prohibited to use the attribute along with Cilk Plus's @code{vector}

I think we usually don't say prohibited in the docs, perhaps
"The attribute should not be used together with Cilk Plus @code{vector}
attribute on the same function."?

> +attribute. If the attribute is specified and @code{#pragma omp declare simd}
> +presented on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}

is present on ?

> 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..bc91ccf
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/attr-simd-2.c
> @@ -0,0 +1,14 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fdump-tree-optimized -fopenmp-simd" } */
> +
> +#pragma omp declare simd
> +__attribute__((__simd__))
> +extern

Maybe just add
#ifdef __cplusplus
"C"
#endif
and remove the C++ mangling cruft from the scan-assembler lines?

> +int simd_attr (void)
> +{
> +  return 0;
> +}
> +
> +/* { dg-final { scan-tree-dump "omp declare simd" "optimized" } } */
> +/* { dg-final { scan-assembler-times "_ZGVbN4_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
> +/* { dg-final { scan-assembler-times "_ZGVbM4_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */

> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/attr-simd.c

Similarly.

Ok for trunk with those changes.

	Jakub

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-11-13 11:55                                   ` Kirill Yukhin
  2015-11-13 12:16                                     ` Jakub Jelinek
@ 2015-11-18  9:39                                     ` Andreas Schwab
  2015-11-18  9:46                                     ` Andreas Schwab
  2 siblings, 0 replies; 28+ messages in thread
From: Andreas Schwab @ 2015-11-18  9:39 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Jakub Jelinek, Joseph Myers, Jeff Law, GCC Patches

Kirill Yukhin <kirill.yukhin@gmail.com> writes:

> diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
> new file mode 100644
> index 0000000..2bbdf04
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
> @@ -0,0 +1,5 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fcilkplus" } */
> +/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
> +
> +void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */

FAIL: c-c++-common/attr-simd-3.c  -std=gnu++11  (test for errors, line 5)
FAIL: c-c++-common/attr-simd-3.c  -std=gnu++11 (test for excess errors)
Excess errors:
/usr/local/gcc/gcc-20151118/gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types [-Wattributes]

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-11-13 11:55                                   ` Kirill Yukhin
  2015-11-13 12:16                                     ` Jakub Jelinek
  2015-11-18  9:39                                     ` Andreas Schwab
@ 2015-11-18  9:46                                     ` Andreas Schwab
  2015-11-18 14:11                                       ` Kirill Yukhin
  2 siblings, 1 reply; 28+ messages in thread
From: Andreas Schwab @ 2015-11-18  9:46 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Jakub Jelinek, Joseph Myers, Jeff Law, GCC Patches

Kirill Yukhin <kirill.yukhin@gmail.com> writes:

> diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
> new file mode 100644
> index 0000000..b4eda34
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/attr-simd.c
> @@ -0,0 +1,32 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fdump-tree-optimized" } */
> +
> +__attribute__((__simd__))
> +extern
> +int simd_attr (void)
> +{
> +  return 0;
> +}
> +
> +/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */

On ia64:

FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump optimized "simd_attr[ \\t]simdclone|vector"
FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump optimized "simd_attr2[ \\t]simdclone|vector"

$ grep simd_attr attr-simd.c.194t.optimized 
;; Function simd_attr (simd_attr, funcdef_no=0, decl_uid=1389, cgraph_uid=0, symbol_order=0)
simd_attr ()
;; Function simd_attr2 (simd_attr2, funcdef_no=1, decl_uid=1392, cgraph_uid=1, symbol_order=1)
simd_attr2 ()

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  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
  0 siblings, 2 replies; 28+ messages in thread
From: Kirill Yukhin @ 2015-11-18 14:11 UTC (permalink / raw)
  To: Andreas Schwab, David Edelsohn
  Cc: Jakub Jelinek, Joseph Myers, Jeff Law, GCC Patches

Hello Andreas, Devid.

On 18 Nov 10:45, Andreas Schwab wrote:
> Kirill Yukhin <kirill.yukhin@gmail.com> writes:
> 
> > diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
> > new file mode 100644
> > index 0000000..b4eda34
> > --- /dev/null
> > +++ b/gcc/testsuite/c-c++-common/attr-simd.c
> > @@ -0,0 +1,32 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-fdump-tree-optimized" } */
> > +
> > +__attribute__((__simd__))
> > +extern
> > +int simd_attr (void)
> > +{
> > +  return 0;
> > +}
> > +
> > +/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
> 
> On ia64:
> 
> FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump optimized "simd_attr[ \\t]simdclone|vector"
> FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump optimized "simd_attr2[ \\t]simdclone|vector"
> 
> $ grep simd_attr attr-simd.c.194t.optimized 
> ;; Function simd_attr (simd_attr, funcdef_no=0, decl_uid=1389, cgraph_uid=0, symbol_order=0)
> simd_attr ()
> ;; Function simd_attr2 (simd_attr2, funcdef_no=1, decl_uid=1392, cgraph_uid=1, symbol_order=1)
> simd_attr2 ()
As far as vABI is supported on x86_64/i?86 only, I am going to enable mentioned `scan-tree-dump' only
for these targets. This should cure both IA64 and Power.

Concerning attr-simd-3.c. It is known issue: PR68158.
And I believe this test should work everywhere as far as PR is resolved.
I'll put xfail into the test.
Which will lead to (in g++.log):
gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
 [-Wattributes]^M
output is:
gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
 [-Wattributes]^M

XFAIL: c-c++-common/attr-simd-3.c  -std=gnu++98 PR68158 (test for errors, line 5)
FAIL: c-c++-common/attr-simd-3.c  -std=gnu++98 (test for excess errors)
Excess errors:
gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
 [-Wattributes]

Patch in the bottom.

gcc/tessuite/
	* c-c++-common/attr-simd-3.c: Put xfail (PR68158) on dg-error.
	* c-c++-common/attr-simd.c: Limit scan of dump to x86_64/i?86.

> 
> Andreas.
> 
> -- 
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
index 2bbdf04..35dd4c0 100644
--- a/gcc/testsuite/c-c++-common/attr-simd-3.c
+++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
@@ -2,4 +2,4 @@
 /* { dg-options "-fcilkplus" } */
 /* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */

-void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
+void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" "PR68158" { xfail c++ } } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
index 61974e3..7674588 100644
--- a/gcc/testsuite/c-c++-common/attr-simd.c
+++ b/gcc/testsuite/c-c++-common/attr-simd.c
@@ -11,7 +11,7 @@ int simd_attr (void)
   return 0;
 }

-/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
+/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" { target { i?86-*-* x86_64-*-* } } } } */
 /* { dg-final { scan-assembler-times "_ZGVbN4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
 /* { dg-final { scan-assembler-times "_ZGVbM4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
 /* { dg-final { scan-assembler-times "_ZGVcN4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
@@ -29,7 +29,7 @@ int simd_attr2 (void)
   return 0;
 }

-/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" } } */
+/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" { target { i?86-*-* x86_64-*-* } } } } */
 /* { dg-final { scan-assembler-times "_ZGVbN4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
 /* { dg-final { scan-assembler-times "_ZGVbM4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
 /* { dg-final { scan-assembler-times "_ZGVcN4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-11-18 14:11                                       ` Kirill Yukhin
@ 2015-11-18 17:01                                         ` Jeff Law
  2015-11-20 12:15                                         ` Kyrill Tkachov
  1 sibling, 0 replies; 28+ messages in thread
From: Jeff Law @ 2015-11-18 17:01 UTC (permalink / raw)
  To: Kirill Yukhin, Andreas Schwab, David Edelsohn
  Cc: Jakub Jelinek, Joseph Myers, GCC Patches

On 11/18/2015 07:11 AM, Kirill Yukhin wrote:
> Hello Andreas, Devid.
>
> On 18 Nov 10:45, Andreas Schwab wrote:
>> Kirill Yukhin <kirill.yukhin@gmail.com> writes:
>>
>>> diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
>>> new file mode 100644
>>> index 0000000..b4eda34
>>> --- /dev/null
>>> +++ b/gcc/testsuite/c-c++-common/attr-simd.c
>>> @@ -0,0 +1,32 @@
>>> +/* { dg-do compile } */
>>> +/* { dg-options "-fdump-tree-optimized" } */
>>> +
>>> +__attribute__((__simd__))
>>> +extern
>>> +int simd_attr (void)
>>> +{
>>> +  return 0;
>>> +}
>>> +
>>> +/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
>>
>> On ia64:
>>
>> FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump optimized "simd_attr[ \\t]simdclone|vector"
>> FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump optimized "simd_attr2[ \\t]simdclone|vector"
>>
>> $ grep simd_attr attr-simd.c.194t.optimized
>> ;; Function simd_attr (simd_attr, funcdef_no=0, decl_uid=1389, cgraph_uid=0, symbol_order=0)
>> simd_attr ()
>> ;; Function simd_attr2 (simd_attr2, funcdef_no=1, decl_uid=1392, cgraph_uid=1, symbol_order=1)
>> simd_attr2 ()
> As far as vABI is supported on x86_64/i?86 only, I am going to enable mentioned `scan-tree-dump' only
> for these targets. This should cure both IA64 and Power.
>
> Concerning attr-simd-3.c. It is known issue: PR68158.
> And I believe this test should work everywhere as far as PR is resolved.
> I'll put xfail into the test.
> Which will lead to (in g++.log):
> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
>   [-Wattributes]^M
> output is:
> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
>   [-Wattributes]^M
>
> XFAIL: c-c++-common/attr-simd-3.c  -std=gnu++98 PR68158 (test for errors, line 5)
> FAIL: c-c++-common/attr-simd-3.c  -std=gnu++98 (test for excess errors)
> Excess errors:
> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
>   [-Wattributes]
>
> Patch in the bottom.
>
> gcc/tessuite/
> 	* c-c++-common/attr-simd-3.c: Put xfail (PR68158) on dg-error.
> 	* c-c++-common/attr-simd.c: Limit scan of dump to x86_64/i?86.
This is fine.  Though we might consider whether or not we need another 
target-supports if we find ourselves sprinkling too many target 
conditionals on these tests.

jeff

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  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
  1 sibling, 2 replies; 28+ messages in thread
From: Kyrill Tkachov @ 2015-11-20 12:15 UTC (permalink / raw)
  To: Kirill Yukhin, Andreas Schwab, David Edelsohn
  Cc: Jakub Jelinek, Joseph Myers, Jeff Law, GCC Patches

Hi Kirill,

On 18/11/15 14:11, Kirill Yukhin wrote:
> Hello Andreas, Devid.
>
> On 18 Nov 10:45, Andreas Schwab wrote:
>> Kirill Yukhin <kirill.yukhin@gmail.com> writes:
>>
>>> diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
>>> new file mode 100644
>>> index 0000000..b4eda34
>>> --- /dev/null
>>> +++ b/gcc/testsuite/c-c++-common/attr-simd.c
>>> @@ -0,0 +1,32 @@
>>> +/* { dg-do compile } */
>>> +/* { dg-options "-fdump-tree-optimized" } */
>>> +
>>> +__attribute__((__simd__))
>>> +extern
>>> +int simd_attr (void)
>>> +{
>>> +  return 0;
>>> +}
>>> +
>>> +/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
>> On ia64:
>>
>> FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump optimized "simd_attr[ \\t]simdclone|vector"
>> FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump optimized "simd_attr2[ \\t]simdclone|vector"
>>
>> $ grep simd_attr attr-simd.c.194t.optimized
>> ;; Function simd_attr (simd_attr, funcdef_no=0, decl_uid=1389, cgraph_uid=0, symbol_order=0)
>> simd_attr ()
>> ;; Function simd_attr2 (simd_attr2, funcdef_no=1, decl_uid=1392, cgraph_uid=1, symbol_order=1)
>> simd_attr2 ()
> As far as vABI is supported on x86_64/i?86 only, I am going to enable mentioned `scan-tree-dump' only
> for these targets. This should cure both IA64 and Power.
>
> Concerning attr-simd-3.c. It is known issue: PR68158.
> And I believe this test should work everywhere as far as PR is resolved.
> I'll put xfail into the test.
> Which will lead to (in g++.log):
> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
>   [-Wattributes]^M
> output is:
> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
>   [-Wattributes]^M
>
> XFAIL: c-c++-common/attr-simd-3.c  -std=gnu++98 PR68158 (test for errors, line 5)
> FAIL: c-c++-common/attr-simd-3.c  -std=gnu++98 (test for excess errors)
> Excess errors:
> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
>   [-Wattributes]
>
> Patch in the bottom.
>
> gcc/tessuite/
> 	* c-c++-common/attr-simd-3.c: Put xfail (PR68158) on dg-error.

This test fails on bare-metal targets that don't support -fcilkplus or -pthread.
Would you consider moving them to the cilkplus testing directory or adding an appropriate
effective target check?

Thanks,
Kyrill

> 	* c-c++-common/attr-simd.c: Limit scan of dump to x86_64/i?86.
>
>> Andreas.
>>
>> -- 
>> Andreas Schwab, SUSE Labs, schwab@suse.de
>> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
>> "And now for something completely different."
> diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
> index 2bbdf04..35dd4c0 100644
> --- a/gcc/testsuite/c-c++-common/attr-simd-3.c
> +++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
> @@ -2,4 +2,4 @@
>   /* { dg-options "-fcilkplus" } */
>   /* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
>
> -void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
> +void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" "PR68158" { xfail c++ } } */
> diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
> index 61974e3..7674588 100644
> --- a/gcc/testsuite/c-c++-common/attr-simd.c
> +++ b/gcc/testsuite/c-c++-common/attr-simd.c
> @@ -11,7 +11,7 @@ int simd_attr (void)
>     return 0;
>   }
>
> -/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
> +/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVbN4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVbM4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVcN4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
> @@ -29,7 +29,7 @@ int simd_attr2 (void)
>     return 0;
>   }
>
> -/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" } } */
> +/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVbN4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVbM4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVcN4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-11-20 12:15                                         ` Kyrill Tkachov
@ 2015-11-20 13:33                                           ` Kirill Yukhin
  2015-11-20 19:48                                           ` Jeff Law
  1 sibling, 0 replies; 28+ messages in thread
From: Kirill Yukhin @ 2015-11-20 13:33 UTC (permalink / raw)
  To: Kyrill Tkachov
  Cc: Andreas Schwab, David Edelsohn, Jakub Jelinek, Joseph Myers,
	Jeff Law, GCC Patches

Hello Kyrill,
On 20 Nov 12:15, Kyrill Tkachov wrote:
> >gcc/tessuite/
> >	* c-c++-common/attr-simd-3.c: Put xfail (PR68158) on dg-error.
> 
> This test fails on bare-metal targets that don't support -fcilkplus or -pthread.
> Would you consider moving them to the cilkplus testing directory or adding an appropriate
> effective target check?
I think so. I'll commit change in the bottom.

gcc/testsuite/
	* c-c++-common/attr-simd-3.c: Require Cilk Plus in effective target.

> 
> Thanks,
> Kyrill

--
Thanks, K

diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
index 35dd4c0..c7533f0 100644
--- a/gcc/testsuite/c-c++-common/attr-simd-3.c
+++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target cilkplus } */
 /* { dg-do compile } */
 /* { dg-options "-fcilkplus" } */
 /* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-11-20 12:15                                         ` Kyrill Tkachov
  2015-11-20 13:33                                           ` Kirill Yukhin
@ 2015-11-20 19:48                                           ` Jeff Law
  1 sibling, 0 replies; 28+ messages in thread
From: Jeff Law @ 2015-11-20 19:48 UTC (permalink / raw)
  To: Kyrill Tkachov, Kirill Yukhin, Andreas Schwab, David Edelsohn
  Cc: Jakub Jelinek, Joseph Myers, GCC Patches

On 11/20/2015 05:15 AM, Kyrill Tkachov wrote:
> Hi Kirill,
>
> On 18/11/15 14:11, Kirill Yukhin wrote:
>> Hello Andreas, Devid.
>>
>> On 18 Nov 10:45, Andreas Schwab wrote:
>>> Kirill Yukhin <kirill.yukhin@gmail.com> writes:
>>>
>>>> diff --git a/gcc/testsuite/c-c++-common/attr-simd.c
>>>> b/gcc/testsuite/c-c++-common/attr-simd.c
>>>> new file mode 100644
>>>> index 0000000..b4eda34
>>>> --- /dev/null
>>>> +++ b/gcc/testsuite/c-c++-common/attr-simd.c
>>>> @@ -0,0 +1,32 @@
>>>> +/* { dg-do compile } */
>>>> +/* { dg-options "-fdump-tree-optimized" } */
>>>> +
>>>> +__attribute__((__simd__))
>>>> +extern
>>>> +int simd_attr (void)
>>>> +{
>>>> +  return 0;
>>>> +}
>>>> +
>>>> +/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector"
>>>> "optimized" } } */
>>> On ia64:
>>>
>>> FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump
>>> optimized "simd_attr[ \\t]simdclone|vector"
>>> FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump
>>> optimized "simd_attr2[ \\t]simdclone|vector"
>>>
>>> $ grep simd_attr attr-simd.c.194t.optimized
>>> ;; Function simd_attr (simd_attr, funcdef_no=0, decl_uid=1389,
>>> cgraph_uid=0, symbol_order=0)
>>> simd_attr ()
>>> ;; Function simd_attr2 (simd_attr2, funcdef_no=1, decl_uid=1392,
>>> cgraph_uid=1, symbol_order=1)
>>> simd_attr2 ()
>> As far as vABI is supported on x86_64/i?86 only, I am going to enable
>> mentioned `scan-tree-dump' only
>> for these targets. This should cure both IA64 and Power.
>>
>> Concerning attr-simd-3.c. It is known issue: PR68158.
>> And I believe this test should work everywhere as far as PR is resolved.
>> I'll put xfail into the test.
>> Which will lead to (in g++.log):
>> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__'
>> attribute does not apply to types\
>>   [-Wattributes]^M
>> output is:
>> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__'
>> attribute does not apply to types\
>>   [-Wattributes]^M
>>
>> XFAIL: c-c++-common/attr-simd-3.c  -std=gnu++98 PR68158 (test for
>> errors, line 5)
>> FAIL: c-c++-common/attr-simd-3.c  -std=gnu++98 (test for excess errors)
>> Excess errors:
>> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__'
>> attribute does not apply to types\
>>   [-Wattributes]
>>
>> Patch in the bottom.
>>
>> gcc/tessuite/
>>     * c-c++-common/attr-simd-3.c: Put xfail (PR68158) on dg-error.
>
> This test fails on bare-metal targets that don't support -fcilkplus or
> -pthread.
> Would you consider moving them to the cilkplus testing directory or
> adding an appropriate
> effective target check?
I think an effective-target-check is the most appropriate.  The whole 
point here is to make that attribute independent of Cilk support.

jeff

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-11-13 12:16                                     ` Jakub Jelinek
@ 2015-12-02 12:47                                       ` Kirill Yukhin
  2015-12-02 17:40                                         ` Jeff Law
  0 siblings, 1 reply; 28+ messages in thread
From: Kirill Yukhin @ 2015-12-02 12:47 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Joseph Myers, Jeff Law, GCC Patches

Hello Jakub,

On 13 Nov 13:16, Jakub Jelinek wrote:
> > --- /dev/null
> > +++ b/gcc/testsuite/c-c++-common/attr-simd.c
> 
> Similarly.
> 
> Ok for trunk with those changes.
It turns out that current implementation of GLibC does not
contain masked variants of math routines. So, this attribute
is useless until it is capable to generation only [nonmasked|maked]
variants of the routines.

Patch in the bottom introduces `notinbranch' and `inbranch' flags to
the attribute.

Bootstrapped and regtested. New tests pass.

Is it ok for trunk (GCC v6)?

gcc/
	* c-family/c-common.c (c_common_attribute_table[]): Update max aerguments
	count for "simd" attribute.
	(handle_simd_attribute): Parse "notinbranch" and "inbranch" arguments.
	* doc/extend.texi ("simd"): Describe new flags.
gcc/testsuite/
	* c-c++-common/attr-simd-4.c: New test.
	* c-c++-common/attr-simd-5.c: New test.

--
Thanks, K

> 
> 	Jakub

commit cf458a0a00214022556498bdda94a07d0af70574
Author: Kirill Yukhin <kirill.yukhin@intel.com>
Date:   Mon Nov 30 16:24:39 2015 +0300

    [attr-simd] Add notinbranch/inbranch flags.

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 369574f..0104306 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -818,7 +818,7 @@ const struct attribute_spec c_common_attribute_table[] =
 			      handle_omp_declare_simd_attribute, false },
   { "cilk simd function",     0, -1, true,  false, false,
 			      handle_omp_declare_simd_attribute, false },
-  { "simd",		      0, 0, true,  false, false,
+  { "simd",		      0, 1, true,  false, false,
 			      handle_simd_attribute, false },
   { "omp declare target",     0, 0, true, false, false,
 			      handle_omp_declare_target_attribute, false },
@@ -9032,7 +9032,7 @@ handle_omp_declare_simd_attribute (tree *, tree, tree, int, bool *)
 /* Handle a "simd" attribute.  */
 
 static tree
-handle_simd_attribute (tree *node, tree name, tree, int, bool *no_add_attrs)
+handle_simd_attribute (tree *node, tree name, tree args, int, bool *no_add_attrs)
 {
   if (TREE_CODE (*node) == FUNCTION_DECL)
     {
@@ -9045,9 +9045,41 @@ handle_simd_attribute (tree *node, tree name, tree, int, bool *no_add_attrs)
 	  *no_add_attrs = true;
 	}
       else
-	DECL_ATTRIBUTES (*node)
-	  = tree_cons (get_identifier ("omp declare simd"),
-		       NULL_TREE, DECL_ATTRIBUTES (*node));
+	{
+	  tree t = get_identifier ("omp declare simd");
+	  tree attr = NULL_TREE;
+	  if (args)
+	    {
+	      tree id = TREE_VALUE (args);
+
+	      if (TREE_CODE (id) != STRING_CST)
+		{
+		  error ("attribute %qE argument not a string", name);
+		  *no_add_attrs = true;
+		  return NULL_TREE;
+		}
+
+	      if (strcmp (TREE_STRING_POINTER (id), "notinbranch") == 0)
+		attr = build_omp_clause (DECL_SOURCE_LOCATION (*node),
+					 OMP_CLAUSE_NOTINBRANCH);
+	      else
+		if (strcmp (TREE_STRING_POINTER (id), "inbranch") == 0)
+		  attr = build_omp_clause (DECL_SOURCE_LOCATION (*node),
+					   OMP_CLAUSE_INBRANCH);
+		else
+		{
+		  error ("only %<inbranch%> and %<notinbranch%> flags are "
+			 "allowed for %<__simd__%> attribute");
+		  *no_add_attrs = true;
+		  return NULL_TREE;
+		}
+	    }
+
+	  DECL_ATTRIBUTES (*node) = tree_cons (t,
+					       build_tree_list (NULL_TREE,
+								attr),
+					       DECL_ATTRIBUTES (*node));
+	}
     }
   else
     {
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 63fce0f..c517038 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3144,6 +3144,7 @@ At the function call it will create resolver @code{ifunc}, that will
 dynamically call a clone suitable for current architecture.
 
 @item simd
+@itemx simd("@var{mask}")
 @cindex @code{simd} function attribute.
 This attribute enables creation of one or more function versions that
 can process multiple arguments using SIMD instructions from a
@@ -3158,6 +3159,9 @@ attribute on the same function.
 If the attribute is specified and @code{#pragma omp declare simd}
 present on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}
 switch is specified, then the attribute is ignored.
+The optional argument @var{mask} may have "notinbranch" or "inbranch"
+value and instructs the compiler to generate non-masked or masked
+clones correspondingly. By default, all clones are generated.
 
 @item target (@var{options})
 @cindex @code{target} function attribute
diff --git a/gcc/testsuite/c-c++-common/attr-simd-4.c b/gcc/testsuite/c-c++-common/attr-simd-4.c
new file mode 100644
index 0000000..66cd8f1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd-4.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+__attribute__((__simd__("notinbranch")))
+int simd_attr (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVbN4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVcN4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVdN8_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-not "_ZGVbM4_simd_attr:" { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-not "_ZGVcM4_simd_attr:" { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-not "_ZGVdM8_simd_attr:" { target { i?86-*-* x86_64-*-* } } } } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+__attribute__((simd("inbranch")))
+int simd_attr2 (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-not "_ZGVbN4_simd_attr2:" { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-not "_ZGVcN4_simd_attr2:" { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-not "_ZGVdN8_simd_attr2:" { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVbM4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVcM4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
+/* { dg-final { scan-assembler-times "_ZGVdM8_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
diff --git a/gcc/testsuite/c-c++-common/attr-simd-5.c b/gcc/testsuite/c-c++-common/attr-simd-5.c
new file mode 100644
index 0000000..7bf3f2c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-simd-5.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+
+__attribute__((__simd__("bug")))
+int simd_attr (void) { return 0; } /* { dg-error "only 'inbranch' and 'notinbranch'" } */
+
+__attribute__((__simd__("notinbranch", "inbranch")))
+int simd_attr2 (void) { return 0; } /* { dg-error "wrong number of arguments specified" } */

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-12-02 12:47                                       ` Kirill Yukhin
@ 2015-12-02 17:40                                         ` Jeff Law
  2015-12-02 17:42                                           ` Jakub Jelinek
  0 siblings, 1 reply; 28+ messages in thread
From: Jeff Law @ 2015-12-02 17:40 UTC (permalink / raw)
  To: Kirill Yukhin, Jakub Jelinek; +Cc: Joseph Myers, GCC Patches

On 12/02/2015 05:46 AM, Kirill Yukhin wrote:
> Hello Jakub,
>
> On 13 Nov 13:16, Jakub Jelinek wrote:
>>> --- /dev/null
>>> +++ b/gcc/testsuite/c-c++-common/attr-simd.c
>>
>> Similarly.
>>
>> Ok for trunk with those changes.
> It turns out that current implementation of GLibC does not
> contain masked variants of math routines. So, this attribute
> is useless until it is capable to generation only [nonmasked|maked]
> variants of the routines.
>
> Patch in the bottom introduces `notinbranch' and `inbranch' flags to
> the attribute.
>
> Bootstrapped and regtested. New tests pass.
>
> Is it ok for trunk (GCC v6)?
>
> gcc/
> 	* c-family/c-common.c (c_common_attribute_table[]): Update max aerguments
> 	count for "simd" attribute.
> 	(handle_simd_attribute): Parse "notinbranch" and "inbranch" arguments.
> 	* doc/extend.texi ("simd"): Describe new flags.
> gcc/testsuite/
> 	* c-c++-common/attr-simd-4.c: New test.
> 	* c-c++-common/attr-simd-5.c: New test.
Why not use "unmasked" and "masked" instead of "notinbranch" and 
"inbranch"?   If those terms come from OpenMP or are in use by other 
compilers (llvm, icc, whatever), then I guess we should stick with them. 
  Otherwise we should consider [un]masked which are consistent with the 
vector abi document.

So I think if [not]inbranch comes from OpenMP, then this patch is OK 
as-is.   Similarly if other compilers are using the [not]inbranch 
modifier.  If the modifiers are totally arbitrary, then consider using 
[un]masked which is consistent with the vector abi documentation and the 
patch would be pre-approved with that change.


Jeff

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
  2015-12-02 17:40                                         ` Jeff Law
@ 2015-12-02 17:42                                           ` Jakub Jelinek
  0 siblings, 0 replies; 28+ messages in thread
From: Jakub Jelinek @ 2015-12-02 17:42 UTC (permalink / raw)
  To: Jeff Law; +Cc: Kirill Yukhin, Joseph Myers, GCC Patches

On Wed, Dec 02, 2015 at 10:40:13AM -0700, Jeff Law wrote:
> Why not use "unmasked" and "masked" instead of "notinbranch" and "inbranch"?
> If those terms come from OpenMP or are in use by other compilers (llvm, icc,
> whatever), then I guess we should stick with them.  Otherwise we should
> consider [un]masked which are consistent with the vector abi document.

notinbranch/inbranch are OpenMP clauses used for this purpose.

	Jakub

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.
@ 2015-11-17 16:10 David Edelsohn
  0 siblings, 0 replies; 28+ messages in thread
From: David Edelsohn @ 2015-11-17 16:10 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: GCC Patches

Kirill,

        * c-c++-common/attr-simd.c
and
        * c-c++-common/attr-simd-3.c

fail on 32 bit systems, e.g., see powerpc64-linux tested in 32 bit mode.

- David

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2015-12-02 17:42 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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     ` [PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC 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
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

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).