From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10172 invoked by alias); 19 Jan 2018 08:44:33 -0000 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 Received: (qmail 130024 invoked by uid 89); 19 Jan 2018 08:42:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 19 Jan 2018 08:42:18 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1ecSFc-0001Wi-3o from Tom_deVries@mentor.com for gcc-patches@gcc.gnu.org; Fri, 19 Jan 2018 00:42:16 -0800 Received: from [172.30.72.194] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 19 Jan 2018 08:42:12 +0000 Subject: Re: [PATCH,PTX] Add support for CUDA 9 To: Cesar Philippidis CC: "gcc-patches@gcc.gnu.org" References: <002bf03f-baad-5809-6e9a-2fdffa0c1e2c@codesourcery.com> <6fd03d69-e18f-fb3d-f7c3-f833c8ba5ff7@codesourcery.com> From: Tom de Vries Message-ID: Date: Fri, 19 Jan 2018 08:46:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <6fd03d69-e18f-fb3d-f7c3-f833c8ba5ff7@codesourcery.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) X-SW-Source: 2018-01/txt/msg01709.txt.bz2 On 01/19/2018 01:59 AM, Cesar Philippidis wrote: > Here's the updated patch with the changes that you requested. There are > no new regressions in trunk. I tested it on my desktop running driver > 387.34 on a Pascal GPU. > > Is this OK for trunk? OK with 'PR target/83790' added to the changelog entry. Thanks, - Tom > > trunk-cuda9.diff > > > 2018-01-18 Cesar Philippidis > > gcc/ > * config/nvptx/nvptx.c (output_init_frag): Don't use generic address > spaces for function labels. > > gcc/testsuite/ > * gcc.target/nvptx/indirect_call.c: New test. > > diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c > index 86fc13f4fc0..4cb87c8ad07 100644 > --- a/gcc/config/nvptx/nvptx.c > +++ b/gcc/config/nvptx/nvptx.c > @@ -1899,9 +1899,15 @@ output_init_frag (rtx sym) > > if (sym) > { > - fprintf (asm_out_file, "generic("); > + bool function = (SYMBOL_REF_DECL (sym) > + && (TREE_CODE (SYMBOL_REF_DECL (sym)) == FUNCTION_DECL)); > + if (!function) > + fprintf (asm_out_file, "generic("); > output_address (VOIDmode, sym); > - fprintf (asm_out_file, val ? ") + " : ")"); > + if (!function) > + fprintf (asm_out_file, ")"); > + if (val) > + fprintf (asm_out_file, " + "); > } > > if (!sym || val) > diff --git a/gcc/testsuite/gcc.target/nvptx/indirect_call.c b/gcc/testsuite/gcc.target/nvptx/indirect_call.c > new file mode 100644 > index 00000000000..39992a7137b > --- /dev/null > +++ b/gcc/testsuite/gcc.target/nvptx/indirect_call.c > @@ -0,0 +1,19 @@ > +/* { dg-options "-O2 -msoft-stack" } */ > +/* { dg-do run } */ > + > +int > +f1 (int a) > +{ > + return a + 1; > +} > + > +int (*f2)(int) = f1; > + > +int > +main () > +{ > + if (f2 (100) != 101) > + __builtin_abort(); > + > + return 0; > +} >