diff options
author | Tobias Burnus <burnus@net-b.de> | 2013-11-05 08:29:47 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2013-11-05 08:29:47 +0100 |
commit | 6d7f7e0a635298c307d51d3eb166905b5bcaf07a (patch) | |
tree | 789e5dc3cac9b9f008c01fc7464776cb40592969 /gcc/c-family/c-pragma.c | |
parent | 6310844b657ce0658c3d1061b56ffc88e7beaeb0 (diff) | |
download | gcc-6d7f7e0a635298c307d51d3eb166905b5bcaf07a.zip gcc-6d7f7e0a635298c307d51d3eb166905b5bcaf07a.tar.gz gcc-6d7f7e0a635298c307d51d3eb166905b5bcaf07a.tar.bz2 |
invoke.texi (-fopenmp-simd): Document new option.
2013-11-05 Tobias Burnus <burnus@net-b.de>
gcc/
* doc/invoke.texi (-fopenmp-simd): Document new option.
* gimplify.c (gimplify_body): Accept -fopenmp-simd.
* omp-low.c (execute_expand_omp, execute_lower_omp): Ditto.
* tree.c (attribute_value_equal): Ditto.
gcc/fortran/
* lang.opt (fopenmp-simd): New option.
* gfortran.h (gfc_option_t): Add gfc_flag_openmp_simd.
* options.c (gfc_handle_option): Handle it.
gcc/c-family/
* c.opt (fopenmp-simd): New option.
* c-pragma.c (omp_pragmas): Move pragmas which can contain simd
* to ...
(omp_pragmas): ... this new struct.
(c_pp_lookup_pragma): Also walk omp_pragmas.
(init_pragma): Init pragmas for -fopenmp-simd.
gcc/c
* c-parser.c (c_parser_omp_for, c_parser_omp_parallel,
c_parser_omp_distribute, c_parser_omp_teams,
c_parser_omp_target, c_parser_omp_declare): Handle
-fopenmp-simd.
gcc/cp
* parser.c (cp_parser_omp_for, cp_parser_omp_parallel,
cp_parser_omp_distribute, cp_parser_omp_teams,
cp_parser_omp_target,
cp_parser_omp_declare): Handle
-fopenmp-simd.
gcc/testsuite/
* g++.dg/gomp/openmp-simd-1.C: New.
* g++.dg/gomp/openmp-simd-2.C: New.
* gcc.dg/gomp/openmp-simd-1.c: New.
* gcc.dg/gomp/openmp-simd-2.c: New.
From-SVN: r204382
Diffstat (limited to 'gcc/c-family/c-pragma.c')
-rw-r--r-- | gcc/c-family/c-pragma.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index 3ce77a2..c75b087 100644 --- a/gcc/c-family/c-pragma.c +++ b/gcc/c-family/c-pragma.c @@ -1170,31 +1170,35 @@ static const struct omp_pragma_def omp_pragmas[] = { { "cancel", PRAGMA_OMP_CANCEL }, { "cancellation", PRAGMA_OMP_CANCELLATION_POINT }, { "critical", PRAGMA_OMP_CRITICAL }, - { "declare", PRAGMA_OMP_DECLARE_REDUCTION }, - { "distribute", PRAGMA_OMP_DISTRIBUTE }, { "end", PRAGMA_OMP_END_DECLARE_TARGET }, { "flush", PRAGMA_OMP_FLUSH }, - { "for", PRAGMA_OMP_FOR }, { "master", PRAGMA_OMP_MASTER }, { "ordered", PRAGMA_OMP_ORDERED }, - { "parallel", PRAGMA_OMP_PARALLEL }, { "section", PRAGMA_OMP_SECTION }, { "sections", PRAGMA_OMP_SECTIONS }, - { "simd", PRAGMA_OMP_SIMD }, { "single", PRAGMA_OMP_SINGLE }, - { "target", PRAGMA_OMP_TARGET }, - { "task", PRAGMA_OMP_TASK }, { "taskgroup", PRAGMA_OMP_TASKGROUP }, { "taskwait", PRAGMA_OMP_TASKWAIT }, { "taskyield", PRAGMA_OMP_TASKYIELD }, - { "teams", PRAGMA_OMP_TEAMS }, { "threadprivate", PRAGMA_OMP_THREADPRIVATE } }; +static const struct omp_pragma_def omp_pragmas_simd[] = { + { "declare", PRAGMA_OMP_DECLARE_REDUCTION }, + { "distribute", PRAGMA_OMP_DISTRIBUTE }, + { "for", PRAGMA_OMP_FOR }, + { "parallel", PRAGMA_OMP_PARALLEL }, + { "simd", PRAGMA_OMP_SIMD }, + { "target", PRAGMA_OMP_TARGET }, + { "task", PRAGMA_OMP_TASK }, + { "teams", PRAGMA_OMP_TEAMS }, +}; void c_pp_lookup_pragma (unsigned int id, const char **space, const char **name) { const int n_omp_pragmas = sizeof (omp_pragmas) / sizeof (*omp_pragmas); + const int n_omp_pragmas_simd = sizeof (omp_pragmas_simd) + / sizeof (*omp_pragmas); int i; for (i = 0; i < n_omp_pragmas; ++i) @@ -1205,6 +1209,14 @@ c_pp_lookup_pragma (unsigned int id, const char **space, const char **name) return; } + for (i = 0; i < n_omp_pragmas_simd; ++i) + if (omp_pragmas_simd[i].id == id) + { + *space = "omp"; + *name = omp_pragmas_simd[i].name; + return; + } + if (id >= PRAGMA_FIRST_EXTERNAL && (id < PRAGMA_FIRST_EXTERNAL + registered_pp_pragmas.length ())) { @@ -1357,6 +1369,16 @@ init_pragma (void) cpp_register_deferred_pragma (parse_in, "omp", omp_pragmas[i].name, omp_pragmas[i].id, true, true); } + if (flag_openmp || flag_openmp_simd) + { + const int n_omp_pragmas_simd = sizeof (omp_pragmas_simd) + / sizeof (*omp_pragmas); + int i; + + for (i = 0; i < n_omp_pragmas_simd; ++i) + cpp_register_deferred_pragma (parse_in, "omp", omp_pragmas_simd[i].name, + omp_pragmas_simd[i].id, true, true); + } if (!flag_preprocess_only) cpp_register_deferred_pragma (parse_in, "GCC", "pch_preprocess", |