From patchwork Thu Jul 16 10:02:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 1330116 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nextmovesoftware.com header.i=@nextmovesoftware.com header.a=rsa-sha256 header.s=default header.b=gUdYnmAf; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B6qZP26qtz9sRW for ; Thu, 16 Jul 2020 20:03:07 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 938F1388A82B; Thu, 16 Jul 2020 10:03:03 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id 53615388A81D for ; Thu, 16 Jul 2020 10:03:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 53615388A81D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=roger@nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ffX7N7E2ZaGMY+zCngleDFbdyX01heA7y0sdcrouu0k=; b=gUdYnmAfj+bZsKMu2Se6ikObJT 4MhZHS8tJAhlcdEO4mwKRRMCn3bnLgSUHZNQPml/1yBcS1v090fpyh0oLZl4h40Y6TD2h092m0kGV Awql4xXwAbs7tYGSBRwv5EKq30NzGwwhsK7uY/p6ya0Of1FU09Sbb8X4OxD01qFkg86GDHterLx3X S1BeYxhLT4ISuads/+JGWHXyxjrkWP2Cke579QgghqtJ5/DLTCCJ/DeUnrRO8iZ6jBIVMAFNl0wlc RzetIV2pByARHgwPzayJUPLyVclw01FSSLWk/4miCOn8q/OeQOi4PN3mSCd523bfOCrhwJ/I0Jtgt /npbbnjg==; Received: from host86-137-89-56.range86-137.btcentralplus.com ([86.137.89.56]:51737 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jw0jE-0003BC-GB; Thu, 16 Jul 2020 06:03:00 -0400 From: "Roger Sayle" To: "'GCC Patches'" Subject: [PATCH] Define TARGET_TRULY_NOOP_TRUNCATION to false. Date: Thu, 16 Jul 2020 11:02:59 +0100 Message-ID: <001001d65b58$4a10c130$de324390$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdZbVvUwMkNSQo4AQQiMftLkL8ZBag== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Many thanks to Richard Biener for approving the midde-end patch that cleared the way for this one. This nvptx patch defines the target hook TARGET_TRULY_NOOP_TRUNCATION to false, indicating that integer truncations require explicit instructions. nvptx.c already defines TARGET_MODES_TIEABLE_P and TARGET_CAN_CHANGE_MODE_CLASS to false, and as (previously) documented that may require TARGET_TRULY_NOOP_TRUNCATION to be defined likewise. This patch decreases the number of unexpected failures in the testsuite by 10, and increases the number of expected passes by 4, including these previous FAILs/ICEs: gcc.c-torture/compile/opout.c gcc.dg/torture/pr79125.c gcc.dg/tree-ssa/pr92085-1.c Unfortunately there is one testsuite failure that used to pass gcc.target/nvptx/v2si-cvt.c, but this isn't an ICE or incorrect code. As explained in this test, the scan-assembler already isn't testing what it should. Given that there are several (nvptx) patches pending review that affect code generation of this example, and (perhaps) more on the way, I propose letting this test FAIL for now until the dust settles and it becomes clear what instruction(s) should be generated (certainly not a cvt.u32.u32). This patch has been tested on nvptx-none hosted on x86_64-pc-linux-gnu with "make" and "make check" with fewer ICEs and no wrong code regressions. Ok for mainline? 2020-07-16 Roger Sayle gcc/ChangeLog * config/nvptx/nvptx.c (nvptx_truly_noop_truncation): Implement. (TARGET_TRULY_NOOP_TRUNCATION): Define. Thanks in advance. --- Roger Sayle NextMove Software Cambridge, UK diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index e3e84df..f5b5d8c 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -6450,6 +6450,14 @@ nvptx_can_change_mode_class (machine_mode, machine_mode, reg_class_t) return false; } +/* Implement TARGET_TRULY_NOOP_TRUNCATION. */ + +static bool +nvptx_truly_noop_truncation (poly_uint64, poly_uint64) +{ + return false; +} + static GTY(()) tree nvptx_previous_fndecl; static void @@ -6599,6 +6607,9 @@ nvptx_set_current_function (tree fndecl) #undef TARGET_CAN_CHANGE_MODE_CLASS #define TARGET_CAN_CHANGE_MODE_CLASS nvptx_can_change_mode_class +#undef TARGET_TRULY_NOOP_TRUNCATION +#define TARGET_TRULY_NOOP_TRUNCATION nvptx_truly_noop_truncation + #undef TARGET_HAVE_SPECULATION_SAFE_VALUE #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed