PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / pr54087.c
blob5874e9cd7bd4baeeb80461d10aac83e77cee3ca8
1 /* PR54087. Verify __atomic_sub (val) uses __atomic_add (-val) if there is no
2 atomic_aub. */
3 /* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
4 /* { dg-require-effective-target sync_int_long } */
5 /* { dg-final { scan-assembler-times "xadd" 2 } } */
8 int a;
10 int f1(int p)
12 return __atomic_sub_fetch(&a, p, __ATOMIC_SEQ_CST) == 0;
15 int f2(int p)
17 return __atomic_fetch_sub(&a, p, __ATOMIC_SEQ_CST) - p == 0;