From: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH][committed] aarch64: Add test for LDAR generation from __atomic_load_n
Date: Thu, 6 Oct 2022 11:11:24 +0000 [thread overview]
Message-ID: <PAXPR08MB69265A6AC35BC0A688C6C7B4935C9@PAXPR08MB6926.eurprd08.prod.outlook.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 217 bytes --]
Hi all,
I'd like a test to check the generation of LDAR for atomic_load_n.
No new functionality added.
Pushing to trunk.
Thanks,
Kyrill
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/ldar_1.c: New test.
[-- Attachment #2: ldar-test.patch --]
[-- Type: application/octet-stream, Size: 1374 bytes --]
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 0000000000000000000000000000000000000000..d968a72b30f7c84a7822baef7ea28d1f31b7195a
--- /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:11 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=PAXPR08MB69265A6AC35BC0A688C6C7B4935C9@PAXPR08MB6926.eurprd08.prod.outlook.com \
--to=kyrylo.tkachov@arm.com \
--cc=gcc-patches@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: link
Be 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).