public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c'
@ 2022-12-19 20:40 Thomas Schwinge
  2022-12-19 20:40 ` [PATCH 2/2] nvptx: Prevent emitting duplicate declarations for '__nvptx_stacks', '__nvptx_uni' Thomas Schwinge
  2023-01-20 20:26 ` [og12] Add 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c' Thomas Schwinge
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Schwinge @ 2022-12-19 20:40 UTC (permalink / raw)
  To: tdevries, amonakov, gcc-patches; +Cc: Thomas Schwinge

... 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

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

-----------------
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-12  9:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 20:40 [PATCH 1/2] Add 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c' Thomas Schwinge
2022-12-19 20:40 ` [PATCH 2/2] nvptx: Prevent emitting duplicate declarations for '__nvptx_stacks', '__nvptx_uni' Thomas Schwinge
2023-01-11 11:44   ` [PING] " Thomas Schwinge
2023-01-20 20:30   ` [og12] " Thomas Schwinge
2023-05-12  9:34   ` [PATCH 2/2] " Thomas Schwinge
2023-01-20 20:26 ` [og12] Add 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c' Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).