public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3129] aarch64: Add test for LDAR generation from __atomic_load_n
@ 2022-10-06 11:12 Kyrylo Tkachov
0 siblings, 0 replies; only message in thread
From: Kyrylo Tkachov @ 2022-10-06 11:12 UTC (permalink / raw)
To: gcc-cvs
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);
+}
+
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-06 11:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06 11:12 [gcc r13-3129] aarch64: Add test for LDAR generation from __atomic_load_n Kyrylo Tkachov
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).