From patchwork Wed Jul 20 21:49:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 105847 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 3A7FFB6F74 for ; Thu, 21 Jul 2011 07:50:18 +1000 (EST) Received: (qmail 12580 invoked by alias); 20 Jul 2011 21:50:16 -0000 Received: (qmail 12567 invoked by uid 22791); 20 Jul 2011 21:50:15 -0000 X-SWARE-Spam-Status: No, hits=-2.2 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-pz0-f49.google.com (HELO mail-pz0-f49.google.com) (209.85.210.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Jul 2011 21:50:01 +0000 Received: by pzk33 with SMTP id 33so1055751pzk.36 for ; Wed, 20 Jul 2011 14:50:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.80.3 with SMTP id d3mr1243823wfb.363.1311198598802; Wed, 20 Jul 2011 14:49:58 -0700 (PDT) Received: by 10.142.89.19 with HTTP; Wed, 20 Jul 2011 14:49:58 -0700 (PDT) In-Reply-To: References: <201107202004.24004.ebotcazou@adacore.com> Date: Wed, 20 Jul 2011 23:49:58 +0200 Message-ID: Subject: Re: [RFC PATCH, i386]: Allow SUBREG_PROMOTED_UNSIGNED_P subregs in address From: Uros Bizjak To: Eric Botcazou Cc: gcc-patches@gcc.gnu.org, Jakub Jelinek , Richard Henderson , "H.J. Lu" 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, Jul 20, 2011 at 9:46 PM, Uros Bizjak wrote: > I have looked at example in rs6000.c, the only target that uses > SUBREG_PROMOTED_UNSIGNED_P. Looking at other sources, S_P_U_P is used > in conjunction with SUBREG_PROMOTED_VAR. It looks to me that using the > combination should be OK to determine if subreg is correct. Attached patch adds paradoxical subreg handling. Patch is diffed vs. current mainline. H.J., does it work for x32 branch? Does it make any difference? (BTW: You will need [1] from the trunk). [1] http://gcc.gnu.org/ml/gcc-patches/2011-07/msg01693.html Uros. Index: i386.c =================================================================== --- i386.c (revision 176536) +++ i386.c (working copy) @@ -11089,8 +11089,11 @@ ix86_decompose_address (rtx addr, struct base = addr; else if (GET_CODE (addr) == SUBREG) { - /* Allow only subregs of DImode hard regs. */ - if (register_no_elim_operand (SUBREG_REG (addr), DImode)) + /* Allow only promoted paradoxical subregs + or subregs of DImode hard regs. */ + if ((SUBREG_PROMOTED_VAR_P (addr) + && SUBREG_PROMOTED_UNSIGNED_P (addr) > 0) + || register_no_elim_operand (SUBREG_REG (addr), DImode)) base = addr; else return 0; @@ -11148,8 +11151,11 @@ ix86_decompose_address (rtx addr, struct break; case SUBREG: - /* Allow only subregs of DImode hard regs in PLUS chains. */ - if (!register_no_elim_operand (SUBREG_REG (op), DImode)) + /* Allow only promoted paradoxical subregs + or subregs of DImode hard regs in PLUS chains. */ + if (!((SUBREG_PROMOTED_VAR_P (op) + && SUBREG_PROMOTED_UNSIGNED_P (op) > 0) + || register_no_elim_operand (SUBREG_REG (op), DImode))) return 0; /* FALLTHRU */ @@ -11201,9 +11207,12 @@ ix86_decompose_address (rtx addr, struct { if (REG_P (index)) ; - /* Allow only subregs of DImode hard regs. */ + /* Allow only promoted paradoxical subregs + or subregs of DImode hard regs. */ else if (GET_CODE (index) == SUBREG - && !register_no_elim_operand (SUBREG_REG (index), DImode)) + && !((SUBREG_PROMOTED_VAR_P (index) + && SUBREG_PROMOTED_UNSIGNED_P (index) > 0) + || register_no_elim_operand (SUBREG_REG (index), DImode))) return 0; } @@ -11650,7 +11659,9 @@ ix86_legitimate_address_p (enum machine_ else if (GET_CODE (base) == SUBREG && REG_P (SUBREG_REG (base))) { reg = SUBREG_REG (base); - gcc_assert (register_no_elim_operand (reg, DImode)); + gcc_assert ((SUBREG_PROMOTED_VAR_P (base) + && SUBREG_PROMOTED_UNSIGNED_P (base) > 0) + || register_no_elim_operand (reg, DImode)); } else /* Base is not a register. */ @@ -11675,7 +11686,9 @@ ix86_legitimate_address_p (enum machine_ else if (GET_CODE (index) == SUBREG && REG_P (SUBREG_REG (index))) { reg = SUBREG_REG (index); - gcc_assert (register_no_elim_operand (reg, DImode)); + gcc_assert ((SUBREG_PROMOTED_VAR_P (index) + && SUBREG_PROMOTED_UNSIGNED_P (index) > 0) + || register_no_elim_operand (reg, DImode)); } else /* Index is not a register. */