diff options
author | Jakub Jelinek <jakub@redhat.com> | 2015-06-30 14:12:42 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2015-06-30 14:12:42 +0200 |
commit | 3446fe483e3d734e38555a8034e7ab672afa68ee (patch) | |
tree | 3f50a5e4d765602e07b37879ad1f3e725d473799 /libgomp | |
parent | b14a9c57cff644851084c4f602437c7fa353c5d0 (diff) | |
download | gcc-3446fe483e3d734e38555a8034e7ab672afa68ee.zip gcc-3446fe483e3d734e38555a8034e7ab672afa68ee.tar.gz gcc-3446fe483e3d734e38555a8034e7ab672afa68ee.tar.bz2 |
re PR middle-end/66702 (#pragma omp declare simd uniform and linear issues)
PR middle-end/66702
* omp-low.c (simd_clone_adjust): Handle addressable linear
or uniform parameters or non-gimple type uniform parameters.
* testsuite/libgomp.c++/pr66702-1.C: New test.
* testsuite/libgomp.c++/pr66702-2.C: New test.
From-SVN: r225179
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 6 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/pr66702-1.C | 49 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/pr66702-2.C | 34 |
3 files changed, 89 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index a5c51f5..2f1346d 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2015-06-30 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/66702 + * testsuite/libgomp.c++/pr66702-1.C: New test. + * testsuite/libgomp.c++/pr66702-2.C: New test. + 2015-06-30 Tom de Vries <tom@codesourcery.com> * testsuite/libgomp.c/parloops-exit-first-loop-alt-5.c: New test. diff --git a/libgomp/testsuite/libgomp.c++/pr66702-1.C b/libgomp/testsuite/libgomp.c++/pr66702-1.C new file mode 100644 index 0000000..1577256 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr66702-1.C @@ -0,0 +1,49 @@ +// PR middle-end/66702 +// { dg-options "-O2" } +// { dg-additional-options "-msse2" { target sse2_runtime } } +// { dg-additional-options "-mavx" { target avx_runtime } } + +void +bar (int &a, int &b, int *&c, int &d) +{ + volatile int x; + int *volatile y; + x = a; a = x; + x = b; b = x; + y = c; c = y; + x = d; d = x; +} + +void (*volatile barp) (int &, int &, int *&, int &) = bar; + +#pragma omp declare simd uniform(b, c) linear(d:2) aligned(c:32) notinbranch +int +foo (int a, int b, int *c, int d) +{ + a++; + b++; + c += 8; + d += 2; + barp (a, b, c, d); + return a + b + *c + d; +} + +volatile int e = 5; +int c[64] __attribute__((aligned (32))); + +int +main () +{ + int d = 7, r = 0; + int b = e; + for (int i = 0; i < 64; i++) + c[i] = i; + #pragma omp simd reduction(+:r) linear(d:2) + for (int i = 0; i < 64; i++) + { + r += foo (i, b, c, d); + d += 2; + } + if (r != 7584) + __builtin_abort (); +} diff --git a/libgomp/testsuite/libgomp.c++/pr66702-2.C b/libgomp/testsuite/libgomp.c++/pr66702-2.C new file mode 100644 index 0000000..7de3de0 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr66702-2.C @@ -0,0 +1,34 @@ +// PR middle-end/66702 +// { dg-options "-O2" } +// { dg-additional-options "-msse2" { target sse2_runtime } } +// { dg-additional-options "-mavx" { target avx_runtime } } + +struct S { int s1, s2; }; +struct T { T (); ~T (); int t; }; + +T::T () : t(0) {} +T::~T () {} + +#pragma omp declare simd uniform(b, c) notinbranch +__attribute__((noinline)) int +foo (int a, S b, T c) +{ + a++; + b.s1++; + b.s2++; + c.t++; + return a + b.s1 + b.s2 + c.t; +} + +int +main () +{ + int r = 0; + S s = { 2, 3 }; + T t; + #pragma omp simd reduction(+:r) + for (int i = 0; i < 64; i++) + r += foo (i, s, t); + if (r != 2592) + __builtin_abort (); +} |