From patchwork Tue Jan 25 04:08:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 80309 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 5A154B713B for ; Tue, 25 Jan 2011 15:08:52 +1100 (EST) Received: (qmail 31941 invoked by alias); 25 Jan 2011 04:08:49 -0000 Received: (qmail 31890 invoked by uid 22791); 25 Jan 2011 04:08:47 -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_FW X-Spam-Check-By: sourceware.org Received: from mail-qw0-f47.google.com (HELO mail-qw0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Jan 2011 04:08:41 +0000 Received: by qwi2 with SMTP id 2so4774620qwi.20 for ; Mon, 24 Jan 2011 20:08:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.224.37.82 with SMTP id w18mr4969611qad.142.1295928518970; Mon, 24 Jan 2011 20:08:38 -0800 (PST) Received: by 10.220.184.2 with HTTP; Mon, 24 Jan 2011 20:08:38 -0800 (PST) In-Reply-To: <4D3E497C.9040302@gnu.org> References: <20110125021652.GA21397@intel.com> <4D3E3D2B.6090708@gnu.org> <4D3E497C.9040302@gnu.org> Date: Mon, 24 Jan 2011 20:08:38 -0800 Message-ID: Subject: =?windows-1252?Q?Re=3A_PATCH=3A_PR_middle=2Dend=2F47449=3A_=5Bx32=5D_can=92t_find_a?= =?windows-1252?Q?_register_in_class_=91DIREG=92_while_reloading_=91asm=92?= From: "H.J. Lu" To: Paolo Bonzini Cc: gcc-patches@gcc.gnu.org, Alan Modra 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 Mon, Jan 24, 2011 at 7:54 PM, Paolo Bonzini wrote: > On 01/25/2011 04:50 AM, H.J. Lu wrote: >> >>   /* If this is a paradoxical SUBREG...  */ >>   if (GET_MODE_SIZE (use_mode) >>       >  GET_MODE_SIZE (GET_MODE (SUBREG_REG (use_reg)))) >>     { >>       /* If this is a paradoxical SUBREG, we have no idea what value the >>          extra bits would have.  However, if the operand is equivalent to >>          a SUBREG whose operand is the same as our mode, and all the modes >>          are within a word, we can just use the inner operand because >>          these SUBREGs just say how to treat the register.  */ >>       use_insn = DF_REF_INSN (use); >>       src = SET_SRC (def_set); >>       if (GET_CODE (src) == SUBREG >>           &&  REG_P (SUBREG_REG (src)) >>           &&  GET_MODE (SUBREG_REG (src)) == use_mode >>           &&  subreg_lowpart_p (src) >>           &&  all_uses_available_at (def_insn, use_insn)) >>         return try_fwprop_subst (use, DF_REF_LOC (use), SUBREG_REG (src), >>                                  def_insn, false); >>     } >> >> Should it check hard registers? > > Yes. Here is a new patch. OK for trunk and 4.5? Thanks. diff --git a/gcc/fwprop.c b/gcc/fwprop.c index 7ff5135..67ef93c 100644 --- a/gcc/fwprop.c +++ b/gcc/fwprop.c @@ -1101,6 +1101,7 @@ forward_propagate_subreg (df_ref use, rtx def_insn, rtx def_set) src = SET_SRC (def_set); if (GET_CODE (src) == SUBREG && REG_P (SUBREG_REG (src)) + && REGNO (SUBREG_REG (src)) >= FIRST_PSEUDO_REGISTER && GET_MODE (SUBREG_REG (src)) == use_mode && subreg_lowpart_p (src) && all_uses_available_at (def_insn, use_insn)) @@ -1119,6 +1120,7 @@ forward_propagate_subreg (df_ref use, rtx def_insn, rtx def_set) if ((GET_CODE (src) == ZERO_EXTEND || GET_CODE (src) == SIGN_EXTEND) && REG_P (XEXP (src, 0)) + && REGNO (XEXP (src, 0)) >= FIRST_PSEUDO_REGISTER && GET_MODE (XEXP (src, 0)) == use_mode && !free_load_extend (src, def_insn) && all_uses_available_at (def_insn, use_insn)) diff --git a/gcc/testsuite/gcc.target/i386/pr47449.c b/gcc/testsuite/gcc.target/i386/pr47449.c new file mode 100644 index 0000000..99ef32f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr47449.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void bar (void *, void *); +int +foo (void *p1, void *p2) +{ + int ret1, ret2; + __asm ("" : "=D" (ret1), "=S" (ret2)); + bar (p1, p2); + return ret1 + ret2; +}