From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20966 invoked by alias); 21 Jul 2011 23:28:33 -0000 Received: (qmail 20956 invoked by uid 22791); 21 Jul 2011 23:28:32 -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_FN X-Spam-Check-By: sourceware.org Received: from mail-fx0-f49.google.com (HELO mail-fx0-f49.google.com) (209.85.161.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jul 2011 23:28:14 +0000 Received: by fxd20 with SMTP id 20so3279348fxd.22 for ; Thu, 21 Jul 2011 16:28:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.135.18 with SMTP id l18mr233867bkt.191.1311290892605; Thu, 21 Jul 2011 16:28:12 -0700 (PDT) Received: by 10.204.41.6 with HTTP; Thu, 21 Jul 2011 16:28:12 -0700 (PDT) In-Reply-To: <4E28A291.5080700@redhat.com> References: <20110709212846.GA3563@intel.com> <4E1A1D43.3010106@redhat.com> <4E1A4864.2030702@redhat.com> <4E1DB962.6010808@redhat.com> <4E1DBBC9.4030305@redhat.com> <4E28A291.5080700@redhat.com> Date: Fri, 22 Jul 2011 00:10:00 -0000 Message-ID: Subject: Re: PATCH [3/n] X32: Promote pointers to Pmode From: "H.J. Lu" To: Richard Henderson Cc: Uros Bizjak , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg01901.txt.bz2 On Thu, Jul 21, 2011 at 3:05 PM, Richard Henderson wrote: > On 07/21/2011 03:02 PM, H.J. Lu wrote: >> =A0 =A0 =A0 * config/i386/i386.c (function_value_64): Always return poin= ters >> =A0 =A0 =A0 in Pmode. >> =A0 =A0 =A0 (ix86_promote_function_mode): New. >> =A0 =A0 =A0 (TARGET_PROMOTE_FUNCTION_MODE): Likewise. > > Much better, thanks. > > > r~ > Also need this patch. Otherwise, I got FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2a.c (internal compiler e= rror) FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2a.c (test for excess err= ors) FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2b.c (internal compiler e= rror) FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2b.c (test for excess err= ors) OK for trunk? Thanks. --=20 H.J. -- 2011-07-21 H.J. Lu * config/i386/i386.c (function_value_ms_64): Take a new argument. Always return pointers in Pmode. (ix86_function_value_1): Updated. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b603f4e..9bc2eef 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -7097,11 +7097,17 @@ function_value_64 (enum machine_mode orig_mode, enum machine_mode mode, } static rtx -function_value_ms_64 (enum machine_mode orig_mode, enum machine_mode mode) +function_value_ms_64 (enum machine_mode orig_mode, enum machine_mode mode, + const_tree valtype) { unsigned int regno =3D AX_REG; - if (TARGET_SSE) + if (valtype && POINTER_TYPE_P (valtype)) + { + /* Pointers are always returned in Pmode. */ + orig_mode =3D Pmode; + } + else if (TARGET_SSE) { switch (GET_MODE_SIZE (mode)) { @@ -7134,7 +7140,7 @@ ix86_function_value_1 (const_tree valtype, const_tree fntype_or_decl, fntype =3D fn ? TREE_TYPE (fn) : fntype_or_decl; if (TARGET_64BIT && ix86_function_type_abi (fntype) =3D=3D MS_ABI) - return function_value_ms_64 (orig_mode, mode); + return function_value_ms_64 (orig_mode, mode, valtype); else if (TARGET_64BIT) return function_value_64 (orig_mode, mode, valtype); else