This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING]: [GOMP4] [PATCH] SIMD-Enabled Functions (formerly Elemental functions) for C
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: "Iyer\, Balaji V" <balaji dot v dot iyer at intel dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, "gcc-patches\ at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 27 Nov 2013 08:52:00 -0700
- Subject: Re: [PING]: [GOMP4] [PATCH] SIMD-Enabled Functions (formerly Elemental functions) for C
- Authentication-results: sourceware.org; auth=none
- References: <BF230D13CA30DD48930C31D4099330003A4ACA4E at FMSMSX101 dot amr dot corp dot intel dot com>
- Reply-to: aldyh at redhat dot com
"Iyer, Balaji V" <balaji.v.iyer@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