diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-12-16 10:34:28 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-12-16 10:34:28 +0000 |
commit | c22ad51504f2b1c539e9dc9314e2f8f2c1fadb84 (patch) | |
tree | 868a7ab834e32006cd4680082ed892580ab32dfa /libgomp | |
parent | b6fc5e7229ae6ab1c313a347a010794cbda8778b (diff) | |
download | gcc-c22ad51504f2b1c539e9dc9314e2f8f2c1fadb84.tar.gz |
PR libgomp/58756
* omp-low.c (lower_rec_input_clauses) <case OMP_CLAUSE_REDUCTION>: For
reductions without placeholder if is_simd, but when not using
GOMP_SIMD* internal calls, also perform the reduction operation
on the outer var rather than simple assignment.
* testsuite/libgomp.c/pr58756.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206011 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 5 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/pr58756.c | 58 |
2 files changed, 63 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index bdcc930d97b..566a4c12752 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2013-12-16 Jakub Jelinek <jakub@redhat.com> + + PR libgomp/58756 + * testsuite/libgomp.c/pr58756.c: New test. + 2013-12-12 Jakub Jelinek <jakub@redhat.com> PR libgomp/59467 diff --git a/libgomp/testsuite/libgomp.c/pr58756.c b/libgomp/testsuite/libgomp.c/pr58756.c new file mode 100644 index 00000000000..d35ea792e8d --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr58756.c @@ -0,0 +1,58 @@ +/* PR libgomp/58756 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +extern void abort (void); +int d[32 * 32]; + +__attribute__((noinline, noclone)) int +foo (int a, int b) +{ + int j, c = 0; + #pragma omp parallel for reduction(+: c) + for (j = 0; j < a; j += 32) + { + int l; + #pragma omp simd reduction(+: c) safelen(1) + for (l = 0; l < b; ++l) + c += d[j + l]; + } + return c; +} + +__attribute__((noinline, noclone)) int +bar (int a) +{ + int j, c = 0; + #pragma omp parallel for simd reduction(+: c) safelen(1) + for (j = 0; j < a; ++j) + c += d[j]; + return c; +} + +__attribute__((noinline)) static int +baz (int a) +{ + int j, c = 0; + #pragma omp simd reduction(+: c) safelen(1) + for (j = 0; j < a; ++j) + c += d[j]; + return c; +} + +int +main () +{ + int i; + for (i = 0; i < 32 * 32; i++) + d[i] = (i & 31); + if (foo (32 * 32, 32) != (31 * 32 / 2) * 32) + abort (); + if (bar (32 * 32) != (31 * 32 / 2) * 32) + abort (); + if (baz (32 * 32) != (31 * 32 / 2) * 32) + abort (); + return 0; +} |