From patchwork Thu Sep 18 10:13:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 390737 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 7B0B91401F1 for ; Thu, 18 Sep 2014 20:13:22 +1000 (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:subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=MIS q9ZiKKSz06IS0bioN3Qw27rRtQm7XrlpQG7Niy2FTnLSZ/t/W8adHt5NDz0kWW16 hb93babDw+RHOPYJuWsdi72uK7sUuW7WF9GSAG+r7RsDIAwOLRNLjEFB3t8mA3BA VvFfcU7/ILOMz9WOg3FGYpd1jnrsW1hABO8Sa7Ys= 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:subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=s2zCItBKi vUOBRg37dsBQ04OutU=; b=CQryt/ORu+VRNmSNH3YP0ue8ETEPM4N6EhoMo6US9 N5GB5kbhCUzfxC390TiafrLE8kp0a2a2OS/+9aJK/ImLo9Dn18aSdpxNmnk84g+Y NGlEDsdtHnZsjn+z15jN+0tLTJKKOO2JIOGl883GfdxJdrlUKfAtaf/R4/L7DvJh gg= Received: (qmail 17114 invoked by alias); 18 Sep 2014 10:13:15 -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 17100 invoked by uid 89); 18 Sep 2014 10:13:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, 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, 18 Sep 2014 10:13:13 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 18 Sep 2014 11:13:10 +0100 Received: from localhost ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Sep 2014 11:13:10 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH 3/5] Use simplify_subreg_regno in combine.c:subst References: <87ppetnsxd.fsf@e105548-lin.cambridge.arm.com> Date: Thu, 18 Sep 2014 11:13:09 +0100 In-Reply-To: <87ppetnsxd.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Thu, 18 Sep 2014 11:07:10 +0100") Message-ID: <87d2atnsne.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: 114091811131020501 combine.c:subst should refuse to substitute a hard register into a subreg if the new subreg would not be simplified to a simple hard register, since the result would have to be reloaded. This is more for optimisation than correctness, since in theory the RA should be able to fix up any unsimplified subregs. gcc/ * combine.c (subst): Use simplify_subreg_regno rather than REG_CANNOT_CHANGE_MODE_P to detect invalid mode changes. Index: gcc/combine.c =================================================================== --- gcc/combine.c 2014-09-15 10:00:17.545330404 +0100 +++ gcc/combine.c 2014-09-15 10:00:17.545330404 +0100 @@ -5121,15 +5121,13 @@ #define COMBINE_RTX_EQUAL_P(X,Y) \ ) return gen_rtx_CLOBBER (VOIDmode, const0_rtx); -#ifdef CANNOT_CHANGE_MODE_CLASS if (code == SUBREG && REG_P (to) && REGNO (to) < FIRST_PSEUDO_REGISTER - && REG_CANNOT_CHANGE_MODE_P (REGNO (to), - GET_MODE (to), - GET_MODE (x))) + && simplify_subreg_regno (REGNO (to), GET_MODE (to), + SUBREG_BYTE (x), + GET_MODE (x)) < 0) return gen_rtx_CLOBBER (VOIDmode, const0_rtx); -#endif new_rtx = (unique_copy && n_occurrences ? copy_rtx (to) : to); n_occurrences++;