PR c/64856
[official-gcc.git] / gcc / testsuite / gcc.dg / ia64-sync-4.c
blobeec472f388e195d288b92eb280c7d26299625cd9
1 /* { dg-do compile } */
2 /* { dg-require-effective-target sync_int_long } */
3 /* { dg-options "-O2 -finline-functions" } */
4 /* { dg-options "-march=i486" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
5 /* { dg-options "-mcpu=v9" { target sparc*-*-* } } */
7 /* Test inlining __sync_bool_compare_and_swap. */
9 #include <stdbool.h>
11 static bool
12 compare_and_swap(long *addr, long old, long new_val)
14 return __sync_bool_compare_and_swap(addr, old, new_val);
17 void
18 foo (long *address)
20 long he_address = *address & ~1;
21 while (!compare_and_swap(address, he_address, he_address | 1))
22 he_address = *address & ~1;