summaryrefslogtreecommitdiffstats
path: root/libgomp
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-21 08:06:04 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-21 08:06:04 +0000
commit390f90c6c4122aaecca8a990fadf072aed10b3ea (patch)
tree0c0a371ff6562b3391990cfff0d92e29c9310c7b /libgomp
parent2dd12f6a43c783ae68e71530855fec815a50aa57 (diff)
downloadppe42-gcc-390f90c6c4122aaecca8a990fadf072aed10b3ea.tar.gz
ppe42-gcc-390f90c6c4122aaecca8a990fadf072aed10b3ea.zip
PR middle-end/61252
* omp-low.c (handle_simd_reference): New function. (lower_rec_input_clauses): Use it. Defer adding reference initialization even for reduction without placeholder if in simd, handle it properly later on. * testsuite/libgomp.c++/simd-9.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@210681 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog5
-rw-r--r--libgomp/testsuite/libgomp.c++/simd-9.C52
2 files changed, 57 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 6ccff24c799..1f14a8d5d7f 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2014-05-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/61252
+ * testsuite/libgomp.c++/simd-9.C: New test.
+
2014-05-18 Uros Bizjak <ubizjak@gmail.com>
* libgomp.texi (Runitme Library Routines): Remove multiple @menu.
diff --git a/libgomp/testsuite/libgomp.c++/simd-9.C b/libgomp/testsuite/libgomp.c++/simd-9.C
new file mode 100644
index 00000000000..3c567b31c3e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/simd-9.C
@@ -0,0 +1,52 @@
+// { dg-do run }
+// { dg-options "-O2" }
+// { dg-additional-options "-msse2" { target sse2_runtime } }
+// { dg-additional-options "-mavx" { target avx_runtime } }
+
+extern "C" void abort ();
+int a[1024] __attribute__((aligned (32))) = { 1 };
+#pragma omp declare reduction (foo:int:omp_out += omp_in) \
+ initializer (omp_priv = 0)
+
+__attribute__((noinline, noclone)) void
+foo (int &u, int &v)
+{
+ int i;
+ #pragma omp simd aligned(a : 32) reduction(foo:u) reduction(+:v)
+ for (i = 0; i < 1024; i++)
+ {
+ int x = a[i];
+ u += x;
+ v += x;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+bar (int &u, int &v)
+{
+ int i;
+ #pragma omp simd aligned(a : 32) reduction(foo:u) reduction(+:v) \
+ safelen(1)
+ for (i = 0; i < 1024; i++)
+ {
+ int x = a[i];
+ u += x;
+ v += x;
+ }
+}
+
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 1024; i++)
+ a[i] = (i & 31) + (i / 128);
+ int u = 0, v = 0;
+ foo (u, v);
+ if (u != 19456 || v != 19456)
+ abort ();
+ u = 0; v = 0;
+ bar (u, v);
+ if (u != 19456 || v != 19456)
+ abort ();
+}
OpenPOWER on IntegriCloud