public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] Add 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c' Date: Fri, 20 Jan 2023 20:25:05 +0000 (GMT) [thread overview] Message-ID: <20230120202505.0EC933858D20@sourceware.org> (raw) https://gcc.gnu.org/g:703ebfdb483fdade316ceb003a0d57ca132a090b commit 703ebfdb483fdade316ceb003a0d57ca132a090b Author: Thomas Schwinge <thomas@codesourcery.com> Date: Mon Dec 19 17:10:52 2022 +0100 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. Diff: --- gcc/testsuite/ChangeLog.omp | 3 +++ gcc/testsuite/gcc.target/nvptx/softstack-decl-1.c | 20 +++++++++++++++ .../gcc.target/nvptx/uniform-simt-decl-1.c | 29 ++++++++++++++++++++++ 3 files changed, 52 insertions(+) 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 <thomas@codesourcery.com> + * 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 } } +*/
reply other threads:[~2023-01-20 20:25 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230120202505.0EC933858D20@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).