From patchwork Fri Feb 11 07:47:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 51038 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6036A385842D for ; Fri, 11 Feb 2022 07:47:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6036A385842D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1644565663; bh=ico/Z5HYtP4FzCB1qx2Gf2IxAqe+odQVFjTSmq8hmu0=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=LLpCy/+LzF/1j9HURqa46hIBi8QP0kLEXQx5022c7GhPlSD9qIstGxSUM3Fs3P29V UnwYj33cQckrNj+8cVXBGtrn75H+LNMFURjNXFc7ZjSBd+JT3G9q+/RYDhCXbHb9ro AQSpyKqtwTmncr2l4vpdYgZt1mjHUwT6NAbGSx6o= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 328F33858D1E for ; Fri, 11 Feb 2022 07:47:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 328F33858D1E Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4258D212B5 for ; Fri, 11 Feb 2022 07:47:13 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 270C6139E9 for ; Fri, 11 Feb 2022 07:47:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4IRpB4EUBmL6ZgAAMHmgww (envelope-from ) for ; Fri, 11 Feb 2022 07:47:13 +0000 Date: Fri, 11 Feb 2022 08:47:11 +0100 To: gcc-patches@gcc.gnu.org Subject: [committed][nvptx] Handle asm insn in prevent_branch_around_nothing Message-ID: <20220211074710.GA25194@delia.home> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gcc-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, With GOMP_NVPTX_JIT=-00 and -mptx=3.1, I run into: ... FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/acc_prof-version-1.c \ -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O2 \ execution test ... The problem is that we're generating a diverging branch around nothing: ... { .reg.u32 %x; mov.u32 %x, %tid.x; setp.ne.u32 %r23, %x, 0; } @%r23 bra $L2; $L2: ... which the driver JIT has problems with at -O0, so consequently we run into the nvptx_uniform_warp_check. Fix this by handling asm ("") and alike in prevent_branch_around_nothing. Tested on x86_64 with nvptx accelerator. Committed to trunk. Thanks, - Tom [nvptx] Handle asm insn in prevent_branch_around_nothing gcc/ChangeLog: 2022-02-10 Tom de Vries PR target/104456 * config/nvptx/nvptx.cc (prevent_branch_around_nothing): Handle asm insn. --- gcc/config/nvptx/nvptx.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc index 5b26c0f4c7d..afbad5bdde6 100644 --- a/gcc/config/nvptx/nvptx.cc +++ b/gcc/config/nvptx/nvptx.cc @@ -5257,6 +5257,14 @@ prevent_branch_around_nothing (void) case CODE_FOR_nvptx_join: case CODE_FOR_nop: continue; + case -1: + /* Handle asm ("") and similar. */ + if (GET_CODE (PATTERN (insn)) == ASM_INPUT + || GET_CODE (PATTERN (insn)) == ASM_OPERANDS + || (GET_CODE (PATTERN (insn)) == PARALLEL + && asm_noperands (PATTERN (insn)) >= 0)) + continue; + /* FALLTHROUGH. */ default: seen_label = NULL; continue;