OSDN Git Service

Add the new file.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / ia64-sync-4.c
1 /* { dg-do compile { target ia64-*-* } } */
2 /* { dg-options "-O2 -finline-functions" } */
3
4 /* Test inlining __sync_bool_compare_and_swap_di.  */
5
6 #include <stdbool.h>
7 #include <ia64intrin.h>
8
9 static bool
10 compare_and_swap(long *addr, long old, long new_val)
11 {
12   return __sync_bool_compare_and_swap_di(addr, old, new_val);
13 }
14
15 void
16 foo (long *address)
17 {
18   long he_address = *address & ~1;
19   while (!compare_and_swap(address, he_address, he_address | 1))
20     he_address = *address & ~1;
21 }