diff options
author | Jakub Jelinek <jakub@redhat.com> | 2014-03-03 08:27:46 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2014-03-03 08:27:46 +0100 |
commit | b3bdf019b761cc75d967e1330f3e90cd4c94e116 (patch) | |
tree | 5211c40837d9bbda568a517fba0223bd536a83b7 | |
parent | 79c7fda6d56eea84a95df8ea67387b4cf972e9de (diff) | |
download | gcc-b3bdf019b761cc75d967e1330f3e90cd4c94e116.zip gcc-b3bdf019b761cc75d967e1330f3e90cd4c94e116.tar.gz gcc-b3bdf019b761cc75d967e1330f3e90cd4c94e116.tar.bz2 |
c-pragma.c (c_pp_lookup_pragma): Handle PRAGMA_CILK_SIMD.
* c-pragma.c (c_pp_lookup_pragma): Handle PRAGMA_CILK_SIMD.
(init_pragma): Call cpp_register_deferred_pragma for PRAGMA_CILK_SIMD
even when flag_preprocess_only.
* c-c++-common/cilk-plus/PS/vectorlength-2.c: New test.
* c-c++-common/cilk-plus/PS/vectorlength-3.c: New test.
From-SVN: r208268
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-pragma.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-2.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-3.c | 14 |
5 files changed, 45 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 088d158a..a775d4c 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2014-03-03 Jakub Jelinek <jakub@redhat.com> + + * c-pragma.c (c_pp_lookup_pragma): Handle PRAGMA_CILK_SIMD. + (init_pragma): Call cpp_register_deferred_pragma for PRAGMA_CILK_SIMD + even when flag_preprocess_only. + 2014-02-26 Jason Merrill <jason@redhat.com> PR c++/59231 diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index 91fffdb..2594d73 100644 --- a/gcc/c-family/c-pragma.c +++ b/gcc/c-family/c-pragma.c @@ -1221,6 +1221,13 @@ c_pp_lookup_pragma (unsigned int id, const char **space, const char **name) return; } + if (id == PRAGMA_CILK_SIMD) + { + *space = NULL; + *name = "simd"; + return; + } + if (id >= PRAGMA_FIRST_EXTERNAL && (id < PRAGMA_FIRST_EXTERNAL + registered_pp_pragmas.length ())) { @@ -1384,7 +1391,7 @@ init_pragma (void) omp_pragmas_simd[i].id, true, true); } - if (flag_cilkplus && !flag_preprocess_only) + if (flag_cilkplus) cpp_register_deferred_pragma (parse_in, NULL, "simd", PRAGMA_CILK_SIMD, true, false); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7db73e4..7ba8d1b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-03 Jakub Jelinek <jakub@redhat.com> + + * c-c++-common/cilk-plus/PS/vectorlength-2.c: New test. + * c-c++-common/cilk-plus/PS/vectorlength-3.c: New test. + 2014-03-02 Jan Hubicka <hubicka@ucw.cz> PR ipa/60150 diff --git a/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-2.c b/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-2.c new file mode 100644 index 0000000..d903977 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-2.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcilkplus" } */ + +#define vl(n) vectorlength(2*n) +void +foo (int *a, int *b, int *c) +{ + int i; +#pragma simd vl(4) + for (i = 0; i < 64; i++) + a[i] = b[i] * c[i]; +} diff --git a/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-3.c b/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-3.c new file mode 100644 index 0000000..9cef5a5 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-3.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcilkplus -save-temps" } */ + +#define vl(n) vectorlength(2*n) +void +foo (int *a, int *b, int *c) +{ + int i; +#pragma simd vl(4) + for (i = 0; i < 64; i++) + a[i] = b[i] * c[i]; +} + +/* { dg-final { cleanup-saved-temps } } */ |