diff options
Diffstat (limited to 'clang/test/Sema/builtins-arm-exclusive-none.c')
-rw-r--r-- | clang/test/Sema/builtins-arm-exclusive-none.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/Sema/builtins-arm-exclusive-none.c b/clang/test/Sema/builtins-arm-exclusive-none.c new file mode 100644 index 0000000..76d327f --- /dev/null +++ b/clang/test/Sema/builtins-arm-exclusive-none.c @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -triple armv6m -fsyntax-only -verify %s + +// Armv6-M does not support exclusive loads/stores at all, so all uses of +// __builtin_arm_ldrex and __builtin_arm_strex is forbidden. + +int test_ldrex(char *addr) { + int sum = 0; + sum += __builtin_arm_ldrex(addr); // expected-error {{load and store exclusive builtins are not available on this architecture}} + sum += __builtin_arm_ldrex((short *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}} + sum += __builtin_arm_ldrex((int *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}} + sum += __builtin_arm_ldrex((long long *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}} + return sum; +} + +int test_strex(char *addr) { + int res = 0; + res |= __builtin_arm_strex(4, addr); // expected-error {{load and store exclusive builtins are not available on this architecture}} + res |= __builtin_arm_strex(42, (short *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}} + res |= __builtin_arm_strex(42, (int *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}} + res |= __builtin_arm_strex(42, (long long *)addr); // expected-error {{load and store exclusive builtins are not available on this architecture}} + return res; +} |