Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/ldar_1.c

raw
1 /* Test the LDAR instruction generation from atomic acquire loads. */
2 /* { dg-do assemble } */
3 /* { dg-additional-options "--save-temps -O1" } */
4 /* { dg-final { check-function-bodies "**" "" "" } } */
5
6 #include <stdint.h>
7
8 #pragma GCC target "+norcpc"
9
10 uint8_t v_uint8_t;
11 uint16_t v_uint16_t;
12 uint32_t v_uint32_t;
13 uint64_t v_uint64_t;
14
15 /*
16 ** load_uint8_t:
17 ** ...
18 ** ldarb w0, \[x[0-9]+\]
19 ** ret
20 */
21
22 uint8_t
23 load_uint8_t (void)
24 {
25 return __atomic_load_n (&v_uint8_t, __ATOMIC_ACQUIRE);
26 }
27
28 /*
29 ** load_uint16_t:
30 ** ...
31 ** ldarh w0, \[x[0-9]+\]
32 ** ret
33 */
34
35 uint16_t
36 load_uint16_t (void)
37 {
38 return __atomic_load_n (&v_uint16_t, __ATOMIC_ACQUIRE);
39 }
40
41 /*
42 ** load_uint32_t:
43 ** ...
44 ** ldar w0, \[x[0-9]+\]
45 ** ret
46 */
47
48 uint32_t
49 load_uint32_t (void)
50 {
51 return __atomic_load_n (&v_uint32_t, __ATOMIC_ACQUIRE);
52 }
53
54 /*
55 ** load_uint64_t:
56 ** ...
57 ** ldar x0, \[x[0-9]+\]
58 ** ret
59 */
60
61 uint64_t
62 load_uint64_t (void)
63 {
64 return __atomic_load_n (&v_uint64_t, __ATOMIC_ACQUIRE);
65 }
66