From patchwork Tue May 17 08:58:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Clifton X-Patchwork-Id: 95892 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]) by ozlabs.org (Postfix) with SMTP id EA434B6EEE for ; Tue, 17 May 2011 18:58:08 +1000 (EST) Received: (qmail 26838 invoked by alias); 17 May 2011 08:58:05 -0000 Received: (qmail 26829 invoked by uid 22791); 17 May 2011 08:58:03 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 May 2011 08:57:46 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4H8vkAY014429 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 May 2011 04:57:46 -0400 Received: from Gift.redhat.com (vpn2-11-6.ams2.redhat.com [10.36.11.6]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4H8vh6T004988 for ; Tue, 17 May 2011 04:57:45 -0400 From: Nick Clifton To: gcc-patches@gcc.gnu.org Subject: Commit: RX: Include cost of register moving in the cost of register loading. Date: Tue, 17 May 2011 09:58:41 +0100 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes 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 Hi Guys, I am applying the patch below to fix a bug with the rx_memory_move_cost function. The problem was that the costs are meant to be relative to the cost of moving a value between registers, but the existing definition was making stores cheaper than moves, and loads the same cost as moves. Thus gcc was sometimes choosing to store values in memory when actually it was better to keep them in memory. The patch fixes the problem by adding in the register move cost to the memory move cost. It also removes the call to memory_move_secondary_cost since there is no secondary cost. Cheers Nick gcc/ChangeLog 2011-05-17 Nick Clifton * config/rx/rx.c (rx_memory_move_cost): Include cost of register moves. Index: gcc/config/rx/rx.c =================================================================== --- gcc/config/rx/rx.c (revision 173815) +++ gcc/config/rx/rx.c (working copy) @@ -2638,7 +2638,7 @@ static int rx_memory_move_cost (enum machine_mode mode, reg_class_t regclass, bool in) { - return (in ? 2 : 0) + memory_move_secondary_cost (mode, regclass, in); + return (in ? 2 : 0) + REGISTER_MOVE_COST (mode, regclass, regclass); } /* Convert a CC_MODE to the set of flags that it represents. */