From patchwork Sat Mar 12 15:57:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 86524 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 A3ACBB6F11 for ; Sun, 13 Mar 2011 02:57:46 +1100 (EST) Received: (qmail 9294 invoked by alias); 12 Mar 2011 15:57:43 -0000 Received: (qmail 9285 invoked by uid 22791); 12 Mar 2011 15:57:42 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL, BAYES_00, NO_DNS_FOR_FROM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga14.intel.com (HELO mga14.intel.com) (143.182.124.37) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 12 Mar 2011 15:57:38 +0000 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 12 Mar 2011 07:57:36 -0800 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by azsmga001.ch.intel.com with ESMTP; 12 Mar 2011 07:57:36 -0800 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id 0FDFF180DDE; Sat, 12 Mar 2011 07:57:36 -0800 (PST) Date: Sat, 12 Mar 2011 07:57:36 -0800 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Subject: PATCH: copy_addr_to_reg: Convert to Pmode if needed Message-ID: <20110312155735.GA4668@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi, copy_addr_to_reg doesn't check of mode is valid before copy it to Pmode. This patch converts to Pmode if needed. OK for 4.7? Thanks. H.J. diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32 index b85956c..3405300 100644 --- a/gcc/ChangeLog.x32 +++ b/gcc/ChangeLog.x32 @@ -1,5 +1,10 @@ 2011-03-12 H.J. Lu + PR target/48084 + * explow.c (copy_addr_to_reg): Convert to Pmode if needed. + +2011-03-12 H.J. Lu + * config/i386/i386.md (*tls_global_dynamic_64): Don't generate byte 0x66 before lea for TARGET_X32. 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); } diff --git a/gcc/testsuite/ChangeLog.x32 b/gcc/testsuite/ChangeLog.x32 index 06ba94e..3b7be1d 100644 --- a/gcc/testsuite/ChangeLog.x32 +++ b/gcc/testsuite/ChangeLog.x32 @@ -1,3 +1,8 @@ +2011-03-12 H.J. Lu + + PR target/48084 + * gcc.target/i386/pr48084-5.c: New. + 2011-03-11 H.J. Lu PR target/48084 diff --git a/gcc/testsuite/gcc.target/i386/pr48084-5.c b/gcc/testsuite/gcc.target/i386/pr48084-5.c new file mode 100644 index 0000000..d6ed8e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr48084-5.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -mrdrnd" } */ + +int +_rdrand16_step (unsigned short *__P) +{ + return __builtin_ia32_rdrand16_step (__P); +}