From patchwork Sat Apr 2 05:34:18 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: 89426 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 5F98EB6F8E for ; Sat, 2 Apr 2011 16:34:33 +1100 (EST) Received: (qmail 6017 invoked by alias); 2 Apr 2011 05:34:30 -0000 Received: (qmail 5859 invoked by uid 22791); 2 Apr 2011 05:34: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, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pz0-f47.google.com (HELO mail-pz0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 02 Apr 2011 05:34:18 +0000 Received: by pzk35 with SMTP id 35so1408592pzk.20 for ; Fri, 01 Apr 2011 22:34:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.21.42 with SMTP id y42mr3963634wfi.294.1301722458049; Fri, 01 Apr 2011 22:34:18 -0700 (PDT) Received: by 10.68.48.232 with HTTP; Fri, 1 Apr 2011 22:34:18 -0700 (PDT) In-Reply-To: References: <20110312155735.GA4668@intel.com> Date: Fri, 1 Apr 2011 22:34:18 -0700 Message-ID: Subject: Re: PATCH: copy_addr_to_reg: Convert to Pmode if needed From: "H.J. Lu" To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org 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, Mar 21, 2011 at 9:05 AM, Richard Sandiford wrote: > "H.J. Lu" writes: >> diff --git a/gcc/explow.c b/gcc/explow.c >> index 460af1f..9b3c082 100644 >> --- a/gcc/explow.c >> +++ b/gcc/explow.c >> @@ -611,6 +611,8 @@ copy_to_reg (rtx x) >>  rtx >>  copy_addr_to_reg (rtx x) >>  { >> +  if (GET_MODE (x) != VOIDmode && GET_MODE (x) != Pmode) >> +    x = convert_to_mode (Pmode, x, 1); >>    return copy_to_mode_reg (Pmode, x); >>  } > > I think you need to say why the conversion should be done here > rather than in the caller. > > Regardless of that, though: I think this should be convert_memory_address > rather than convert_to_mode.  Paasing 1 is wrong, because pointers are > signed on some targets. > > Richard > I checked in this patch instead. diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32 index 86e4425..fa9d384 100644 --- a/gcc/ChangeLog.x32 +++ b/gcc/ChangeLog.x32 @@ -1,6 +1,12 @@ 2011-03-21 H.J. Lu PR target/48084 + * config/i386/i386.c (ix86_expand_builtin): Call + convert_memory_address. + +2011-03-21 H.J. Lu + + PR target/48084 * explow.c (copy_addr_to_reg): Don't convert to Pmode here. 2011-03-17 H.J. Lu diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 73ce73a..4ac335f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -27790,7 +27790,10 @@ rdrand_step: arg0 = CALL_EXPR_ARG (exp, 0); op1 = expand_normal (arg0); if (!address_operand (op1, VOIDmode)) - op1 = copy_addr_to_reg (op1); + { + op1 = convert_memory_address (Pmode, op1); + op1 = copy_addr_to_reg (op1); + } emit_move_insn (gen_rtx_MEM (mode0, op1), op0); return target;