PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / arm / pr69904.c
blob24fe844d58eba445ddbe3877e227d0086310192a
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -marm" } */
3 /* { dg-require-effective-target arm_arch_v7a_ok } */
4 /* { dg-add-options arm_arch_v7a } */
6 /* Make sure that RTL optimizers don't do any unexpected transformations
7 on the compare_exchange loop. */
9 #include <stdatomic.h>
11 atomic_uint foo;
12 atomic_uint bar;
13 int glob;
15 int
16 main (void)
18 glob = atomic_compare_exchange_strong (&foo, &bar, 0);
19 return glob;
22 /* { dg-final { scan-assembler-times "dmb\tish" 2 } } */
23 /* { dg-final { scan-assembler-times "ldrex\t" 1 } } */
24 /* { dg-final { scan-assembler-times "strex\t" 1 } } */