From patchwork Thu Aug 27 16:42:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 1352704 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=TP9TP86W; 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 4BcpRw14Tcz9sR4 for ; Fri, 28 Aug 2020 02:42:35 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E51F93870890; Thu, 27 Aug 2020 16:42:31 +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 35FC8385EC58 for ; Thu, 27 Aug 2020 16:42:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 35FC8385EC58 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=1rFE5W+ibtKae2Ym98IOyORzrJR7eeID86FXyErIDhE=; b=TP9TP86Wg0WQR4fXA634KYRTgX a+uB6SxPaCkFGeiKGMcNMFA889nEZnUddjBM623Su/zXWgKzv0NJ8lgDsRjtfjpgUFSc5v8hPvpO9 vaS1YgkrtIGKTdXTr2LxReuqFDSooNJNrmzOVIaSsnOwy7+E1m4COdA0aVq9csu7w1IESCkgN7pJK /KYrCY49/E42s3sX/5AjvTTIR0zEJqlIgrP4kWPI99Qp7xmVKNjP9sQrmoTl9YyDKmKyoKpFqznNq NIsIZbmiZWE5nPpKDQzY36if3tQof4WpagA913y0CfPoOGgn3D0+DhWMREU2qv8SoslvPXX7KvfvJ c6HUpQZg==; Received: from [185.62.158.67] (port=54154 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 1kBKyr-0005KR-GE; Thu, 27 Aug 2020 12:42:29 -0400 From: "Roger Sayle" To: "'GCC Patches'" Subject: [PATCH] hppa: Improve hppa_rtx_costs for shifts by constants. Date: Thu, 27 Aug 2020 17:42:28 +0100 Message-ID: <007701d67c91$0e0eee50$2a2ccaf0$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdZ8jei7kZPBqpjLQPON0vo7dIZ41w== 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=-10.8 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: , Cc: 'John David Anglin' Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi Dave (and Jeff), For your consideration, here's a patch that should fix the recent regression of gcc.dg/tree-ssa/slrt-13.c on hppa targets. This patch provides more accurate rtx_costs estimates for shifts by integer constants (which are cheaper than by a register amount). Fine tuning these is sufficient to have simple-ssa-strength-reduce prefer multiplications by four, over multiplications by five. Technically only the ASHIFT is required to fix the regression, but for symmetry I've added the appropriate PA-RISC values for all three shift types (in SImode). I've also checked that this doesn't reintroduce PR middle-end/87256. I was wondering whether you could please "put this in the queue", and reconfirm that PR middle-end/87256 remains resolved? 2020-08-27 Roger Sayle gcc/ChangeLog * config/pa/pa.c (hppa_rtx_costs) [ASHIFT, ASHIFTRT, LSHIFTRT]: Provide accurate costs for shifts of integer constants. Many thanks in advance (and my apologies for the inconvenience), Roger --- Roger Sayle NextMove Software Cambridge, UK diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index cb88852..a9223ab 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -1642,6 +1642,14 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code, else *total = COSTS_N_INSNS (18); } + else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1))) + { + if (TARGET_64BIT) + *total = COSTS_N_INSNS (2); + else + *total = COSTS_N_INSNS (1); + return true; + } else if (TARGET_64BIT) *total = COSTS_N_INSNS (4); else @@ -1665,6 +1673,14 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code, else *total = COSTS_N_INSNS (19); } + else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1))) + { + if (TARGET_64BIT) + *total = COSTS_N_INSNS (2); + else + *total = COSTS_N_INSNS (1); + return true; + } else if (TARGET_64BIT) *total = COSTS_N_INSNS (4); else @@ -1688,6 +1704,11 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code, else *total = COSTS_N_INSNS (15); } + else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1))) + { + *total = COSTS_N_INSNS (1); + return true; + } else if (TARGET_64BIT) *total = COSTS_N_INSNS (3); else