From patchwork Tue Mar 13 20:15:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 146477 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 5AF58B6EE7 for ; Wed, 14 Mar 2012 07:15:34 +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=1332274535; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=Pow2PHZ+XrAthSyHVjBwOXww1Oo=; b=d1ZEtKjzsHtEVsO 39XruCKvVBZK5h95fLFMnvGpvRblGvHAagvrpoH8oDPWMtXWornBAZulsqHgmcd1 k15IoLKYrwrKTOYf6/Haj+qSQlR/jWq0XDuAiqC+vxhGAGQHqwmh1bE7sdYp2u6+ C/syNx1OLnQ2fUkWzQFbf8zTWUHg= 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:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=pEqpzWXSqc+MeiEnPL7dyXNHZ+JDIl6XanUXU0208l9O5b+GrXTnr6tB3iMlXW YfTjxUmTkB4N5vzUvwAaL8jmFEKAGE8HMugcdPfZGgBF/hyLe6oAiE8JWauzQKl9 s+H8frgg6t6tKL73/+0X/ycLX/zkM9ja5e7yiyJ/oCQfY=; Received: (qmail 16921 invoked by alias); 13 Mar 2012 20:15:30 -0000 Received: (qmail 16907 invoked by uid 22791); 13 Mar 2012 20:15:28 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Mar 2012 20:15:15 +0000 Received: by yenm3 with SMTP id m3so1051721yen.20 for ; Tue, 13 Mar 2012 13:15:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.116.73 with SMTP id f49mr18165892yhh.97.1331669714885; Tue, 13 Mar 2012 13:15:14 -0700 (PDT) Received: by 10.146.241.18 with HTTP; Tue, 13 Mar 2012 13:15:14 -0700 (PDT) In-Reply-To: References: Date: Tue, 13 Mar 2012 21:15:14 +0100 Message-ID: Subject: Re: [PATCH, i386]: Handle subregs of AND zero extended address correctly From: Uros Bizjak To: "H.J. Lu" Cc: gcc-patches@gcc.gnu.org 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 Tue, Mar 13, 2012 at 9:09 PM, Uros Bizjak wrote: > On Tue, Mar 13, 2012 at 9:01 PM, H.J. Lu wrote: >> On Tue, Mar 13, 2012 at 9:21 AM, Uros Bizjak wrote: >>> Hello! >>> >>> We allow addresses, zero extended with (AND (Dimode OP) >>> (0x0ffffffff)). Since we now track address mode precisely, we should >>> convert this operand to a SImode subreg before passing it further down >>> of ix86_decompose_address function. This fixes a small hole, where >>> operands in wrong mode could squeeze through. >>> >>> 2012-03-13  Uros Bizjak   >>> >>>        * config/i386/i386.c (ix86_decompose_address): Handle subregs of >>>        AND zero extended address correctly. >>> >>> Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN. >> >> I think this caused: >> >> FAIL: gcc.target/i386/pr43766.c scan-assembler-not lea[lq]?[ \t] > > Ah, we also need to consider: > > Failed to match this instruction: > (prefetch (and:DI (subreg:DI (plus:SI (ashift:SI (reg/v:SI 63 [ i ]) >                    (const_int 2 [0x2])) >                (subreg:SI (reg/v/f:DI 62 [ a ]) 0)) 0) >        (const_int 4294967295 [0xffffffff])) >    (const_int 0 [0]) >    (const_int 3 [0x3])) Fixed by attached patch. Committed. Uros. Index: i386.c =================================================================== --- i386.c (revision 185351) +++ i386.c (working copy) @@ -11436,11 +11436,11 @@ addr = XEXP (addr, 0); /* Adjust SUBREGs. */ - if (GET_MODE (addr) == DImode) + if (GET_CODE (addr) == SUBREG + && GET_MODE (SUBREG_REG (addr)) == SImode) + addr = SUBREG_REG (addr); + else if (GET_MODE (addr) == DImode) addr = gen_rtx_SUBREG (SImode, addr, 0); - else if (GET_CODE (addr) == SUBREG - && GET_MODE (SUBREG_REG (addr)) == SImode) - addr = SUBREG_REG (addr); else return 0; }