| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
/* { dg-require-effective-target arm_arch_v7a_ok } */ |
| 4 |
/* { dg-add-options arm_arch_v7a } */ |
| 5 |
|
| 6 |
#include <stdatomic.h> |
| 7 |
|
| 8 |
int t0 (int *p, int x) |
| 9 |
{ |
| 10 |
if (x > 100) |
| 11 |
x = atomic_load_explicit (p, memory_order_relaxed); |
| 12 |
return x + 1; |
| 13 |
} |
| 14 |
|
| 15 |
long long t1 (long long *p, int x) |
| 16 |
{ |
| 17 |
if (x > 100) |
| 18 |
x = atomic_load_explicit (p, memory_order_relaxed); |
| 19 |
return x + 1; |
| 20 |
} |
| 21 |
|
| 22 |
void t2 (int *p, int x) |
| 23 |
{ |
| 24 |
if (x > 100) |
| 25 |
atomic_store_explicit (p, x, memory_order_relaxed); |
| 26 |
} |
| 27 |
|
| 28 |
void t3 (long long *p, int x) |
| 29 |
{ |
| 30 |
if (x > 100) |
| 31 |
atomic_store_explicit (p, x, memory_order_relaxed); |
| 32 |
} |
| 33 |
|
| 34 |
/* { dg-final { scan-assembler-times "ldrexd\t" 2 } } */ |
| 35 |
/* { dg-final { scan-assembler-not "ldrgt" } } */ |
| 36 |
/* { dg-final { scan-assembler-not "ldrdgt" } } */ |
| 37 |
/* { dg-final { scan-assembler-not "ldrexdgt" } } */ |
| 38 |
/* { dg-final { scan-assembler-not "strgt" } } */ |
| 39 |
/* { dg-final { scan-assembler-not "strdgt" } } */ |