diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-21 08:04:03 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-21 08:04:03 +0000 |
commit | 2712b6de992a5d27cf467781615e7bcf14254dd1 (patch) | |
tree | 83ee15107981de3b2fc88d6ca0feff25cb45f4a4 /libgomp/testsuite/libgomp.c++ | |
parent | 0a931cb58575fc111f027f1cecabde5ee4a532e5 (diff) | |
download | gcc-2712b6de992a5d27cf467781615e7bcf14254dd1.tar.gz |
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/trunk@210679 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/testsuite/libgomp.c++')
-rw-r--r-- | libgomp/testsuite/libgomp.c++/simd-9.C | 52 |
1 files changed, 52 insertions, 0 deletions
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 (); +} |