From patchwork Sat Nov 3 11:13:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 196819 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 63DE72C00B2 for ; Sat, 3 Nov 2012 22:13:15 +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=1352545995; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Mail-Followup-To:Subject:References:Date: In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=6GH+BqRX1cyZfj80Yq1R 58vtPgc=; b=jMNcyEZP0KsQ2yclF9JlwrlWrAwguJMqL24Sk1T3/k9lEG1rsEgb PPJ+iHLF4tuMaNk58JCvbPVk4vQLVdvkmDxIBdHPdrOXboW8PVVHvImyqP1EEQPh Ocg4nIypVW2bxleIIWfOOP5B9Lnpb4AVLFin9oUKHYrJ1Ix2hNT6BQE= 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:Received:From:To:Mail-Followup-To:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=x5xrL84ZERinBkY4/BIO7Z+8nNkqHX/87TmxYrUspgZO8YgYJHzzzTpa+k1LD9 thEoVtmjRgu/ndTqkHNwEf7mCuRsQGmEd+t5zTzcbwidVF3rDlrAC26xs5g9aB0s YGAThmbicHEMlI4Uy1jvKT6GK/AJbGke/QrvyCqw5M3qc=; Received: (qmail 32615 invoked by alias); 3 Nov 2012 11:13:08 -0000 Received: (qmail 32605 invoked by uid 22791); 3 Nov 2012 11:13:08 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=AWL, BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_SPAMHAUS_DROP, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-wi0-f173.google.com (HELO mail-wi0-f173.google.com) (209.85.212.173) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 03 Nov 2012 11:13:04 +0000 Received: by mail-wi0-f173.google.com with SMTP id hm4so1548694wib.8 for ; Sat, 03 Nov 2012 04:13:03 -0700 (PDT) Received: by 10.216.207.103 with SMTP id m81mr1447802weo.190.1351941183432; Sat, 03 Nov 2012 04:13:03 -0700 (PDT) Received: from localhost ([2.26.192.222]) by mx.google.com with ESMTPS id fp6sm1949712wib.0.2012.11.03.04.13.01 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 03 Nov 2012 04:13:02 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [1/8] Handle TRUNCATE in make_extraction References: <87k3u3eybu.fsf@talisman.home> Date: Sat, 03 Nov 2012 11:13:07 +0000 In-Reply-To: <87k3u3eybu.fsf@talisman.home> (Richard Sandiford's message of "Sat, 03 Nov 2012 11:10:45 +0000") Message-ID: <87fw4rey7w.fsf@talisman.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 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 combine.c:make_extraction peels off truncating lowpart subregs from the structure operand. On !TRULY_NOOP_TRUNCATION targets, truncations are represented as TRUNCATE instead, so this patch handles them too. As for why this patch is suddenly needed now: at the moment, we start out with INNER being the original (truncate:SI (foo:DI)) expression, but after having looked at the insv/ext(z)v pattern, we decide that we want INNER to be word_mode (DImode) instead. The truncation then gets stripped by the force_to_mode call. However, with optabs, an SImode INNER would cause us to use an SImode operation instead. That isn't what we want, because the explicit TRUNCATE is there precisely because the DImode value needs to be modified by active instructions before being acceptable in an SImode operation. Tested as described in the covering note. OK to install? Richard gcc/ * combine.c (make_extraction): Handle TRUNCATEd INNERs. Index: gcc/combine.c =================================================================== --- gcc/combine.c 2012-11-02 08:15:57.000000000 +0000 +++ gcc/combine.c 2012-11-02 08:22:07.702369220 +0000 @@ -7022,6 +7022,8 @@ make_extraction (enum machine_mode mode, if (new_rtx != 0) return gen_rtx_ASHIFT (mode, new_rtx, XEXP (inner, 1)); } + else if (GET_CODE (inner) == TRUNCATE) + inner = XEXP (inner, 0); inner_mode = GET_MODE (inner);