aarch64-special-register.c revision b6d6993e6e6d3daf4d9876794254d20a134e37c2
1// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -triple aarch64 %s
2
3void string_literal(unsigned v) {
4  __builtin_arm_wsr(0, v); // expected-error {{expression is not a string literal}}
5}
6
7void wsr_1(unsigned v) {
8  __builtin_arm_wsr("sysreg", v);
9}
10
11void wsrp_1(void *v) {
12  __builtin_arm_wsrp("sysreg", v);
13}
14
15void wsr64_1(unsigned long v) {
16  __builtin_arm_wsr64("sysreg", v); //expected-error {{invalid special register for builtin}}
17}
18
19unsigned rsr_1() {
20  return __builtin_arm_rsr("sysreg");
21}
22
23void *rsrp_1() {
24  return __builtin_arm_rsrp("sysreg");
25}
26
27unsigned long rsr64_1() {
28  return __builtin_arm_rsr64("sysreg"); //expected-error {{invalid special register for builtin}}
29}
30
31void wsr_2(unsigned v) {
32  __builtin_arm_wsr("0:1:2:3:4", v);
33}
34
35void wsrp_2(void *v) {
36  __builtin_arm_wsrp("0:1:2:3:4", v);
37}
38
39void wsr64_2(unsigned long v) {
40  __builtin_arm_wsr64("0:1:2:3:4", v);
41}
42
43unsigned rsr_2() {
44  return __builtin_arm_rsr("0:1:2:3:4");
45}
46
47void *rsrp_2() {
48  return __builtin_arm_rsrp("0:1:2:3:4");
49}
50
51unsigned long rsr64_2() {
52  return __builtin_arm_rsr64("0:1:2:3:4");
53}
54
55void wsr_3(unsigned v) {
56  __builtin_arm_wsr("0:1:2", v); //expected-error {{invalid special register for builtin}}
57}
58
59void wsrp_3(void *v) {
60  __builtin_arm_wsrp("0:1:2", v); //expected-error {{invalid special register for builtin}}
61}
62
63void wsr64_3(unsigned long v) {
64  __builtin_arm_wsr64("0:1:2", v); //expected-error {{invalid special register for builtin}}
65}
66
67unsigned rsr_3() {
68  return __builtin_arm_rsr("0:1:2"); //expected-error {{invalid special register for builtin}}
69}
70
71void *rsrp_3() {
72  return __builtin_arm_rsrp("0:1:2"); //expected-error {{invalid special register for builtin}}
73}
74
75unsigned long rsr64_3() {
76  return __builtin_arm_rsr64("0:1:2"); //expected-error {{invalid special register for builtin}}
77}
78