From patchwork Mon Dec 19 20:40:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 34761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2605152wrn; Mon, 19 Dec 2022 12:41:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Aq3FW9QnqodRnO5RzXdvbNMKC96DeUY90YB24H04vMxUGzdq/CJmDChPD4wcgM/ppAskP X-Received: by 2002:a17:907:76d4:b0:7c0:e5c8:d439 with SMTP id kf20-20020a17090776d400b007c0e5c8d439mr37899096ejc.3.1671482487877; Mon, 19 Dec 2022 12:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671482487; cv=none; d=google.com; s=arc-20160816; b=e2xsWcIKrOsDcbchYKivxL4BxtSXb5+yXIcDJemLgSdQowaEezB9SYhQTOOFqG02iv WnaO6uZbx94WYo23G9hE2BPSir7iHEvxJ/wPtfWRZ7P9RkzNAOdVQdtFLVuySZpOkPOw IeCcmnMPWszXgKTKcwYwILH67gsvahM+t0z83auA3zETEoPlA6eceFnDI+hegThcaZS8 hu5J1HSzGwsMPHmYJFTHUlPGyXhgPKd13xajp2ElPDVOxPF6ShL/+/fdv2khgrKT0kGT IgCsr75hkQnucyGRkYh3po0WhamDbu4TMNhcxFAz8Z6EaOI+uxaxUWpAtAAxRUtT7XnR CNgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:ironport-sdr :dmarc-filter:delivered-to; bh=A0RYPcPRpI2fDuLm2cefRSQb4D5lg3uqHVC+yiqxDRw=; b=qcssMGu6KNZvlVtknsuRHSQuLUAZzWOlmkoUJnGOztixEt8BQPQcmkOvarF1e4Q08e dOU05gn44oZ2Ou3VtybYnwfPfcxx0AHA2NENJ3b7PpG4Q6EpyQ2R+ZL1DpvQmq6qkC+c /y6vLgpmh8r9m98fwlLW+KwLERGacDO6Ck1nIwcpSlMKSGjHtNQSWg8HlqY3qthjZZ71 5vYmd4ddWGVkD+UXiw3cQpTHA7hu6EPgQZaH69yk0HgLfyGM4gyohJ9HnH8jKK0SCFyz tLMWXzVkTEWqq2LW59wa9l7Pqq4PxY5+yL0g7VAZBbgMP8RnL4USVKYfPGxdul9ePkNK WGcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id tk21-20020a170907c29500b007ae127c6c80si8237798ejc.672.2022.12.19.12.41.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 12:41:27 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 080BD3850F0B for ; Mon, 19 Dec 2022 20:40:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 18F393858C2F for ; Mon, 19 Dec 2022 20:40:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 18F393858C2F 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.96,257,1665475200"; d="scan'208";a="90110649" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 19 Dec 2022 12:40:23 -0800 IronPort-SDR: c/zQJnw70dRIFSmSpEbUQbSP+nPJZhkmIhh6Yf357zKCiOzKFgD0d66twHInHk0+7emNFwcz6w xHoiOy0NmI6GaHmfUqpnAltK1cDPCSdd2QO1sI+vRezlf8vQxtyKOwQ8h5rnyhQZvNv8RhyRtg Ex7moZ1iwInBj2IbnFDN1kQXb8llSedVN+qftTFT8JtaRlJHroU0UADJY4ua9YqG3xlY8A8yZD GB83EQ/0BQKJZ2NM/V0Q2EkYFHShW4kmegL8uiAe0Q9F13sTccX+YrKzJPfRajHpNyM8uIJjEp T4o= From: Thomas Schwinge To: , , CC: Thomas Schwinge Subject: [PATCH 1/2] Add 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c' Date: Mon, 19 Dec 2022 21:40:06 +0100 Message-ID: <20221219204007.2818567-1-thomas@codesourcery.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) 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, 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752676421615847805?= X-GMAIL-MSGID: =?utf-8?q?1752676421615847805?= ... 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.target/nvptx/softstack-decl-1.c | 20 +++++++++++++ .../gcc.target/nvptx/uniform-simt-decl-1.c | 29 +++++++++++++++++++ 2 files changed, 49 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 -- 2.25.1 ----------------- 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 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 } } +*/