Patchwork [omp4/cilkplus] jumps in/out-of #pragma simd for

login
register
mail settings
Submitter Aldy Hernandez
Date June 26, 2013, 2:44 p.m.
Message ID <51CAFE33.1040106@redhat.com>
Download mbox | patch
Permalink /patch/254781/
State New
Headers show

Comments

Aldy Hernandez - June 26, 2013, 2:44 p.m.
This is a followup for the C++ changes (your pt.c suggested changes, etc).

Only a few minor changes are needed, since c_finish_cilk_simd_loop() is 
shared between C/C++ and it creates the appropriate CILK_SIMD tree node.

Is this what you had in mind?
commit db2127098137dea6c246041e0d763a57a174fa3c
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Jun 26 09:29:27 2013 -0500

    Handle CILK_SIMD tree code in C++.
Jakub Jelinek - June 26, 2013, 3:33 p.m.
On Wed, Jun 26, 2013 at 09:44:03AM -0500, Aldy Hernandez wrote:
> This is a followup for the C++ changes (your pt.c suggested changes, etc).
> 
> Only a few minor changes are needed, since c_finish_cilk_simd_loop()
> is shared between C/C++ and it creates the appropriate CILK_SIMD
> tree node.
> 
> Is this what you had in mind?

Yes.

	Jakub
Aldy Hernandez - June 26, 2013, 7:29 p.m.
On 06/26/13 10:33, Jakub Jelinek wrote:
> On Wed, Jun 26, 2013 at 09:44:03AM -0500, Aldy Hernandez wrote:
>> This is a followup for the C++ changes (your pt.c suggested changes, etc).
>>
>> Only a few minor changes are needed, since c_finish_cilk_simd_loop()
>> is shared between C/C++ and it creates the appropriate CILK_SIMD
>> tree node.
>>
>> Is this what you had in mind?
>
> Yes.

Perfect.  I have pushed this to my aldyh/cilk-in-gomp branch.

This is pretty much all I have for the cilk patches sitting on top of 
your gomp4 branch.  Everything else should just depend on gomp-4_0-branch.

Thanks.

Patch

diff --git a/gcc/cp/ChangeLog.cilkplus b/gcc/cp/ChangeLog.cilkplus
index e7f7596..f0ee3ee 100644
--- a/gcc/cp/ChangeLog.cilkplus
+++ b/gcc/cp/ChangeLog.cilkplus
@@ -1,3 +1,10 @@ 
+2013-06-26  Aldy Hernandez  <aldyh@redhat.com>
+
+	* cp-gimplify.c (cp_gimplify_expr): Add case for CILK_SIMD.
+	(cp_genericize_r): Same.
+	* pt.c (tsubst_expr): Same.
+	* semantics.c (finish_omp_for): Same.
+
 2013-05-21  Balaji V. Iyer  <balaji.v.iyer@intel.com>
 	    Aldy Hernandez  <aldyh@redhat.com>
 
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 0dfa4a2..52ce57b 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -670,6 +670,7 @@  cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
 
     case OMP_FOR:
     case OMP_SIMD:
+    case CILK_SIMD:
     case OMP_DISTRIBUTE:
       ret = cp_gimplify_omp_for (expr_p, pre_p);
       break;
@@ -1120,6 +1121,7 @@  cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
     genericize_break_stmt (stmt_p);
   else if (TREE_CODE (stmt) == OMP_FOR
 	   || TREE_CODE (stmt) == OMP_SIMD
+	   || TREE_CODE (stmt) == CILK_SIMD
 	   || TREE_CODE (stmt) == OMP_DISTRIBUTE)
     genericize_omp_for_stmt (stmt_p, walk_subtrees, data);
   else if (TREE_CODE (stmt) == SIZEOF_EXPR)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 63d960d..d0fa491 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13293,6 +13293,7 @@  tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
 
     case OMP_FOR:
     case OMP_SIMD:
+    case CILK_SIMD:
     case OMP_DISTRIBUTE:
       {
 	tree clauses, body, pre_body;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ee83462..722a996 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5782,7 +5782,7 @@  finish_omp_for (location_t locus, enum tree_code code, tree declv, tree initv,
 
       if (CLASS_TYPE_P (TREE_TYPE (decl)))
 	{
-	  if (code == OMP_SIMD)
+	  if (code == OMP_SIMD || code == CILK_SIMD)
 	    {
 	      error_at (elocus, "%<#pragma omp simd%> used with class "
 				"iteration variable %qE", decl);