public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Kyrylo Tkachov <ktkachov@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3129] aarch64: Add test for LDAR generation from __atomic_load_n Date: Thu, 6 Oct 2022 11:12:48 +0000 (GMT) [thread overview] Message-ID: <20221006111248.88E1E3839DDF@sourceware.org> (raw) https://gcc.gnu.org/g:badd1ac23d24664b2258b1db4d49f37a3f60ccca commit r13-3129-gbadd1ac23d24664b2258b1db4d49f37a3f60ccca Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com> Date: Thu Oct 6 12:08:40 2022 +0100 aarch64: Add test for LDAR generation from __atomic_load_n I'd like a test to check the generation of LDAR for atomic_load_n. No new functionality added. gcc/testsuite/ChangeLog: * gcc.target/aarch64/ldar_1.c: New test. Diff: --- gcc/testsuite/gcc.target/aarch64/ldar_1.c | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/gcc/testsuite/gcc.target/aarch64/ldar_1.c b/gcc/testsuite/gcc.target/aarch64/ldar_1.c new file mode 100644 index 00000000000..d968a72b30f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/ldar_1.c @@ -0,0 +1,66 @@ +/* Test the LDAR instruction generation from atomic acquire loads. */ +/* { dg-do assemble } */ +/* { dg-additional-options "--save-temps -O1" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +#include <stdint.h> + +#pragma GCC target "+norcpc" + +uint8_t v_uint8_t; +uint16_t v_uint16_t; +uint32_t v_uint32_t; +uint64_t v_uint64_t; + +/* +** load_uint8_t: +** ... +** ldarb w0, \[x[0-9]+\] +** ret +*/ + +uint8_t +load_uint8_t (void) +{ + return __atomic_load_n (&v_uint8_t, __ATOMIC_ACQUIRE); +} + +/* +** load_uint16_t: +** ... +** ldarh w0, \[x[0-9]+\] +** ret +*/ + +uint16_t +load_uint16_t (void) +{ + return __atomic_load_n (&v_uint16_t, __ATOMIC_ACQUIRE); +} + +/* +** load_uint32_t: +** ... +** ldar w0, \[x[0-9]+\] +** ret +*/ + +uint32_t +load_uint32_t (void) +{ + return __atomic_load_n (&v_uint32_t, __ATOMIC_ACQUIRE); +} + +/* +** load_uint64_t: +** ... +** ldar x0, \[x[0-9]+\] +** ret +*/ + +uint64_t +load_uint64_t (void) +{ + return __atomic_load_n (&v_uint64_t, __ATOMIC_ACQUIRE); +} +
reply other threads:[~2022-10-06 11:12 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=20221006111248.88E1E3839DDF@sourceware.org \ --to=ktkachov@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).