aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-05-02 19:43:40 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2014-05-02 19:43:40 +0200
commit95782571f3bcd00cca47233cc07b927c24d400ef (patch)
treeaf453d4b9541da0c90d1c0689ff569fa7c986574 /libgomp
parent047f1cec7fe69c13ed55fcdd005ace93397f0a95 (diff)
downloadgcc-95782571f3bcd00cca47233cc07b927c24d400ef.zip
gcc-95782571f3bcd00cca47233cc07b927c24d400ef.tar.gz
gcc-95782571f3bcd00cca47233cc07b927c24d400ef.tar.bz2
gimplify.c (gimplify_adjust_omp_clauses_1): Handle GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE.
* gimplify.c (gimplify_adjust_omp_clauses_1): Handle GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE. (gimplify_adjust_omp_clauses): Simd region is never directly nested in combined parallel. Instead, for linear with copyin/copyout, if in combined for simd loop, make decl firstprivate/lastprivate on OMP_FOR. * omp-low.c (expand_omp_for_generic, expand_omp_for_static_nochunk, expand_omp_for_static_chunk): When setting endvar, also set fd->loop.v to the same value. libgomp/ * testsuite/libgomp.c/simd-10.c: New test. * testsuite/libgomp.c/simd-11.c: New test. * testsuite/libgomp.c/simd-12.c: New test. * testsuite/libgomp.c/simd-13.c: New test. From-SVN: r210009
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog7
-rw-r--r--libgomp/testsuite/libgomp.c/simd-10.c26
-rw-r--r--libgomp/testsuite/libgomp.c/simd-11.c27
-rw-r--r--libgomp/testsuite/libgomp.c/simd-12.c19
-rw-r--r--libgomp/testsuite/libgomp.c/simd-13.c18
5 files changed, 97 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 0b26b9f..c73e60b 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,10 @@
+2014-05-02 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.c/simd-10.c: New test.
+ * testsuite/libgomp.c/simd-11.c: New test.
+ * testsuite/libgomp.c/simd-12.c: New test.
+ * testsuite/libgomp.c/simd-13.c: New test.
+
2014-04-24 Jakub Jelinek <jakub@redhat.com>
* testsuite/libgomp.c++/atomic-14.C: Allow seq_cst and
diff --git a/libgomp/testsuite/libgomp.c/simd-10.c b/libgomp/testsuite/libgomp.c/simd-10.c
new file mode 100644
index 0000000..70cd9f0
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/simd-10.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+int s = 0, i, u;
+
+void
+foo ()
+{
+ #pragma omp for simd schedule(static, 32) reduction(+:s) lastprivate(u)
+ for (i = 0; i < 128; i++)
+ {
+ s++;
+ u = i;
+ }
+ if (i != 128 || s != 128 || u != 127)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ foo ();
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/simd-11.c b/libgomp/testsuite/libgomp.c/simd-11.c
new file mode 100644
index 0000000..b09f0dd
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/simd-11.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+int s = 0, i, j, u;
+
+void
+foo ()
+{
+ #pragma omp for simd schedule(static, 32) reduction(+:s) lastprivate(u) collapse(2)
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 16; j++)
+ {
+ s++;
+ u = i + j;
+ }
+ if (i != 16 || j != 16 || s != 256 || u != 30)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ foo ();
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/simd-12.c b/libgomp/testsuite/libgomp.c/simd-12.c
new file mode 100644
index 0000000..6685111
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/simd-12.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+int
+main ()
+{
+ int k = 0, i, s = 0;
+ #pragma omp parallel
+ #pragma omp for simd linear(k : 3) reduction(+: s) schedule (static, 16)
+ for (i = 0; i < 128; i++)
+ {
+ k = k + 3;
+ s = s + k;
+ }
+ if (s != 128 * 129 / 2 * 3) __builtin_abort ();
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/simd-13.c b/libgomp/testsuite/libgomp.c/simd-13.c
new file mode 100644
index 0000000..7c817b7
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/simd-13.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+int
+main ()
+{
+ int k = 0, i, s = 0;
+ #pragma omp parallel for simd linear(k : 3) reduction(+: s) schedule (static, 16)
+ for (i = 0; i < 128; i++)
+ {
+ k = k + 3;
+ s = s + k;
+ }
+ if (s != 128 * 129 / 2 * 3) __builtin_abort ();
+ return 0;
+}