2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / ia64-sync-4.c
blob98dfdac78ac7458068162e508cf1908cde9e9455
1 /* { dg-do compile { target ia64-*-* } } */
2 /* { dg-options "-O2 -finline-functions" } */
4 /* Test inlining __sync_bool_compare_and_swap_di. */
6 #include <stdbool.h>
7 #include <ia64intrin.h>
9 static bool
10 compare_and_swap(long *addr, long old, long new_val)
12 return __sync_bool_compare_and_swap_di(addr, old, new_val);
15 void
16 foo (long *address)
18 long he_address = *address & ~1;
19 while (!compare_and_swap(address, he_address, he_address | 1))
20 he_address = *address & ~1;