aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-05-21 10:04:03 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2014-05-21 10:04:03 +0200
commitdecaaec8116ffefcc2a260185c133333834eb083 (patch)
tree83ee15107981de3b2fc88d6ca0feff25cb45f4a4 /libgomp
parentc3d96270fc4d1f16fbb905049e16cf39152c9baa (diff)
downloadgcc-decaaec8116ffefcc2a260185c133333834eb083.tar.gz
gcc-decaaec8116ffefcc2a260185c133333834eb083.tar.bz2
gcc-decaaec8116ffefcc2a260185c133333834eb083.zip
re PR middle-end/61252 (Invalid code produced for omp simd reduction(min:var) where var is reference)
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. From-SVN: r210679
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 9e02f5426e5..45daf0e6597 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 ();
+}