diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-05-22 08:10:32 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-05-22 08:10:32 +0000 |
commit | 1e71fa5dfb9ee10a390b43a29503a23398323a80 (patch) | |
tree | 4c6ad9c29456cf7e5478fa54dcdda89c8b6ce719 /libgomp | |
parent | 44f5e867ee71240a6976210a16053cbb0f1c4445 (diff) | |
download | gcc-1e71fa5dfb9ee10a390b43a29503a23398323a80.tar.gz |
Backported from mainline
2015-05-19 Jakub Jelinek <jakub@redhat.com>
PR middle-end/66199
* tree.h (OMP_TEAMS_COMBINED): Define.
* gimplify.c (enum gimplify_omp_var_data): Add
GOVD_LINEAR_LASTPRIVATE_NO_OUTER.
(enum omp_region_type): Add ORT_COMBINED_TEAMS.
(omp_notice_variable): Accept both ORT_TEAMS
and ORT_COMBINED_TEAMS. Don't recurse if
GOVD_LINEAR_LASTPRIVATE_NO_OUTER is set and either
GOVD_LINEAR is set, or GOVD_LASTPRIVATE without
GOVD_FIRSTPRIVATE.
(omp_no_lastprivate): New function.
(gimplify_scan_omp_clauses): For OMP_CLAUSE_LASTPRIVATE
and OMP_CLAUSE_LINEAR, if omp_no_lastprivate, don't
notice_outer and set appropriate bits, otherwise make
sure default(none) combined constructs won't complain.
(gimplify_adjust_omp_clauses): Remove OMP_CLAUSE_LINEAR
outer special casing, for OMP_CLAUSE_LASTPRIVATE if
omp_no_lastprivate either remove the clause or turn it
into OMP_CLAUSE_PRIVATE.
(gimplify_omp_for): Fix up handling of implicit
lastprivate or linear iterators.
(gimplify_omp_workshare): For OMP_TEAMS_COMBINED use
ORT_COMBINED_TEAMS.
* omp-low.c (lower_omp_for_lastprivate): For combined
for simd use fd.loop.n2 from the for rather than simd.
gcc/c/
* c-parser.c (c_parser_omp_for_loop): Don't add
OMP_CLAUSE_SHARED to OMP_PARALLEL_CLAUSES when moving
OMP_CLAUSE_LASTPRIVATE clause to OMP_FOR_CLAUSES.
(c_parser_omp_teams): Set OMP_TEAMS_COMBINED for combined
constructs.
gcc/cp/
* parser.c (cp_parser_omp_for_loop): Don't add
OMP_CLAUSE_SHARED to OMP_PARALLEL_CLAUSES when moving
OMP_CLAUSE_LASTPRIVATE clause to OMP_FOR_CLAUSES.
(cp_parser_omp_teams): Set OMP_TEAMS_COMBINED for combined
constructs.
gcc/fortran/
* trans-openmp.c (gfc_trans_omp_teams): Set OMP_TEAMS_COMBINED for
combined constructs.
(gfc_trans_omp_target): Make sure BIND_EXPR has non-NULL
BIND_EXPR_BLOCK.
libgomp/
* testsuite/libgomp.c/pr66199-1.c: New test.
* testsuite/libgomp.c/pr66199-2.c: New test.
* testsuite/libgomp.c++/pr66199-1.C: New test.
* testsuite/libgomp.c++/pr66199-2.C: New test.
* testsuite/libgomp.fortran/pr66199-1.f90: New test.
* testsuite/libgomp.fortran/pr66199-2.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@223521 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 10 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/pr66199-1.C | 5 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/pr66199-2.C | 5 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/pr66199-1.c | 62 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/pr66199-2.c | 59 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/pr66199-1.f90 | 49 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/pr66199-2.f90 | 47 |
7 files changed, 237 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index f498aabc972..6c23ff19f1d 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,6 +1,16 @@ 2015-05-22 Jakub Jelinek <jakub@redhat.com> Backported from mainline + 2015-05-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/66199 + * testsuite/libgomp.c/pr66199-1.c: New test. + * testsuite/libgomp.c/pr66199-2.c: New test. + * testsuite/libgomp.c++/pr66199-1.C: New test. + * testsuite/libgomp.c++/pr66199-2.C: New test. + * testsuite/libgomp.fortran/pr66199-1.f90: New test. + * testsuite/libgomp.fortran/pr66199-2.f90: New test. + 2015-05-13 Jakub Jelinek <jakub@redhat.com> PR middle-end/66133 diff --git a/libgomp/testsuite/libgomp.c++/pr66199-1.C b/libgomp/testsuite/libgomp.c++/pr66199-1.C new file mode 100644 index 00000000000..2139e11b51c --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr66199-1.C @@ -0,0 +1,5 @@ +// PR middle-end/66199 +// { dg-do run } +// { dg-options "-O2 -fopenmp" } + +#include "../libgomp.c/pr66199-1.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-2.C b/libgomp/testsuite/libgomp.c++/pr66199-2.C new file mode 100644 index 00000000000..36392da270a --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr66199-2.C @@ -0,0 +1,5 @@ +// PR middle-end/66199 +// { dg-do run } +// { dg-options "-O2 -fopenmp" } + +#include "../libgomp.c/pr66199-2.c" diff --git a/libgomp/testsuite/libgomp.c/pr66199-1.c b/libgomp/testsuite/libgomp.c/pr66199-1.c new file mode 100644 index 00000000000..6fd9f87fa24 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr66199-1.c @@ -0,0 +1,62 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ +/* { dg-options "-O2 -fopenmp" } */ + +int u[1024], v[1024], w[1024]; + +__attribute__((noinline, noclone)) long +f1 (long a, long b) +{ + long d; + #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; + return d; +} + +__attribute__((noinline, noclone)) long +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w) linear(d) linear(c:5) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + c += 5; + e = c; + } + return d + c + e; +} + +__attribute__((noinline, noclone)) long +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +__attribute__((noinline, noclone)) long +f4 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +int +main () +{ + if (f1 (0, 1024) != 1024 + || f2 (0, 1024, 17) != 1024 + 2 * (17 + 5 * 1024) + || f3 (0, 32, 0, 32) != 64 + || f4 (0, 32, 0, 32) != 64) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr66199-2.c b/libgomp/testsuite/libgomp.c/pr66199-2.c new file mode 100644 index 00000000000..dbcd701b755 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr66199-2.c @@ -0,0 +1,59 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ +/* { dg-options "-O2 -fopenmp" } */ + +#pragma omp declare target +int u[1024], v[1024], w[1024]; +#pragma omp end declare target + +__attribute__((noinline, noclone)) void +f1 (long a, long b) +{ + long d; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; +} + +__attribute__((noinline, noclone)) void +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w) linear(d) linear(c:5) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + c += 5; + e = c; + } +} + +__attribute__((noinline, noclone)) void +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; +} + +__attribute__((noinline, noclone)) void +f4 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; +} + +int +main () +{ + f1 (0, 1024); + f2 (0, 1024, 17); + f3 (0, 32, 0, 32); + f4 (0, 32, 0, 32); + return 0; +} diff --git a/libgomp/testsuite/libgomp.fortran/pr66199-1.f90 b/libgomp/testsuite/libgomp.fortran/pr66199-1.f90 new file mode 100644 index 00000000000..0cd232f3e14 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr66199-1.f90 @@ -0,0 +1,49 @@ +! PR middle-end/66199 +! { dg-do run } +! { dg-options "-O2 -fopenmp" } + + integer :: u(1024), v(1024), w(1024), a, b, c, d, e, a1, b1, a2, b2, d1, d2 + a = 1 + b = 1024 + d = 75 + !$omp parallel do simd default(none) firstprivate (a, b) shared(u, v, w) + do d = a, b + u(d) = v(d) + w(d) + end do + if (d .ne. 1025) call abort + c = 17 + d = 75 + !$omp parallel do simd default(none) firstprivate (a, b) shared(u, v, w) & + !$omp& linear(d) linear(c:5) lastprivate(e) + do d = a, b + u(d) = v(d) + w(d) + c = c + 5 + e = c + end do + if (d .ne. 1025 .or. c .ne. (17 + 5 * 1024)) call abort + if (e .ne. (17 + 5 * 1024)) call abort + a1 = 0 + a2 = 0 + b1 = 31 + b2 = 31 + d1 = 7 + d2 = 9 + !$omp parallel do simd default(none) firstprivate (a1, b1, a2, b2) & + !$omp& shared(u, v, w) lastprivate(d1, d2) collapse(2) + do d1 = a1, b1 + do d2 = a2, b2 + u(d1 * 32 + d2 + 1) = v(d1 * 32 + d2 + 1) + w(d1 * 32 + d2 + 1) + end do + end do + if (d1 .ne. 32 .or. d2 .ne. 32) call abort + d1 = 7 + d2 = 9 + !$omp parallel do simd default(none) firstprivate (a1, b1, a2, b2) & + !$omp& shared(u, v, w) collapse(2) + do d1 = a1, b1 + do d2 = a2, b2 + u(d1 * 32 + d2 + 1) = v(d1 * 32 + d2 + 1) + w(d1 * 32 + d2 + 1) + end do + end do + if (d1 .ne. 32 .or. d2 .ne. 32) call abort +end diff --git a/libgomp/testsuite/libgomp.fortran/pr66199-2.f90 b/libgomp/testsuite/libgomp.fortran/pr66199-2.f90 new file mode 100644 index 00000000000..ad11eade72c --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr66199-2.f90 @@ -0,0 +1,47 @@ +! PR middle-end/66199 +! { dg-do run } +! { dg-options "-O2 -fopenmp" } + + integer :: u(1024), v(1024), w(1024), a, b, c, d, e, a1, b1, a2, b2, d1, d2 + a = 1 + b = 1024 + d = 75 + !$omp target teams distribute parallel do simd default(none) & + !$omp& firstprivate (a, b) shared(u, v, w) + do d = a, b + u(d) = v(d) + w(d) + end do + c = 17 + d = 75 + !$omp target teams distribute parallel do simd default(none) & + !$omp& firstprivate (a, b) shared(u, v, w) & + !$omp& linear(d) linear(c:5) lastprivate(e) + do d = a, b + u(d) = v(d) + w(d) + c = c + 5 + e = c + end do + a1 = 0 + a2 = 0 + b1 = 31 + b2 = 31 + d1 = 7 + d2 = 9 + !$omp target teams distribute parallel do simd default(none) & + !$omp& firstprivate (a1, b1, a2, b2) & + !$omp& shared(u, v, w) lastprivate(d1, d2) collapse(2) + do d1 = a1, b1 + do d2 = a2, b2 + u(d1 * 32 + d2 + 1) = v(d1 * 32 + d2 + 1) + w(d1 * 32 + d2 + 1) + end do + end do + d1 = 7 + d2 = 9 + !$omp target teams distribute parallel do simd default(none) & + !$omp& firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + do d1 = a1, b1 + do d2 = a2, b2 + u(d1 * 32 + d2 + 1) = v(d1 * 32 + d2 + 1) + w(d1 * 32 + d2 + 1) + end do + end do +end |