Debian Codegraph @

clang/test/Sema/builtins-arm-exclusive-4.c

raw
1 // RUN: %clang_cc1 -triple armv6 -fsyntax-only -verify %s
2
3 // Armv6 (apart from Armv6-M) provides 4-byte exclusive accesses, but not any
4 // other size. So only the calls with a pointer to a 32-bit type are accepted.
5
6 int test_ldrex(char *addr) {
7 int sum = 0;
8 sum += __builtin_arm_ldrex(addr); // expected-error {{address argument to load or store exclusive builtin must be a pointer to 4 byte type}}
9 sum += __builtin_arm_ldrex((short *)addr); // expected-error {{address argument to load or store exclusive builtin must be a pointer to 4 byte type}}
10 sum += __builtin_arm_ldrex((int *)addr);
11 sum += __builtin_arm_ldrex((long long *)addr); // expected-error {{address argument to load or store exclusive builtin must be a pointer to 4 byte type}}
12 return sum;
13 }
14
15 int test_strex(char *addr) {
16 int res = 0;
17 res |= __builtin_arm_strex(4, addr); // expected-error {{address argument to load or store exclusive builtin must be a pointer to 4 byte type}}
18 res |= __builtin_arm_strex(42, (short *)addr); // expected-error {{address argument to load or store exclusive builtin must be a pointer to 4 byte type}}
19 res |= __builtin_arm_strex(42, (int *)addr);
20 res |= __builtin_arm_strex(42, (long long *)addr); // expected-error {{address argument to load or store exclusive builtin must be a pointer to 4 byte type}}
21 return res;
22 }
23
24 int test_ldrexd(char *addr) {
25 int sum = 0;
26 sum += __builtin_arm_ldrexd(addr); // expected-error {{load and store exclusive builtins are not available on this architecture}}
27 sum += __builtin_arm_ldrexd((short *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}}
28 sum += __builtin_arm_ldrexd((int *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}}
29 sum += __builtin_arm_ldrexd((long long *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}}
30 return sum;
31 }
32
33 int test_strexd(char *addr) {
34 int res = 0;
35 res |= __builtin_arm_strexd(4, addr); // expected-error {{load and store exclusive builtins are not available on this architecture}}
36 res |= __builtin_arm_strexd(42, (short *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}}
37 res |= __builtin_arm_strexd(42, (int *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}}
38 res |= __builtin_arm_strexd(42, (long long *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}}
39 return res;
40 }