From: Tom de Vries Date: Wed, 24 Jan 2018 11:27:10 +0000 (+0000) Subject: [nvptx, PR81352] Add exit insn after noreturn call for neutered threads in warp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=be606483c9fc0c79ffb671238404203e01288b00;p=gcc.git [nvptx, PR81352] Add exit insn after noreturn call for neutered threads in warp 2018-01-24 Tom de Vries 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. * testsuite/libgomp.oacc-fortran/pr81352.f90: New test. From-SVN: r257014 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0e48b861c4f..e4eba86378e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-01-24 Tom de Vries + + 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-01-24 Richard Biener PR tree-optimization/83176 diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index f5bb4387865..3516740bb19 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -4062,7 +4062,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 && 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 f9c087b6d22..135479be129 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -994,6 +994,11 @@ "" "") +(define_insn "exit" + [(const_int 1)] + "" + "exit;") + (define_insn "return" [(return)] "" diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index c308227951b..11cda22e1c3 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2018-01-24 Tom de Vries + + PR target/81352 + * testsuite/libgomp.oacc-fortran/pr81352.f90: New test. + 2018-01-19 Tom de Vries Cesar Philippidis 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