From patchwork Thu Mar 1 04:11:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaz Kojima X-Patchwork-Id: 143897 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 5877DB6EEC for ; Thu, 1 Mar 2012 15:12:17 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1331179938; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:Message-Id:To:Subject:From:Mime-Version:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=1MfNSBGbRfY5QrT1gqmpQ05GkJY=; b=Ln7JzV35ZttpMFh 7nM5cByDPGR/xBQHKXF38vg44u9AeL7fH+2qiJVG+PvOu5LXjdoOVRYuAevhIQ49 VfRN0PBuW8AV/4evcTkWFpiJlV2wCisXqli4IM+qPz+yV8CXsSXpoXZIrg/cyqrj diLp71kKuAOyGun/mYDxDZzXws9M= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:Message-Id:To:Subject:From:Mime-Version:Content-Type:Content-Transfer-Encoding:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ZVxbQaHDIqt7WwokfDxzIC+q5BsUkXpKqa5CsNUCOb1kVoBKkqYUB6Srdyv4KK V19T96ucu0Qyoyxru7s9bf1H2XkZ5pAK8Af+stnyRNqS57haRxwwMs1P7VjBlIGV yWEG/1BCpJnbNodjvSwqKKGT6jGCS5LUUwKvZMFCWGAKM=; Received: (qmail 5724 invoked by alias); 1 Mar 2012 04:12:10 -0000 Received: (qmail 5636 invoked by uid 22791); 1 Mar 2012 04:12:07 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mo10.iij4u.or.jp (HELO mo.iij4u.or.jp) (210.138.174.78) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Mar 2012 04:11:52 +0000 Received: by mo.iij4u.or.jp (mo10) id q214Bo6P026710; Thu, 1 Mar 2012 13:11:50 +0900 Received: from localhost (238.152.138.210.bn.2iij.net [210.138.152.238]) by mbox.iij4u.or.jp (mbox10) id q214BnpW000784; Thu, 1 Mar 2012 13:11:49 +0900 Date: Thu, 01 Mar 2012 13:11:49 +0900 (JST) Message-Id: <20120301.131149.253359368.kkojima@rr.iij4u.or.jp> To: gcc-patches@gcc.gnu.org Subject: [PATCH] [SH] Fix target/48596 From: Kaz Kojima 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, The attached patch is to avoid PR target/48596 which is a 4.7 regression on SH. It seems that now IRA aggressively tried to use fp regs as the holder for memory addresses on this port. SH requires a special fpul register to move from the fp regs to the general regs which are legitimate for pointers and, in the problematic situation, fpul is already reserved for reload and the spill failure resulted for the reg equiv processing in RA. I guess that no other targets have such restrictions. Perhaps if there eas a direct way to notify IRA that some register classes will be too costly for the addresses, SH port will utilize it, though it looks to be invasive. The patch tries to work around the problem with increasing the move cost between fp and general registers for SImode. The usual tests are done successfully on sh4-unknown-linux-gnu with no new failures. A bit surprisingly, there are no size/performance regressions and a few code size improvements with CSiBE tests I've done. I'd like to hear the suggestions from the experts before applying this work around. Regards, kaz --- PR target/48596 * config/sh/sh.c (sh_register_move_cost): Increase cost between GENERAL_REGS and FP_REGS for SImode. --- ORIG/trunk/gcc/config/sh/sh.c 2012-02-23 21:24:18.000000000 +0900 +++ trunk/gcc/config/sh/sh.c 2012-03-01 09:41:00.000000000 +0900 @@ -11497,8 +11498,15 @@ sh_register_move_cost (enum machine_mode && REGCLASS_HAS_GENERAL_REG (srcclass)) || (REGCLASS_HAS_GENERAL_REG (dstclass) && REGCLASS_HAS_FP_REG (srcclass))) - return (((TARGET_SHMEDIA ? 4 : TARGET_FMOVD ? 8 : 12) + 64) - * ((GET_MODE_SIZE (mode) + 7) / 8U)); + { + /* Discourage trying to use fp regs for a pointer. This also + discourages fp regs with SImode because Pmode is an alias + of SImode on this target. See PR target/48596. */ + int addend = (mode == Pmode) ? 40 : 0; + + return (((TARGET_SHMEDIA ? 4 : TARGET_FMOVD ? 8 : 12) + addend) + * ((GET_MODE_SIZE (mode) + 7) / 8U)); + } if ((dstclass == FPUL_REGS && REGCLASS_HAS_GENERAL_REG (srcclass))