Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/acle/rwsr-1.c

raw
1 /* Test the __arm_[r,w]sr ACLE intrinsics family. */
2 /* Ensure that illegal behavior is rejected by the compiler. */
3
4 /* { dg-do compile } */
5 /* { dg-options "-O3 -march=armv8-a" } */
6
7 #include <arm_acle.h>
8
9 /* Ensure that read/write-only register attributes are respected by the compiler. */
10 void
11 test_rwsr_read_write_only ()
12 {
13 /* Attempt to write to read-only registers. */
14 long long a = __arm_rsr64 ("aidr_el1"); /* Read ok. */
15 __arm_wsr64 ("aidr_el1", a); /* { dg-error {invalid system register name 'aidr_el1'} } */
16
17 /* Attempt to read from write-only registers. */
18 __arm_wsr64 ("icc_asgi1r_el1", a); /* Write ok. */
19 long long b = __arm_rsr64 ("icc_asgi1r_el1"); /* { dg-error {invalid system register name 'icc_asgi1r_el1'} } */
20 }
21
22 /* Ensure that empty strings are rejected. */
23 void
24 test_empty_string ()
25 {
26 long long c = __arm_rsr64 (""); /* { dg-error "invalid system register name ''" } */
27 __arm_wsr64 ("", c); /* { dg-error "invalid system register name ''" } */
28 }