From patchwork Wed Feb 27 21:21:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 223707 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 600292C03B6 for ; Thu, 28 Feb 2013 08:22:54 +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=1362604975; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:In-Reply-To:References:From:Date: Message-ID:Subject:To:Cc:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=7vAB9hlNjnG91sQYNoaERiwZDv8=; b=LxM6Z/QIejvYRKV U1myzpLDsGSsVR1Y95f5CPJYiJJFhysN6B4FI/M/pEjP5hZLlKPFV1xNR524HfvZ axyvydahSPq/DHEm4tkCsiQYTYCF9mXbB7MDCSt+gM6fd09jJUPUjpGascAzlF5y KANGqW1yKtBEESiUe1UmcvR3vg+A= 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:X-Received:MIME-Version:Received:In-Reply-To:References:From:Date:Message-ID:Subject:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=esgUHcwciLpvrZnMIdQrkefz3qBz0dbOXAmGVxj07gL9I3gXqzb8DE5D/pr9cK A3Hbu/vW1qXlhZSgiPdcVDVlWsIxqh7cUmR6SKqtdpDotetNIXes2ikchimJ1VqY LxdgH04HlVKK2diIeAvUssToYX7fOCh4faGS0ipflD9w0=; Received: (qmail 17208 invoked by alias); 27 Feb 2013 21:22:40 -0000 Received: (qmail 17199 invoked by uid 22791); 27 Feb 2013 21:22:39 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_FW X-Spam-Check-By: sourceware.org Received: from mail-ia0-f182.google.com (HELO mail-ia0-f182.google.com) (209.85.210.182) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Feb 2013 21:22:34 +0000 Received: by mail-ia0-f182.google.com with SMTP id k38so890955iah.41 for ; Wed, 27 Feb 2013 13:22:33 -0800 (PST) X-Received: by 10.50.196.165 with SMTP id in5mr8116229igc.99.1362000153850; Wed, 27 Feb 2013 13:22:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.70.68 with HTTP; Wed, 27 Feb 2013 13:21:53 -0800 (PST) In-Reply-To: References: From: Steven Bosscher Date: Wed, 27 Feb 2013 22:21:53 +0100 Message-ID: Subject: Re: extend fwprop optimization To: Wei Mi Cc: GCC Patches , David Li , Uros Bizjak 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 On Wed, Feb 27, 2013 at 7:37 PM, Wei Mi wrote: > What do you think? I think you'll not be able to teach fold_rtx to perform the transformation you want it to do without having SHIFT_COUNT_TRUNCATED set for i386. I already tried it the other day, but GCC won't do the truncation without knowing the insn is really a shift insn and shift_truncation_mask returns something useful. Ciao! Steven Index: cse.c =================================================================== --- cse.c (revision 196182) +++ cse.c (working copy) @@ -3179,9 +3179,22 @@ fold_rtx (rtx x, rtx insn) switch (GET_CODE (folded_arg)) { + case SUBREG: + /* If the SUBREG_REG comes in from an AND, and this is not a + paradoxical subreg, then try to fold the SUBREG. */ + if (REG_P (SUBREG_REG (folded_arg)) + && ! paradoxical_subreg_p (folded_arg)) + { + rtx y = lookup_as_function (SUBREG_REG (folded_arg), AND); + if (y != 0) + y = simplify_gen_binary(AND, GET_MODE (folded_arg), + XEXP(y, 0), XEXP(y, 1)); + if (y != 0) + folded_arg = y; + } + /* ... fall through ... */ case MEM: case REG: - case SUBREG: const_arg = equiv_constant (folded_arg); break;