From patchwork Mon Sep 7 19:59:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 1359243 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=8.43.85.97; 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=stYQw6wK; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 4BlfJZ5Hl3z9sR4 for ; Tue, 8 Sep 2020 05:59:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93EE23948A51; Mon, 7 Sep 2020 19:59:53 +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 58A7E39450CD for ; Mon, 7 Sep 2020 19:59:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 58A7E39450CD 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=TIOYH6SZ2g9/tKPRlYQ/of6JZVb9fWobmeO6uMc2/0Y=; b=stYQw6wKlSNqGG//InSUNrPcFn 9WfQRr3Lbxi08d/kfYuvNg7GVnDKu0oeAxZRz0fHqF5Lylj3w+ohRLMs4tQdcEZEoZcsOQzOo6fmo 39be9Ljrj2aMA2RiwZTTEeuOteE+79Cne2Fxls/TpDmGrfdryVd7kh9TOwNWTWwX9/AyT9Gz8kkOs /++7hFSbxQriE2EE5sRgh7zUGoQB6zUl1mYtRkraAKiDhUjEHVCEjMfdh+KV2/VGqGW6xY3xA3dkn 8yHff8iR3lv+J8atouJt6XUhrX14xVsDxRfRwrD3aJMZ1kV04dX/Kmrejc+BqjLm5sNpdXjoSednY c1/0A1aQ==; Received: from host81-135-26-18.range81-135.btcentralplus.com ([81.135.26.18]:51467 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 1kFNIs-00012s-Dc; Mon, 07 Sep 2020 15:59:50 -0400 From: "Roger Sayle" To: "'GCC Patches'" Subject: [PATCH] hppa64: Improve hppa_rtx_costs for DImode shifts by constants. Date: Mon, 7 Sep 2020 20:59:47 +0100 Message-ID: <006f01d68551$716332e0$542998a0$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdaFThNitbmusV/6TAqecg+/h4poYg== 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.2 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, Here's another patch for you to try on hppa64. I've no idea whether it helps PR middle-end/87256 on hppa64 or makes things worse, but this updates the DImode shift by constant costs on TARGET_64BIT, in the same way that the previous rtx_costs patch improved the SImode costs. Generating optimal code is a useful pre-requisite. If nothing else, this should reduce the number PA2.0 instructions generated for PR87256's hog.c. Please let me know what you think. 2020-09-07 Roger Sayle gcc/ChangeLog * config/pa/pa.c (hppa_rtx_costs) [ASHIFT, ASHIFTRT, LSHIFTRT]: Provide accurate costs for DImode shifts of integer constants. Many thanks in advance, Roger diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index a9223ab..210e44f 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -1630,13 +1630,16 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code, case ASHIFT: if (mode == DImode) { - if (TARGET_64BIT) - *total = COSTS_N_INSNS (3); - else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1))) + if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1))) { - *total = COSTS_N_INSNS (2); + if (TARGET_64BIT) + *total = COSTS_N_INSNS (1); + else + *total = COSTS_N_INSNS (2); return true; } + else if (TARGET_64BIT) + *total = COSTS_N_INSNS (3); else if (speed) *total = COSTS_N_INSNS (13); else @@ -1661,13 +1664,16 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code, case ASHIFTRT: if (mode == DImode) { - if (TARGET_64BIT) - *total = COSTS_N_INSNS (3); - else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1))) + if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1))) { - *total = COSTS_N_INSNS (2); + if (TARGET_64BIT) + *total = COSTS_N_INSNS (1); + else + *total = COSTS_N_INSNS (2); return true; } + else if (TARGET_64BIT) + *total = COSTS_N_INSNS (3); else if (speed) *total = COSTS_N_INSNS (14); else @@ -1692,13 +1698,16 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code, case LSHIFTRT: if (mode == DImode) { - if (TARGET_64BIT) - *total = COSTS_N_INSNS (2); - else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1))) + if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1))) { - *total = COSTS_N_INSNS (2); + if (TARGET_64BIT) + *total = COSTS_N_INSNS (1); + else + *total = COSTS_N_INSNS (2); return true; } + else if (TARGET_64BIT) + *total = COSTS_N_INSNS (2); else if (speed) *total = COSTS_N_INSNS (12); else