From patchwork Tue Sep 15 01:19:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 1364022 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=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Z88N0+sz; 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 4Br55W72dNz9sTt for ; Tue, 15 Sep 2020 11:20:47 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2ED44383F857; Tue, 15 Sep 2020 01:20:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2ED44383F857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1600132838; bh=vh+IpVkFeHOTM5LZ0CMEc2sP1rPT0ycrxcypVnmqAOA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Z88N0+szTQXfeMbtvx6kv98WoBUYvMVMmFqa4fyAo2WT5/orCICglZmwE6HhcmzdJ BQjwtYZ9DfBWCbhhfRm8ydpSCKqyJtkBhAVkga81lKa/qccp/EzQbSzsrzj0nlh1Vx 8OL5EJ0o0CASsCZ/ivFBMQKvlQi2SLV2HpPaxH3k= X-Original-To: gcc-patches@sourceware.org Delivered-To: gcc-patches@sourceware.org Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id EC682383F857 for ; Tue, 15 Sep 2020 01:20:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EC682383F857 Received: by mail-pf1-x42e.google.com with SMTP id w7so985410pfi.4 for ; Mon, 14 Sep 2020 18:20:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vh+IpVkFeHOTM5LZ0CMEc2sP1rPT0ycrxcypVnmqAOA=; b=MQY+RfWuVeAX6g1eLlAj+afI6M4NOjnXL68IGOSTcy8X4FYsUJ+dF3hlncBoD0Gv1Q 2WyC3EhsrUc3vAvVfoxPYirsLX395f10htkTyaT9p433ItXI7dWbmZ+WtTPbvgHR8ccs 8Qsikv4NuHSgqkpi0X3vtMR3YYC5GYNYPd5L8atWKNOQpe54hXy72f+e7j0IhWU3xlQe QKEmDhF67VCNmlB3bE1/Omj7ZCv9ckZ8zE+et/YhaC/MDpxghIq6GMKLPD+XIZgceuD8 qM4a05iLb8NGEp3r5P8dc14EBDM3vXyliN3mRohPDYNhdSzf/nRwg5+5aVdRdsQcBb+p WWAg== X-Gm-Message-State: AOAM5316hxf7f0aaerjO7AoGULeCmAVrmsV/NSX/5laX0xkJEjW8v8hp DB5t0FidkVtWAYBEqt6z9ZrHpEbI4Jo= X-Google-Smtp-Source: ABdhPJzd2W80zQLR+Agv4yLoIIq6FW81BpKhmqb16XusrEqtR4si0okWGx3etkiPMQzi5jiNmmoZzg== X-Received: by 2002:aa7:948d:0:b029:13e:cb8d:60e0 with SMTP id z13-20020aa7948d0000b029013ecb8d60e0mr16355189pfk.9.1600132835148; Mon, 14 Sep 2020 18:20:35 -0700 (PDT) Received: from bubble.grove.modra.org ([2406:3400:51d:8cc0:2474:1d78:84bf:1670]) by smtp.gmail.com with ESMTPSA id e207sm12210851pfh.171.2020.09.14.18.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 18:20:34 -0700 (PDT) To: Segher Boessenkool Subject: [RS6000] rs6000_rtx_costs for AND Date: Tue, 15 Sep 2020 10:49:41 +0930 Message-Id: <20200915011946.3395-4-amodra@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200915011946.3395-1-amodra@gmail.com> References: <20200915011946.3395-1-amodra@gmail.com> X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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: , X-Patchwork-Original-From: Alan Modra via Gcc-patches From: Alan Modra Reply-To: Alan Modra Cc: gcc-patches@sourceware.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The existing "case AND" in this function is not sufficient for optabs.c:avoid_expensive_constant usage, where the AND is passed in outer_code. * config/rs6000/rs6000.c (rs6000_rtx_costs): Move costing for AND to CONST_INT case. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 32044d33977..523d029800a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -21150,16 +21150,13 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code, || outer_code == MINUS) && (satisfies_constraint_I (x) || satisfies_constraint_L (x))) - || (outer_code == AND - && (satisfies_constraint_K (x) - || (mode == SImode - ? satisfies_constraint_L (x) - : satisfies_constraint_J (x)))) - || ((outer_code == IOR || outer_code == XOR) + || ((outer_code == AND || outer_code == IOR || outer_code == XOR) && (satisfies_constraint_K (x) || (mode == SImode ? satisfies_constraint_L (x) : satisfies_constraint_J (x)))) + || (outer_code == AND + && rs6000_is_valid_and_mask (x, mode)) || outer_code == ASHIFT || outer_code == ASHIFTRT || outer_code == LSHIFTRT @@ -21196,7 +21193,9 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code, || outer_code == IOR || outer_code == XOR) && (INTVAL (x) - & ~ (unsigned HOST_WIDE_INT) 0xffffffff) == 0)) + & ~ (unsigned HOST_WIDE_INT) 0xffffffff) == 0) + || (outer_code == AND + && rs6000_is_valid_2insn_and (x, mode))) { *total = COSTS_N_INSNS (1); return true; @@ -21334,26 +21333,6 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code, *total += COSTS_N_INSNS (1); return true; } - - /* rotate-and-mask (no rotate), andi., andis.: 1 insn. */ - HOST_WIDE_INT val = INTVAL (XEXP (x, 1)); - if (rs6000_is_valid_and_mask (XEXP (x, 1), mode) - || (val & 0xffff) == val - || (val & 0xffff0000) == val - || ((val & 0xffff) == 0 && mode == SImode)) - { - *total = rtx_cost (left, mode, AND, 0, speed); - *total += COSTS_N_INSNS (1); - return true; - } - - /* 2 insns. */ - if (rs6000_is_valid_2insn_and (XEXP (x, 1), mode)) - { - *total = rtx_cost (left, mode, AND, 0, speed); - *total += COSTS_N_INSNS (2); - return true; - } } *total = COSTS_N_INSNS (1);