From patchwork Thu May 31 20:55:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 162231 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 48F0BB6FC3 for ; Fri, 1 Jun 2012 06:56:25 +1000 (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=1339102586; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Subject:From:To:Date:Content-Type:Mime-Version: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=P8xQ+9B7N8mAyloxNFMG 1B5b560=; b=S4k196RUUUYgKN4LdVcl6ZXqhzCqnN9JfeQrXgrkp+00HFAMJncJ AtXXuHpNyuMLPofrw7jUnQeYwPaseMvqJJmaakflR6udawWbmdJWt9iEohgdL3E7 2hhvFlSPfoOdvvmycoFF65c2ZlCH4vR1/7y+S4naJRUUuXg5trPYSPs= 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:Message-ID:Subject:From:To:Date:Content-Type:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=VjMlO9Yl+DTgIu8/sGaJdqMXUpsFmCvjKwFAgB/wNktsEiA5s9gmvtnWpDXXtn vFIbGf3OGyjdB5s+h2ioCsDmk3ZGstPMVTtdMijIBX2J8qsWWqCDGxsZgR+0FPm3 LK/Kh/ptjk7iHW26snZbSigxVg4b+O2bCpgB5brvCHyK4=; Received: (qmail 28233 invoked by alias); 31 May 2012 20:56:21 -0000 Received: (qmail 28185 invoked by uid 22791); 31 May 2012 20:56:21 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout07.t-online.de (HELO mailout07.t-online.de) (194.25.134.83) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 31 May 2012 20:56:06 +0000 Received: from fwd00.aul.t-online.de (fwd00.aul.t-online.de ) by mailout07.t-online.de with smtp id 1SaCPd-0007Al-1n; Thu, 31 May 2012 22:56:05 +0200 Received: from [192.168.0.104] (VsYSa4ZHYhD0AHNoKpo4FPlzcRNj4iuA1l99gDAxGaAKsq6ATEsgEV65C5IqhGawui@[87.157.62.42]) by fwd00.t-online.de with esmtp id 1SaCPO-0NQBHM0; Thu, 31 May 2012 22:55:50 +0200 Message-ID: <1338497749.2146.5.camel@yam-132-YW-E178-FTW> Subject: [SH, 4.7] Backport Fix sh64-elf build failure [1/3] From: Oleg Endo To: gcc-patches Date: Thu, 31 May 2012 22:55:49 +0200 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 Original patch: http://gcc.gnu.org/ml/gcc-patches/2012-03/msg00208.html 'Tested' with.. ../gcc-4_7-branch/configure --target=sh-elf --prefix=/usr/local --enable-languages=c,c++ --enable-multilib --disable-libssp --disable-nls --disable-werror --enable-lto --with-newlib --with-gnu-as --with-gnu-ld --with-system-zlib make all OK for 4.7 branch? ChangeLog: Backport from mainline 2012-03-03 Kaz Kojima * config/sh/sh.c (shiftcosts): Return MAX_COST when the first operand is CONST_INT. Take COSTS_N_INSNS into account. (sh_rtx_costs): Don't apply COSTS_N_INSNS to the return value of shiftcosts. Index: gcc/config/sh/sh.c =================================================================== --- gcc/config/sh/sh.c (revision 188026) +++ gcc/config/sh/sh.c (working copy) @@ -2811,22 +2811,26 @@ { int value; + /* There is no pattern for constant first operand. */ + if (CONST_INT_P (XEXP (x, 0))) + return MAX_COST; + if (TARGET_SHMEDIA) - return 1; + return COSTS_N_INSNS (1); if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD) { if (GET_MODE (x) == DImode && CONST_INT_P (XEXP (x, 1)) && INTVAL (XEXP (x, 1)) == 1) - return 2; + return COSTS_N_INSNS (2); /* Everything else is invalid, because there is no pattern for it. */ return MAX_COST; } /* If shift by a non constant, then this will be expensive. */ if (!CONST_INT_P (XEXP (x, 1))) - return SH_DYNAMIC_SHIFT_COST; + return COSTS_N_INSNS (SH_DYNAMIC_SHIFT_COST); /* Otherwise, return the true cost in instructions. Cope with out of range shift counts more or less arbitrarily. */ @@ -2838,10 +2842,10 @@ /* If SH3, then we put the constant in a reg and use shad. */ if (cost > 1 + SH_DYNAMIC_SHIFT_COST) cost = 1 + SH_DYNAMIC_SHIFT_COST; - return cost; + return COSTS_N_INSNS (cost); } else - return shift_insns[value]; + return COSTS_N_INSNS (shift_insns[value]); } /* Return the cost of an AND/XOR/IOR operation. */ @@ -3074,7 +3078,7 @@ case ASHIFT: case ASHIFTRT: case LSHIFTRT: - *total = COSTS_N_INSNS (shiftcosts (x)); + *total = shiftcosts (x); return true; case DIV: