]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/gcc.dg/ia64-sync-4.c
8cd3940a89c101bdae53f9dbb27bdde2f21b3939
[gcc.git] / gcc / testsuite / gcc.dg / ia64-sync-4.c
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-*-* } && ilp32 } } } */
5
6 /* Test inlining __sync_bool_compare_and_swap. */
7
8 #include <stdbool.h>
9
10 static bool
11 compare_and_swap(long *addr, long old, long new_val)
12 {
13 return __sync_bool_compare_and_swap(addr, old, new_val);
14 }
15
16 void
17 foo (long *address)
18 {
19 long he_address = *address & ~1;
20 while (!compare_and_swap(address, he_address, he_address | 1))
21 he_address = *address & ~1;
22 }
This page took 0.036849 seconds and 4 git commands to generate.