summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCesar Philippidis <cesar@codesourcery.com>2018-03-12 14:08:21 -0700
committerCesar Philippidis <cesar@codesourcery.com>2018-03-12 14:08:21 -0700
commit7445a4d4073c5074862f1da1a27f05d35151e082 (patch)
treef5659100f927eac507feacc13dc540b70f0c5812
parentf39058384c40bc1fcae824f60a18f8c520be7e0c (diff)
downloadgcc-openacc-gcc-7-branch.tar.gz
Backport PR74048 and PR81352 nvptx fixesopenacc-gcc-7-branch
Backport from trunk: 2018-01-25 Tom de Vries <tom@codesourcery.com> PR target/84028 gcc/ * config/nvptx/nvptx.c (nvptx_single): Add exit insn after noreturn call for neutered workers. * testsuite/libgomp.oacc-fortran/pr84028.f90: New test. 2018-01-24 Tom de Vries <tom@codesourcery.com> PR target/81352 gcc/ * config/nvptx/nvptx.c (nvptx_single): Add exit insn after noreturn call for neutered threads in warp. * config/nvptx/nvptx.md (define_insn "exit"): New insn. * testsuite/libgomp.oacc-fortran/pr81352.f90: New test.
-rw-r--r--gcc/ChangeLog.openacc16
-rw-r--r--gcc/config/nvptx/nvptx.c7
-rw-r--r--gcc/config/nvptx/nvptx.md5
-rw-r--r--gcc/testsuite/ChangeLog.openacc13
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/pr81352.f9020
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/pr84028.f9025
6 files changed, 85 insertions, 1 deletions
diff --git a/gcc/ChangeLog.openacc b/gcc/ChangeLog.openacc
index 40878fb846c..b0efb97dd1b 100644
--- a/gcc/ChangeLog.openacc
+++ b/gcc/ChangeLog.openacc
@@ -1,3 +1,19 @@
+2018-03-12 Cesar Philippidis <cesar@codesourcery.com>
+
+ Backport from trunk:
+ 2018-01-25 Tom de Vries <tom@codesourcery.com>
+
+ PR target/84028
+ * config/nvptx/nvptx.c (nvptx_single): Add exit insn after noreturn call
+ for neutered workers.
+
+ 2018-01-24 Tom de Vries <tom@codesourcery.com>
+
+ PR target/81352
+ * config/nvptx/nvptx.c (nvptx_single): Add exit insn after noreturn call
+ for neutered threads in warp.
+ * config/nvptx/nvptx.md (define_insn "exit"): New insn.
+
2018-03-08 Cesar Philippidis <cesar@codesourcery.com>
* config/nvptx/nvptx.c (nvptx_single): Adjust placement of nvptx_fork
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index efc6161a6b0..070d236fa87 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -4128,7 +4128,12 @@ nvptx_single (unsigned mask, basic_block from, basic_block to)
if (tail_branch)
before = emit_label_before (label, before);
else
- emit_label_after (label, tail);
+ {
+ rtx_insn *label_insn = emit_label_after (label, tail);
+ if ((mode == GOMP_DIM_VECTOR || mode == GOMP_DIM_WORKER)
+ && CALL_P (tail) && find_reg_note (tail, REG_NORETURN, NULL))
+ emit_insn_after (gen_exit (), label_insn);
+ }
}
/* Now deal with propagating the branch condition. */
diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md
index ac7b7cc8440..2b4bcb3a45b 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -972,6 +972,11 @@
""
"")
+(define_insn "exit"
+ [(const_int 1)]
+ ""
+ "exit;")
+
(define_insn "return"
[(return)]
""
diff --git a/gcc/testsuite/ChangeLog.openacc b/gcc/testsuite/ChangeLog.openacc
index 050cdb5bd5b..cc7286d2080 100644
--- a/gcc/testsuite/ChangeLog.openacc
+++ b/gcc/testsuite/ChangeLog.openacc
@@ -1,3 +1,16 @@
+2018-03-12 Cesar Philippidis <cesar@codesourcery.com>
+
+ Backport from trunk:
+ 2018-01-25 Tom de Vries <tom@codesourcery.com>
+
+ PR target/84028
+ * libgomp.oacc-fortran/pr84028.f90: New test.
+
+ 2018-01-24 Tom de Vries <tom@codesourcery.com>
+
+ PR target/81352
+ * libgomp.oacc-fortran/pr81352.f90: New test.
+
2018-01-31 Cesar Philippidis <cesar@codesourcery.com>
* c-c++-common/goacc/large_array.c: New test.
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/pr81352.f90 b/libgomp/testsuite/libgomp.oacc-fortran/pr81352.f90
new file mode 100644
index 00000000000..f6969c8595d
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/pr81352.f90
@@ -0,0 +1,20 @@
+! { dg-do run }
+
+program foo
+ integer :: a(3,3), l, ll
+ a = 0
+
+ !$acc parallel num_gangs (1) num_workers(1)
+
+ do l=1,3
+ !$acc loop vector
+ do ll=1,3
+ a(l,ll) = 2
+ enddo
+ enddo
+
+ if (any(a(1:3,1:3).ne.2)) call abort
+
+ !$acc end parallel
+
+end program foo
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/pr84028.f90 b/libgomp/testsuite/libgomp.oacc-fortran/pr84028.f90
new file mode 100644
index 00000000000..693faa2214f
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/pr84028.f90
@@ -0,0 +1,25 @@
+! { dg-do run }
+
+program foo
+ integer :: a(3,3,3), ll, lll
+
+ a = 1
+
+ !$acc parallel num_gangs(1) num_workers(2) ! { dg-warning "region is worker partitioned" }
+
+ if (any(a(1:3,1:3,1:3).ne.1)) call abort
+
+ do ll=1,3
+
+ !$acc loop vector
+ do lll=1,3
+ a(1,ll,lll) = 2
+ enddo
+
+ enddo
+
+ if (a(1,1,1).ne.2) call abort
+
+ !$acc end parallel
+
+end program foo