On Fri, Jun 21, 2013 at 07:16:56AM -0500, Aldy Hernandez wrote:
> I have done as suggested, and cleaned things up along the way.
>
> I believe this is the last remaining TODO on my Cilk Plus pragma
> simd list. Everything else is dependent on OMP4.
>
> Is this what you had in mind?
Roughly, yes.
You don't handle CILK_SIMD in pt.c (but perhaps this is for C FE only so
far).
> --- a/gcc/gimplify.c
> +++ b/gcc/gimplify.c
> @@ -6838,6 +6839,8 @@ find_combined_omp_for (tree *tp, int *walk_subtrees,
> void *)
> *walk_subtrees = 1;
> /* FALLTHRU */
> case OMP_SIMD:
> + case CILK_SIMD:
> + /* ?? Hmmm, is this the right way to handle CILK_SIMD? */
> if (OMP_FOR_INIT (*tp) != NULL_TREE)
CILK_SIMD can't be ever combined with #pragma omp for or #pragma omp
distribute, so no, the above is wrong, just don't list CILK_SIMD there.
> return *tp;
> break;
> @@ -6868,9 +6871,11 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
>
> orig_for_stmt = for_stmt = *expr_p;
>
> - simd = TREE_CODE (for_stmt) == OMP_SIMD;
> + simd = TREE_CODE (for_stmt) == OMP_SIMD
> + || TREE_CODE (for_stmt) == CILK_SIMD;
> gimplify_scan_omp_clauses (&OMP_FOR_CLAUSES (for_stmt), pre_p,
> - TREE_CODE (for_stmt) == OMP_SIMD
> + (TREE_CODE (for_stmt) == OMP_SIMD
> + || TREE_CODE (for_stmt) == CILK_SIMD)
I guess this should be just "simd ? ORT_SIMD : ORT_WORKSHARE);" then.
> ? ORT_SIMD : ORT_WORKSHARE);
> case NE_EXPR:
> - if (!flag_enable_cilk)
> + /* NE_EXPR is only allowed for Cilk Plus loops. */
> + if (flag_enable_cilk
Very weird name of a flag. Should have been flag_cilk or flag_cilkplus
IMHO.
> if (copyin_by_ref || lastprivate_firstprivate)
> {
> - /* Don't add any barrier for #pragma omp simd. */
> + /* Don't add any barrier for #pragma omp simd or #pragma simd. */
> if (gimple_code (ctx->stmt) != GIMPLE_OMP_FOR
> - || gimple_omp_for_kind (ctx->stmt) != GF_OMP_FOR_KIND_SIMD)
> + || !(gimple_omp_for_kind (ctx->stmt) & GF_OMP_FOR_KIND_SIMD))
> gimplify_and_add (build_omp_barrier (), ilist);
This one will clash with a change I'm working on right now (we don't
want a barrier for distribute either, so this is now
|| gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_FOR
Jakub