diff mbox

[Cilk+] CIlk_for enabling in the compiler

Message ID 87ppfa2ymk.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge Sept. 5, 2014, 9:41 a.m. UTC
Hi!

On Fri, 29 Aug 2014 14:36:17 +0000, "Zamyatin, Igor" <igor.zamyatin@intel.com> wrote:
> The patch is another attempt to enable Cilk_for (see eg https://www.cilkplus.org/sites/default/files/open_specifications/Intel_Cilk_plus_lang_spec_1.2.htm) in the GCC compiler.
> 
> Bootstrapped and regtested on x86_64.
> Is it ok for the trunk?

(Committed as r214818.)

One question:

> --- a/gcc/gimplify.c
> +++ b/gcc/gimplify.c
> @@ -7056,6 +7058,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
>      case OMP_FOR: kind = GF_OMP_FOR_KIND_FOR; break;
>      case OMP_SIMD: kind = GF_OMP_FOR_KIND_SIMD; break;
>      case CILK_SIMD: kind = GF_OMP_FOR_KIND_CILKSIMD; break;
> +    case CILK_FOR: kind = GF_OMP_FOR_KIND_CILKFOR; break;
>      case OMP_DISTRIBUTE: kind = GF_OMP_FOR_KIND_DISTRIBUTE; break;
>      default:
>        gcc_unreachable ();
> @@ -8128,6 +8131,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
> 	case OMP_FOR:
> 	case OMP_SIMD:
> 	case CILK_SIMD:
> +	case CILK_FOR:
> 	case OMP_DISTRIBUTE:
> 	  ret = gimplify_omp_for (expr_p, pre_p);
> 	  break;

> --- a/gcc/tree.def
> +++ b/gcc/tree.def
> @@ -1064,6 +1064,10 @@ DEFTREECODE (OMP_SIMD, "omp_simd", tcc_statement, 6)
>     Operands like for OMP_FOR.  */
> DEFTREECODE (CILK_SIMD, "cilk_simd", tcc_statement, 6)
> 
> +/* Cilk Plus - _Cilk_for (..)
> +   Operands like for OMP_FOR.  */
> +DEFTREECODE (CILK_FOR, "cilk_for", tcc_statement, 6)
> +
> /* OpenMP - #pragma omp distribute [clause1 ... clauseN]
>     Operands like for OMP_FOR.  */
> DEFTREECODE (OMP_DISTRIBUTE, "omp_distribute", tcc_statement, 6)

Shouldn't CILK_FOR also be added to gcc/gimplify.c:is_gimple_stmt, next
to all the other OMP_FOR variants?



Grüße,
 Thomas

Comments

Jakub Jelinek Sept. 5, 2014, 9:47 a.m. UTC | #1
On Fri, Sep 05, 2014 at 11:41:07AM +0200, Thomas Schwinge wrote:
> Shouldn't CILK_FOR also be added to gcc/gimplify.c:is_gimple_stmt, next
> to all the other OMP_FOR variants?
> 
> diff --git gcc/gimplify.c gcc/gimplify.c
> index 2319fc3..a621824 100644
> --- gcc/gimplify.c
> +++ gcc/gimplify.c
> @@ -4426,6 +4426,7 @@ is_gimple_stmt (tree t)
>      case OMP_FOR:
>      case OMP_SIMD:
>      case CILK_SIMD:
> +    case CILK_FOR:
>      case OMP_DISTRIBUTE:
>      case OACC_LOOP:
>      case OMP_SECTIONS:

Yes, and not just that, both CILK_SIMD and CILK_FOR are missing
e.g. in cp_gimplify_expr:
    case OMP_FOR:
    case OMP_SIMD:
    case OMP_DISTRIBUTE:
      ret = cp_gimplify_omp_for (expr_p, pre_p);
      break;
or in cp_genericize_r:
  else if (TREE_CODE (stmt) == OMP_FOR
           || TREE_CODE (stmt) == OMP_SIMD
           || TREE_CODE (stmt) == OMP_DISTRIBUTE)
    genericize_omp_for_stmt (stmt_p, walk_subtrees, data);

I'd suggest to grep for -w OMP_FOR and/or -w OMP_SIMD and
see if CILK_FOR or CILK_SIMD shouldn't be supported there too.

	Jakub
diff mbox

Patch

diff --git gcc/gimplify.c gcc/gimplify.c
index 2319fc3..a621824 100644
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -4426,6 +4426,7 @@  is_gimple_stmt (tree t)
     case OMP_FOR:
     case OMP_SIMD:
     case CILK_SIMD:
+    case CILK_FOR:
     case OMP_DISTRIBUTE:
     case OACC_LOOP:
     case OMP_SECTIONS: