This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PING]: [GOMP4] [PATCH] SIMD-Enabled Functions (formerly Elemental functions) for C


HI Aldy and Jakub,
	Attached, please find a fixed patch. I have fixed all the changes you have mentioned below. Is this OK to install?

Here are the ChangeLog entries:
gcc/ChangeLog
2013-11-27  Balaji V. Iyer  <balaji.v.iyer@intel.com>

        * config/i386/i386.c (ix86_simd_clone_compute_vecsize_and_simdlen):
        Removed a carriage return from the warning string.
        * omp-low.c (simd_clone_clauses_extract): Added a check for cilk plus
        SIMD-enabled function attributes.

gcc/c/ChangeLog
2013-11-27  Balaji V. Iyer  <balaji.v.iyer@intel.com>

        * c-parser.c (struct c_parser::elem_fn_tokens): Added new field.
        (c_parser_declaration_or_fndef): Added a check if elem_fn_tokens
        field in parser is not empty.  If not-empty, call the function
        c_parser_finish_omp_declare_simd.
        (c_parser_elem_fn_vectorlength): New function.
        (c_parser_elem_fn_expr_list): Likewise.
        (c_finish_elem_fn_tokens): Likewise.
        (c_parser_attributes): Added a elem_fn_tokens parameter.  Added a
        check for vector attribute and if so call c_parser_elem_fn_expr_list.
        Also, called c_finish_elem_fn_tokens when Cilk Plus is enabled.
        (c_finish_omp_declare_simd): Added a check if elem_fn_tokens in
        parser field is non-empty.  If so, parse them as you would parse
        the omp declare simd pragma.

gcc/testsuite/ChangeLog
2013-11-27  Balaji V. Iyer  <balaji.v.iyer@intel.com>

        * c-c++-common/cilk-plus/EF/ef_test.c: New test.
        * c-c++-common/cilk-plus/EF/ef_test2.c: Likewise.
        * c-c++-common/cilk-plus/EF/vlength_errors.c: Likewise.
        * c-c++-common/cilk-plus/EF/ef_error.c: Likewise.
        * c-c++-common/cilk-plus/EF/ef_error2.c: Likewise.
        * gcc.dg/cilk-plus/cilk-plus.exp: Added calls for the above tests.


Thanks,

Balaji V. Iyer.

> -----Original Message-----
> From: Aldy Hernandez [mailto:aldyh@redhat.com]
> Sent: Wednesday, November 27, 2013 10:52 AM
> To: Iyer, Balaji V
> Cc: Jakub Jelinek; gcc-patches@gcc.gnu.org
> Subject: Re: [PING]: [GOMP4] [PATCH] SIMD-Enabled Functions (formerly
> Elemental functions) for C
> 
> "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.
> 

Fixed.

> 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.
> 

Fixed. 

> Aldy

Attachment: diff.txt
Description: diff.txt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]