From patchwork Fri Jan 20 20:26:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 63487 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C137E3858416 for ; Fri, 20 Jan 2023 20:27:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 7C46D3858D33 for ; Fri, 20 Jan 2023 20:26:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7C46D3858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.97,233,1669104000"; d="scan'208,223";a="95183208" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 20 Jan 2023 12:26:50 -0800 IronPort-SDR: mvlH3I+qX5rcFGh/vfcR3q3v7/B9LAm9tBGDumaBPwJ8dHpq7AKHcNSSMyj+kYOaow8FYE4lDw 5PO1HOc3fRYeLclSozAbOuYj5HSMOCBn2JfyATQGKjFl4q1WfMR7m18kva/xGwvrd3eMJJnDha Xe7i/+gLTLIfK078EUKhceIA73NCfV78PMY8sqVvuNGOQN7M5ENjbNURHvtT2Pz1MsUw7UGGLt Z0wjQgxnUQVJabujith2SJXUroO8PnhbujMtHPMAapNkssxCuB6MXmaqCKoeEWpK8/Z+j2A+0E VXo= From: Thomas Schwinge To: CC: , Subject: [og12] Add 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c' In-Reply-To: <20221219204007.2818567-1-thomas@codesourcery.com> References: <20221219204007.2818567-1-thomas@codesourcery.com> User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) Date: Fri, 20 Jan 2023 21:26:43 +0100 Message-ID: <877cxh2br0.fsf@dem-tschwing-1.ger.mentorg.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! On 2022-12-19T21:40:06+0100, Thomas Schwinge wrote: > ... to document the status quo re implicit (via 'need_softstack_decl', > 'need_unisimt_decl') and explicit declarations of '__nvptx_stacks', > '__nvptx_uni'. For now pushed to devel/omp/gcc-12 branch in commit 703ebfdb483fdade316ceb003a0d57ca132a090b "Add 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c'", see attached. Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 703ebfdb483fdade316ceb003a0d57ca132a090b Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 19 Dec 2022 17:10:52 +0100 Subject: [PATCH] Add 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c' ... to document the status quo re implicit (via 'need_softstack_decl', 'need_unisimt_decl') and explicit declarations of '__nvptx_stacks', '__nvptx_uni'. gcc/testsuite/ * gcc.target/nvptx/softstack-decl-1.c: New. * gcc.target/nvptx/uniform-simt-decl-1.c: Likewise. --- gcc/testsuite/ChangeLog.omp | 3 ++ .../gcc.target/nvptx/softstack-decl-1.c | 20 +++++++++++++ .../gcc.target/nvptx/uniform-simt-decl-1.c | 29 +++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 gcc/testsuite/gcc.target/nvptx/softstack-decl-1.c create mode 100644 gcc/testsuite/gcc.target/nvptx/uniform-simt-decl-1.c diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp index 7339bf41482..5b3d9fe416b 100644 --- a/gcc/testsuite/ChangeLog.omp +++ b/gcc/testsuite/ChangeLog.omp @@ -1,5 +1,8 @@ 2023-01-20 Thomas Schwinge + * gcc.target/nvptx/softstack-decl-1.c: New. + * gcc.target/nvptx/uniform-simt-decl-1.c: Likewise. + * gcc.target/nvptx/nvptx.exp (check_effective_target_default_ptx_isa_version_at_least_6_0): New. diff --git a/gcc/testsuite/gcc.target/nvptx/softstack-decl-1.c b/gcc/testsuite/gcc.target/nvptx/softstack-decl-1.c new file mode 100644 index 00000000000..c502eacc1b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/softstack-decl-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options {-save-temps -O0 -msoft-stack} } */ + +extern void *__nvptx_stacks[32] __attribute__((shared,nocommon)); + +void *f() +{ + /* Implicit '__nvptx_stacks' usage for frame; per 'init_softstack_frame': + { dg-final { scan-assembler-times {mov\.u64 %fstmp2, __nvptx_stacks;} 1 } } + */ + void *stack_array[123]; + /* Explicit '__nvptx_stacks' usage. */ + stack_array[5] = __nvptx_stacks[0]; + return stack_array[5]; +} + +/* The implicit (via 'need_softstack_decl') and explicit declarations of + '__nvptx_stacks' are both emitted: + { dg-final { scan-assembler-times {(?n)\.extern .* __nvptx_stacks\[32\];} 2 } } +*/ diff --git a/gcc/testsuite/gcc.target/nvptx/uniform-simt-decl-1.c b/gcc/testsuite/gcc.target/nvptx/uniform-simt-decl-1.c new file mode 100644 index 00000000000..486456ab243 --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/uniform-simt-decl-1.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options {-save-temps -O0 -muniform-simt} } */ + +extern unsigned __nvptx_uni[32] __attribute__((shared,nocommon)); + +enum memmodel +{ + MEMMODEL_RELAXED = 0, +}; + +int a = 0; + +int f (void) +{ + /* Explicit '__nvptx_uni' usage. */ + __builtin_printf("%u\n", __nvptx_uni[0]); + + /* Implicit '__nvptx_uni' usage; per 'nvptx_init_unisimt_predicate': + { dg-final { scan-assembler-times {mov\.u64 %r[0-9]+, __nvptx_uni;} 1 } } + */ + int expected = 1; + return __atomic_compare_exchange_n (&a, &expected, 0, 0, MEMMODEL_RELAXED, + MEMMODEL_RELAXED); +} + +/* The implicit (via 'need_unisimt_decl') and explicit declarations of + '__nvptx_uni' are both emitted: + { dg-final { scan-assembler-times {(?n)\.extern .* __nvptx_uni\[32\];} 2 } } +*/ -- 2.25.1