"Iyer, Balaji V" <balaji.v.i...@intel.com> writes:

>  c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms,
>                          vec<c_token> clauses)
>  {
> +
> +  if (flag_enable_cilkplus
> +      && clauses.exists () && !vec_safe_is_empty (parser->elem_fn_tokens))
> +    {
> +      error ("%<#pragma omp declare simd%> cannot be used in the same"
> +          "function marked as a SIMD-enabled function");
> +      vec_free (parser->elem_fn_tokens);
> +      return;
> +    }

I see Cilk Plus elementals are handled as omp declare simd in the above
function.  This function sets an "omp declare simd" attribute here:

     if (c != NULL_TREE)
        c = tree_cons (NULL_TREE, c, NULL_TREE);
      c = build_tree_list (get_identifier ("omp declare simd"), c);
      TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl);
      DECL_ATTRIBUTES (fndecl) = c;

but you also need a "cilk plus elemental" attribute so the rest of the
compiler can differentiate Cilk Plus elementals from omp declare simds.

See simd_clone_clauses_extract():

+  /* To distinguish from an OpenMP simd clone, Cilk Plus functions to
+     be cloned have a distinctive artificial label in addition to "omp
+     declare simd".  */
+  bool cilk_clone
+    = (flag_enable_cilkplus
+       && lookup_attribute ("cilk plus elemental",
+                           DECL_ATTRIBUTES (node->decl)));

Also you probably want some kind of test for this, so test for whatever
cilk_elemental is doing.  In trunk, the only use of cilk_elemental is in
ix86_simd_clone_compute_vecsize_and_simdlen(), so come up with some
x86 specific test for cilk_elemental==true.

Aldy

Reply via email to