On Wed, Oct 28, 2015 at 12:16:04PM +0300, Kirill Yukhin wrote: > Bootstrapped. Regtested. Is it ok for trunk? > > > gcc/ > * omp-low.c (pass_omp_simd_clone::gate): If target allows - call > without additional conditions. > * doc/extend.texi (simd): Document new attribute. > gcc/cp/ > * parser.h (cp_parser): Add simd_attr_present. > * parser.c (cp_parser_late_return_type_opt): Handle simd_attr_present, > require comman in __vector__ attribute. > (cp_parser_gnu_attribute_list): Ditto. > gcc/c/ > * c-parser.c (c_parser): Add simd_attr_present flag. > (c_parser_declaration_or_fndef): Call c_parser_declaration_or_fndef > if simd_attr_present is set. > (c_finish_omp_declare_simd): Handle simd_attr_present.
Actually, do you plan to eventually add some clauses/operands to the simd attribute, or is the plan to just say that simd attribute is #pragma omp declare simd with no clauses as if -fopenmp-simd has been enabled? If you don't plan to add any clauses, I wonder whether you really need to add any parser changes at all, whether this couldn't be all handled in c-family/c-common.c - handle_simd_attribute, adding simd to the attribute table in there as a function decl attribute, and simply when processing it add tree c = build_tree_list (get_identifier ("omp declare simd"), NULL_TREE); TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl); DECL_ATTRIBUTES (fndecl) = c; (after checking whether the attribute isn't already present and erroring out if there is "cilk simd function" attribute). The reason for the (admittedly ugly) parser changes for #pragma omp declare simd is that the clauses on the directive refer to parameters that will be declared later, so we need to save the tokens of the pragma and then after parsing the parameter declarations actually parse the clauses. But, in the simd attribute case, there are no clauses, there is nothing to parse later. Sorry for not raising this earlier. Jakub