From patchwork Thu Mar 27 17:33:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Greenhalgh X-Patchwork-Id: 334427 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 11A2914009B for ; Fri, 28 Mar 2014 04:35:45 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=OtGJ1ntq+IRDKLvM fyPfQkcKbUfB+ohblaWVCY4RzJm5HVwrMr1dZZ0QKCX4dqaNZ3YfLPzDc2sRzfAK zbROyYTVlG4AMVrVTi1Tl0yTf8NVaZoti2+C0KwduUHOa8584SZ7w0J0B9Bnw7bQ 74af6yM8CQOQSjifBJNYDneGWtw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=default; bh=7KFodVY/5SLxtO6nIOVC0P galQ0=; b=JvXDZuamdA+V8sXR9RlNAwz4VegD84GNkepN9ohJAAmn5I0h+12cd7 v5wdQTk2kem6nRcO6FWDMDdBuQaZo/bIyfedREfz2l0DFVwCre9WWoEPzYOc2lEz NCI98rJVNYo6nCbgADGmI70qRHx4EtImlx70+1Z4gdsJnUy8o/alc= Received: (qmail 32411 invoked by alias); 27 Mar 2014 17:34:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 32295 invoked by uid 89); 27 Mar 2014 17:34:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Mar 2014 17:34:15 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 27 Mar 2014 17:34:12 +0000 Received: from e106375-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 27 Mar 2014 17:34:26 +0000 From: James Greenhalgh To: gcc-patches@gcc.gnu.org Cc: richard.earnshaw@arm.com, marcus.shawcroft@arm.com, philipp.tomsich@theobroma-systems.com Subject: [AArch64 costs 13/18] Improve costs for div/mod Date: Thu, 27 Mar 2014 17:33:37 +0000 Message-Id: <1395941622-22926-14-git-send-email-james.greenhalgh@arm.com> In-Reply-To: <1395941622-22926-1-git-send-email-james.greenhalgh@arm.com> References: <1395941622-22926-1-git-send-email-james.greenhalgh@arm.com> MIME-Version: 1.0 X-MC-Unique: 114032717341206301 X-IsSubscribed: yes Hi, Now DIV/MOD. Tested in series on aarch64-none-elf. OK for stage 1? Thanks, James --- 2014-03-27 James Greenhalgh Philipp Tomsich * config/aarch64/aarch64.c (aarch64_rtx_costs): Improve costs for DIV/MOD. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 338f6b3..c6f1ac5 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5423,7 +5423,6 @@ cost_minus: case MOD: case UMOD: - *cost = COSTS_N_INSNS (2); if (speed) { if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT) @@ -5440,15 +5439,15 @@ cost_minus: case DIV: case UDIV: - *cost = COSTS_N_INSNS (1); + case SQRT: if (speed) { - if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT) - *cost += extra_cost->mult[GET_MODE (x) == DImode].idiv; - else if (GET_MODE (x) == DFmode) - *cost += extra_cost->fp[1].div; - else if (GET_MODE (x) == SFmode) - *cost += extra_cost->fp[0].div; + if (GET_MODE_CLASS (mode) == MODE_INT) + /* There is no integer SQRT, so only DIV and UDIV can get + here. */ + *cost += extra_cost->mult[mode == DImode].idiv; + else + *cost += extra_cost->fp[mode == DFmode].div; } return false; /* All arguments need to be in registers. */