From: Tom de Vries Date: Tue, 20 Mar 2018 10:31:23 +0000 (+0000) Subject: [nvptx] Fix bar.sync position X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=038012e2d9211e56a2d6710a85314373af9d4d44;p=gcc.git [nvptx] Fix bar.sync position 2018-03-20 Tom de Vries PR target/84952 * config/nvptx/nvptx.c (nvptx_single): Don't neuter bar.sync. (nvptx_process_pars): Emit bar.sync asap and alap. From-SVN: r258676 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 460802d8b64..c1ac2f9228a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-20 Tom de Vries + + PR target/84952 + * config/nvptx/nvptx.c (nvptx_single): Don't neuter bar.sync. + (nvptx_process_pars): Emit bar.sync asap and alap. + 2018-03-20 Tom de Vries PR target/84954 diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 7b0b182deb2..1ba27e31ef0 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -3969,7 +3969,9 @@ nvptx_single (unsigned mask, basic_block from, basic_block to) while (true) { /* Find first insn of from block. */ - while (head != BB_END (from) && !INSN_P (head)) + while (head != BB_END (from) + && (!INSN_P (head) + || recog_memoized (head) == CODE_FOR_nvptx_barsync)) head = NEXT_INSN (head); if (from == to) @@ -4018,6 +4020,7 @@ nvptx_single (unsigned mask, basic_block from, basic_block to) { default: break; + case CODE_FOR_nvptx_barsync: case CODE_FOR_nvptx_fork: case CODE_FOR_nvptx_forked: case CODE_FOR_nvptx_joining: @@ -4275,8 +4278,8 @@ nvptx_process_pars (parallel *par) nvptx_wpropagate (false, par->forked_block, par->forked_insn); nvptx_wpropagate (true, par->forked_block, par->fork_insn); /* Insert begin and end synchronizations. */ - emit_insn_after (nvptx_wsync (false), par->forked_insn); - emit_insn_before (nvptx_wsync (true), par->joining_insn); + emit_insn_before (nvptx_wsync (false), par->forked_insn); + emit_insn_before (nvptx_wsync (true), par->join_insn); } else if (par->mask & GOMP_DIM_MASK (GOMP_DIM_VECTOR)) nvptx_vpropagate (par->forked_block, par->forked_insn);