diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-02 07:36:13 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-02 07:36:13 +0000 |
commit | a5bb293cfc164994dd7afd08dc27fe6cad587b25 (patch) | |
tree | ae76a4709c28c535455650bc2a328f048513e6f0 /libgomp | |
parent | dea77c54843f884df098d25532e0ffda4ec5a0ff (diff) | |
download | gcc-a5bb293cfc164994dd7afd08dc27fe6cad587b25.tar.gz |
008-12-02 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r142344
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@142346 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 13 | ||||
-rw-r--r-- | libgomp/config/linux/powerpc/mutex.h | 2 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/for-6.C | 109 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/for-7.C | 110 |
4 files changed, 234 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 0cdfba6d83f..46536c88381 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,16 @@ +2008-12-01 Janis Johnson <janis187@us.ibm.com> + + PR libgomp/38270 + * config/linux/powerpc/mutex.h: New. + +2008-12-01 Jakub Jelinek <jakub@redhat.com> + + PR c++/38257 + * testsuite/libgomp.c++/for-7.C: New test. + + PR c++/38348 + * testsuite/libgomp.c++/for-6.C: New test. + 2008-11-26 Janis Johnson <janis187@us.ibm.com> PR testsuite/28870 diff --git a/libgomp/config/linux/powerpc/mutex.h b/libgomp/config/linux/powerpc/mutex.h new file mode 100644 index 00000000000..e64ff077c83 --- /dev/null +++ b/libgomp/config/linux/powerpc/mutex.h @@ -0,0 +1,2 @@ +/* On PowerPC __sync_lock_test_and_set isn't a full barrier. */ +#include "config/linux/ia64/mutex.h" diff --git a/libgomp/testsuite/libgomp.c++/for-6.C b/libgomp/testsuite/libgomp.c++/for-6.C new file mode 100644 index 00000000000..0da21ce2fe5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/for-6.C @@ -0,0 +1,109 @@ +// PR c++/38348 +// { dg-do run } + +extern "C" void abort (); +int cnt; + +template <typename T> +void +f0 (T, int) +{ + abort (); +} + +template <> +void +f0<int> (int, int type) +{ + if (type != 0) + abort (); +#pragma omp atomic + cnt++; +} + +template <> +void +f0<const char *> (const char *, int type) +{ + if (type != 1) + abort (); +#pragma omp atomic + cnt++; +} + +template <typename T> +void +f1 () +{ +#pragma omp parallel for + for (int i = 0; i < 10; i++) + f0 (i, 0); +} + +template <typename T> +void +f2 () +{ +#pragma omp parallel for + for (T i = T (0); i < T (10); i += T (1)) + f0 (i, 0); +} + +void +f3 () +{ +#pragma omp parallel for + for (int i = 0; i < 10; i++) + f0 (i, 0); +} + +const char *p = "abcdefghij"; + +template <typename T> +void +f4 () +{ +#pragma omp parallel for + for (const char *i = p; i < p + 10; i += 1) + f0 (i, 1); +} + +template <typename T> +void +f5 () +{ +#pragma omp parallel for + for (T i = T (p); i < T (p + 10); i += 1) + f0 (i, 1); +} + +void +f6 () +{ +#pragma omp parallel for + for (const char *i = p; i < p + 10; i++) + f0 (i, 1); +} + +int +main () +{ + f1<int> (); + if (cnt != 10) + abort (); + f2<int> (); + if (cnt != 20) + abort (); + f3 (); + if (cnt != 30) + abort (); + f4<int> (); + if (cnt != 40) + abort (); + f5<const char *> (); + if (cnt != 50) + abort (); + f6 (); + if (cnt != 60) + abort (); +} diff --git a/libgomp/testsuite/libgomp.c++/for-7.C b/libgomp/testsuite/libgomp.c++/for-7.C new file mode 100644 index 00000000000..9d626c028df --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/for-7.C @@ -0,0 +1,110 @@ +// PR c++/ +// { dg-do run } +// { dg-options "-std=c++0x -fopenmp" } + +extern "C" void abort (); +int cnt; + +template <typename T> +void +f0 (T, int) +{ + abort (); +} + +template <> +void +f0<int> (int, int type) +{ + if (type != 0) + abort (); +#pragma omp atomic + cnt++; +} + +template <> +void +f0<const char *> (const char *, int type) +{ + if (type != 1) + abort (); +#pragma omp atomic + cnt++; +} + +template <typename T> +void +f1 () +{ +#pragma omp parallel for + for (auto i = 0; i < 10; i++) + f0 (i, 0); +} + +template <typename T> +void +f2 () +{ +#pragma omp parallel for + for (auto i = T (0); i < T (10); i += T (1)) + f0 (i, 0); +} + +void +f3 () +{ +#pragma omp parallel for + for (auto i = 0; i < 10; i++) + f0 (i, 0); +} + +const char *p = "abcdefghij"; + +template <typename T> +void +f4 () +{ +#pragma omp parallel for + for (auto i = p; i < p + 10; i++) + f0 (i, 1); +} + +template <typename T> +void +f5 () +{ +#pragma omp parallel for + for (auto i = T (p); i < T (p + 10); i++) + f0 (i, 1); +} + +void +f6 () +{ +#pragma omp parallel for + for (auto i = p; i < p + 10; i++) + f0 (i, 1); +} + +int +main () +{ + f1<int> (); + if (cnt != 10) + abort (); + f2<int> (); + if (cnt != 20) + abort (); + f3 (); + if (cnt != 30) + abort (); + f4<int> (); + if (cnt != 40) + abort (); + f5<const char *> (); + if (cnt != 50) + abort (); + f6 (); + if (cnt != 60) + abort (); +} |