From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 488843857820; Tue, 1 Feb 2022 18:29:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 488843857820 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Tom de Vries To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6967] [nvptx] Handle nop in prevent_branch_around_nothing X-Act-Checkin: gcc X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: e0451f93d9faa13495132f4e246e9bef30b51417 X-Git-Newrev: 456de10c549379b74d4858f00d4b8817035a73fc Message-Id: <20220201182941.488843857820@sourceware.org> Date: Tue, 1 Feb 2022 18:29:41 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2022 18:29:41 -0000 https://gcc.gnu.org/g:456de10c549379b74d4858f00d4b8817035a73fc commit r12-6967-g456de10c549379b74d4858f00d4b8817035a73fc Author: Tom de Vries Date: Sun Jan 23 06:42:24 2022 +0100 [nvptx] Handle nop in prevent_branch_around_nothing When running libgomp test-case reduction-7.c on an nvptx accelerator (T400, driver version 470.86) and GOMP_NVPTX_JIT=-O0, I run into: ... reduction-7.exe:reduction-7.c:312: v_p_2: \ Assertion `out[j * 32 + i] == (i + j) * 2' failed. FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/reduction-7.c \ -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none \ -O0 execution test ... During investigation I found ptx code like this: ... @ %r163 bra $L262; $L262: ... There's a known problem with executing this type of code, and a workaround is in place to address this: prevent_branch_around_nothing. The workaround does not trigger though because it doesn't handle the nop insn. Fix this by handling the nop insn in prevent_branch_around_nothing. Tested libgomp on x86_64 with nvptx accelerator. gcc/ChangeLog: 2022-01-27 Tom de Vries PR target/100428 * config/nvptx/nvptx.cc (prevent_branch_around_nothing): Handle nop insn. Diff: --- gcc/config/nvptx/nvptx.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc index ceea4d3a093..262e8f9cc1b 100644 --- a/gcc/config/nvptx/nvptx.cc +++ b/gcc/config/nvptx/nvptx.cc @@ -5103,6 +5103,7 @@ prevent_branch_around_nothing (void) case CODE_FOR_nvptx_forked: case CODE_FOR_nvptx_joining: case CODE_FOR_nvptx_join: + case CODE_FOR_nop: continue; default: seen_label = NULL;