diff options
author | Kirill Yukhin <kirill.yukhin@intel.com> | 2015-11-16 13:14:57 +0000 |
---|---|---|
committer | Kirill Yukhin <kyukhin@gcc.gnu.org> | 2015-11-16 13:14:57 +0000 |
commit | fff7721799b3bf7cabbcdf1096eeab18b68ef5d3 (patch) | |
tree | 5731243bcaf252b767216c4d28809a9959258645 /gcc/c | |
parent | 56b08a5894fd02a502b2b40897a2aa892f70caec (diff) | |
download | gcc-fff7721799b3bf7cabbcdf1096eeab18b68ef5d3.zip gcc-fff7721799b3bf7cabbcdf1096eeab18b68ef5d3.tar.gz gcc-fff7721799b3bf7cabbcdf1096eeab18b68ef5d3.tar.bz2 |
Add __attribute__((__simd__)) to GCC.
gcc/
* omp-low.c (pass_omp_simd_clone::gate): If target allows - call
without additional conditions.
* doc/extend.texi (@item simd): New.
gcc/c-family/
* c-common.c (handle_simd_attribute): New.
(struct attribute_spec): Add entry for "simd".
(handle_simd_attribute): New.
gcc/c/
* c-parser.c (c_finish_omp_declare_simd): Look for
"simd" attribute as well. Update error message.
gcc/cp/
* parser.c (cp_parser_late_parsing_cilk_simd_fn_info): Look for
"simd" attribute as well. Update error message.
gcc/testsuite/
* c-c++-common/attr-simd.c: New test.
* c-c++-common/attr-simd-2.c: New test.
* c-c++-common/attr-simd-3.c: New test.
From-SVN: r230422
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 23 |
2 files changed, 23 insertions, 5 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index ce4d7c0..3868771 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2015-11-16 Kirill Yukhin <kirill.yukhin@intel.com> + + * c-parser.c (c_finish_omp_declare_simd): Look for + "simd" attribute as well. Update error message. + 2015-11-14 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * c-parser.c (c_parser_omp_declare_target): Adjust. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index e470234..e63148e 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -16141,10 +16141,13 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms, vec<c_token> clauses) { if (flag_cilkplus - && clauses.exists () && !vec_safe_is_empty (parser->cilk_simd_fn_tokens)) + && (clauses.exists () + || lookup_attribute ("simd", DECL_ATTRIBUTES (fndecl))) + && !vec_safe_is_empty (parser->cilk_simd_fn_tokens)) { - error ("%<#pragma omp declare simd%> cannot be used in the same " - "function marked as a Cilk Plus SIMD-enabled function"); + error ("%<#pragma omp declare simd%> or %<simd%> attribute cannot be " + "used in the same function marked as a Cilk Plus SIMD-enabled " + "function"); vec_free (parser->cilk_simd_fn_tokens); return; } @@ -16182,6 +16185,16 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms, parser->tokens = parser->cilk_simd_fn_tokens->address (); parser->tokens_avail = vec_safe_length (parser->cilk_simd_fn_tokens); is_cilkplus_cilk_simd_fn = true; + + if (lookup_attribute ("simd", DECL_ATTRIBUTES (fndecl)) != NULL) + { + error_at (DECL_SOURCE_LOCATION (fndecl), + "%<__simd__%> attribute cannot be used in the same " + "function marked as a Cilk Plus SIMD-enabled function"); + vec_free (parser->cilk_simd_fn_tokens); + return; + } + } else { @@ -16213,12 +16226,12 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms, if (c != NULL_TREE) c = tree_cons (NULL_TREE, c, NULL_TREE); if (is_cilkplus_cilk_simd_fn) - { + { tree k = build_tree_list (get_identifier ("cilk simd function"), NULL_TREE); TREE_CHAIN (k) = DECL_ATTRIBUTES (fndecl); DECL_ATTRIBUTES (fndecl) = k; - } + } c = build_tree_list (get_identifier ("omp declare simd"), c); TREE_CHAIN (c) = DECL_ATTRIBUTES (fndecl); DECL_ATTRIBUTES (fndecl) = c; |