]>
Commit | Line | Data |
---|---|---|
cd8b6dc5 AM |
1 | /* PR54087. Verify __atomic_sub (val) uses __atomic_add (-val) if there is no |
2 | atomic_aub. */ | |
cd8b6dc5 | 3 | /* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ |
54cd497b | 4 | /* { dg-require-effective-target sync_int_long } */ |
cd8b6dc5 AM |
5 | /* { dg-final { scan-assembler-times "xadd" 2 } } */ |
6 | ||
7 | ||
8 | int a; | |
9 | ||
10 | int f1(int p) | |
11 | { | |
12 | return __atomic_sub_fetch(&a, p, __ATOMIC_SEQ_CST) == 0; | |
13 | } | |
14 | ||
15 | int f2(int p) | |
16 | { | |
17 | return __atomic_fetch_sub(&a, p, __ATOMIC_SEQ_CST) - p == 0; | |
18 | } |